Last state SW BAND/AUTO stored in flash and made it more user friendly

This commit is contained in:
Sjef Verhoeven PE5PVB
2023-10-10 17:42:25 +02:00
parent cb31950de0
commit a5181c2463
2 changed files with 68 additions and 59 deletions
+67 -59
View File
@@ -424,6 +424,7 @@ void setup() {
fmdeemphasis = EEPROM.readByte(EE_BYTE_FM_DEEMPHASIS); fmdeemphasis = EEPROM.readByte(EE_BYTE_FM_DEEMPHASIS);
BWsetFM = EEPROM.readByte(EE_BYTE_BWSET_FM); BWsetFM = EEPROM.readByte(EE_BYTE_BWSET_FM);
BWsetAM = EEPROM.readByte(EE_BYTE_BWSET_AM); BWsetAM = EEPROM.readByte(EE_BYTE_BWSET_AM);
nowToggleSWMIBand = EEPROM.readByte(EE_BYTE_BANDAUTOSW);
LWLowEdgeSet = FREQ_LW_LOW_EDGE_MIN; // later will read from flash LWLowEdgeSet = FREQ_LW_LOW_EDGE_MIN; // later will read from flash
LWHighEdgeSet = FREQ_LW_HIGH_EDGE_MAX; // later will read from flash LWHighEdgeSet = FREQ_LW_HIGH_EDGE_MAX; // later will read from flash
@@ -2055,13 +2056,17 @@ void ButtonPress() {
EEPROM.writeByte(EE_BYTE_EQSET, EQset); EEPROM.writeByte(EE_BYTE_EQSET, EQset);
EEPROM.commit(); EEPROM.commit();
} else { } else {
if (band == BAND_SW) { if (band == BAND_SW && tunemode != TUNE_MEM) {
if (tunemode != TUNE_MEM) { nowToggleSWMIBand = !nowToggleSWMIBand;
nowToggleSWMIBand = !nowToggleSWMIBand; tunemode = TUNE_MAN;
tunemode = TUNE_MEM; EEPROM.writeByte(EE_BYTE_BANDAUTOSW, nowToggleSWMIBand);
doTuneMode(); EEPROM.commit();
ShowTuneMode(); if (!screenmute) {
tftPrint(0, "AUTO", 22, 60, BackgroundColor, BackgroundColor, 16);
tftPrint(0, "BAND", 22, 60, BackgroundColor, BackgroundColor, 16);
} }
doTuneMode();
ShowTuneMode();
} }
} }
} }
@@ -2798,72 +2803,74 @@ void doTuneMode() {
} }
void ShowTuneMode() { void ShowTuneMode() {
switch (tunemode) { if (!screenmute) {
case TUNE_MAN: switch (tunemode) {
if (band == BAND_SW && nowToggleSWMIBand) { case TUNE_MAN:
tftPrint(0, "AUTO", 22, 60, BackgroundColor, BackgroundColor, 16); if (band == BAND_SW && nowToggleSWMIBand) {
tft.drawRoundRect(1, 57, 42, 20, 5, GreyoutColor); tftPrint(0, "AUTO", 22, 60, BackgroundColor, BackgroundColor, 16);
tftPrint(0, "BAND", 22, 60, GreyoutColor, BackgroundColor, 16); tft.drawRoundRect(1, 57, 42, 20, 5, GreyoutColor);
} else { tftPrint(0, "BAND", 22, 60, GreyoutColor, BackgroundColor, 16);
tftPrint(0, "BAND", 22, 60, BackgroundColor, BackgroundColor, 16); } else {
tft.drawRoundRect(1, 57, 42, 20, 5, GreyoutColor); tftPrint(0, "BAND", 22, 60, BackgroundColor, BackgroundColor, 16);
tftPrint(0, "AUTO", 22, 60, GreyoutColor, BackgroundColor, 16); tft.drawRoundRect(1, 57, 42, 20, 5, GreyoutColor);
} tftPrint(0, "AUTO", 22, 60, GreyoutColor, BackgroundColor, 16);
}
tft.drawRoundRect(1, 35, 42, 20, 5, ActiveColor); tft.drawRoundRect(1, 35, 42, 20, 5, ActiveColor);
tftPrint(0, "MAN", 22, 38, ActiveColor, ActiveColorSmooth, 16); tftPrint(0, "MAN", 22, 38, ActiveColor, ActiveColorSmooth, 16);
tft.drawRoundRect(1, 79, 42, 20, 5, GreyoutColor); tft.drawRoundRect(1, 79, 42, 20, 5, GreyoutColor);
tftPrint(0, "MEM", 22, 82, GreyoutColor, BackgroundColor, 16); tftPrint(0, "MEM", 22, 82, GreyoutColor, BackgroundColor, 16);
break; break;
case TUNE_AUTO: case TUNE_AUTO:
tft.drawRoundRect(1, 57, 42, 20, 5, ActiveColor); tft.drawRoundRect(1, 57, 42, 20, 5, ActiveColor);
tftPrint(0, "AUTO", 22, 60, ActiveColor, ActiveColorSmooth, 16); tftPrint(0, "AUTO", 22, 60, ActiveColor, ActiveColorSmooth, 16);
tft.drawRoundRect(1, 35, 42, 20, 5, GreyoutColor); tft.drawRoundRect(1, 35, 42, 20, 5, GreyoutColor);
tftPrint(0, "MAN", 22, 38, GreyoutColor, BackgroundColor, 16); tftPrint(0, "MAN", 22, 38, GreyoutColor, BackgroundColor, 16);
tft.drawRoundRect(1, 79, 42, 20, 5, GreyoutColor); tft.drawRoundRect(1, 79, 42, 20, 5, GreyoutColor);
tftPrint(0, "MEM", 22, 82, GreyoutColor, BackgroundColor, 16); tftPrint(0, "MEM", 22, 82, GreyoutColor, BackgroundColor, 16);
break; break;
case TUNE_MEM: case TUNE_MEM:
if (band == BAND_SW && nowToggleSWMIBand) { if (band == BAND_SW && nowToggleSWMIBand) {
tftPrint(0, "AUTO", 22, 60, BackgroundColor, BackgroundColor, 16); tftPrint(0, "AUTO", 22, 60, BackgroundColor, BackgroundColor, 16);
tft.drawRoundRect(1, 57, 42, 20, 5, GreyoutColor); tft.drawRoundRect(1, 57, 42, 20, 5, GreyoutColor);
tftPrint(0, "BAND", 22, 60, GreyoutColor, BackgroundColor, 16); tftPrint(0, "BAND", 22, 60, GreyoutColor, BackgroundColor, 16);
} else { } else {
tftPrint(0, "BAND", 22, 60, BackgroundColor, BackgroundColor, 16); tftPrint(0, "BAND", 22, 60, BackgroundColor, BackgroundColor, 16);
tft.drawRoundRect(1, 57, 42, 20, 5, GreyoutColor); tft.drawRoundRect(1, 57, 42, 20, 5, GreyoutColor);
tftPrint(0, "AUTO", 22, 60, GreyoutColor, BackgroundColor, 16); tftPrint(0, "AUTO", 22, 60, GreyoutColor, BackgroundColor, 16);
} }
tft.drawRoundRect(1, 35, 42, 20, 5, GreyoutColor); tft.drawRoundRect(1, 35, 42, 20, 5, GreyoutColor);
tftPrint(0, "MAN", 22, 39, GreyoutColor, BackgroundColor, 16); tftPrint(0, "MAN", 22, 39, GreyoutColor, BackgroundColor, 16);
if (memorystore) { if (memorystore) {
tft.drawRoundRect(1, 79, 42, 20, 5, SignificantColor); tft.drawRoundRect(1, 79, 42, 20, 5, SignificantColor);
tftPrint(0, "MEM", 22, 82, SignificantColor, SignificantColorSmooth, 16); tftPrint(0, "MEM", 22, 82, SignificantColor, SignificantColorSmooth, 16);
} else { } else {
tft.drawRoundRect(1, 79, 42, 20, 5, ActiveColor); tft.drawRoundRect(1, 79, 42, 20, 5, ActiveColor);
tftPrint(0, "MEM", 22, 82, ActiveColor, ActiveColorSmooth, 16); tftPrint(0, "MEM", 22, 82, ActiveColor, ActiveColorSmooth, 16);
} }
break; break;
case TUNE_MI_BAND: case TUNE_MI_BAND:
tft.drawRoundRect(1, 57, 42, 20, 5, ActiveColor); tft.drawRoundRect(1, 57, 42, 20, 5, ActiveColor);
tft.setTextColor(ActiveColor); tft.setTextColor(ActiveColor);
tftPrint(0, "BAND", 22, 60, ActiveColor, ActiveColorSmooth, 16); tftPrint(0, "BAND", 22, 60, ActiveColor, ActiveColorSmooth, 16);
tft.drawRoundRect(1, 35, 42, 20, 5, GreyoutColor); tft.drawRoundRect(1, 35, 42, 20, 5, GreyoutColor);
tftPrint(0, "MAN", 22, 38, GreyoutColor, BackgroundColor, 16); tftPrint(0, "MAN", 22, 38, GreyoutColor, BackgroundColor, 16);
tft.drawRoundRect(1, 79, 42, 20, 5, GreyoutColor); tft.drawRoundRect(1, 79, 42, 20, 5, GreyoutColor);
tftPrint(0, "MEM", 22, 82, GreyoutColor, BackgroundColor, 16); tftPrint(0, "MEM", 22, 82, GreyoutColor, BackgroundColor, 16);
break; break;
}
} }
} }
@@ -3275,6 +3282,7 @@ void DefaultSettings(byte userhardwaremodel) {
EEPROM.writeByte(EE_BYTE_FM_DEEMPHASIS, DEEMPHASIS_50); EEPROM.writeByte(EE_BYTE_FM_DEEMPHASIS, DEEMPHASIS_50);
EEPROM.writeByte(EE_BYTE_BWSET_FM, 0); EEPROM.writeByte(EE_BYTE_BWSET_FM, 0);
EEPROM.writeByte(EE_BYTE_BWSET_AM, 2); EEPROM.writeByte(EE_BYTE_BWSET_AM, 2);
EEPROM.writeByte(EE_BYTE_BANDAUTOSW, 0);
EEPROM.commit(); EEPROM.commit();
} }
+1
View File
@@ -144,6 +144,7 @@
#define EE_BYTE_LOWLEVELSET 47 #define EE_BYTE_LOWLEVELSET 47
#define EE_BYTE_BWSET_FM 48 #define EE_BYTE_BWSET_FM 48
#define EE_BYTE_BWSET_AM 49 #define EE_BYTE_BWSET_AM 49
#define EE_BYTE_BANDAUTOSW 50
#define EE_BYTE_MEMORYPOS 51 #define EE_BYTE_MEMORYPOS 51
#define EE_BYTE_REGION 52 #define EE_BYTE_REGION 52
#define EE_BYTE_RDS_UNDERSCORE 53 #define EE_BYTE_RDS_UNDERSCORE 53