Added menu option to adjust scan sensitivity for AM

This commit is contained in:
Sjef Verhoeven PE5PVB
2023-11-11 13:17:36 +01:00
parent 2c4b6463be
commit 8c3e34e352
5 changed files with 74 additions and 29 deletions
+6 -2
View File
@@ -117,6 +117,7 @@ byte aid_counterold;
byte af; byte af;
byte afpagenr; byte afpagenr;
byte amnb; byte amnb;
byte amscansens;
byte audiomode; byte audiomode;
byte band; byte band;
byte bandAM; byte bandAM;
@@ -447,6 +448,7 @@ void setup() {
tot = EEPROM.readByte(EE_BYTE_TOT); tot = EEPROM.readByte(EE_BYTE_TOT);
mwstepsize = EEPROM.readByte(EE_BYTE_MWREGION); mwstepsize = EEPROM.readByte(EE_BYTE_MWREGION);
spispeed = EEPROM.readByte(EE_BYTE_SPISPEED); spispeed = EEPROM.readByte(EE_BYTE_SPISPEED);
amscansens = EEPROM.readByte(EE_BYTE_AMSCANSENS);
if (spispeed == SPI_SPEED_DEFAULT) tft.setSPISpeed(SPI_FREQUENCY / 1000000); else tft.setSPISpeed(spispeed * 10); if (spispeed == SPI_SPEED_DEFAULT) tft.setSPISpeed(SPI_FREQUENCY / 1000000); else tft.setSPISpeed(spispeed * 10);
LWLowEdgeSet = FREQ_LW_LOW_EDGE_MIN; LWLowEdgeSet = FREQ_LW_LOW_EDGE_MIN;
@@ -1880,6 +1882,7 @@ void ModeButtonPress() {
EEPROM.writeByte(EE_BYTE_TOT, tot); EEPROM.writeByte(EE_BYTE_TOT, tot);
EEPROM.writeByte(EE_BYTE_MWREGION, mwstepsize); EEPROM.writeByte(EE_BYTE_MWREGION, mwstepsize);
EEPROM.writeByte(EE_BYTE_SPISPEED, spispeed); EEPROM.writeByte(EE_BYTE_SPISPEED, spispeed);
EEPROM.writeByte(EE_BYTE_AMSCANSENS, amscansens);
EEPROM.commit(); EEPROM.commit();
if (af == 2) radio.rds.afreg = true; else radio.rds.afreg = false; if (af == 2) radio.rds.afreg = true; else radio.rds.afreg = false;
Serial.end(); Serial.end();
@@ -3264,7 +3267,7 @@ void Seek(bool mode) {
} }
} else { } else {
radio.getStatusAM(SStatus, USN, WAM, OStatus, BW, MStatus, CN); radio.getStatusAM(SStatus, USN, WAM, OStatus, BW, MStatus, CN);
if ((USN < 200) && (OStatus < 2 && OStatus > -2) && (Squelch < SStatus || Squelch == 920)) { if ((USN < amscansens * 30) && (OStatus < 2 && OStatus > -2) && (Squelch < SStatus || Squelch == 920)) {
seek = false; seek = false;
radio.setUnMute(); radio.setUnMute();
if (!screenmute) tft.drawBitmap(92, 4, Speaker, 26, 22, GreyoutColor); if (!screenmute) tft.drawBitmap(92, 4, Speaker, 26, 22, GreyoutColor);
@@ -3419,7 +3422,8 @@ void DefaultSettings(byte userhardwaremodel) {
EEPROM.writeByte(EE_BYTE_FASTPS, 1); EEPROM.writeByte(EE_BYTE_FASTPS, 1);
EEPROM.writeByte(EE_BYTE_TOT, 0); EEPROM.writeByte(EE_BYTE_TOT, 0);
EEPROM.writeByte(EE_BYTE_MWREGION, 0); EEPROM.writeByte(EE_BYTE_MWREGION, 0);
EEPROM.writeByte(EE_BYTE_SPISPEED, SPI_SPEED_DEFAULT); EEPROM.writeByte(EE_BYTE_SPISPEED, 3);
EEPROM.writeByte(EE_BYTE_AMSCANSENS, 4);
EEPROM.commit(); EEPROM.commit();
} }
+6 -5
View File
@@ -107,7 +107,7 @@
// EEPROM index defines // EEPROM index defines
#define EE_PRESETS_CNT 99 #define EE_PRESETS_CNT 99
#define EE_CHECKBYTE_VALUE 40 // 0 ~ 255,add new entry, change for new value #define EE_CHECKBYTE_VALUE 41 // 0 ~ 255,add new entry, change for new value
#define EE_TOTAL_CNT 819 #define EE_TOTAL_CNT 819
#define EE_UINT16_FREQUENCY_FM 0 #define EE_UINT16_FREQUENCY_FM 0
@@ -185,10 +185,11 @@
#define EE_BYTE_TOT 119 #define EE_BYTE_TOT 119
#define EE_BYTE_MWREGION 120 #define EE_BYTE_MWREGION 120
#define EE_BYTE_SPISPEED 121 #define EE_BYTE_SPISPEED 121
#define EE_PRESETS_BAND_START 122 #define EE_BYTE_AMSCANSENS 122
#define EE_PRESET_BW_START 222 #define EE_PRESETS_BAND_START 123
#define EE_PRESET_MS_START 322 #define EE_PRESET_BW_START 223
#define EE_PRESETS_START 422 #define EE_PRESET_MS_START 323
#define EE_PRESETS_START 423
#define EE_PRESETS_FREQUENCY 8750 #define EE_PRESETS_FREQUENCY 8750
// End of EEPROM index defines // End of EEPROM index defines
+22 -1
View File
@@ -7,7 +7,7 @@
#include <cstring> #include <cstring>
byte menuitem; byte menuitem;
byte items[8] = {8, (dynamicspi ? 3 : 2), 6, 10, 9, 10, 9, 5}; byte items[8] = {8, (dynamicspi ? 3 : 2), 6, 10, 9, 10, 10, 5};
void doTheme() { // Use this to put your own colors in: http://www.barth-dev.de/online/rgb565-color-picker/ void doTheme() { // Use this to put your own colors in: http://www.barth-dev.de/online/rgb565-color-picker/
switch (CurrentTheme) { switch (CurrentTheme) {
@@ -542,6 +542,7 @@ void BuildMenu() {
tftPrint(-1, myLanguage[language][187], 8, ITEM7 + 6, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][187], 8, ITEM7 + 6, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, myLanguage[language][198], 8, ITEM8 + 6, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][198], 8, ITEM8 + 6, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, myLanguage[language][169], 8, ITEM9 + 6, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][169], 8, ITEM9 + 6, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, myLanguage[language][207], 8, ITEM10 + 6, ActiveColor, ActiveColorSmooth, 16);
if (softmuteam) tftPrint(1, myLanguage[language][42], 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (softmuteam) tftPrint(1, myLanguage[language][42], 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16);
if (amnb != 0) tftPrint(1, "%", 310, ITEM2 + 6, ActiveColor, ActiveColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM2 + 6, ActiveColor, ActiveColorSmooth, 16); if (amnb != 0) tftPrint(1, "%", 310, ITEM2 + 6, ActiveColor, ActiveColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM2 + 6, ActiveColor, ActiveColorSmooth, 16);
@@ -567,6 +568,7 @@ void BuildMenu() {
tftPrint(1, String(amcodectcount, DEC), 310, ITEM7 + 6, PrimaryColor, PrimaryColorSmooth, 16); tftPrint(1, String(amcodectcount, DEC), 310, ITEM7 + 6, PrimaryColor, PrimaryColorSmooth, 16);
if (amrfagc != 0) tftPrint(1, String(amrfagc, DEC), 270, ITEM8 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (amrfagc != 0) tftPrint(1, String(amrfagc, DEC), 270, ITEM8 + 6, PrimaryColor, PrimaryColorSmooth, 16);
if (mwstepsize) tftPrint(1, "10", 270, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, "9", 270, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (mwstepsize) tftPrint(1, "10", 270, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, "9", 270, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16);
tftPrint(1, String(amscansens), 310, ITEM10 + 6, PrimaryColor, PrimaryColorSmooth, 16);
break; break;
case CONNECTIVITY: case CONNECTIVITY:
@@ -1367,6 +1369,13 @@ void MenuUp() {
if (mwstepsize) mwstepsize = false; else mwstepsize = true; if (mwstepsize) mwstepsize = false; else mwstepsize = true;
if (mwstepsize) tftPrint (1, "10", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint (1, "9", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); if (mwstepsize) tftPrint (1, "10", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint (1, "9", 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
break; break;
case ITEM10:
tftPrint(1, String(amscansens), 155, 118, BackgroundColor, BackgroundColor, 28);
amscansens++;
if (amscansens > 10) amscansens = 1;
tftPrint(1, String(amscansens), 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
break;
} }
break; break;
@@ -1926,6 +1935,13 @@ void MenuDown() {
if (mwstepsize) mwstepsize = false; else mwstepsize = true; if (mwstepsize) mwstepsize = false; else mwstepsize = true;
if (mwstepsize) tftPrint (1, "10", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint (1, "9", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); if (mwstepsize) tftPrint (1, "10", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint (1, "9", 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
break; break;
case ITEM10:
tftPrint(1, String(amscansens), 155, 118, BackgroundColor, BackgroundColor, 28);
amscansens--;
if (amscansens == 0) amscansens = 10;
tftPrint(1, String(amscansens), 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
break;
} }
break; break;
@@ -2377,6 +2393,11 @@ void DoMenu() {
tftPrint(-1, "kHz", 170, 118, ActiveColor, ActiveColorSmooth, 28); tftPrint(-1, "kHz", 170, 118, ActiveColor, ActiveColorSmooth, 28);
if (mwstepsize) tftPrint (1, "10", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint (1, "9", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); if (mwstepsize) tftPrint (1, "10", 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint (1, "9", 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
break; break;
case ITEM10:
Infoboxprint(myLanguage[language][207]);
tftPrint (1, String(amscansens), 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
break;
} }
break; break;
+1
View File
@@ -62,6 +62,7 @@ extern byte af;
extern byte af_counterold; extern byte af_counterold;
extern byte afpagenr; extern byte afpagenr;
extern byte amnb; extern byte amnb;
extern byte amscansens;
extern byte audiomode; extern byte audiomode;
extern byte band; extern byte band;
extern byte bandAM; extern byte bandAM;
+39 -21
View File
@@ -1,6 +1,6 @@
// [number of languages][number of texts] // [number of languages][number of texts]
// *** means the text is the same as in English // *** means the text is the same as in English
static const char* const myLanguage[18][207] = { static const char* const myLanguage[18][208] = {
{ "English", // English { "English", // English
"Rotary direction changed", // 1 "Rotary direction changed", // 1
"Please release button", // 2 "Please release button", // 2
@@ -207,7 +207,8 @@ static const char* const myLanguage[18][207] = {
"Fast PS", // 203 "Fast PS", // 203
"Detected applications", // 204 "Detected applications", // 204
"Min.", // 205 "Min.", // 205
"Dynamic SPI speed" // 206 "Dynamic SPI speed", // 206
"Scan sensitivity" // 207
}, },
{ "Nederlands", // Dutch { "Nederlands", // Dutch
@@ -416,7 +417,8 @@ static const char* const myLanguage[18][207] = {
"Snelle PS", // 203 "Snelle PS", // 203
"Gedetecteerde applicaties", // 204 "Gedetecteerde applicaties", // 204
"Min.", // 205 *** "Min.", // 205 ***
"Dynamische\nSPI snelheid" // 206 "Dynamische\nSPI snelheid", // 206
"Zoek gevoeligheid" // 207
}, },
{ "Polski", // Polish { "Polski", // Polish
@@ -625,7 +627,8 @@ static const char* const myLanguage[18][207] = {
"Szybki PS", // 203 "Szybki PS", // 203
"Wykryte aplikacje", // 204 "Wykryte aplikacje", // 204
"Min.", // 205 *** "Min.", // 205 ***
"Dynam. predkosc SPI" // 206 *** "Dynam. predkosc SPI", // 206 ***
"Scan sensitivity" // 207
}, },
{ "Hrvatski", // Croatian { "Hrvatski", // Croatian
@@ -834,7 +837,8 @@ static const char* const myLanguage[18][207] = {
"Brzi PS", // 203 "Brzi PS", // 203
"Otkrivene aplikacije", // 204 "Otkrivene aplikacije", // 204
"Min.", // 205 *** "Min.", // 205 ***
"Dynamic SPI speed" // 206 *** "Dynamic SPI speed", // 206 ***
"Scan sensitivity" // 207
}, },
{ "Ελληνικά", // Greek { "Ελληνικά", // Greek
@@ -1043,7 +1047,8 @@ static const char* const myLanguage[18][207] = {
"Γρήγορο PS", // 203 "Γρήγορο PS", // 203
"Εντοπισμένες εφαρμογές", // 204 "Εντοπισμένες εφαρμογές", // 204
"Λεπτ.", // 205 "Λεπτ.", // 205
"Δυναμική ταχύτητα\nSPI" // 206 "Δυναμική ταχύτητα\nSPI", // 206
"Scan sensitivity" // 207
}, },
{ "Română", // Romanian { "Română", // Romanian
@@ -1252,7 +1257,8 @@ static const char* const myLanguage[18][207] = {
"PS rapid", // 203 "PS rapid", // 203
"Identificare aplicații", // 204 "Identificare aplicații", // 204
"Min.", // 205 *** "Min.", // 205 ***
"Dynamic SPI speed" // 206 *** "Dynamic SPI speed", // 206 ***
"Scan sensitivity" // 207
}, },
{ "Deutsch", // German { "Deutsch", // German
@@ -1447,7 +1453,7 @@ static const char* const myLanguage[18][207] = {
"HAUPT", // 189 "HAUPT", // 189
"AUDIO", // 190 "AUDIO", // 190
"ANZEIGE", // 191 "ANZEIGE", // 191
"RDS", // 192 "RDS", // 192
"UKW", // 193 "UKW", // 193
"AM", // 194 "AM", // 194
"NETZ", // 195 "NETZ", // 195
@@ -1461,7 +1467,8 @@ static const char* const myLanguage[18][207] = {
"Schnelles PS", // 203 "Schnelles PS", // 203
"Erkannte Applikationen", // 204 "Erkannte Applikationen", // 204
"Min.", // 205 "Min.", // 205
"Dyn. SPI-Geschwind." // 206 "Dyn. SPI-Geschwind.", // 206
"Scan sensitivity" // 207
}, },
{ "Český", // Czech { "Český", // Czech
@@ -1670,7 +1677,8 @@ static const char* const myLanguage[18][207] = {
"Rychlé načtení PS", // 203 "Rychlé načtení PS", // 203
"Detekované aplikace", // 204 "Detekované aplikace", // 204
"Min.", // 205 *** "Min.", // 205 ***
"Dynamic SPI speed" // 206 *** "Dynamic SPI speed", // 206 ***
"Scan sensitivity" // 207
}, },
{ "Slovenský", // Slovak { "Slovenský", // Slovak
@@ -1879,7 +1887,8 @@ static const char* const myLanguage[18][207] = {
"Rýchle načítanie PS", // 203 "Rýchle načítanie PS", // 203
"Detegované aplikácie", // 204 "Detegované aplikácie", // 204
"Min.", // 205 *** "Min.", // 205 ***
"Dynamic SPI speed" // 206 *** "Dynamic SPI speed", // 206 ***
"Scan sensitivity" // 207
}, },
{ "Français", // French { "Français", // French
@@ -2088,7 +2097,8 @@ static const char* const myLanguage[18][207] = {
"PS rapide", // 203 "PS rapide", // 203
"Applications détectées", // 204 "Applications détectées", // 204
"Min.", // 205 "Min.", // 205
"Vitesse SPI\ndynamique" // 206 "Vitesse SPI\ndynamique", // 206
"Scan sensitivity" // 207
}, },
{ "Български", // Bulgarian { "Български", // Bulgarian
@@ -2297,7 +2307,8 @@ static const char* const myLanguage[18][207] = {
"Fast PS", // 203 *** "Fast PS", // 203 ***
"Detected applications", // 204 *** "Detected applications", // 204 ***
"Мин.", // 205 "Мин.", // 205
"Dynamic SPI speed" // 206 *** "Dynamic SPI speed", // 206 ***
"Scan sensitivity" // 207
}, },
{ "Русский", // Russian { "Русский", // Russian
@@ -2506,7 +2517,8 @@ static const char* const myLanguage[18][207] = {
"Быстрый PS", // 203 "Быстрый PS", // 203
"Обнаруженные приложения", // 204 "Обнаруженные приложения", // 204
"мин.", // 205 "мин.", // 205
"Скорость шины дисплея SPI" // 206 *** "Скорость шины дисплея SPI", // 206 ***
"Scan sensitivity" // 207
}, },
{ "Українська", // Ukranian { "Українська", // Ukranian
@@ -2715,7 +2727,8 @@ static const char* const myLanguage[18][207] = {
"Швидкий PS", // 203 "Швидкий PS", // 203
"Виявлені програми", // 204 "Виявлені програми", // 204
"мін.", // 205 "мін.", // 205
"Dynamic SPI speed" // 206 *** "Dynamic SPI speed", // 206 ***
"Scan sensitivity" // 207
}, },
{ "Italiano", // Italian { "Italiano", // Italian
@@ -2924,7 +2937,8 @@ static const char* const myLanguage[18][207] = {
"Fast PS", // 203 *** "Fast PS", // 203 ***
"Detected applications", // 204 *** "Detected applications", // 204 ***
"Min.", // 205 *** "Min.", // 205 ***
"Dynamic SPI speed" // 206 *** "Dynamic SPI speed", // 206 ***
"Scan sensitivity" // 207
}, },
{ "Simplified Chinese", // Simplified Chinese { "Simplified Chinese", // Simplified Chinese
@@ -3133,7 +3147,8 @@ static const char* const myLanguage[18][207] = {
"快速 PS", // 203 "快速 PS", // 203
"Detected applications", // 204 *** "Detected applications", // 204 ***
"分钟", // 205 "分钟", // 205
"调整SPI通讯速率" // 206 "调整SPI通讯速率", // 206
"Scan sensitivity" // 207
}, },
{ "Norsk", // Norwegian { "Norsk", // Norwegian
@@ -3342,7 +3357,8 @@ static const char* const myLanguage[18][207] = {
"Rask PS", // 203 "Rask PS", // 203
"Oppdaget applikasjoner", // 204 "Oppdaget applikasjoner", // 204
"Min.", // 205 *** "Min.", // 205 ***
"Dynamisk SPI hastighet" // 206 *** "Dynamisk SPI hastighet", // 206 ***
"Scan sensitivity" // 207
}, },
{ "Español", // Spanish { "Español", // Spanish
@@ -3551,7 +3567,8 @@ static const char* const myLanguage[18][207] = {
"PS rápido", // 203 "PS rápido", // 203
"Aplicaciones detectadas", // 204 "Aplicaciones detectadas", // 204
"Min.", // 205 "Min.", // 205
"Velocidad de SPI" // 206 "Velocidad de SPI", // 206
"Scan sensitivity" // 207
}, },
{ "Português", // Portuguese { "Português", // Portuguese
@@ -3760,6 +3777,7 @@ static const char* const myLanguage[18][207] = {
"PS rápido", // 203 "PS rápido", // 203
"Aplicativos detectados", // 204 "Aplicativos detectados", // 204
"Min.", // 205 "Min.", // 205
"Velocidade dinâmica\nde SPI" // 206 "Velocidade dinâmica\nde SPI", // 206
"Scan sensitivity" // 207
} }
}; };