diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index 6d2ca3a..90eefef 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -140,8 +140,7 @@ byte licold; byte memoryband[EE_PRESETS_CNT]; byte memorypos; byte memoryposold; -byte menupage = 1; -byte menupagestotal = 5; +byte menupage = PAGE1; byte MSold; byte optenc; byte poweroptions; @@ -192,7 +191,7 @@ int FrequencyColor; int GreyoutColor; int InsignificantColor; int InsignificantColorSmooth; -int menuoption = 30; +int menuoption = ITEM1; int MStatusold; int offsetupdatetimer; int OStatusold; @@ -776,7 +775,7 @@ void loop() { } } - if (menu == true && menuopen == true && menupage == 1 && menuoption == 110) { + if (menu == true && menuopen == true && menupage == PAGE1 && menuoption == ITEM5) { if (band < BAND_GAP) radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus, SNR); else radio.getStatusAM(SStatus, USN, WAM, OStatus, BW, MStatus, SNR); if (millis() >= lowsignaltimer + 500 || change2 == true) { lowsignaltimer = millis(); diff --git a/src/gui.cpp b/src/gui.cpp index 6e5dfe8..eab22bf 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -355,7 +355,7 @@ void BuildMenu() { tft.drawRect(0, 0, 320, 240, FrameColor); tft.drawLine(0, 23, 320, 23, FrameColor); tftPrint(-1, myLanguage[language][41], 4, 7, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(1, String(menupage) + "/" + String(menupagestotal), 314, 7, ActiveColor, ActiveColorSmooth, 16); + tftPrint(1, String(menupage) + "/" + String(PAGE_COUNT), 314, 7, ActiveColor, ActiveColorSmooth, 16); tft.drawRoundRect(3, menuoption + 3, 315, 21, 5, ActiveColor); switch (menupage) { case PAGE1: @@ -478,11 +478,11 @@ void BuildMenu() { break; case PAGE5: - tftPrint(-1, myLanguage[language][108], 8, 36, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, myLanguage[language][173], 8, 56, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, myLanguage[language][176], 8, 76, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, myLanguage[language][185], 8, 96, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, myLanguage[language][187], 8, 116, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, myLanguage[language][108], 8, ITEM1 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, myLanguage[language][173], 8, ITEM2 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, myLanguage[language][176], 8, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, myLanguage[language][185], 8, ITEM4 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, myLanguage[language][187], 8, ITEM5 + 6, ActiveColor, ActiveColorSmooth, 16); if (amcodect != 0) tftPrint(1, "%", 310, 96, ActiveColor, ActiveColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, 96, ActiveColor, ActiveColorSmooth, 16); switch (hardwaremodel) { @@ -754,19 +754,19 @@ void MenuUp() { if (menuopen == false) { tft.drawRoundRect(3, menuoption + 3, 315, 21, 5, BackgroundColor); if (hardwaremodel == BASE_ILI9341) { - menuoption += 20; - if (menuoption > 210) { + menuoption += ITEM_GAP; + if (menuoption > ITEM10) { menupage++; - if (menupage > menupagestotal) menupage = 1; - menuoption = 30; + if (menupage > PAGE_COUNT) menupage = PAGE1; + menuoption = ITEM1; BuildMenu(); } } else { - menuoption -= 20; - if (menuoption < 30) { + menuoption -= ITEM_GAP; + if (menuoption < ITEM1) { menupage--; - if (menupage == 0) menupage = menupagestotal; - menuoption = 210; + if (menupage == PAGE1 - 1) menupage = PAGE_COUNT; + menuoption = ITEM10; BuildMenu(); } } @@ -1175,19 +1175,19 @@ void MenuDown() { if (menuopen == false) { tft.drawRoundRect(3, menuoption + 3, 315, 21, 5, BackgroundColor); if (hardwaremodel == BASE_ILI9341) { - menuoption -= 20; - if (menuoption < 30) { + menuoption -= ITEM_GAP; + if (menuoption < ITEM1) { menupage--; - if (menupage == 0) menupage = menupagestotal; - menuoption = 210; + if (menupage == PAGE1 - 1) menupage = PAGE_COUNT; + menuoption = ITEM10; BuildMenu(); } } else { - menuoption += 20; - if (menuoption > 210) { + menuoption += ITEM_GAP; + if (menuoption > ITEM10) { menupage++; - if (menupage > menupagestotal) menupage = 1; - menuoption = 30; + if (menupage > PAGE_COUNT) menupage = PAGE1; + menuoption = ITEM1; BuildMenu(); } } @@ -1904,11 +1904,11 @@ void DoMenu() { } } else { - if (menupage == 2 && menuoption == 190 && wifi == true) { + if (menupage == PAGE2 && menuoption == ITEM9 && wifi == true) { tryWiFi(); delay(2000); } - if (menupage == 2 && menuoption == 30) { + if (menupage == PAGE2 && menuoption == ITEM1) { doTheme(); } menuopen = false; diff --git a/src/gui.h b/src/gui.h index a41a33e..e93b9f1 100644 --- a/src/gui.h +++ b/src/gui.h @@ -10,6 +10,7 @@ #define SMETERPIN 27 #define CONTRASTPIN 2 +#define ITEM_GAP 20 #define ITEM1 30 #define ITEM2 50 #define ITEM3 70 @@ -21,6 +22,7 @@ #define ITEM9 190 #define ITEM10 210 +#define PAGE_COUNT 5 #define PAGE1 1 #define PAGE2 2 #define PAGE3 3 @@ -85,7 +87,6 @@ extern byte HighCutOffset; extern byte language; extern byte licold; extern byte menupage; -extern byte menupagestotal; extern byte MSold; extern byte poweroptions; extern byte poweroptionsold;