Merge pull request #436 from ohmytime/Add_Band_None

Add Band None for AM & FM
This commit is contained in:
ohmytime
2023-11-22 08:57:36 +08:00
committed by GitHub
4 changed files with 113 additions and 51 deletions

View File

@@ -1119,6 +1119,10 @@ void doBandSelectionFM() {
SelectBand();
}
break;
case FM_BAND_NONE:
ToggleBand(band);
SelectBand();
break;
}
}
@@ -1178,6 +1182,29 @@ void doBandSelectionAM() {
SelectBand();
}
break;
case AM_BAND_NONE:
ToggleBand(band);
SelectBand();
break;
}
}
void AMjumptoFM() {
if (bandFM != FM_BAND_NONE) {
if (bandFM == FM_BAND_FM) band = BAND_FM; else band = BAND_OIRT;
} else {
// do nothing
}
}
void FMjumptoAM() {
if (bandAM == AM_BAND_ALL || bandAM == AM_BAND_LW_MW || bandAM == AM_BAND_LW_SW || bandAM == AM_BAND_LW) {
band = BAND_LW;
if (stepsize > 3) stepsize = 3;
} else if (bandAM == AM_BAND_MW_SW || bandAM == AM_BAND_MW) {
band = BAND_MW;
} else if (bandAM == AM_BAND_SW) {
band = BAND_SW;
}
}
@@ -1188,51 +1215,56 @@ void ToggleBand(byte nowBand) {
band = BAND_MW;
} else if (bandAM == AM_BAND_LW_SW) {
band = BAND_SW;
} else if (bandAM == AM_BAND_LW) {
if (bandFM == FM_BAND_FM) band = BAND_FM; else band = BAND_OIRT;
} else if (bandAM == AM_BAND_LW || bandAM == AM_BAND_NONE) {
AMjumptoFM();
}
break;
case BAND_MW:
if (bandAM == AM_BAND_MW_SW || bandAM == AM_BAND_ALL) {
band = BAND_SW;
} else if (bandAM == AM_BAND_LW_MW || bandAM == AM_BAND_MW) {
if (bandFM == FM_BAND_FM) band = BAND_FM; else band = BAND_OIRT;
} else if (bandAM == AM_BAND_LW_MW) {
if (bandFM != FM_BAND_NONE) {
if (bandFM == FM_BAND_FM) band = BAND_FM; else band = BAND_OIRT;
} else {
band = BAND_LW;
}
} else if (bandAM == AM_BAND_MW || bandAM == AM_BAND_NONE) {
AMjumptoFM();
}
break;
case BAND_SW:
if (bandFM == FM_BAND_FM) band = BAND_FM; else band = BAND_OIRT;
if (bandFM != FM_BAND_NONE) {
if (bandFM == FM_BAND_FM) band = BAND_FM; else band = BAND_OIRT;
} else {
if (bandAM == AM_BAND_LW_SW || bandAM == AM_BAND_ALL) {
band = BAND_LW;
} else if (bandAM == AM_BAND_MW_SW) {
band = BAND_MW;
} else if (bandAM == AM_BAND_SW || bandAM == AM_BAND_NONE) {
AMjumptoFM();
}
}
break;
case BAND_OIRT:
if (bandFM == FM_BAND_ALL) {
if (bandFM == FM_BAND_ALL || bandFM == FM_BAND_FM) {
band = BAND_FM;
} else if (bandFM == FM_BAND_OIRT) {
if (bandAM == AM_BAND_ALL || bandAM == AM_BAND_LW_MW || bandAM == AM_BAND_LW_SW || bandAM == AM_BAND_LW) {
band = BAND_LW;
if (stepsize > 3) stepsize = 3;
if (bandAM != AM_BAND_NONE) {
FMjumptoAM();
} else {
// do nothing
}
} else if (bandAM == AM_BAND_MW_SW || bandAM == AM_BAND_MW) {
band = BAND_MW;
} else if (bandAM == AM_BAND_SW) {
band = BAND_SW;
} else if (bandFM == FM_BAND_FM) {
if (bandAM == AM_BAND_ALL || bandAM == AM_BAND_LW_MW || bandAM == AM_BAND_LW_SW || bandAM == AM_BAND_LW) {
band = BAND_LW;
if (stepsize > 3) stepsize = 3;
}
} else if (bandAM == AM_BAND_MW_SW || bandAM == AM_BAND_MW) {
band = BAND_MW;
} else if (bandAM == AM_BAND_SW) {
band = BAND_SW;
}
break;
case BAND_FM:
if (bandAM == AM_BAND_ALL || bandAM == AM_BAND_LW_MW || bandAM == AM_BAND_LW_SW || bandAM == AM_BAND_LW) {
band = BAND_LW;
if (stepsize > 3) stepsize = 3;
} else if (bandAM == AM_BAND_MW_SW || bandAM == AM_BAND_MW) {
band = BAND_MW;
} else if (bandAM == AM_BAND_SW) {
band = BAND_SW;
if (bandAM != AM_BAND_NONE) {
FMjumptoAM();
} else {
if (bandFM == FM_BAND_OIRT || bandFM == FM_BAND_ALL) {
band = BAND_OIRT;
} else if (bandFM == FM_BAND_FM) {
// do nothing
}
}
break;
}

View File

@@ -205,13 +205,13 @@ enum RADIO_BAND {
// Toggle: LW -> MW -> SW
enum RADIO_AM_BAND_SELECTION {
AM_BAND_ALL = 0, AM_BAND_LW_MW, AM_BAND_LW_SW, AM_BAND_MW_SW,
AM_BAND_LW, AM_BAND_MW, AM_BAND_SW,
AM_BAND_LW, AM_BAND_MW, AM_BAND_SW, AM_BAND_NONE,
AM_BAND_CNT
};
// Toggle: OIRT -> FM
enum RADIO_FM_BAND_SELECTION {
FM_BAND_ALL = 0, FM_BAND_OIRT, FM_BAND_FM,
FM_BAND_ALL = 0, FM_BAND_OIRT, FM_BAND_FM, FM_BAND_NONE,
FM_BAND_CNT
};

View File

@@ -535,6 +535,7 @@ void BuildMenu() {
case FM_BAND_ALL: tftPrint(1, myLanguage[language][105] + String(",") + myLanguage[language][106], 310, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
case FM_BAND_OIRT: tftPrint(1, myLanguage[language][106], 310, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
case FM_BAND_FM: tftPrint(1, myLanguage[language][105], 310, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
case FM_BAND_NONE: tftPrint(1, myLanguage[language][208], 310, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
}
tftPrint(1, String(fmscansens), 310, ITEM10 + 6, PrimaryColor, PrimaryColorSmooth, 16);
break;
@@ -567,6 +568,7 @@ void BuildMenu() {
case AM_BAND_LW: tftPrint(1, myLanguage[language][102], 310, ITEM4 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
case AM_BAND_MW: tftPrint(1, myLanguage[language][103], 310, ITEM4 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
case AM_BAND_SW: tftPrint(1, myLanguage[language][104], 310, ITEM4 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
case AM_BAND_NONE: tftPrint(1, myLanguage[language][208], 310, ITEM4 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
}
if (showSWMIBand) tftPrint(1, myLanguage[language][42], 310, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16);
@@ -1268,6 +1270,7 @@ void MenuUp() {
case FM_BAND_ALL: tftPrint(0, myLanguage[language][105] + String(",") + myLanguage[language][106], 155, 118, BackgroundColor, BackgroundColor, 28); break;
case FM_BAND_OIRT: tftPrint(0, myLanguage[language][106], 155, 118, BackgroundColor, BackgroundColor, 28); break;
case FM_BAND_FM: tftPrint(0, myLanguage[language][105], 155, 118, BackgroundColor, BackgroundColor, 28); break;
case FM_BAND_NONE: tftPrint(0, myLanguage[language][208], 155, 118, BackgroundColor, BackgroundColor, 28); break;
}
bandFM++;
@@ -1277,6 +1280,7 @@ void MenuUp() {
case FM_BAND_ALL: tftPrint(0, myLanguage[language][105] + String(",") + myLanguage[language][106], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case FM_BAND_OIRT: tftPrint(0, myLanguage[language][106], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case FM_BAND_FM: tftPrint(0, myLanguage[language][105], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case FM_BAND_NONE: tftPrint(0, myLanguage[language][208], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
}
break;
@@ -1327,6 +1331,7 @@ void MenuUp() {
case AM_BAND_LW: tftPrint(0, myLanguage[language][102], 155, 118, BackgroundColor, BackgroundColor, 28); break;
case AM_BAND_MW: tftPrint(0, myLanguage[language][103], 155, 118, BackgroundColor, BackgroundColor, 28); break;
case AM_BAND_SW: tftPrint(0, myLanguage[language][104], 155, 118, BackgroundColor, BackgroundColor, 28); break;
case AM_BAND_NONE: tftPrint(0, myLanguage[language][208], 155, 118, BackgroundColor, BackgroundColor, 28); break;
}
bandAM++;
@@ -1340,6 +1345,7 @@ void MenuUp() {
case AM_BAND_LW: tftPrint(0, myLanguage[language][102], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case AM_BAND_MW: tftPrint(0, myLanguage[language][103], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case AM_BAND_SW: tftPrint(0, myLanguage[language][104], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case AM_BAND_NONE: tftPrint(0, myLanguage[language][208], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
}
break;
@@ -1840,15 +1846,17 @@ void MenuDown() {
case FM_BAND_ALL: tftPrint(0, myLanguage[language][105] + String(",") + myLanguage[language][106], 155, 118, BackgroundColor, BackgroundColor, 28); break;
case FM_BAND_OIRT: tftPrint(0, myLanguage[language][106], 155, 118, BackgroundColor, BackgroundColor, 28); break;
case FM_BAND_FM: tftPrint(0, myLanguage[language][105], 155, 118, BackgroundColor, BackgroundColor, 28); break;
case FM_BAND_NONE: tftPrint(0, myLanguage[language][208], 155, 118, BackgroundColor, BackgroundColor, 28); break;
}
bandFM--;
if (bandFM > FM_BAND_CNT) bandFM = FM_BAND_FM;
if (bandFM > FM_BAND_CNT) bandFM = FM_BAND_NONE;
switch (bandFM) {
case FM_BAND_ALL: tftPrint(0, myLanguage[language][105] + String(",") + myLanguage[language][106], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case FM_BAND_OIRT: tftPrint(0, myLanguage[language][106], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case FM_BAND_FM: tftPrint(0, myLanguage[language][105], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case FM_BAND_NONE: tftPrint(0, myLanguage[language][208], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
}
break;
@@ -1899,10 +1907,11 @@ void MenuDown() {
case AM_BAND_LW: tftPrint(0, myLanguage[language][102], 155, 118, BackgroundColor, BackgroundColor, 28); break;
case AM_BAND_MW: tftPrint(0, myLanguage[language][103], 155, 118, BackgroundColor, BackgroundColor, 28); break;
case AM_BAND_SW: tftPrint(0, myLanguage[language][104], 155, 118, BackgroundColor, BackgroundColor, 28); break;
case AM_BAND_NONE: tftPrint(0, myLanguage[language][208], 155, 118, BackgroundColor, BackgroundColor, 28); break;
}
bandAM--;
if (bandAM > AM_BAND_CNT) bandAM = AM_BAND_SW;
if (bandAM > AM_BAND_CNT) bandAM = AM_BAND_NONE;
switch (bandAM) {
case AM_BAND_ALL: tftPrint(0, myLanguage[language][102] + String(",") + myLanguage[language][103] + String(",") + myLanguage[language][104], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
@@ -1912,6 +1921,7 @@ void MenuDown() {
case AM_BAND_LW: tftPrint(0, myLanguage[language][102], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case AM_BAND_MW: tftPrint(0, myLanguage[language][103], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case AM_BAND_SW: tftPrint(0, myLanguage[language][104], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case AM_BAND_NONE: tftPrint(0, myLanguage[language][208], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
}
break;
@@ -2349,6 +2359,7 @@ void DoMenu() {
case FM_BAND_ALL: tftPrint(0, myLanguage[language][105] + String(",") + myLanguage[language][106], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case FM_BAND_OIRT: tftPrint(0, myLanguage[language][106], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case FM_BAND_FM: tftPrint(0, myLanguage[language][105], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case FM_BAND_NONE: tftPrint(0, myLanguage[language][208], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
}
break;
@@ -2388,6 +2399,7 @@ void DoMenu() {
case AM_BAND_LW: tftPrint(0, myLanguage[language][102], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case AM_BAND_MW: tftPrint(0, myLanguage[language][103], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case AM_BAND_SW: tftPrint(0, myLanguage[language][104], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case AM_BAND_NONE: tftPrint(0, myLanguage[language][208], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
}
break;

View File

@@ -1,6 +1,6 @@
// [number of languages][number of texts]
// *** means the text is the same as in English
static const char* const myLanguage[18][208] = {
static const char* const myLanguage[18][209] = {
{ "English", // English
"Rotary direction changed", // 1
"Please release button", // 2
@@ -208,7 +208,8 @@ static const char* const myLanguage[18][208] = {
"Detected applications", // 204
"Min.", // 205
"Dynamic SPI speed", // 206
"Scan sensitivity" // 207
"Scan sensitivity", // 207
"NONE" // 208 represents: AM/FM bands unavailable(please delete this note after translation
},
{ "Nederlands", // Dutch
@@ -418,7 +419,8 @@ static const char* const myLanguage[18][208] = {
"Gedetecteerde applicaties", // 204
"Min.", // 205 ***
"Dynamische\nSPI snelheid", // 206
"Zoek gevoeligheid" // 207
"Zoek gevoeligheid", // 207
"NONE" // 208 represents: AM/FM bands unavailable(please delete this note after translation
},
{ "Polski", // Polish
@@ -628,7 +630,8 @@ static const char* const myLanguage[18][208] = {
"Wykryte aplikacje", // 204
"Min.", // 205 ***
"Dynam. predkosc SPI", // 206 ***
"Czulosc skanowania" // 207
"Czulosc skanowania", // 207
"NONE" // 208 represents: AM/FM bands unavailable(please delete this note after translation
},
{ "Hrvatski", // Croatian
@@ -838,7 +841,8 @@ static const char* const myLanguage[18][208] = {
"Otkrivene aplikacije", // 204
"Min.", // 205 ***
"Dynamic SPI speed", // 206 ***
"Scan sensitivity" // 207
"Scan sensitivity", // 207
"NONE" // 208 represents: AM/FM bands unavailable(please delete this note after translation
},
{ "Ελληνικά", // Greek
@@ -1048,7 +1052,8 @@ static const char* const myLanguage[18][208] = {
"Εντοπισμένες εφαρμογές", // 204
"Λεπτά", // 205
"Δυναμική ταχύτητα\nSPI", // 206
"Ευαισθησία\nανίχνευσης" // 207
"Ευαισθησία\nανίχνευσης", // 207
"NONE" // 208 represents: AM/FM bands unavailable(please delete this note after translation
},
{ "Română", // Romanian
@@ -1258,7 +1263,8 @@ static const char* const myLanguage[18][208] = {
"Identificare aplicații", // 204
"Min.", // 205 ***
"Dynamic SPI speed", // 206 ***
"Scan sensitivity" // 207
"Scan sensitivity", // 207
"NONE" // 208 represents: AM/FM bands unavailable(please delete this note after translation
},
{ "Deutsch", // German
@@ -1469,6 +1475,7 @@ static const char* const myLanguage[18][208] = {
"Min.", // 205
"Dynamische \nSPI-Geschwindigkeit", // 206
"Scanempfindlichkeit", // 207
"NONE" // 208 represents: AM/FM bands unavailable(please delete this note after translation
},
{ "Český", // Czech
@@ -1678,7 +1685,8 @@ static const char* const myLanguage[18][208] = {
"Detekované aplikace", // 204
"Min.", // 205 ***
"Dynamic SPI speed", // 206 ***
"Scan sensitivity" // 207
"Scan sensitivity", // 207
"NONE" // 208 represents: AM/FM bands unavailable(please delete this note after translation
},
{ "Slovenský", // Slovak
@@ -1888,7 +1896,8 @@ static const char* const myLanguage[18][208] = {
"Detegované aplikácie", // 204
"Min.", // 205 ***
"Dynamic SPI speed", // 206 ***
"Scan sensitivity" // 207
"Scan sensitivity", // 207
"NONE" // 208 represents: AM/FM bands unavailable(please delete this note after translation
},
{ "Français", // French
@@ -2098,7 +2107,8 @@ static const char* const myLanguage[18][208] = {
"Applications détectées", // 204
"Min.", // 205
"Vitesse SPI\ndynamique", // 206
"Sensibilité\ndu scanne " // 207
"Sensibilité\ndu scanne ", // 207
"NONE" // 208 represents: AM/FM bands unavailable(please delete this note after translation
},
{ "Български", // Bulgarian
@@ -2308,7 +2318,8 @@ static const char* const myLanguage[18][208] = {
"Detected applications", // 204 ***
"Мин.", // 205
"Dynamic SPI speed", // 206 ***
"Scan sensitivity" // 207
"Scan sensitivity", // 207
"NONE" // 208 represents: AM/FM bands unavailable(please delete this note after translation
},
{ "Русский", // Russian
@@ -2518,7 +2529,8 @@ static const char* const myLanguage[18][208] = {
"Обнаруженные приложения", // 204
"мин.", // 205
"Скорость шины дисплея (SPI)", // 206 ***
"Чувствительность сканирования" // 207
"Чувствительность сканирования", // 207
"NONE" // 208 represents: AM/FM bands unavailable(please delete this note after translation
},
{ "Українська", // Ukranian
@@ -2728,7 +2740,8 @@ static const char* const myLanguage[18][208] = {
"Виявлені програми", // 204
"мін.", // 205
"Dynamic SPI speed", // 206 ***
"Scan sensitivity" // 207
"Scan sensitivity", // 207
"NONE" // 208 represents: AM/FM bands unavailable(please delete this note after translation
},
{ "Italiano", // Italian
@@ -2938,7 +2951,8 @@ static const char* const myLanguage[18][208] = {
"Applicazioni rilevate", // 204 ***
"Min.", // 205 ***
"Velocità SPI Dinamico", // 206 ***
"Sensibilità scansione" // 207
"Sensibilità scansione", // 207
"NONE" // 208 represents: AM/FM bands unavailable(please delete this note after translation
},
{ "Simplified Chinese", // Simplified Chinese
@@ -3148,7 +3162,8 @@ static const char* const myLanguage[18][208] = {
"Detected applications", // 204 ***
"分钟", // 205
"调整SPI通讯速率", // 206
"搜索灵敏度" // 207
"搜索灵敏度", // 207
"不可用" // 208
},
{ "Norsk", // Norwegian
@@ -3358,7 +3373,8 @@ static const char* const myLanguage[18][208] = {
"Oppdaget applikasjoner", // 204
"Min.", // 205 ***
"Dynamisk SPI hastighet", // 206
"Skannefølsomhet" // 207
"Skannefølsomhet", // 207
"NONE" // 208 represents: AM/FM bands unavailable(please delete this note after translation
},
{ "Español", // Spanish
@@ -3568,7 +3584,8 @@ static const char* const myLanguage[18][208] = {
"Aplicaciones detectadas", // 204
"Min.", // 205
"Velocidad de SPI", // 206
"Sensibilidad\ndel escaneo" // 207
"Sensibilidad\ndel escaneo", // 207
"NONE" // 208 represents: AM/FM bands unavailable(please delete this note after translation
},
{ "Português", // Portuguese
@@ -3778,6 +3795,7 @@ static const char* const myLanguage[18][208] = {
"Aplicativos detectados", // 204
"Min.", // 205
"Velocidade dinâmica\nde SPI", // 206
"Sensibilidade\nda varredura" // 207
"Sensibilidade\nda varredura", // 207
"NONE" // 208 represents: AM/FM bands unavailable(please delete this note after translation
}
};