From e51fddaf41bec98e1fa8466bfbf0d3c7e786eb26 Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Fri, 13 Oct 2023 15:08:02 +0200 Subject: [PATCH] Added AF-REG indicator When AF method B is detected, AF-R will be shown. --- src/gui.cpp | 22 ++++++++++++---------- src/gui.h | 1 + src/rds.cpp | 35 +++++++++++++++++++++-------------- 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/src/gui.cpp b/src/gui.cpp index 68ee4aa..05377ec 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -350,6 +350,7 @@ void BuildAFScreen() { af_counterold = 254; strcpy(radioIdPrevious, ""); programServicePrevious = ""; + afmethodBold = false; for (byte i = 0; i < 11; i++) eonpsold[i] = ""; } @@ -645,15 +646,16 @@ void BuildAdvancedRDS() { } if (radio.rds.hasCT) tftPrint(1, rds_clockold, 205, 109, SecondaryColor, SecondaryColorSmooth, 16); - tftPrint(-1, "TP", 3, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "TA", 25, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "AF", 47, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "CT", 69, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "TMC", 89, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "RT+", 122, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "EON", 150, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "M", 183, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "S", 199, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(-1, "TP", 2, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(-1, "TA", 21, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(-1, "AF", 42, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(-1, "-R", 60, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(-1, "CT", 78, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(-1, "TMC", 95, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(-1, "RT+", 130, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(-1, "EON", 157, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(-1, "S", 188, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(-1, "M", 196, 51, GreyoutColor, BackgroundColor, 16); } RDSstatusold = false; @@ -693,7 +695,7 @@ void BuildAdvancedRDS() { eonstringold = ""; afstringold = ""; rtplusstringold = ""; - + afmethodBold = false; ShowMemoryPos(); } diff --git a/src/gui.h b/src/gui.h index eb572bc..fc1500d 100644 --- a/src/gui.h +++ b/src/gui.h @@ -29,6 +29,7 @@ extern byte items[8]; extern bool advancedRDS; extern bool af; +extern bool afmethodBold; extern bool afpage; extern bool afscreen; extern bool artheadold; diff --git a/src/rds.cpp b/src/rds.cpp index a5f8afb..2cfb53c 100644 --- a/src/rds.cpp +++ b/src/rds.cpp @@ -85,7 +85,7 @@ void ShowAdvancedRDS() { if (radio.rds.hasAF) for (byte i = 0; i < radio.af_counter; i++) afstring += String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10) + (i == radio.af_counter - 1 ? " " : " | "); else afstring = myLanguage[language][87]; if (hasafold != radio.rds.hasAF) { if (!screenmute) { - if (radio.rds.hasAF) tftPrint(-1, "AF", 47, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "AF", 47, 51, GreyoutColor, BackgroundColor, 16); + if (radio.rds.hasAF) tftPrint(-1, "AF", 42, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "AF", 42, 51, GreyoutColor, BackgroundColor, 16); } hasafold = radio.rds.hasAF; } @@ -123,7 +123,7 @@ void ShowAdvancedRDS() { if (radio.rds.hasEON) for (byte i = 0; i < radio.eon_counter; i++) eonstring += String(radio.eon[i].picode) + (radio.eon[i].ps.length() > 0 ? String(": " + String(radio.eon[i].ps)) : "") + (radio.eon[i].mappedfreq > 0 ? String(" " + String(radio.eon[i].mappedfreq / 100) + "." + String((radio.eon[i].mappedfreq % 100) / 10)) : "") + (radio.eon[i].mappedfreq2 > 0 ? String(" / " + String(radio.eon[i].mappedfreq2 / 100) + "." + String((radio.eon[i].mappedfreq2 % 100) / 10)) : "") + (radio.eon[i].mappedfreq3 > 0 ? String(" / " + String(radio.eon[i].mappedfreq3 / 100) + "." + String((radio.eon[i].mappedfreq3 % 100) / 10)) : "") + (i == radio.eon_counter - 1 ? " " : " | "); else eonstring = myLanguage[language][88]; if (haseonold != radio.rds.hasEON) { if (!screenmute) { - if (radio.rds.hasEON) tftPrint(-1, "EON", 150, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "EON", 150, 51, GreyoutColor, BackgroundColor, 16); + if (radio.rds.hasEON) tftPrint(-1, "EON", 157, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "EON", 157, 51, GreyoutColor, BackgroundColor, 16); } haseonold = radio.rds.hasEON; } @@ -160,7 +160,7 @@ void ShowAdvancedRDS() { if (radio.rds.hasRDSplus) rtplusstring = (radio.rds.rdsplusTag1 != 169 ? String(myLanguage[language][radio.rds.rdsplusTag1]) + ": " + String(radio.rds.RTContent1) : "") + (radio.rds.rdsplusTag2 != 169 ? " - " + String(myLanguage[language][radio.rds.rdsplusTag2]) + ": " + String(radio.rds.RTContent2) : "") + " "; else rtplusstring = myLanguage[language][89]; if (hasrtplusold != radio.rds.hasRDSplus) { if (!screenmute) { - if (radio.rds.hasRDSplus) tftPrint(-1, "RT+", 122, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "RT+", 122, 51, GreyoutColor, BackgroundColor, 16); + if (radio.rds.hasRDSplus) tftPrint(-1, "RT+", 130, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "RT+", 130, 51, GreyoutColor, BackgroundColor, 16); } hasrtplusold = radio.rds.hasRDSplus; } @@ -195,34 +195,41 @@ void ShowAdvancedRDS() { if (TPold != radio.rds.hasTP) { if (!screenmute) { - if (radio.rds.hasTP) tftPrint(-1, "TP", 3, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "TP", 3, 51, GreyoutColor, BackgroundColor, 16); + if (radio.rds.hasTP) tftPrint(-1, "TP", 2, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "TP", 2, 51, GreyoutColor, BackgroundColor, 16); } TPold = radio.rds.hasTP; } if (TAold != radio.rds.hasTA) { if (!screenmute) { - if (radio.rds.hasTA) tftPrint(-1, "TA", 25, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "TA", 25, 51, GreyoutColor, BackgroundColor, 16); + if (radio.rds.hasTA) tftPrint(-1, "TA", 21, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "TA", 21, 51, GreyoutColor, BackgroundColor, 16); } TAold = radio.rds.hasTA; } + if (afmethodBold != radio.afmethodB || rdsreset) { + if (!screenmute) { + if (radio.afmethodB) tftPrint(-1, "-R", 60, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "-R", 60, 51, GreyoutColor, BackgroundColor, 16); + } + afmethodBold = radio.afmethodB; + } + if (MSold != radio.rds.MS) { if (!screenmute) { switch (radio.rds.MS) { case 0: - tftPrint(-1, "M", 183, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "S", 199, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(-1, "M", 196, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(-1, "S", 188, 51, GreyoutColor, BackgroundColor, 16); break; case 1: - tftPrint(-1, "M", 183, 51, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(-1, "S", 199, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(-1, "M", 196, 51, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(-1, "S", 188, 51, GreyoutColor, BackgroundColor, 16); break; case 2: - tftPrint(-1, "M", 183, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "S", 199, 51, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(-1, "M", 196, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(-1, "S", 188, 51, PrimaryColor, PrimaryColorSmooth, 16); break; } } @@ -234,10 +241,10 @@ void ShowAdvancedRDS() { if (!screenmute) { if (radio.rds.hasCT) { tftReplace(1, rds_clockold, rds_clock, 205, 109, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(-1, "CT", 69, 51, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(-1, "CT", 78, 51, PrimaryColor, PrimaryColorSmooth, 16); } else { tftPrint(1, rds_clock, 205, 109, BackgroundColor, BackgroundColor, 16); - tftPrint(-1, "CT", 69, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(-1, "CT", 78, 51, GreyoutColor, BackgroundColor, 16); } } rds_clockold = rds_clock; @@ -251,7 +258,7 @@ void ShowAdvancedRDS() { if (hastmcold != radio.rds.hasTMC) { if (!screenmute) { - if (radio.rds.hasTMC) tftPrint(-1, "TMC", 89, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "TMC", 89, 51, GreyoutColor, BackgroundColor, 16); + if (radio.rds.hasTMC) tftPrint(-1, "TMC", 95, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "TMC", 95, 51, GreyoutColor, BackgroundColor, 16); } hastmcold = radio.rds.hasTMC; }