Merge pull request #789 from MCelliotG/main

GUI optimizations
This commit is contained in:
Sjef Verhoeven PE5PVB
2025-02-11 10:16:27 +01:00
committed by GitHub
3 changed files with 79 additions and 61 deletions
+21 -23
View File
@@ -1232,11 +1232,11 @@ void loop() {
if ((SStatus / 10 > LowLevelSet) && !LowLevelInit && !BWtune && !menu && band < BAND_GAP) {
if (!screenmute && !advancedRDS && !afscreen) {
if (showmodulation) {
tftPrint(-1, "10", 27, 144, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "30", 57, 144, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "50", 87, 144, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "70", 117, 144, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "100", 164, 144, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "10", 24, 144, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "30", 54, 144, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "50", 84, 144, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "70", 114, 144, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "100", 160, 144, ActiveColor, ActiveColorSmooth, 16);
tftPrint(0, "M", 7, 128, ActiveColor, ActiveColorSmooth, 16);
for (byte segments = 0; segments < 94; segments++) {
if (segments > 54) {
@@ -1270,11 +1270,11 @@ void loop() {
}
}
if (showmodulation) {
tftPrint(-1, "10", 27, 144, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "30", 57, 144, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "50", 87, 144, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "70", 117, 144, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "100", 164, 144, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "10", 24, 144, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "30", 54, 144, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "50", 84, 144, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "70", 114, 144, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "100", 160, 144, GreyoutColor, BackgroundColor, 16);
tftPrint(0, "M", 7, 128, GreyoutColor, BackgroundColor, 16);
tft.fillRect(16, 133, 187, 6, GreyoutColor);
}
@@ -3330,12 +3330,12 @@ void ShowSignalLevel() {
SNRupdatetimer = millis();
if (!advancedRDS) {
if (CN > (CNold + 1) || CN < (CNold - 1)) {
if (CNold == 0) tftPrint(1, "--", 236, 163, BackgroundColor, BackgroundColor, 16); else tftPrint(1, String(CNold), 236, 163, BackgroundColor, BackgroundColor, 16);
if (CNold == 0) tftPrint(1, "--", 234, 165, BackgroundColor, BackgroundColor, 16); else tftPrint(1, String(CNold), 234, 165, BackgroundColor, BackgroundColor, 16);
if (tuned) {
if (CN == 0) tftPrint(1, "--", 236, 163, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, String(CN), 236, 163, PrimaryColor, PrimaryColorSmooth, 16);
if (CN == 0) tftPrint(1, "--", 234, 165, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, String(CN), 234, 165, PrimaryColor, PrimaryColorSmooth, 16);
CNold = CN;
} else {
tftPrint(1, "--", 236, 163, PrimaryColor, PrimaryColorSmooth, 16);
tftPrint(1, "--", 234, 165, PrimaryColor, PrimaryColorSmooth, 16);
CNold = 0;
}
}
@@ -3343,7 +3343,8 @@ void ShowSignalLevel() {
MPprint = constrain(map(MP, 0, 1000, 0, 99), 0, 99);
if (MPprint != MPold) {
tftReplace(1, String(MPold), (band < BAND_GAP ? String(MPprint) : "--"), 299, 163, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 16);
tftReplace(1, String(MPold), (band < BAND_GAP ? String(MPprint) : "--"), 299, 165, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 16);
tftPrint(1, "%", 316, 165, PrimaryColor, PrimaryColorSmooth, 16);
MPold = MPprint;
}
@@ -3351,7 +3352,8 @@ void ShowSignalLevel() {
USprint = constrain(map(US, 0, 1000, 0, 99), 0, 99);
if (USprint != USold) {
tftReplace(1, String(USold), (band < BAND_GAP ? String(USprint) : "--"), 299, 145, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 16);
tftReplace(1, String(USold), (band < BAND_GAP ? String(USprint) : "--"), 299, 147, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 16);
tftPrint(1, "%", 316, 147, PrimaryColor, PrimaryColorSmooth, 16);
USold = USprint;
}
}
@@ -3677,15 +3679,11 @@ void ShowModLevel() {
}
void showAutoSquelch(bool mode) {
if (language == LANGUAGE_CHS) SquelchSprite.loadFont(FONT16_CHS); else SquelchSprite.loadFont(FONT16);
if (mode) {
SquelchSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
tft.drawBitmap(223, 145, AutoSQ, 18, 18, PrimaryColor);
} else {
SquelchSprite.setTextColor(BackgroundColor, BackgroundColor, false);
tft.drawBitmap(223, 145, AutoSQ, 18, 18, BackgroundColor);
}
SquelchSprite.fillSprite(BackgroundColor);
SquelchSprite.drawString("A.", 0, 0);
SquelchSprite.pushSprite(223, 145);
}
void doSquelch() {
@@ -3749,7 +3747,7 @@ void doSquelch() {
} else {
SquelchSprite.drawString(String(SquelchShow), 0, 0);
}
SquelchSprite.pushSprite(223, 145);
SquelchSprite.pushSprite(223, 147);
Squelchold = Squelch;
}
}
@@ -3799,7 +3797,7 @@ void doSquelch() {
SquelchSprite.drawString(String(SquelchShow), 0, 0);
}
if (Squelch != Squelchold) {
SquelchSprite.pushSprite(223, 145);
SquelchSprite.pushSprite(223, 147);
}
Squelchold = Squelch;
}
+21
View File
@@ -467,6 +467,27 @@ static const uint8_t TEFLogo[] PROGMEM = {
0x01, 0xfc, 0x00, 0x7f, 0xff, 0x3f, 0x80, 0x00
};
static const uint8_t AutoSQ[] PROGMEM = {
0x03, 0xf0, 0x00,
0x0f, 0xfc, 0x00,
0x1f, 0x3e, 0x00,
0x38, 0x07, 0x00,
0xf0, 0xc3, 0x80,
0xe1, 0xc1, 0x80,
0xf1, 0xe1, 0xc0,
0xf3, 0x60, 0xc0,
0x03, 0x30, 0x00,
0x03, 0xf0, 0x00,
0x47, 0xf3, 0x80,
0xe6, 0x1b, 0xc0,
0x64, 0x19, 0xc0,
0x70, 0x03, 0xc0,
0x38, 0x07, 0x40,
0x1e, 0x1e, 0x00,
0x0f, 0xfc, 0x00,
0x03, 0xf0, 0x00
};
static const uint8_t RDSLogo[] PROGMEM = {
0x01, 0xf8, 0x0f, 0xe0, 0x00,
0x07, 0x80, 0x30, 0x18, 0x00,
+37 -38
View File
@@ -2854,19 +2854,18 @@ void BuildAdvancedRDS() {
tft.drawLine(0, 68, 320, 68, FrameColor);
tft.drawLine(0, 104, 320, 104, FrameColor);
tft.drawLine(0, 126, 320, 126, FrameColor);
tft.drawLine(105, 30, 105, 0, FrameColor);
tft.drawLine(210, 30, 210, 240, FrameColor);
tft.drawLine(30, 30, 30, 0, FrameColor);
tft.drawLine(66, 30, 66, 0, FrameColor);
tft.drawLine(105, 30, 105, 0, FrameColor);
tft.drawLine(162, 30, 162, 0, FrameColor);
tft.drawLine(248, 30, 248, 0, FrameColor);
tft.drawLine(0, 140, 210, 140, FrameColor);
tft.drawLine(0, 166, 210, 166, FrameColor);
tft.drawLine(0, 193, 210, 193, FrameColor);
tft.drawLine(210, 191, 320, 191, FrameColor);
tft.drawLine(0, 217, 210, 217, FrameColor);
tft.drawRect(0, 0, 320, 240, FrameColor);
tft.drawLine(30, 30, 30, 0, FrameColor);
tft.drawLine(66, 30, 66, 0, FrameColor);
tft.drawLine(105, 30, 105, 0, FrameColor);
tft.drawLine(105, 30, 105, 0, FrameColor);
tft.drawLine(162, 30, 162, 0, FrameColor);
tft.drawLine(210, 30, 210, 240, FrameColor);
tft.drawLine(210, 191, 320, 191, FrameColor);
tft.drawLine(248, 30, 248, 0, FrameColor);
tftPrint(-1, "ERRORS", 3, 34, ActiveColor, ActiveColorSmooth, 16);
tftPrint(1, "MHz", 310, 35, ActiveColor, ActiveColorSmooth, 16);
@@ -2981,17 +2980,19 @@ void BuildDisplay() {
tft.drawRect(0, 0, 320, 240, FrameColor);
tft.drawLine(0, 30, 320, 30, FrameColor);
tft.drawLine(0, 100, 320, 100, FrameColor);
tft.drawLine(105, 30, 105, 0, FrameColor);
tft.drawLine(210, 180, 210, 217, FrameColor);
tft.drawLine(195, 100, 195, 180, FrameColor);
tft.drawLine(248, 30, 248, 0, FrameColor);
tft.drawLine(0, 160, 195, 160, FrameColor);
tft.drawLine(0, 180, 320, 180, FrameColor);
tft.drawLine(0, 217, 320, 217, FrameColor);
tft.drawLine(16, 114, 189, 114, ActiveColor);
tft.drawLine(30, 30, 30, 0, FrameColor);
tft.drawLine(66, 30, 66, 0, FrameColor);
tft.drawLine(105, 30, 105, 0, FrameColor);
tft.drawLine(162, 30, 162, 0, FrameColor);
tft.drawLine(16, 114, 189, 114, ActiveColor);
tft.drawLine(195, 100, 195, 180, FrameColor);
tft.drawLine(195, 144, 320, 144, FrameColor);
tft.drawLine(210, 180, 210, 217, FrameColor);
tft.drawLine(257, 144, 257, 180, FrameColor);
tft.drawLine(248, 30, 248, 0, FrameColor);
if (!showmodulation) tft.drawLine(16, 143, 189, 143, GreyoutColor); else tft.drawLine(16, 143, 189, 143, ActiveColor);
@@ -3009,37 +3010,35 @@ void BuildDisplay() {
}
}
if (usesquelch || autosquelch) tftPrint(-1, "SQ:", 200, 145, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "US:", 261, 145, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "MP:", 261, 163, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "CN:", 200, 163, ActiveColor, ActiveColorSmooth, 16);
tftPrint(1, "dB", 257, 163, ActiveColor, ActiveColorSmooth, 16);
tftPrint(1, "%", 316, 163, ActiveColor, ActiveColorSmooth, 16);
tftPrint(1, "%", 316, 145, ActiveColor, ActiveColorSmooth, 16);
if (usesquelch || autosquelch) tftPrint(-1, "SQ:", 197, 147, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "US:", 259, 147, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "MP:", 259, 165, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "CN:", 197, 165, ActiveColor, ActiveColorSmooth, 16);
tftPrint(1, "dB", 255, 165, ActiveColor, ActiveColorSmooth, 16);
tftPrint(0, "S", 7, 101, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "1", 24, 115, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "3", 48, 115, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "5", 72, 115, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "7", 96, 115, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "9", 120, 115, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "+10", 134, 115, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "+30", 168, 115, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "1", 21, 115, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "3", 41, 115, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "5", 61, 115, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "7", 81, 115, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "9", 101, 115, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "+10", 127, 115, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "+30", 160, 115, ActiveColor, ActiveColorSmooth, 16);
if (!showmodulation) {
tftPrint(0, "M", 7, 128, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "10", 27, 144, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "30", 57, 144, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "50", 87, 144, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "70", 117, 144, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "100", 164, 144, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "10", 24, 144, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "30", 54, 144, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "50", 84, 144, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "70", 114, 144, GreyoutColor, BackgroundColor, 16);
tftPrint(-1, "100", 160, 144, GreyoutColor, BackgroundColor, 16);
} else {
tftPrint(0, "M", 7, 128, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "10", 27, 144, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "30", 57, 144, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "50", 87, 144, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "70", 117, 144, ActiveColor, BackgroundColor, 16);
tftPrint(-1, "100", 164, 144, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "10", 24, 144, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "30", 54, 144, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "50", 84, 144, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "70", 114, 144, ActiveColor, BackgroundColor, 16);
tftPrint(-1, "100", 160, 144, ActiveColor, ActiveColorSmooth, 16);
}
tftPrint(1, "kHz", 246, 4, ActiveColor, ActiveColorSmooth, 28);