Merge pull request #109 from ohmytime/Fix_MI_Band

SW MI band bugfix & adjust
This commit is contained in:
Sjef Verhoeven PE5PVB
2023-07-22 16:41:31 +02:00
committed by GitHub
+22 -21
View File
@@ -1069,10 +1069,10 @@ void DivdeSWMIBand() {
} }
} }
void ToggleSWMIBand(bool plus) { void ToggleSWMIBand(bool frequencyup) {
switch (SWMIBandPosold) { switch (SWMIBandPosold) {
case SW_MI_BAND_GAP: case SW_MI_BAND_GAP:
if (plus) { if (frequencyup) {
SWMIBandPos = SW_MI_BAND_160M; SWMIBandPos = SW_MI_BAND_160M;
SWMIBandPosold = SWMIBandPos; SWMIBandPosold = SWMIBandPos;
frequency_AM = FREQ_SW_160M_START; frequency_AM = FREQ_SW_160M_START;
@@ -1085,7 +1085,7 @@ void ToggleSWMIBand(bool plus) {
frequency_SW = frequency_AM; frequency_SW = frequency_AM;
break; break;
case SW_MI_BAND_11M: case SW_MI_BAND_11M:
if (plus) { if (frequencyup) {
SWMIBandstringold = (String) "" + SWMIBandPosold + " m"; SWMIBandstringold = (String) "" + SWMIBandPosold + " m";
SWMIBandPos = SW_MI_BAND_160M; SWMIBandPos = SW_MI_BAND_160M;
SWMIBandPosold = SWMIBandPos; SWMIBandPosold = SWMIBandPos;
@@ -1102,7 +1102,7 @@ void ToggleSWMIBand(bool plus) {
frequency_SW = frequency_AM; frequency_SW = frequency_AM;
break; break;
case SW_MI_BAND_13M: case SW_MI_BAND_13M:
if (plus) { if (frequencyup) {
SWMIBandstringold = (String) "" + SWMIBandPosold + " m"; SWMIBandstringold = (String) "" + SWMIBandPosold + " m";
SWMIBandPos = SW_MI_BAND_11M; SWMIBandPos = SW_MI_BAND_11M;
SWMIBandPosold = SWMIBandPos; SWMIBandPosold = SWMIBandPos;
@@ -1119,7 +1119,7 @@ void ToggleSWMIBand(bool plus) {
frequency_SW = frequency_AM; frequency_SW = frequency_AM;
break; break;
case SW_MI_BAND_15M: case SW_MI_BAND_15M:
if (plus) { if (frequencyup) {
SWMIBandstringold = (String) "" + SWMIBandPosold + " m"; SWMIBandstringold = (String) "" + SWMIBandPosold + " m";
SWMIBandPos = SW_MI_BAND_13M; SWMIBandPos = SW_MI_BAND_13M;
SWMIBandPosold = SWMIBandPos; SWMIBandPosold = SWMIBandPos;
@@ -1136,7 +1136,7 @@ void ToggleSWMIBand(bool plus) {
frequency_SW = frequency_AM; frequency_SW = frequency_AM;
break; break;
case SW_MI_BAND_16M: case SW_MI_BAND_16M:
if (plus) { if (frequencyup) {
SWMIBandstringold = (String) "" + SWMIBandPosold + " m"; SWMIBandstringold = (String) "" + SWMIBandPosold + " m";
SWMIBandPos = SW_MI_BAND_15M; SWMIBandPos = SW_MI_BAND_15M;
SWMIBandPosold = SWMIBandPos; SWMIBandPosold = SWMIBandPos;
@@ -1153,7 +1153,7 @@ void ToggleSWMIBand(bool plus) {
frequency_SW = frequency_AM; frequency_SW = frequency_AM;
break; break;
case SW_MI_BAND_19M: case SW_MI_BAND_19M:
if (plus) { if (frequencyup) {
SWMIBandstringold = (String) "" + SWMIBandPosold + " m"; SWMIBandstringold = (String) "" + SWMIBandPosold + " m";
SWMIBandPos = SW_MI_BAND_16M; SWMIBandPos = SW_MI_BAND_16M;
SWMIBandPosold = SWMIBandPos; SWMIBandPosold = SWMIBandPos;
@@ -1170,7 +1170,7 @@ void ToggleSWMIBand(bool plus) {
frequency_SW = frequency_AM; frequency_SW = frequency_AM;
break; break;
case SW_MI_BAND_22M: case SW_MI_BAND_22M:
if (plus) { if (frequencyup) {
SWMIBandstringold = (String) "" + SWMIBandPosold + " m"; SWMIBandstringold = (String) "" + SWMIBandPosold + " m";
SWMIBandPos = SW_MI_BAND_19M; SWMIBandPos = SW_MI_BAND_19M;
SWMIBandPosold = SWMIBandPos; SWMIBandPosold = SWMIBandPos;
@@ -1187,7 +1187,7 @@ void ToggleSWMIBand(bool plus) {
frequency_SW = frequency_AM; frequency_SW = frequency_AM;
break; break;
case SW_MI_BAND_25M: case SW_MI_BAND_25M:
if (plus) { if (frequencyup) {
SWMIBandstringold = (String) "" + SWMIBandPosold + " m"; SWMIBandstringold = (String) "" + SWMIBandPosold + " m";
SWMIBandPos = SW_MI_BAND_22M; SWMIBandPos = SW_MI_BAND_22M;
SWMIBandPosold = SWMIBandPos; SWMIBandPosold = SWMIBandPos;
@@ -1204,7 +1204,7 @@ void ToggleSWMIBand(bool plus) {
frequency_SW = frequency_AM; frequency_SW = frequency_AM;
break; break;
case SW_MI_BAND_31M: case SW_MI_BAND_31M:
if (plus) { if (frequencyup) {
SWMIBandstringold = (String) "" + SWMIBandPosold + " m"; SWMIBandstringold = (String) "" + SWMIBandPosold + " m";
SWMIBandPos = SW_MI_BAND_25M; SWMIBandPos = SW_MI_BAND_25M;
SWMIBandPosold = SWMIBandPos; SWMIBandPosold = SWMIBandPos;
@@ -1221,7 +1221,7 @@ void ToggleSWMIBand(bool plus) {
frequency_SW = frequency_AM; frequency_SW = frequency_AM;
break; break;
case SW_MI_BAND_41M: case SW_MI_BAND_41M:
if (plus) { if (frequencyup) {
SWMIBandstringold = (String) "" + SWMIBandPosold + " m"; SWMIBandstringold = (String) "" + SWMIBandPosold + " m";
SWMIBandPos = SW_MI_BAND_31M; SWMIBandPos = SW_MI_BAND_31M;
SWMIBandPosold = SWMIBandPos; SWMIBandPosold = SWMIBandPos;
@@ -1238,7 +1238,7 @@ void ToggleSWMIBand(bool plus) {
frequency_SW = frequency_AM; frequency_SW = frequency_AM;
break; break;
case SW_MI_BAND_49M: case SW_MI_BAND_49M:
if (plus) { if (frequencyup) {
SWMIBandstringold = (String) "" + SWMIBandPosold + " m"; SWMIBandstringold = (String) "" + SWMIBandPosold + " m";
SWMIBandPos = SW_MI_BAND_41M; SWMIBandPos = SW_MI_BAND_41M;
SWMIBandPosold = SWMIBandPos; SWMIBandPosold = SWMIBandPos;
@@ -1255,7 +1255,7 @@ void ToggleSWMIBand(bool plus) {
frequency_SW = frequency_AM; frequency_SW = frequency_AM;
break; break;
case SW_MI_BAND_60M: case SW_MI_BAND_60M:
if (plus) { if (frequencyup) {
SWMIBandstringold = (String) "" + SWMIBandPosold + " m"; SWMIBandstringold = (String) "" + SWMIBandPosold + " m";
SWMIBandPos = SW_MI_BAND_49M; SWMIBandPos = SW_MI_BAND_49M;
SWMIBandPosold = SWMIBandPos; SWMIBandPosold = SWMIBandPos;
@@ -1272,7 +1272,7 @@ void ToggleSWMIBand(bool plus) {
frequency_SW = frequency_AM; frequency_SW = frequency_AM;
break; break;
case SW_MI_BAND_75M: case SW_MI_BAND_75M:
if (plus) { if (frequencyup) {
SWMIBandstringold = (String) "" + SWMIBandPosold + " m"; SWMIBandstringold = (String) "" + SWMIBandPosold + " m";
SWMIBandPos = SW_MI_BAND_60M; SWMIBandPos = SW_MI_BAND_60M;
SWMIBandPosold = SWMIBandPos; SWMIBandPosold = SWMIBandPos;
@@ -1289,7 +1289,7 @@ void ToggleSWMIBand(bool plus) {
frequency_SW = frequency_AM; frequency_SW = frequency_AM;
break; break;
case SW_MI_BAND_90M: case SW_MI_BAND_90M:
if (plus) { if (frequencyup) {
SWMIBandstringold = (String) "" + SWMIBandPosold + " m"; SWMIBandstringold = (String) "" + SWMIBandPosold + " m";
SWMIBandPos = SW_MI_BAND_75M; SWMIBandPos = SW_MI_BAND_75M;
SWMIBandPosold = SWMIBandPos; SWMIBandPosold = SWMIBandPos;
@@ -1306,7 +1306,7 @@ void ToggleSWMIBand(bool plus) {
frequency_SW = frequency_AM; frequency_SW = frequency_AM;
break; break;
case SW_MI_BAND_120M: case SW_MI_BAND_120M:
if (plus) { if (frequencyup) {
SWMIBandstringold = (String) "" + SWMIBandPosold + " m"; SWMIBandstringold = (String) "" + SWMIBandPosold + " m";
SWMIBandPos = SW_MI_BAND_90M; SWMIBandPos = SW_MI_BAND_90M;
SWMIBandPosold = SWMIBandPos; SWMIBandPosold = SWMIBandPos;
@@ -1323,7 +1323,7 @@ void ToggleSWMIBand(bool plus) {
frequency_SW = frequency_AM; frequency_SW = frequency_AM;
break; break;
case SW_MI_BAND_160M: case SW_MI_BAND_160M:
if (plus) { if (frequencyup) {
SWMIBandstringold = (String) "" + SWMIBandPosold + " m"; SWMIBandstringold = (String) "" + SWMIBandPosold + " m";
SWMIBandPos = SW_MI_BAND_120M; SWMIBandPos = SW_MI_BAND_120M;
SWMIBandPosold = SWMIBandPos; SWMIBandPosold = SWMIBandPos;
@@ -2024,9 +2024,9 @@ void KeyUp() {
case TUNE_MI_BAND: case TUNE_MI_BAND:
if (showSWMIBand) { if (showSWMIBand) {
if (displayflip) { if (displayflip) {
ToggleSWMIBand(false);
} else {
ToggleSWMIBand(true); ToggleSWMIBand(true);
} else {
ToggleSWMIBand(REVERSE);
} }
} }
break; break;
@@ -2410,9 +2410,9 @@ void KeyDown() {
case TUNE_MI_BAND: case TUNE_MI_BAND:
if (showSWMIBand) { if (showSWMIBand) {
if (displayflip) { if (displayflip) {
ToggleSWMIBand(true); ToggleSWMIBand(REVERSE);
} else { } else {
ToggleSWMIBand(false); ToggleSWMIBand(true);
} }
} }
break; break;
@@ -4386,6 +4386,7 @@ void updateSWMIBand() {
case SW_MI_BAND_120M: case SW_MI_BAND_120M:
case SW_MI_BAND_160M: case SW_MI_BAND_160M:
tftReplace(-1, SWMIBandstringold, SWMIBandstring, 50, 51, PrimaryColor, PrimaryColorSmooth, FONT16); tftReplace(-1, SWMIBandstringold, SWMIBandstring, 50, 51, PrimaryColor, PrimaryColorSmooth, FONT16);
if (!SWMIBandstring.equals(SWMIBandstringold)) SWMIBandstringold = SWMIBandstring;
break; break;
case SW_MI_BAND_GAP: case SW_MI_BAND_GAP: