From 28b36f242ff152d7ccaec2c73b497cfae12a966b Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Mon, 6 Jan 2025 22:07:28 +0100 Subject: [PATCH] Fixed a bug in PS viewer --- src/rds.cpp | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/src/rds.cpp b/src/rds.cpp index 6e9fbce..f1ac66b 100644 --- a/src/rds.cpp +++ b/src/rds.cpp @@ -5,25 +5,9 @@ #include "constants.h" #include -bool rtABold; -int RadiotextWidth; -int PSLongWidth; -int AIDWidth; -int afstringWidth; -int eonstringWidth; -int rtplusstringWidth; -int length1, length2, length3, length4, length5, length6, length7; - -String afstringold; -String eonstringold; -String rtplusstringold; -String stationNameLongOld; -String AIDStringold; - -bool ps12errorold; -bool ps34errorold; -bool ps56errorold; -bool ps78errorold; +int RadiotextWidth, PSLongWidth, AIDWidth, afstringWidth, eonstringWidth, rtplusstringWidth, length1, length2, length3, length4, length5, length6, length7; +String afstringold, eonstringold, rtplusstringold, stationNameLongOld, AIDStringold; +bool rtABold, ps12errorold, ps34errorold, ps56errorold, ps78errorold; void ShowAdvancedRDS() { if (!dropout) { @@ -691,7 +675,7 @@ void showPTY() { } void showPS() { - if (radio.rds.stationName != PSold || (RDSstatus && (!radio.rds.hasLongPS && showlongps) && !(ps12errorold == radio.rds.ps12error || ps34errorold == radio.rds.ps34error || ps56errorold == radio.rds.ps56error || ps78errorold == radio.rds.ps78error)) || (radio.rds.hasLongPS && showlongps)) { + if ((RDSstatus && (radio.rds.stationName != PSold)) || (RDSstatus && !(ps12errorold == radio.rds.ps12error || ps34errorold == radio.rds.ps34error || ps56errorold == radio.rds.ps56error || ps78errorold == radio.rds.ps78error)) || (radio.rds.hasLongPS && showlongps)) { if (afscreen) { if (!screenmute) tftReplace(0, PSold, radio.rds.stationName, 160, 201, BWAutoColor, BWAutoColorSmooth, BackgroundColor, 16); } else { @@ -737,14 +721,10 @@ void showPS() { length6 = PSSprite.textWidth(radio.rds.stationName.substring(5, 6)) + length5; length7 = PSSprite.textWidth(radio.rds.stationName.substring(6, 7)) + length6; - if (PSold.substring(0, 2) != radio.rds.stationName.substring(0, 2)) ps12errorold = true; - if (PSold.substring(2, 4) != radio.rds.stationName.substring(2, 4)) ps34errorold = true; - if (PSold.substring(4, 6) != radio.rds.stationName.substring(4, 6)) ps56errorold = true; - if (PSold.substring(6, 8) != radio.rds.stationName.substring(6, 8)) ps78errorold = true; - if (ps12errorold && PSold.substring(0, 2) != radio.rds.stationName.substring(0, 2)) ps12errorold = radio.rds.ps12error; - if (ps34errorold && PSold.substring(2, 4) != radio.rds.stationName.substring(2, 4)) ps34errorold = radio.rds.ps34error; - if (ps56errorold && PSold.substring(4, 6) != radio.rds.stationName.substring(4, 6)) ps56errorold = radio.rds.ps56error; - if (ps78errorold && PSold.substring(6, 8) != radio.rds.stationName.substring(6, 8)) ps78errorold = radio.rds.ps78error; + if (ps12errorold) ps12errorold = radio.rds.ps12error; + if (ps34errorold) ps34errorold = radio.rds.ps34error; + if (ps56errorold) ps56errorold = radio.rds.ps56error; + if (ps78errorold) ps78errorold = radio.rds.ps78error; if (!RDSstatus || band > BAND_GAP) { PSSprite.setTextColor(RDSDropoutColor, RDSDropoutColorSmooth, false); @@ -762,6 +742,12 @@ void showPS() { PSSprite.drawString(radio.rds.stationName.substring(6, 7), length6, 2); PSSprite.drawString(radio.rds.stationName.substring(7, 8), length7, 2); } + if (PSold != radio.rds.stationName) { + ps12errorold = true; + ps34errorold = true; + ps56errorold = true; + ps78errorold = true; + } } if (!screenmute) { if (advancedRDS) {