More change on region selector

This commit is contained in:
Sjef Verhoeven PE5PVB
2025-02-24 17:03:40 +01:00
parent 423de6d3f1
commit 2f993f274a
6 changed files with 38 additions and 45 deletions
+15 -13
View File
@@ -211,7 +211,6 @@ byte MSold;
byte poweroptions; byte poweroptions;
byte rdsblockold; byte rdsblockold;
byte rdsqualityold; byte rdsqualityold;
byte region;
byte rotarymode; byte rotarymode;
byte touchrotating; byte touchrotating;
byte scancancel; byte scancancel;
@@ -517,7 +516,7 @@ void setup() {
band = EEPROM.readByte(EE_BYTE_BAND); band = EEPROM.readByte(EE_BYTE_BAND);
LowLevelSet = EEPROM.readByte(EE_BYTE_LOWLEVELSET); LowLevelSet = EEPROM.readByte(EE_BYTE_LOWLEVELSET);
memorypos = EEPROM.readByte(EE_BYTE_MEMORYPOS); memorypos = EEPROM.readByte(EE_BYTE_MEMORYPOS);
region = EEPROM.readByte(EE_BYTE_REGION); radio.rds.region = EEPROM.readByte(EE_BYTE_REGION);
radio.underscore = EEPROM.readByte(EE_BYTE_RDS_UNDERSCORE); radio.underscore = EEPROM.readByte(EE_BYTE_RDS_UNDERSCORE);
USBmode = EEPROM.readByte(EE_BYTE_USBMODE); USBmode = EEPROM.readByte(EE_BYTE_USBMODE);
wifi = EEPROM.readByte(EE_BYTE_WIFI); wifi = EEPROM.readByte(EE_BYTE_WIFI);
@@ -928,7 +927,6 @@ void setup() {
radio.setFMNoiseBlanker(fmnb); radio.setFMNoiseBlanker(fmnb);
radio.setAudio(audiomode); radio.setAudio(audiomode);
radio.setDeemphasis(fmdeemphasis); radio.setDeemphasis(fmdeemphasis);
radio.rds.region = region;
radio.setAGC(fmagc); radio.setAGC(fmagc);
radio.setAMAGC(amagc); radio.setAMAGC(amagc);
if (fmsi) radio.setFMSI(2); else radio.setFMSI(1); if (fmsi) radio.setFMSI(2); else radio.setFMSI(1);
@@ -1080,7 +1078,7 @@ void loop() {
if (!scanholdflag) delay(100); if (!scanholdflag) delay(100);
radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus, CN); radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus, CN);
if (RabbitearsUser.length() && RabbitearsPassword.length() && region == REGION_US && radio.rds.correctPI != 0 && frequency >= 8810 && frequency <= 10790 && !(frequency % 10) && ((frequency / 10) % 2)) { if (RabbitearsUser.length() && RabbitearsPassword.length() && radio.rds.region != 0 && radio.rds.correctPI != 0 && frequency >= 8810 && frequency <= 10790 && !(frequency % 10) && ((frequency / 10) % 2)) {
byte i = (frequency / 10 - 881) / 2; byte i = (frequency / 10 - 881) / 2;
if (!rabbitearspi[i]) { if (!rabbitearspi[i]) {
rabbitearspi[i] = radio.rds.correctPI; rabbitearspi[i] = radio.rds.correctPI;
@@ -1246,8 +1244,9 @@ void loop() {
} }
} }
} }
if (region == REGION_EU) tftPrint(-1, "PI:", 212, 193, ActiveColor, ActiveColorSmooth, 16); if (radio.rds.region == 0) {
if (region == REGION_US) { tftPrint(-1, "PI:", 212, 193, ActiveColor, ActiveColorSmooth, 16);
} else {
tftPrint(-1, "PI:", 212, 184, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, "PI:", 212, 184, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "ID:", 212, 201, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, "ID:", 212, 201, ActiveColor, ActiveColorSmooth, 16);
} }
@@ -1278,8 +1277,9 @@ void loop() {
tftPrint(0, "M", 7, 128, GreyoutColor, BackgroundColor, 16); tftPrint(0, "M", 7, 128, GreyoutColor, BackgroundColor, 16);
tft.fillRect(16, 133, 187, 6, GreyoutColor); tft.fillRect(16, 133, 187, 6, GreyoutColor);
} }
if (region == REGION_EU) tftPrint(-1, "PI:", 212, 193, GreyoutColor, BackgroundColor, 16); if (radio.rds.region == 0) {
if (region == REGION_US) { tftPrint(-1, "PI:", 212, 193, GreyoutColor, BackgroundColor, 16);
} else {
tftPrint(-1, "PI:", 212, 184, GreyoutColor, BackgroundColor, 16); tftPrint(-1, "PI:", 212, 184, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "ID:", 212, 201, GreyoutColor, BackgroundColor, 16); tftPrint(-1, "ID:", 212, 201, GreyoutColor, BackgroundColor, 16);
} }
@@ -2394,8 +2394,9 @@ void SelectBand() {
radio.setAMCoChannel(amcodect, amcodectcount); radio.setAMCoChannel(amcodect, amcodectcount);
doBW(); doBW();
if (!screenmute) { if (!screenmute) {
if (region == REGION_EU) tftPrint(-1, "PI:", 212, 193, GreyoutColor, BackgroundColor, 16); if (radio.rds.region == 0) {
if (region == REGION_US) { tftPrint(-1, "PI:", 212, 193, GreyoutColor, BackgroundColor, 16);
} else {
tftPrint(-1, "PI:", 212, 184, GreyoutColor, BackgroundColor, 16); tftPrint(-1, "PI:", 212, 184, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "ID:", 212, 201, GreyoutColor, BackgroundColor, 16); tftPrint(-1, "ID:", 212, 201, GreyoutColor, BackgroundColor, 16);
} }
@@ -2428,8 +2429,9 @@ void SelectBand() {
freqold = frequency_AM; freqold = frequency_AM;
if (!externaltune && tunemode != TUNE_MEM) CheckBandForbiddenFM(); if (!externaltune && tunemode != TUNE_MEM) CheckBandForbiddenFM();
doBW(); doBW();
if (region == REGION_EU) tftPrint(-1, "PI:", 212, 193, ActiveColor, ActiveColorSmooth, 16); if (radio.rds.region == 0) {
if (region == REGION_US) { tftPrint(-1, "PI:", 212, 193, ActiveColor, ActiveColorSmooth, 16);
} else {
tftPrint(-1, "PI:", 212, 184, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, "PI:", 212, 184, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "ID:", 212, 201, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, "ID:", 212, 201, ActiveColor, ActiveColorSmooth, 16);
} }
@@ -4896,7 +4898,7 @@ void endMenu() {
EEPROM.writeByte(EE_BYTE_LANGUAGE, language); EEPROM.writeByte(EE_BYTE_LANGUAGE, language);
EEPROM.writeByte(EE_BYTE_SHOWRDSERRORS, showrdserrors); EEPROM.writeByte(EE_BYTE_SHOWRDSERRORS, showrdserrors);
EEPROM.writeByte(EE_BYTE_LOWLEVELSET, LowLevelSet); EEPROM.writeByte(EE_BYTE_LOWLEVELSET, LowLevelSet);
EEPROM.writeByte(EE_BYTE_REGION, region); EEPROM.writeByte(EE_BYTE_REGION, radio.rds.region);
EEPROM.writeByte(EE_BYTE_RDS_UNDERSCORE, radio.underscore); EEPROM.writeByte(EE_BYTE_RDS_UNDERSCORE, radio.underscore);
EEPROM.writeByte(EE_BYTE_USBMODE, USBmode); EEPROM.writeByte(EE_BYTE_USBMODE, USBmode);
EEPROM.writeByte(EE_BYTE_WIFI, wifi); EEPROM.writeByte(EE_BYTE_WIFI, wifi);
+1 -2
View File
@@ -668,8 +668,7 @@ void TEF6686::readRDS(byte showrdserrors) {
if (!rdsBerrorThreshold) { if (!rdsBerrorThreshold) {
rds.stationTypeCode = (rds.rdsB >> 5) & 0x1F; // Get 5 PTY bits from Block B rds.stationTypeCode = (rds.rdsB >> 5) & 0x1F; // Get 5 PTY bits from Block B
if (rds.region == 0) strcpy(rds.stationType, PTY_EU[rds.stationTypeCode]); if (rds.region == 0) strcpy(rds.stationType, PTY_EU[rds.stationTypeCode]); else strcpy(rds.stationType, PTY_USA[rds.stationTypeCode]);
if (rds.region == 1) strcpy(rds.stationType, PTY_USA[rds.stationTypeCode]);
rds.hasTA = (bitRead(rds.rdsB, 4)); // Read TA flag rds.hasTA = (bitRead(rds.rdsB, 4)); // Read TA flag
+12 -12
View File
@@ -711,8 +711,8 @@ void ShowOneLine(byte position, byte item, bool selected) {
FullLineSprite.setTextDatum(TR_DATUM); FullLineSprite.setTextDatum(TR_DATUM);
FullLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); FullLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
if (region == REGION_EU) FullLineSprite.drawString(myLanguage[language][47], 298, 2); if (radio.rds.region == REGION_EU) FullLineSprite.drawString(myLanguage[language][47], 298, 2);
if (region == REGION_US) FullLineSprite.drawString(myLanguage[language][48], 298, 2); if (radio.rds.region == REGION_US) FullLineSprite.drawString(myLanguage[language][48], 298, 2);
break; break;
case FMSETTINGS: case FMSETTINGS:
@@ -1802,8 +1802,8 @@ void ShowOneButton(byte position, byte item, bool selected) {
PSSprite.drawString(shortLine(removeNewline(myLanguage[language][46])), 75, 1); PSSprite.drawString(shortLine(removeNewline(myLanguage[language][46])), 75, 1);
PSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); PSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
if (region == REGION_EU) PSSprite.drawString(myLanguage[language][47], 75, 15); if (radio.rds.region == REGION_EU) PSSprite.drawString(myLanguage[language][47], 75, 15);
if (region == REGION_US) PSSprite.drawString(myLanguage[language][48], 75, 15); if (radio.rds.region == REGION_US) PSSprite.drawString(myLanguage[language][48], 75, 15);
break; break;
case FMSETTINGS: case FMSETTINGS:
@@ -2870,8 +2870,9 @@ void BuildAdvancedRDS() {
tftPrint(-1, "ERRORS", 3, 34, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, "ERRORS", 3, 34, ActiveColor, ActiveColorSmooth, 16);
tftPrint(1, "MHz", 310, 35, ActiveColor, ActiveColorSmooth, 16); tftPrint(1, "MHz", 310, 35, ActiveColor, ActiveColorSmooth, 16);
tftPrint(1, unitString[unit], 310, 51, ActiveColor, ActiveColorSmooth, 16); tftPrint(1, unitString[unit], 310, 51, ActiveColor, ActiveColorSmooth, 16);
if (region == REGION_EU) tftPrint(-1, "PI", 216, 81, ActiveColor, ActiveColorSmooth, 16); if (radio.rds.region == 0) {
if (region == REGION_US) { tftPrint(-1, "PI", 216, 81, ActiveColor, ActiveColorSmooth, 16);
} else {
tftPrint(-1, "PI:", 216, 72, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, "PI:", 216, 72, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "ID:", 216, 89, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, "ID:", 216, 89, ActiveColor, ActiveColorSmooth, 16);
} }
@@ -3686,12 +3687,11 @@ void MenuUpDown(bool dir) {
break; break;
case ITEM2: case ITEM2:
if (region == REGION_EU) region = REGION_US; else region = REGION_EU; if (radio.rds.region == REGION_EU) radio.rds.region = REGION_US; else radio.rds.region = REGION_EU;
if (region == REGION_EU) OneBigLineSprite.drawString(myLanguage[language][47], 135, 0); if (radio.rds.region == REGION_EU) OneBigLineSprite.drawString(myLanguage[language][47], 135, 0);
if (region == REGION_US) OneBigLineSprite.drawString(myLanguage[language][48], 135, 0); if (radio.rds.region == REGION_US) OneBigLineSprite.drawString(myLanguage[language][48], 135, 0);
OneBigLineSprite.pushSprite(24, 118); OneBigLineSprite.pushSprite(24, 118);
radio.rds.region = region;
break; break;
case ITEM3: case ITEM3:
@@ -4916,8 +4916,8 @@ void DoMenu() {
case ITEM2: case ITEM2:
Infoboxprint(myLanguage[language][46]); Infoboxprint(myLanguage[language][46]);
if (region == REGION_EU) OneBigLineSprite.drawString(myLanguage[language][47], 135, 0); if (radio.rds.region == REGION_EU) OneBigLineSprite.drawString(myLanguage[language][47], 135, 0);
if (region == REGION_US) OneBigLineSprite.drawString(myLanguage[language][48], 135, 0); if (radio.rds.region == REGION_US) OneBigLineSprite.drawString(myLanguage[language][48], 135, 0);
OneBigLineSprite.pushSprite(24, 118); OneBigLineSprite.pushSprite(24, 118);
break; break;
-1
View File
@@ -107,7 +107,6 @@ extern byte MSold;
extern byte poweroptions; extern byte poweroptions;
extern byte eonptyold[20]; extern byte eonptyold[20];
extern byte rdsblockold; extern byte rdsblockold;
extern byte region;
extern byte scancancel; extern byte scancancel;
extern byte scanstart; extern byte scanstart;
extern byte scanstop; extern byte scanstop;
+10 -16
View File
@@ -311,15 +311,13 @@ void readRds() {
if (!screenmute && !afscreen) { if (!screenmute && !afscreen) {
if (!RDSstatus) { if (!RDSstatus) {
if (radio.rds.correctPI != 0 && !dropout) { if (radio.rds.correctPI != 0 && !dropout) {
if (region == REGION_EU) { if (radio.rds.region == 0) {
if (advancedRDS) { if (advancedRDS) {
tftPrint(0, PIold, 275, 75, RDSDropoutColor, RDSDropoutColorSmooth, 28); tftPrint(0, PIold, 275, 75, RDSDropoutColor, RDSDropoutColorSmooth, 28);
} else { } else {
tftPrint(0, PIold, 275, 187, RDSDropoutColor, RDSDropoutColorSmooth, 28); tftPrint(0, PIold, 275, 187, RDSDropoutColor, RDSDropoutColorSmooth, 28);
} }
} } else {
if (region == REGION_US) {
if (advancedRDS) { if (advancedRDS) {
tftPrint(-1, PIold, 240, 72, RDSDropoutColor, RDSDropoutColorSmooth, 16); tftPrint(-1, PIold, 240, 72, RDSDropoutColor, RDSDropoutColorSmooth, 16);
tftPrint(-1, stationIDold, 240, 89, RDSDropoutColor, RDSDropoutColorSmooth, 16); tftPrint(-1, stationIDold, 240, 89, RDSDropoutColor, RDSDropoutColorSmooth, 16);
@@ -360,15 +358,13 @@ void readRds() {
} }
} else { } else {
if (dropout || memreset) { if (dropout || memreset) {
if (region == REGION_EU) { if (radio.rds.region == 0) {
if (advancedRDS) { if (advancedRDS) {
tftPrint(0, PIold, 275, 75, RDSColor, RDSColorSmooth, 28); tftPrint(0, PIold, 275, 75, RDSColor, RDSColorSmooth, 28);
} else { } else {
tftPrint(0, PIold, 275, 187, RDSColor, RDSColorSmooth, 28); tftPrint(0, PIold, 275, 187, RDSColor, RDSColorSmooth, 28);
} }
} } else {
if (region == REGION_US) {
if (advancedRDS) { if (advancedRDS) {
tftPrint(-1, PIold, 240, 72, RDSColor, RDSColorSmooth, 16); tftPrint(-1, PIold, 240, 72, RDSColor, RDSColorSmooth, 16);
tftPrint(-1, stationIDold, 240, 89, RDSColor, RDSColorSmooth, 16); tftPrint(-1, stationIDold, 240, 89, RDSColor, RDSColorSmooth, 16);
@@ -557,7 +553,7 @@ void ShowErrors() {
} }
void showPI() { void showPI() {
if ((region == REGION_US && (String(radio.rds.picode) != PIold || radio.rds.stationIDtext != stationIDold || radio.rds.stationStatetext != stationStateold)) || (region != REGION_US && String(radio.rds.picode) != PIold)) { if ((radio.rds.region != 0 && (String(radio.rds.picode) != PIold || radio.rds.stationIDtext != stationIDold || radio.rds.stationStatetext != stationStateold)) || (radio.rds.region == 0 && String(radio.rds.picode) != PIold)) {
if (!afscreen && !radio.rds.rdsAerror && !radio.rds.rdsBerror && !radio.rds.rdsCerror && !radio.rds.rdsDerror && radio.rds.rdsA != radio.rds.correctPI && PIold.length() > 1) { if (!afscreen && !radio.rds.rdsAerror && !radio.rds.rdsBerror && !radio.rds.rdsCerror && !radio.rds.rdsDerror && radio.rds.rdsA != radio.rds.correctPI && PIold.length() > 1) {
radio.clearRDS(fullsearchrds); radio.clearRDS(fullsearchrds);
if (RDSSPYUSB) Serial.print("G:\r\nRESET-------\r\n\r\n"); if (RDSSPYUSB) Serial.print("G:\r\nRESET-------\r\n\r\n");
@@ -566,14 +562,13 @@ void showPI() {
if (!screenmute) { if (!screenmute) {
if (advancedRDS) { if (advancedRDS) {
if (region == REGION_EU) { if (radio.rds.region == 0) {
if (!RDSstatus) { if (!RDSstatus) {
tftReplace(0, PIold, radio.rds.picode, 275, 75, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 28); tftReplace(0, PIold, radio.rds.picode, 275, 75, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 28);
} else { } else {
tftReplace(0, PIold, radio.rds.picode, 275, 75, RDSColor, RDSColorSmooth, BackgroundColor, 28); tftReplace(0, PIold, radio.rds.picode, 275, 75, RDSColor, RDSColorSmooth, BackgroundColor, 28);
} }
} } else {
if (region == REGION_US) {
if (!RDSstatus) { if (!RDSstatus) {
if (String(radio.rds.picode) != PIold) tftReplace(-1, PIold, radio.rds.picode, 240, 72, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); if (String(radio.rds.picode) != PIold) tftReplace(-1, PIold, radio.rds.picode, 240, 72, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16);
tftReplace(-1, stationIDold, radio.rds.stationIDtext, 240, 89, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); tftReplace(-1, stationIDold, radio.rds.stationIDtext, 240, 89, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16);
@@ -586,14 +581,13 @@ void showPI() {
} else if (afscreen) { } else if (afscreen) {
tftReplace(-1, PIold, radio.rds.picode, 30, 201, BWAutoColor, BWAutoColorSmooth, BackgroundColor, 16); tftReplace(-1, PIold, radio.rds.picode, 30, 201, BWAutoColor, BWAutoColorSmooth, BackgroundColor, 16);
} else { } else {
if (region == REGION_EU) { if (radio.rds.region == 0) {
if (!RDSstatus) { if (!RDSstatus) {
tftReplace(0, PIold, radio.rds.picode, 275, 187, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 28); tftReplace(0, PIold, radio.rds.picode, 275, 187, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 28);
} else { } else {
tftReplace(0, PIold, radio.rds.picode, 275, 187, RDSColor, RDSColorSmooth, BackgroundColor, 28); tftReplace(0, PIold, radio.rds.picode, 275, 187, RDSColor, RDSColorSmooth, BackgroundColor, 28);
} }
} } else {
if (region == REGION_US) {
if (!RDSstatus) { if (!RDSstatus) {
if (String(radio.rds.picode) != PIold || radio.rds.stationIDtext != stationIDold) { if (String(radio.rds.picode) != PIold || radio.rds.stationIDtext != stationIDold) {
tftReplace(-1, PIold, radio.rds.picode, 240, 184, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); tftReplace(-1, PIold, radio.rds.picode, 240, 184, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16);
@@ -623,7 +617,7 @@ void showPI() {
void showPTY() { void showPTY() {
if (strcmp(radio.rds.stationType, programTypePrevious)) { if (strcmp(radio.rds.stationType, programTypePrevious)) {
String PTYString = String(radio.rds.stationTypeCode) + ": " + (radio.rds.region == 1 ? radio.rds.stationType : myLanguage[language][228 + radio.rds.stationTypeCode]); String PTYString = String(radio.rds.stationTypeCode) + ": " + (radio.rds.region != 0 ? radio.rds.stationType : myLanguage[language][228 + radio.rds.stationTypeCode]);
if (radio.rds.stationTypeCode == 32) PTYString = ""; if (radio.rds.stationTypeCode == 32) PTYString = "";
-1
View File
@@ -57,7 +57,6 @@ extern byte MSold;
extern byte eonptyold[20]; extern byte eonptyold[20];
extern byte rdsblockold; extern byte rdsblockold;
extern byte rdsqualityold; extern byte rdsqualityold;
extern byte region;
extern byte showrdserrors; extern byte showrdserrors;
extern byte stationlistid; extern byte stationlistid;
extern char eonpicodeold[20][6]; extern char eonpicodeold[20][6];