that's it for today

This commit is contained in:
2026-02-17 23:16:46 +01:00
parent 140f88d371
commit 9cf4593517
15 changed files with 3761 additions and 3762 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
#include "globals.h" #include "globals.h"
#include "nonvolatile.h" #include "nonvolatile.h"
#include <Hash.h> #include <Hash.h>
#include "main.h" #include "core.h"
void Communication(); void Communication();
void XDRGTKRoutine(); void XDRGTKRoutine();
+34
View File
@@ -0,0 +1,34 @@
#pragma once
#include <stdint.h>
#include <Arduino.h>
void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, uint8_t fontsize);
void tftPrint16(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, bool force_font = true, bool font = false);
void tftReplace(int8_t offset, const String & textold, const String & text, int16_t x, int16_t y, int color, int smoothcolor, int background, uint8_t fontsize);
void tftReplace16(int8_t offset, const String & textold, const String & text, int16_t x, int16_t y, int color, int smoothcolor, int background, bool force_font = true, bool font = false);
const char* textUI(uint16_t number);
uint8_t doAutoMemory(uint16_t startfreq, uint16_t stopfreq, uint8_t startmem, uint8_t stopmem, bool rdsonly, uint8_t doublepi);
void showAutoSquelch(bool mode);
void UpdateFonts();
void setAutoSpeedSPI();
void DoMemoryPosTune();
void startFMDXScan();
void endMenu();
void TuneUp();
void ShowStepSize();
void ShowFreq(int mode);
void ShowMemoryPos();
void TuneDown();
void ShowTuneMode();
void SelectBand();
void doBW();
void ModeButtonPress();
void updateEQ();
void updateiMS();
void Seek(bool mode);
void MuteScreen(bool setting);
void cancelDXScan();
void doStereoToggle();
void updateBW();
void ShowRDSLogo(bool RDSstatus);
void DataPrint(String string);
+3 -3
View File
@@ -3,13 +3,13 @@
#include "globals.h" #include "globals.h"
#include "utils.h" #include "utils.h"
#include "menugraphics.h" #include "menugraphics.h"
#include "main.h" #include "core.h"
static const char* const unitString[] = {"dBμV", "dBf", "dBm"}; static const char* const unitString[] = {"dBμV", "dBf", "dBm"};
static const char* const FreqFont[] = {"Classic", "Roubenstil", "Motoya", "Aura2", "Comic", "Modern"}; static const char* const FreqFont[] = {"Classic", "Roubenstil", "Motoya", "Aura2", "Comic", "Modern"};
static const char* const Theme[] = {"Essence", "Cyan", "Crimson", "Monochrome", "Volcano", "Dendro", "Sakura", "Whiteout", "Tangerine", "Ocean", "Indigo", "Queer", "GoldBrite", "Bubblegum"}; static const char* const Theme[] = {"Essence", "Cyan", "Crimson", "Monochrome", "Volcano", "Dendro", "Sakura", "Whiteout", "Tangerine", "Ocean", "Indigo", "Queer", "GoldBrite", "Bubblegum"};
static const char* BWButtonLabelsFM[] = {"56 kHz", "64 kHz", "72 kHz", "84 kHz", "97 kHz", "114 kHz", "133 kHz", "151 kHz", "168 kHz", "184 kHz", "200 kHz", "217 kHz", "236 kHz", "254 kHz", "287 kHz", "311 kHz", "Auto", "iMS", "EQ"}; extern const char* BWButtonLabelsFM[];
static const char* BWButtonLabelsAM[] = {"3 kHz", "4 kHz", "6 kHz", "8 kHz"}; extern const char* BWButtonLabelsAM[];
void BuildAFScreen(); void BuildAFScreen();
void BuildRDSStatScreen(); void BuildRDSStatScreen();
+1 -1
View File
@@ -6,7 +6,7 @@ using fs::FS;
#include <SPIFFS.h> #include <SPIFFS.h>
#include "globals.h" #include "globals.h"
#include "rtc.hpp" #include "rtc.hpp"
#include "main.h" #include "core.h"
void handleRoot(); void handleRoot();
void handleDownloadCSV(); void handleDownloadCSV();
+14 -31
View File
@@ -1,33 +1,16 @@
#pragma once #pragma once
#include <stdint.h>
#include <Arduino.h>
void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, uint8_t fontsize); #include "system_console.h"
void tftPrint16(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, bool force_font = true, bool font = false); #include "globals.h"
void tftReplace(int8_t offset, const String & textold, const String & text, int16_t x, int16_t y, int color, int smoothcolor, int background, uint8_t fontsize);
const char* textUI(uint16_t number); extern Console console;
uint8_t doAutoMemory(uint16_t startfreq, uint16_t stopfreq, uint8_t startmem, uint8_t stopmem, bool rdsonly, uint8_t doublepi); extern RTC_DATA_ATTR bool gpio_chip;
void showAutoSquelch(bool mode); extern RTC_DATA_ATTR bool tef_found;
void UpdateFonts();
void setAutoSpeedSPI(); template<typename... Args>
void DoMemoryPosTune(); void panic(Args... args);
void startFMDXScan();
void endMenu(); void Round30K(unsigned int freq);
void TuneUp(); void Round50K(unsigned int freq);
void ShowStepSize(); void Round100K(unsigned int freq);
void ShowFreq(int mode); void Round200K(unsigned int freq);
void ShowMemoryPos();
void TuneDown();
void ShowTuneMode();
void SelectBand();
void doBW();
void ModeButtonPress();
void updateEQ();
void updateiMS();
void Seek(bool mode);
void MuteScreen(bool setting);
void cancelDXScan();
void doStereoToggle();
void updateBW();
void ShowRDSLogo(bool RDSstatus);
void DataPrint(String string);
+1 -1
View File
@@ -8,7 +8,7 @@
#include "globals.h" #include "globals.h"
#include "NTPupdate.h" #include "NTPupdate.h"
#include "rtc.hpp" #include "rtc.hpp"
#include "main.h" #include "core.h"
void ShowAdvancedRDS(); void ShowAdvancedRDS();
void readRds(); void readRds();
+2 -6
View File
@@ -1,7 +1,7 @@
#include "NTPupdate.h" #include "NTPupdate.h"
void sendNTPpacket(IPAddress &address) { void sendNTPpacket(IPAddress &address) {
byte packetBuffer[NTP_PACKET_SIZE] = {0}; // Initialize buffer with zeros byte packetBuffer[NTP_PACKET_SIZE] = {0};
packetBuffer[0] = 0b11100011; // LI, Version, Mode packetBuffer[0] = 0b11100011; // LI, Version, Mode
packetBuffer[2] = 6; // Polling interval packetBuffer[2] = 6; // Polling interval
@@ -32,11 +32,7 @@ time_t getNtpTime() {
if (Udp.parsePacket() >= NTP_PACKET_SIZE) { if (Udp.parsePacket() >= NTP_PACKET_SIZE) {
Udp.read(packetBuffer, NTP_PACKET_SIZE); Udp.read(packetBuffer, NTP_PACKET_SIZE);
unsigned long secsSince1900 = unsigned long secsSince1900 = ((unsigned long)packetBuffer[40] << 24) | ((unsigned long)packetBuffer[41] << 16) | ((unsigned long)packetBuffer[42] << 8) | (unsigned long)packetBuffer[43];
((unsigned long)packetBuffer[40] << 24) |
((unsigned long)packetBuffer[41] << 16) |
((unsigned long)packetBuffer[42] << 8) |
(unsigned long)packetBuffer[43];
return secsSince1900 - 2208988800UL; return secsSince1900 - 2208988800UL;
} }
+1 -2
View File
@@ -16,8 +16,7 @@ bool Tuner_ReadBuffer(unsigned char *buf, uint16_t len) {
if (Wire.available() >= len) { if (Wire.available() >= len) {
for (uint16_t i = 0; i < len; i++) buf[i] = Wire.read(); for (uint16_t i = 0; i < len; i++) buf[i] = Wire.read();
return true; return true;
} } return false;
return false;
} }
static void Tuner_Patch_Load(const unsigned char *pLutBytes, uint16_t size) { static void Tuner_Patch_Load(const unsigned char *pLutBytes, uint16_t size) {
+3624
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -6,6 +6,9 @@
extern mem presets[]; extern mem presets[];
bool setWiFiConnectParam = false; bool setWiFiConnectParam = false;
const char* BWButtonLabelsFM[] = {"56 kHz", "64 kHz", "72 kHz", "84 kHz", "97 kHz", "114 kHz", "133 kHz", "151 kHz", "168 kHz", "184 kHz", "200 kHz", "217 kHz", "236 kHz", "254 kHz", "287 kHz", "311 kHz", "Auto", "iMS", "EQ"};
const char* BWButtonLabelsAM[] = {"3 kHz", "4 kHz", "6 kHz", "8 kHz"};
void doTheme() { // Use this to put your own colors in: http://www.barth-dev.de/online/rgb565-color-picker/ void doTheme() { // Use this to put your own colors in: http://www.barth-dev.de/online/rgb565-color-picker/
switch (CurrentTheme) { switch (CurrentTheme) {
case 0: // Essence case 0: // Essence
+3 -6
View File
@@ -104,7 +104,7 @@ void handleRoot() {
String column = header.substring(startIndex, endIndex); String column = header.substring(startIndex, endIndex);
if (column.equalsIgnoreCase("PI")) piCodeIndex = columnIndex; if (column.equalsIgnoreCase("PI")) piCodeIndex = columnIndex;
if (column.equalsIgnoreCase("Frequency")) frequencyIndex = columnIndex; else if (column.equalsIgnoreCase("Frequency")) frequencyIndex = columnIndex;
startIndex = endIndex + 1; startIndex = endIndex + 1;
columnIndex++; columnIndex++;
@@ -170,9 +170,7 @@ void handleDownloadCSV() {
} }
bool handleCreateNewLogbook() { bool handleCreateNewLogbook() {
if (SPIFFS.exists("/logbook.csv")) { if (SPIFFS.exists("/logbook.csv") && !SPIFFS.remove("/logbook.csv")) return false;
if (!SPIFFS.remove("/logbook.csv")) return false;
}
fs::File file = SPIFFS.open("/logbook.csv", "w"); fs::File file = SPIFFS.open("/logbook.csv", "w");
if (!file) return false; if (!file) return false;
@@ -343,8 +341,7 @@ void printLogbookCSV() {
Serial.println("===== Start of logbook.csv ====="); Serial.println("===== Start of logbook.csv =====");
while (file.available()) { while (file.available()) {
String line = file.readStringUntil('\n'); Serial.println(file.readStringUntil('\n'));
Serial.println(line);
} }
file.close(); file.close();
+44 -3677
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -247,7 +247,7 @@ void DefaultSettings() {
EEPROM.writeUInt(EE_UINT16_CONVERTERSET, 0); EEPROM.writeUInt(EE_UINT16_CONVERTERSET, 0);
EEPROM.writeUInt(EE_UINT16_FMLOWEDGESET, 875); EEPROM.writeUInt(EE_UINT16_FMLOWEDGESET, 875);
EEPROM.writeUInt(EE_UINT16_FMHIGHEDGESET, 1080); EEPROM.writeUInt(EE_UINT16_FMHIGHEDGESET, 1080);
EEPROM.writeByte(EE_BYTE_CONTRASTSET, 20); EEPROM.writeByte(EE_BYTE_CONTRASTSET, 10);
EEPROM.writeByte(EE_BYTE_STEREOLEVEL, 0); EEPROM.writeByte(EE_BYTE_STEREOLEVEL, 0);
EEPROM.writeByte(EE_BYTE_BANDFM, FM_BAND_ALL); EEPROM.writeByte(EE_BYTE_BANDFM, FM_BAND_ALL);
EEPROM.writeByte(EE_BYTE_BANDAM, AM_BAND_ALL); EEPROM.writeByte(EE_BYTE_BANDAM, AM_BAND_ALL);
@@ -257,7 +257,7 @@ void DefaultSettings() {
EEPROM.writeByte(EE_BYTE_RTBUFFER, 0); EEPROM.writeByte(EE_BYTE_RTBUFFER, 0);
EEPROM.writeByte(EE_BYTE_EDGEBEEP, 0); EEPROM.writeByte(EE_BYTE_EDGEBEEP, 0);
EEPROM.writeByte(EE_BYTE_SOFTMUTEAM, 1); EEPROM.writeByte(EE_BYTE_SOFTMUTEAM, 1);
EEPROM.writeByte(EE_BYTE_SOFTMUTEFM, 0); EEPROM.writeByte(EE_BYTE_SOFTMUTEFM, 1);
EEPROM.writeUInt(EE_UINT16_FREQUENCY_AM, 828); EEPROM.writeUInt(EE_UINT16_FREQUENCY_AM, 828);
EEPROM.writeByte(EE_BYTE_LANGUAGE, 0); EEPROM.writeByte(EE_BYTE_LANGUAGE, 0);
EEPROM.writeByte(EE_BYTE_SHOWRDSERRORS, 0); EEPROM.writeByte(EE_BYTE_SHOWRDSERRORS, 0);
+25 -27
View File
@@ -66,7 +66,7 @@ void ShowAdvancedRDS() {
} }
if(!screenmute) { if(!screenmute) {
uint8_t font = 0; uint8_t font = 0;
if(radio.rds.ECC.get() == 190) font = 1; if(radio.rds.ECC.get() == 190) font = 1; // Chiba (Chiba)
else if(radio.rds.ECC.get() == 192) font = 1; else if(radio.rds.ECC.get() == 192) font = 1;
else if(radio.rds.ECC.get() == 201) font = 1; else if(radio.rds.ECC.get() == 201) font = 1;
eccDisplay.update(ECCString, RDSstatus, RDSColor, RDSColorSmooth, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, font); eccDisplay.update(ECCString, RDSstatus, RDSColor, RDSColorSmooth, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, font);
@@ -187,7 +187,7 @@ void readRds() {
if (!rdsstatscreen) { if (!rdsstatscreen) {
if (radio.rds.region == 0) tftPrint(ACENTER, PIold, 275, advancedRDS ? 75 : 187, RDSColor, RDSColorSmooth, 28); if (radio.rds.region == 0) tftPrint(ACENTER, PIold, 275, advancedRDS ? 75 : 187, RDSColor, RDSColorSmooth, 28);
else { else {
tftPrint(ALEFT, PIold, 240, advancedRDS ? 72 : 184, RDSColor, RDSColorSmooth, 16); tftPrint16(ALEFT, PIold, 240, advancedRDS ? 72 : 184, RDSColor, RDSColorSmooth);
tftPrint(ALEFT, stationIDold, 240, advancedRDS ? 89 : 201, RDSColor, RDSColorSmooth, 16); tftPrint(ALEFT, stationIDold, 240, advancedRDS ? 89 : 201, RDSColor, RDSColorSmooth, 16);
tftPrint( 1, stationStateold, 318, advancedRDS ? 89 : 201, advancedRDS ? RDSColor : RDSDropoutColor, advancedRDS ? RDSColorSmooth : RDSDropoutColorSmooth, 16); tftPrint( 1, stationStateold, 318, advancedRDS ? 89 : 201, advancedRDS ? RDSColor : RDSDropoutColor, advancedRDS ? RDSColorSmooth : RDSDropoutColorSmooth, 16);
} }
@@ -203,8 +203,7 @@ void readRds() {
} else { } else {
PSSprite.setTextColor(RDSColor, RDSColorSmooth, false); PSSprite.setTextColor(RDSColor, RDSColorSmooth, false);
PSSprite.drawString(PSold, 0, 2); PSSprite.drawString(PSold, 0, 2);
} } PSSprite.pushSprite(36, advancedRDS ? 72 : 185);
PSSprite.pushSprite(36, advancedRDS ? 72 : 185);
} }
tft.fillCircle(314, 223, 2, GreyoutColor); tft.fillCircle(314, 223, 2, GreyoutColor);
@@ -248,9 +247,9 @@ void readRds() {
sprintf(hexbuf, "%04X", radio.rds.rdsD); XDRGTKRDS += hexbuf; sprintf(hexbuf, "%04X", radio.rds.rdsD); XDRGTKRDS += hexbuf;
uint8_t erroutput = 0; uint8_t erroutput = 0;
erroutput |= ((radio.rds.rdsErr >> 8) & B00110000) >> 4; erroutput |= ((radio.rds.rdsErr >> 8) & 0x30) >> 4;
erroutput |= ((radio.rds.rdsErr >> 8) & B00001100); erroutput |= ((radio.rds.rdsErr >> 8) & 0xC);
erroutput |= ((radio.rds.rdsErr >> 8) & B00000011) << 4; erroutput |= ((radio.rds.rdsErr >> 8) & 3) << 4;
sprintf(hexbuf, "%X%X", (erroutput >> 4) & 0xF, erroutput & 0xF); sprintf(hexbuf, "%X%X", (erroutput >> 4) & 0xF, erroutput & 0xF);
XDRGTKRDS += hexbuf; XDRGTKRDS += hexbuf;
@@ -366,15 +365,14 @@ void showPI() {
else tftReplace(ACENTER, PIold, radio.rds.picode, 275, 75, RDSColor, RDSColorSmooth, BackgroundColor, 28); else tftReplace(ACENTER, PIold, radio.rds.picode, 275, 75, RDSColor, RDSColorSmooth, BackgroundColor, 28);
} else { } else {
if (!RDSstatus) { if (!RDSstatus) {
if (String(radio.rds.picode) != PIold) tftReplace(ALEFT, PIold, radio.rds.picode, 240, 72, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); if (String(radio.rds.picode) != PIold) tftReplace16(ALEFT, PIold, radio.rds.picode, 240, 72, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor);
tftReplace(ALEFT, stationIDold, radio.rds.stationIDtext, 240, 89, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); tftReplace(ALEFT, stationIDold, radio.rds.stationIDtext, 240, 89, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16);
} else { } else {
if (String(radio.rds.picode) != PIold) tftReplace(ALEFT, PIold, radio.rds.picode, 240, 72, RDSColor, RDSColorSmooth, BackgroundColor, 16); if (String(radio.rds.picode) != PIold) tftReplace16(ALEFT, PIold, radio.rds.picode, 240, 72, RDSColor, RDSColorSmooth, BackgroundColor);
tftReplace(ALEFT, stationIDold, radio.rds.stationIDtext, 240, 89, RDSColor, RDSColorSmooth, BackgroundColor, 16); tftReplace(ALEFT, stationIDold, radio.rds.stationIDtext, 240, 89, RDSColor, RDSColorSmooth, BackgroundColor, 16);
} } tftReplace(ARIGHT, stationStateold, radio.rds.stationStatetext, 318, 89, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16);
tftReplace(ARIGHT, stationStateold, radio.rds.stationStatetext, 318, 89, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16);
} }
} else if (afscreen) tftReplace(ALEFT, PIold, radio.rds.picode, 30, 201, BWAutoColor, BWAutoColorSmooth, BackgroundColor, 16); } else if (afscreen) tftReplace16(ALEFT, PIold, radio.rds.picode, 30, 201, BWAutoColor, BWAutoColorSmooth, BackgroundColor);
else if (!rdsstatscreen) { else if (!rdsstatscreen) {
if (radio.rds.region == 0) { if (radio.rds.region == 0) {
if (!RDSstatus) tftReplace(ACENTER, PIold, radio.rds.picode, 275, 187, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 28); if (!RDSstatus) tftReplace(ACENTER, PIold, radio.rds.picode, 275, 187, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 28);
@@ -382,12 +380,12 @@ void showPI() {
} else { } else {
if (!RDSstatus) { if (!RDSstatus) {
if (String(radio.rds.picode) != PIold || radio.rds.stationIDtext != stationIDold) { if (String(radio.rds.picode) != PIold || radio.rds.stationIDtext != stationIDold) {
tftReplace(ALEFT, PIold, radio.rds.picode, 240, 184, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); tftReplace16(ALEFT, PIold, radio.rds.picode, 240, 184, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor);
tftReplace(ALEFT, stationIDold, radio.rds.stationIDtext, 240, 201, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); tftReplace(ALEFT, stationIDold, radio.rds.stationIDtext, 240, 201, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16);
} }
} else { } else {
if (String(radio.rds.picode) != PIold || radio.rds.stationIDtext != stationIDold) { if (String(radio.rds.picode) != PIold || radio.rds.stationIDtext != stationIDold) {
tftReplace(ALEFT, PIold, radio.rds.picode, 240, 184, RDSColor, RDSColorSmooth, BackgroundColor, 16); tftReplace16(ALEFT, PIold, radio.rds.picode, 240, 184, RDSColor, RDSColorSmooth, BackgroundColor);
tftReplace(ALEFT, stationIDold, radio.rds.stationIDtext, 240, 201, RDSColor, RDSColorSmooth, BackgroundColor, 16); tftReplace(ALEFT, stationIDold, radio.rds.stationIDtext, 240, 201, RDSColor, RDSColorSmooth, BackgroundColor, 16);
tftReplace(ARIGHT, stationStateold, radio.rds.stationStatetext, 318, 201, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16); tftReplace(ARIGHT, stationStateold, radio.rds.stationStatetext, 318, 201, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16);
} }
@@ -523,8 +521,8 @@ void showCT() {
rds_date = String(dateStr); rds_date = String(dateStr);
if (!screenmute && showclock && (rds_clock != rds_clockold || rds_date != rds_dateold || radio.rds.hasCT.changed(0))) { if (!screenmute && showclock && (rds_clock != rds_clockold || rds_date != rds_dateold || radio.rds.hasCT.changed(0))) {
tftReplace(ACENTER, rds_clockold, rds_clock, 134, 1, RDSColor, RDSColorSmooth, BackgroundColor, 16); tftReplace16(ACENTER, rds_clockold, rds_clock, 134, 1, RDSColor, RDSColorSmooth, BackgroundColor);
tftReplace(ACENTER, rds_dateold, rds_date, 134, 15, RDSColor, RDSColorSmooth, BackgroundColor, 16); tftReplace16(ACENTER, rds_dateold, rds_date, 134, 15, RDSColor, RDSColorSmooth, BackgroundColor);
rds_clockold = rds_clock; rds_clockold = rds_clock;
rds_dateold = rds_date; rds_dateold = rds_date;
} }
@@ -573,7 +571,7 @@ void ShowAFEON() {
if (radio.rds.hasAF && afpagenr == 1) { if (radio.rds.hasAF && afpagenr == 1) {
if (!hasafold) { if (!hasafold) {
tftPrint(ALEFT, textUI(84), 6, 48, BackgroundColor, BackgroundColor, 16); tftPrint(ALEFT, textUI(84), 6, 48, BackgroundColor, BackgroundColor, 16);
tftPrint(ALEFT, "AF:", 4, 32, ActiveColor, ActiveColorSmooth, 16); tftPrint16(ALEFT, "AF:", 4, 32, ActiveColor, ActiveColorSmooth);
hasafold = true; hasafold = true;
} }
@@ -596,10 +594,10 @@ void ShowAFEON() {
if (radio.eon_counter > 0 && afpagenr > 1) { if (radio.eon_counter > 0 && afpagenr > 1) {
if (!haseonold) { if (!haseonold) {
tftPrint(ALEFT, textUI(85), 6, 48, BackgroundColor, BackgroundColor, 16); tftPrint(ALEFT, textUI(85), 6, 48, BackgroundColor, BackgroundColor, 16);
tftPrint(ALEFT, "PI", 4, 32, ActiveColor, ActiveColorSmooth, 16); tftPrint16(ALEFT, "PI", 4, 32, ActiveColor, ActiveColorSmooth);
tftPrint(ACENTER, "TA", 250, 32, ActiveColor, ActiveColorSmooth, 16); tftPrint16(ACENTER, "TA", 250, 32, ActiveColor, ActiveColorSmooth);
tftPrint(ACENTER, "TP", 276, 32, ActiveColor, ActiveColorSmooth, 16); tftPrint16(ACENTER, "TP", 276, 32, ActiveColor, ActiveColorSmooth);
tftPrint(ACENTER, "PTY", 304, 32, ActiveColor, ActiveColorSmooth, 16); tftPrint16(ACENTER, "PTY", 304, 32, ActiveColor, ActiveColorSmooth);
haseonold = true; haseonold = true;
} }
@@ -626,7 +624,7 @@ void ShowAFEON() {
strcpy(eonpicodeold[i + y], radio.eon[i + y].picode); strcpy(eonpicodeold[i + y], radio.eon[i + y].picode);
if (radio.eon[i + y].ps.length() > 0) { if (radio.eon[i + y].ps.length() > 0) {
tftPrint(ALEFT, "PS", 46, 32, ActiveColor, ActiveColorSmooth, 16); tftPrint16(ALEFT, "PS", 46, 32, ActiveColor, ActiveColorSmooth);
if (strcmp(radio.eon[i + y].ps.c_str(), eonpsold[i + y].c_str()) != 0) tftPrint(ALEFT, eonpsold[i + y].c_str(), 46, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); if (strcmp(radio.eon[i + y].ps.c_str(), eonpsold[i + y].c_str()) != 0) tftPrint(ALEFT, eonpsold[i + y].c_str(), 46, 48 + (15 * i), BackgroundColor, BackgroundColor, 16);
tftPrint(ALEFT, radio.eon[i + y].ps.c_str(), 46, 48 + (15 * i), RDSDropoutColor, RDSDropoutColorSmooth, 16); tftPrint(ALEFT, radio.eon[i + y].ps.c_str(), 46, 48 + (15 * i), RDSDropoutColor, RDSDropoutColorSmooth, 16);
@@ -771,7 +769,7 @@ void ShowRDSStatistics() {
xposPct = 310; xposPct = 310;
} }
uint8_t row = rb & 0x07; uint8_t row = rb & 0x07;
uint8_t ypos = pgm_read_byte(&rdsYpos[row]); uint8_t ypos = pgm_read_byte(&rdsYpos[row]);
static int16_t lastX = -1, lastY = -1; static int16_t lastX = -1, lastY = -1;
@@ -814,7 +812,7 @@ void ShowRDSStatistics() {
} }
if (radio.processed_rdsblocks > 0 && !dropout) { if (radio.processed_rdsblocks > 0 && !dropout) {
const uint8_t xErr[4] = {86, 124, 162, 200}; constexpr uint8_t xErr[4] = {86, 124, 162, 200};
const bool errors[4] = {radio.rds.rdsAerror, radio.rds.rdsBerror, radio.rds.rdsCerror, radio.rds.rdsDerror}; const bool errors[4] = {radio.rds.rdsAerror, radio.rds.rdsBerror, radio.rds.rdsCerror, radio.rds.rdsDerror};
for (uint8_t i = 0; i < 4; i++) tft.fillCircle(xErr[i], 41, 5, errors[i] ? SignificantColor : InsignificantColor); for (uint8_t i = 0; i < 4; i++) tft.fillCircle(xErr[i], 41, 5, errors[i] ? SignificantColor : InsignificantColor);
@@ -824,17 +822,17 @@ void ShowRDSStatistics() {
int errC = ((radio.rds.rdsErr >> 8) & 12) >> 2; int errC = ((radio.rds.rdsErr >> 8) & 12) >> 2;
int errD = (radio.rds.rdsErr & 3); int errD = (radio.rds.rdsErr & 3);
const int weights[4] = {0, 2, 6, 12}; constexpr int weights[4] = {0, 2, 6, 12};
int errorBits = weights[errA] + weights[errB] + weights[errC] + weights[errD]; int errorBits = weights[errA] + weights[errB] + weights[errC] + weights[errD];
int totalBits = 4 * 26; constexpr int totalBits = 4 * 26;
float ber = (float)errorBits / (float)totalBits; float ber = (float)errorBits / (float)totalBits;
ber = sqrt(ber); ber = sqrt(ber);
if (ber > 1.0) ber = 1.0; if (ber > 1.0) ber = 1.0;
float alpha = 0.05; constexpr float alpha = 0.05;
smoothBER = (1.0 - alpha) * smoothBER + alpha * ber; smoothBER = (1.0 - alpha) * smoothBER + alpha * ber;
int berPercent = (int)(smoothBER * 100.0); int berPercent = (int)(smoothBER * 100.0);
+2 -4
View File
@@ -96,8 +96,7 @@ String ucs2ToUtf8(const char* ucs2Input) {
utf8Output += (char)(0x80 | ((ucs2Char >> 6) & 0x3F)); utf8Output += (char)(0x80 | ((ucs2Char >> 6) & 0x3F));
utf8Output += (char)(0x80 | (ucs2Char & 0x3F)); utf8Output += (char)(0x80 | (ucs2Char & 0x3F));
} }
} } return utf8Output;
return utf8Output;
} }
String extractUTF8Substring(const String & utf8String, size_t start, size_t length, bool underscore) { String extractUTF8Substring(const String & utf8String, size_t start, size_t length, bool underscore) {
@@ -133,6 +132,5 @@ String removeNewline(String inputString) {
for (int i = 0; i < inputString.length(); i++) { for (int i = 0; i < inputString.length(); i++) {
if (inputString[i] == '\n') outputString += ' '; if (inputString[i] == '\n') outputString += ' ';
else outputString += inputString[i]; else outputString += inputString[i];
} } return outputString;
return outputString;
} }