Merge pull request #237 from ohmytime/Code_formatting

Code formatting
This commit is contained in:
kevin
2023-08-09 15:51:46 +08:00
committed by GitHub
3 changed files with 29 additions and 29 deletions
+3 -4
View File
@@ -140,8 +140,7 @@ byte licold;
byte memoryband[EE_PRESETS_CNT]; byte memoryband[EE_PRESETS_CNT];
byte memorypos; byte memorypos;
byte memoryposold; byte memoryposold;
byte menupage = 1; byte menupage = PAGE1;
byte menupagestotal = 5;
byte MSold; byte MSold;
byte optenc; byte optenc;
byte poweroptions; byte poweroptions;
@@ -192,7 +191,7 @@ int FrequencyColor;
int GreyoutColor; int GreyoutColor;
int InsignificantColor; int InsignificantColor;
int InsignificantColorSmooth; int InsignificantColorSmooth;
int menuoption = 30; int menuoption = ITEM1;
int MStatusold; int MStatusold;
int offsetupdatetimer; int offsetupdatetimer;
int OStatusold; 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 (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) { if (millis() >= lowsignaltimer + 500 || change2 == true) {
lowsignaltimer = millis(); lowsignaltimer = millis();
+24 -24
View File
@@ -355,7 +355,7 @@ void BuildMenu() {
tft.drawRect(0, 0, 320, 240, FrameColor); tft.drawRect(0, 0, 320, 240, FrameColor);
tft.drawLine(0, 23, 320, 23, FrameColor); tft.drawLine(0, 23, 320, 23, FrameColor);
tftPrint(-1, myLanguage[language][41], 4, 7, PrimaryColor, PrimaryColorSmooth, 16); 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); tft.drawRoundRect(3, menuoption + 3, 315, 21, 5, ActiveColor);
switch (menupage) { switch (menupage) {
case PAGE1: case PAGE1:
@@ -478,11 +478,11 @@ void BuildMenu() {
break; break;
case PAGE5: case PAGE5:
tftPrint(-1, myLanguage[language][108], 8, 36, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][108], 8, ITEM1 + 6, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, myLanguage[language][173], 8, 56, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][173], 8, ITEM2 + 6, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, myLanguage[language][176], 8, 76, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][176], 8, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, myLanguage[language][185], 8, 96, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][185], 8, ITEM4 + 6, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, myLanguage[language][187], 8, 116, 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); if (amcodect != 0) tftPrint(1, "%", 310, 96, ActiveColor, ActiveColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, 96, ActiveColor, ActiveColorSmooth, 16);
switch (hardwaremodel) { switch (hardwaremodel) {
@@ -754,19 +754,19 @@ void MenuUp() {
if (menuopen == false) { if (menuopen == false) {
tft.drawRoundRect(3, menuoption + 3, 315, 21, 5, BackgroundColor); tft.drawRoundRect(3, menuoption + 3, 315, 21, 5, BackgroundColor);
if (hardwaremodel == BASE_ILI9341) { if (hardwaremodel == BASE_ILI9341) {
menuoption += 20; menuoption += ITEM_GAP;
if (menuoption > 210) { if (menuoption > ITEM10) {
menupage++; menupage++;
if (menupage > menupagestotal) menupage = 1; if (menupage > PAGE_COUNT) menupage = PAGE1;
menuoption = 30; menuoption = ITEM1;
BuildMenu(); BuildMenu();
} }
} else { } else {
menuoption -= 20; menuoption -= ITEM_GAP;
if (menuoption < 30) { if (menuoption < ITEM1) {
menupage--; menupage--;
if (menupage == 0) menupage = menupagestotal; if (menupage == PAGE1 - 1) menupage = PAGE_COUNT;
menuoption = 210; menuoption = ITEM10;
BuildMenu(); BuildMenu();
} }
} }
@@ -1175,19 +1175,19 @@ void MenuDown() {
if (menuopen == false) { if (menuopen == false) {
tft.drawRoundRect(3, menuoption + 3, 315, 21, 5, BackgroundColor); tft.drawRoundRect(3, menuoption + 3, 315, 21, 5, BackgroundColor);
if (hardwaremodel == BASE_ILI9341) { if (hardwaremodel == BASE_ILI9341) {
menuoption -= 20; menuoption -= ITEM_GAP;
if (menuoption < 30) { if (menuoption < ITEM1) {
menupage--; menupage--;
if (menupage == 0) menupage = menupagestotal; if (menupage == PAGE1 - 1) menupage = PAGE_COUNT;
menuoption = 210; menuoption = ITEM10;
BuildMenu(); BuildMenu();
} }
} else { } else {
menuoption += 20; menuoption += ITEM_GAP;
if (menuoption > 210) { if (menuoption > ITEM10) {
menupage++; menupage++;
if (menupage > menupagestotal) menupage = 1; if (menupage > PAGE_COUNT) menupage = PAGE1;
menuoption = 30; menuoption = ITEM1;
BuildMenu(); BuildMenu();
} }
} }
@@ -1904,11 +1904,11 @@ void DoMenu() {
} }
} else { } else {
if (menupage == 2 && menuoption == 190 && wifi == true) { if (menupage == PAGE2 && menuoption == ITEM9 && wifi == true) {
tryWiFi(); tryWiFi();
delay(2000); delay(2000);
} }
if (menupage == 2 && menuoption == 30) { if (menupage == PAGE2 && menuoption == ITEM1) {
doTheme(); doTheme();
} }
menuopen = false; menuopen = false;
+2 -1
View File
@@ -10,6 +10,7 @@
#define SMETERPIN 27 #define SMETERPIN 27
#define CONTRASTPIN 2 #define CONTRASTPIN 2
#define ITEM_GAP 20
#define ITEM1 30 #define ITEM1 30
#define ITEM2 50 #define ITEM2 50
#define ITEM3 70 #define ITEM3 70
@@ -21,6 +22,7 @@
#define ITEM9 190 #define ITEM9 190
#define ITEM10 210 #define ITEM10 210
#define PAGE_COUNT 5
#define PAGE1 1 #define PAGE1 1
#define PAGE2 2 #define PAGE2 2
#define PAGE3 3 #define PAGE3 3
@@ -85,7 +87,6 @@ extern byte HighCutOffset;
extern byte language; extern byte language;
extern byte licold; extern byte licold;
extern byte menupage; extern byte menupage;
extern byte menupagestotal;
extern byte MSold; extern byte MSold;
extern byte poweroptions; extern byte poweroptions;
extern byte poweroptionsold; extern byte poweroptionsold;