From f9b53f170e9e0ef8f51fbf19db678e8725374d12 Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Sun, 18 Jan 2026 21:55:32 +0100 Subject: [PATCH] way faster wake up from sleep --- include/TEF6686.h | 4 +- include/globals.h | 4 +- lib/ESP32Time/ESP32Time.cpp | 1 + lib/ESP32Time/ESP32Time.h | 4 +- lib/ESP32Time/library.json | 1 - src/TEF6686.cpp | 44 +++++---- src/comms.cpp | 15 ++-- src/globals.cpp | 12 +-- src/gui.cpp | 15 ++-- src/main.cpp | 174 ++++++++++++++++++------------------ src/nonvolatile.cpp | 2 +- src/rds.cpp | 2 +- src/rtc.cpp | 2 +- 13 files changed, 140 insertions(+), 140 deletions(-) diff --git a/include/TEF6686.h b/include/TEF6686.h index b950da9..8cec9db 100644 --- a/include/TEF6686.h +++ b/include/TEF6686.h @@ -542,13 +542,13 @@ class TEF6686 { void setMono(bool mono); bool getStereoStatus(); void init(byte TEF); - void clearRDS(bool fullsearchrds); + void clearRDS(); void power(bool mode); void setAGC(uint8_t agc); void setAMAGC(uint8_t agc); void setiMS(bool mph); void setEQ(bool eq); - void setDeemphasis(uint8_t timeconstant); + void setDeemphasis(RADIO_FM_DEEMPHASIS timeconstant); void setAudio(uint8_t audio); void setFMABandw(); void setFMBandw(uint16_t bandwidth); diff --git a/include/globals.h b/include/globals.h index 09876f5..7bb6e0d 100644 --- a/include/globals.h +++ b/include/globals.h @@ -30,7 +30,7 @@ extern bool dynamicPTYold, edgebeep, externaltune; extern bool findMemoryAF; extern bool firstTouchHandled; extern bool flashing; -extern bool fmsi, fullsearchrds; +extern bool fmsi; extern bool hasafold, haseonold; extern bool initdxscan, invertdisplay, leave; extern bool LowLevelInit; @@ -104,7 +104,7 @@ extern byte fmagc; extern byte fmscansens; extern byte fmdefaultstepsize; extern byte fmnb; -extern byte fmdeemphasis; +extern RADIO_FM_DEEMPHASIS fmdeemphasis; extern byte freqfont; extern byte amcodect; extern byte amcodectcount; diff --git a/lib/ESP32Time/ESP32Time.cpp b/lib/ESP32Time/ESP32Time.cpp index 7fff2de..2c3c5eb 100644 --- a/lib/ESP32Time/ESP32Time.cpp +++ b/lib/ESP32Time/ESP32Time.cpp @@ -25,6 +25,7 @@ #include "ESP32Time.h" #include "time.h" #include +#include "esp_attr.h" #ifdef RTC_DATA_ATTR RTC_DATA_ATTR static bool overflow; diff --git a/lib/ESP32Time/ESP32Time.h b/lib/ESP32Time/ESP32Time.h index e90b421..4ecb5f9 100644 --- a/lib/ESP32Time/ESP32Time.h +++ b/lib/ESP32Time/ESP32Time.h @@ -23,9 +23,7 @@ */ #pragma once - -#include - +#include class ESP32Time { public: diff --git a/lib/ESP32Time/library.json b/lib/ESP32Time/library.json index ccf7705..f7cb469 100644 --- a/lib/ESP32Time/library.json +++ b/lib/ESP32Time/library.json @@ -16,6 +16,5 @@ "maintainer": true } ], - "frameworks": "arduino", "platforms": "espressif8266, espressif32" } diff --git a/src/TEF6686.cpp b/src/TEF6686.cpp index 394594c..012887b 100644 --- a/src/TEF6686.cpp +++ b/src/TEF6686.cpp @@ -7,6 +7,7 @@ uint8_t dropped_groups = 0; bool lastBitState = false; +bool fullsearchrds = false; uint16_t TEF6686::getBlockA() { uint16_t blockA; @@ -146,15 +147,20 @@ void TEF6686::init(byte TEF) { devTEF_Set_Cmd(TEF_FM, Cmd_Set_StHiBlend_Max, 4, 0, 4000); devTEF_Set_Cmd(TEF_AUDIO, Cmd_Set_Ana_Out, 4, 128, 1); devTEF_Set_Cmd(TEF_AUDIO, Cmd_Set_Output_Source, 4, 128, 224); + + uint16_t device; + getIdentification(&device, NULL, NULL); + + if(device == 1 || device == 3) fullsearchrds = true; } void TEF6686::getIdentification(uint16_t *device, uint16_t *hw_version, uint16_t *sw_version) { uint8_t buf[6]; devTEF_Get_Cmd(TEF_APPL, Cmd_Get_Identification, buf, sizeof(buf)); - *device = Convert8bto16b(buf); - *hw_version = Convert8bto16b(buf + 2); - *sw_version = Convert8bto16b(buf + 4); + if(device != NULL) *device = Convert8bto16b(buf); + if(hw_version != NULL) *hw_version = Convert8bto16b(buf + 2); + if(sw_version != NULL) *sw_version = Convert8bto16b(buf + 4); } void TEF6686::power(bool mode) { @@ -232,7 +238,7 @@ bool TEF6686::getStereoStatus() { r = devTEF_Get_Cmd(TEF_FM, Cmd_Get_Signal_Status, buf, sizeof(buf)); status = Convert8bto16b(buf); - bool stereo = 0; + bool stereo = false; if(r) stereo = ((status >> 15) & 1) ? 1 : 0; return stereo; } @@ -258,17 +264,17 @@ void TEF6686::setUnMute() { } void TEF6686::setAGC(uint8_t agc) { - devTEF_Set_Cmd(TEF_FM, Cmd_Set_RFAGC, 4, agc * 10, 0); + devTEF_Set_Cmd(TEF_FM, Cmd_Set_RFAGC, 2, agc * 10); } void TEF6686::setAMAGC(uint8_t agc) { - devTEF_Set_Cmd(TEF_AM, Cmd_Set_RFAGC, 4, agc * 10, 0); + devTEF_Set_Cmd(TEF_AM, Cmd_Set_RFAGC, 2, agc * 10); } -void TEF6686::setDeemphasis(uint8_t timeconstant) { +void TEF6686::setDeemphasis(RADIO_FM_DEEMPHASIS timeconstant) { switch (timeconstant) { - case 1: devTEF_Set_Cmd(TEF_FM, Cmd_Set_Deemphasis, 2, 500); break; - case 2: devTEF_Set_Cmd(TEF_FM, Cmd_Set_Deemphasis, 2, 750); break; + case DEEMPHASIS_50: devTEF_Set_Cmd(TEF_FM, Cmd_Set_Deemphasis, 2, 500); break; + case DEEMPHASIS_75: devTEF_Set_Cmd(TEF_FM, Cmd_Set_Deemphasis, 2, 750); break; default: devTEF_Set_Cmd(TEF_FM, Cmd_Set_Deemphasis, 2, 0); break; } } @@ -351,15 +357,15 @@ void TEF6686::getStatus(int16_t *level, uint16_t *USN, uint16_t *WAM, int16_t *o void TEF6686::getStatusAM(int16_t *level, uint16_t *noise, uint16_t *cochannel, int16_t *offset, uint16_t *bandwidth, uint16_t *modulation, int8_t *snr) { uint8_t buf[14]; devTEF_Get_Cmd(TEF_AM, Cmd_Get_Quality_Data, buf, sizeof(buf)); - *level = Convert8bto16b(buf + 2); - *noise = Convert8bto16b(buf + 4); - *cochannel = Convert8bto16b(buf + 6); - *offset = Convert8bto16b(buf + 8); - *bandwidth = Convert8bto16b(buf + 10) / 10; - *modulation = Convert8bto16b(buf + 12) / 10; - if (*level < -200) *level = -200; - if (*level > 1200) *level = 1200; - *snr = int(0.46222375 * (float)(*level) / 10 - 0.082495118 * (float)(*noise / 50) / 10) + 10; + if(level != NULL) *level = Convert8bto16b(buf + 2); + if(noise != NULL) *noise = Convert8bto16b(buf + 4); + if(cochannel != NULL) *cochannel = Convert8bto16b(buf + 6); + if(offset != NULL) *offset = Convert8bto16b(buf + 8); + if(bandwidth != NULL) *bandwidth = Convert8bto16b(buf + 10) / 10; + if(modulation != NULL) *modulation = Convert8bto16b(buf + 12) / 10; + if(level != NULL && *level < -200) *level = -200; + if(level != NULL && *level > 1200) *level = 1200; + if(snr != NULL) *snr = int(0.46222375 * (float)(*level) / 10 - 0.082495118 * (float)(*noise / 50) / 10) + 10; } void TEF6686::readRDS(byte showrdserrors) { @@ -1555,7 +1561,7 @@ void TEF6686::readRDS(byte showrdserrors) { } } -void TEF6686::clearRDS(bool fullsearchrds) { +void TEF6686::clearRDS() { devTEF_Set_Cmd(TEF_FM, Cmd_Set_RDS, 6, fullsearchrds ? 3 : 1, 1, 0); rds.piBuffer.clear(); rds.stationName = rds.stationText = rds.stationNameLong = ""; diff --git a/src/comms.cpp b/src/comms.cpp index 7ba6e5a..7abd96f 100644 --- a/src/comms.cpp +++ b/src/comms.cpp @@ -47,7 +47,7 @@ void Communication() { uint16_t freqtemp = packet.substring(2).toInt(); if(BAND_FM) freqtemp -= ConverterSet * 1000; if(seek) seek = false; - radio.clearRDS(fullsearchrds); + radio.clearRDS(); if(freqtemp >= LowEdgeOIRTSet && freqtemp <= HighEdgeOIRTSet) { frequency_OIRT = freqtemp; @@ -78,8 +78,7 @@ void Communication() { case 'S': {if (!scandxmode) startFMDXScan(); break;} case 'E': {if (scandxmode) cancelDXScan(); break;} - - case 'R': {radio.clearRDS(fullsearchrds); break;} + case 'R': {radio.clearRDS(); break;} } return; } @@ -152,7 +151,7 @@ void Communication() { } } - radio.clearRDS(fullsearchrds); + radio.clearRDS(); ShowFreq(0); store = true; externaltune = false; @@ -207,7 +206,7 @@ void Communication() { frequency = freq.toInt(); if (scandxmode) cancelDXScan(); radio.SetFreq(frequency); - radio.clearRDS(fullsearchrds); + radio.clearRDS(); if (band != BAND_FM) { band = BAND_FM; SelectBand(); @@ -371,7 +370,7 @@ void Communication() { if (scandxmode) cancelDXScan(); radio.SetFreq(frequency); if (afscreen) BuildAdvancedRDS(); - radio.clearRDS(fullsearchrds); + radio.clearRDS(); if (band != BAND_FM) { band = BAND_FM; SelectBand(); @@ -619,7 +618,7 @@ void XDRGTKRoutine() { DataPrint("M0\n"); DataPrint("T" + String((frequency + ConverterSet * 100) * 10) + "\n"); radio.SetFreq(frequency); - radio.clearRDS(fullsearchrds); + radio.clearRDS(); RDSstatus = false; } store = true; @@ -630,7 +629,7 @@ void XDRGTKRoutine() { if(BAND_FM) freqtemp -= ConverterSet * 1000; if(seek) seek = false; - radio.clearRDS(fullsearchrds); + radio.clearRDS(); if (freqtemp >= LWLowEdgeSet && freqtemp <= LWHighEdgeSet) { frequency_LW = freqtemp; diff --git a/src/globals.cpp b/src/globals.cpp index 894acd2..67beb76 100644 --- a/src/globals.cpp +++ b/src/globals.cpp @@ -9,7 +9,9 @@ bool Data_Accelerator = false; bool advancedRDS, afmethodBold, afpage; bool afscreen, aftest; bool autoDST, autolog, autologged; -bool autosquelch = true, batterydetect = true, beepresetstart; +bool autosquelch = true; +RTC_DATA_ATTR bool batterydetect = true; +bool beepresetstart; bool beepresetstop, BWreset, bwtouchtune; bool BWtune, change, clockampm; bool direction, dropout; @@ -17,7 +19,7 @@ bool dynamicPTYold, edgebeep, externaltune; bool findMemoryAF; bool firstTouchHandled = false; bool flashing; -bool fmsi, fullsearchrds; +RTC_DATA_ATTR bool fmsi; bool hasafold, haseonold; bool initdxscan, invertdisplay, leave; bool LowLevelInit; @@ -80,7 +82,7 @@ byte BWsetFM; byte BWsetRecall; byte BWtemp; byte charwidth = 8; -byte chipmodel; +RTC_DATA_ATTR byte chipmodel; byte hardwaremodel; byte ContrastSet; byte CurrentTheme; @@ -91,7 +93,7 @@ byte fmagc; byte fmscansens; byte fmdefaultstepsize; byte fmnb; -byte fmdeemphasis; +RTC_DATA_ATTR RADIO_FM_DEEMPHASIS fmdeemphasis; byte freqfont; byte amcodect; byte amcodectcount; @@ -219,7 +221,7 @@ int8_t LowLevelSet; int8_t NTPoffset; int8_t CN; int8_t CNold; -int8_t VolSet; +RTC_DATA_ATTR int8_t VolSet; float batteryVold; IPAddress remoteip; String AIDString; diff --git a/src/gui.cpp b/src/gui.cpp index 091459d..cfc9b99 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -3490,11 +3490,11 @@ void MenuUpDown(bool dir) { case ITEM7: if (dir) { - fmdeemphasis++; + fmdeemphasis = (RADIO_FM_DEEMPHASIS)(fmdeemphasis+1); if (fmdeemphasis > DEEMPHASIS_COUNT - 1) fmdeemphasis = DEEMPHASIS_NONE; } else { - fmdeemphasis--; - if (fmdeemphasis > DEEMPHASIS_COUNT - 1) fmdeemphasis = DEEMPHASIS_COUNT - 1; + fmdeemphasis = (RADIO_FM_DEEMPHASIS)(fmdeemphasis-1); + if (fmdeemphasis > DEEMPHASIS_COUNT - 1) fmdeemphasis = (RADIO_FM_DEEMPHASIS)(DEEMPHASIS_COUNT - 1); } OneBigLineSprite.setTextDatum(TL_DATUM); @@ -3952,7 +3952,7 @@ void MenuUpDown(bool dir) { break; case ITEM9: - if (fullsearchrds) { + if (chipmodel == 1 || chipmodel == 3) { fmsi = !fmsi; OneBigLineSprite.drawString((fmsi ? textUI(28) : textUI(27)), 135, 0); OneBigLineSprite.pushSprite(24, 118); @@ -5083,13 +5083,10 @@ void DoMenu() { break; case ITEM9: - if (fullsearchrds) { + if(chipmodel == 1 || chipmodel == 3) { Infoboxprint(textUI(203)); - OneBigLineSprite.drawString((fmsi ? textUI(28) : textUI(27)), 135, 0); - } else { - Infoboxprint(textUI(204)); - } + } else Infoboxprint(textUI(204)); OneBigLineSprite.pushSprite(24, 118); break; diff --git a/src/main.cpp b/src/main.cpp index 48bb7f3..a0d994d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -24,8 +24,8 @@ using fs::FS; #pragma endregion Console console(&tft); -RTC_NOINIT_ATTR bool gpio_chip = false; -RTC_NOINIT_ATTR bool tef_found = false; +RTC_DATA_ATTR bool gpio_chip = false; +RTC_DATA_ATTR bool tef_found = false; template void panic(Args... args) { @@ -838,7 +838,7 @@ void TuneFreq(int temp) { aftest = true; aftimer = millis(); - radio.clearRDS(fullsearchrds); + radio.clearRDS(); if (RDSSPYUSB) Serial.print("G:\r\nRESET-------\r\n\r\n"); if (RDSSPYTCP) RemoteClient.print("G:\r\nRESET-------\r\n\r\n"); } @@ -986,7 +986,7 @@ void startFMDXScan() { void doBandToggle() { if (tunemode != TUNE_MEM) { ToggleBand(band); - radio.clearRDS(fullsearchrds); + radio.clearRDS(); StoreFrequency(); SelectBand(); if (XDRGTKUSB || XDRGTKTCP) { @@ -1026,7 +1026,7 @@ void NumpadProcess(int num) { if (band == BAND_FM) DataPrint("M0\nT" + String(frequency * 10) + "\n"); else if (band == BAND_OIRT) DataPrint("M0\nT" + String(frequency_OIRT * 10) + "\n"); else DataPrint("M1\nT" + String(frequency_AM) + "\n"); } if (!memorystore) { - if (!memtune) radio.clearRDS(fullsearchrds); + if (!memtune) radio.clearRDS(); memtune = false; ShowFreq(0); store = true; @@ -1089,7 +1089,7 @@ void setAutoSpeedSPI() { void endMenu() { if(rds_settings_changed) { - radio.clearRDS(fullsearchrds); + radio.clearRDS(); RDSstatus = false; } rds_settings_changed = menu = false; @@ -1205,11 +1205,77 @@ void setup_periph() { Serial.end(); Wire.setClock(100000); +} + +void later_setup_periph() { + if(gpio_chip) { + console.print("XL9555 found, setting up"); + // Configures the GPIO chip for input in every pin + Wire.beginTransmission(XL9555_ADDRESS); + Wire.write(0x06); + Wire.write(0xFF); + Wire.write(0xFF); + Wire.endTransmission(); + } else console.print("XL9555 found not found on address " + String(XL9555_ADDRESS, HEX) + ". Numpad will not work"); if(tef_found) { // The tuner being missing here, would cause a infinite loop with no exit and no error, as it resets and polls the chip if it reset, if no response then we try again, and now, you see? radio.init(TEF); } + + uint16_t device, hw, sw; + radio.getIdentification(&device, &hw, &sw); + if (TEF != (highByte(hw) * 100 + highByte(sw))) SetTunerPatch(); + + if (lowByte(device) == 14) { + fmsi = false; + chipmodel = 0; + console.print("Detected a TEF6686 Lithio"); + } else if (lowByte(device) == 1) { + chipmodel = 1; + console.print("Detected a TEF6687 Lithio FMSI"); + } else if (lowByte(device) == 9) { + chipmodel = 2; + fmsi = false; + console.print("Detected a TEF6688 Lithio DR"); + } else if (lowByte(device) == 3) { + chipmodel = 3; + console.print("Detected a TEF6689 Lithio FMSI DR"); + } else panic("Unknown TEF device"); + console.print("Chip Patch: v" + String(TEF)); + + if(VolSet != 0) radio.setVolume(VolSet); + radio.setOffset(LevelOffset); + radio.setAMOffset(AMLevelOffset); + radio.setAMCoChannel(amcodect, amcodectcount); + radio.setAMAttenuation(amgain); + radio.setStereoLevel(StereoLevel); + radio.setHighCutLevel(HighCutLevel); + radio.setHighCutOffset(HighCutOffset); + radio.clearRDS(); + radio.setMute(); + if (!StereoToggle) radio.setMono(true); + radio.setSoftmuteFM(softmutefm); + radio.setSoftmuteAM(softmuteam); + radio.setAMNoiseBlanker(amnb); + radio.setFMNoiseBlanker(fmnb); + if(audiomode != 0) radio.setAudio(audiomode); + if(fmdeemphasis != DEEMPHASIS_50) radio.setDeemphasis(fmdeemphasis); + if(fmagc != 92) radio.setAGC(fmagc); + if(amagc != 100) radio.setAMAGC(amagc); + if (fmsi) radio.setFMSI(2); + + if(rx_rtc_avail) { + bool reset = init_rtc(); + if(reset) console.print("RX8010SJ was reset, no time"); + else { + rtcset = true; + console.print("RX8010SJ is used as a time source"); + } + } else console.print("RX8010SJ is not available at address " + String(RX8010SJ_ADDRESS, HEX)); + + if(analogRead(BATTERY_PIN) < 200) batterydetect = false; + else console.print("Battery detected."); } void read_encoder(); @@ -1226,7 +1292,7 @@ void setup() { EEPROM.begin(EE_TOTAL_CNT); setupmode = true; - + Wire.begin(); Wire.setClock(100000); @@ -1285,7 +1351,6 @@ void setup() { } tft.init(); - tft.initDMA(); tft.loadFont(FONT48, 2); @@ -1436,56 +1501,11 @@ void setup() { while (true) delay(1); } - rtc.setTime(0); - if(rx_rtc_avail) { - bool reset = init_rtc(); - if(reset) console.print("RX8010SJ was reset, no time"); - else { - rtcset = true; - console.print("RX8010SJ is used as a time source"); - } - } else console.print("RX8010SJ is not available at address " + String(RX8010SJ_ADDRESS, HEX)); - - if(gpio_chip) { - console.print("XL9555 found, setting up"); - // Configures the GPIO chip for input in every pin - Wire.beginTransmission(XL9555_ADDRESS); - Wire.write(0x06); - Wire.write(0xFF); - Wire.write(0xFF); - Wire.endTransmission(); - } else console.print("XL9555 found not found on address " + String(XL9555_ADDRESS, HEX) + ". Numpad will not work"); TEF = EEPROM.readByte(EE_BYTE_TEF); if(FORBIDDEN_TUNER(TEF)) SetTunerPatch(); - uint16_t device, hw, sw; - radio.getIdentification(&device, &hw, &sw); - if (TEF != (highByte(hw) * 100 + highByte(sw))) SetTunerPatch(); - - if (lowByte(device) == 14) { - fullsearchrds = false; - fmsi = false; - chipmodel = 0; - console.print("Detected a TEF6686 Lithio"); - } else if (lowByte(device) == 1) { - fullsearchrds = true; - chipmodel = 1; - console.print("Detected a TEF6687 Lithio FMSI"); - } else if (lowByte(device) == 9) { - fullsearchrds = false; - chipmodel = 2; - fmsi = false; - console.print("Detected a TEF6688 Lithio DR"); - } else if (lowByte(device) == 3) { - fullsearchrds = true; - chipmodel = 3; - console.print("Detected a TEF6689 Lithio FMSI DR"); - } - console.print("Chip Patch: v" + String(TEF)); - - if(analogRead(BATTERY_PIN) < 200) batterydetect = false; - else console.print("Battery detected."); + if(esp_reset_reason() != ESP_RST_DEEPSLEEP) later_setup_periph(); if(!SPIFFS.exists("/logbook.csv")) { handleCreateNewLogbook(); @@ -1505,28 +1525,6 @@ void setup() { console.print("Init done."); - radio.setVolume(VolSet); - radio.setOffset(LevelOffset); - radio.setAMOffset(AMLevelOffset); - if (band > BAND_GAP) { - radio.setAMCoChannel(amcodect, amcodectcount); - radio.setAMAttenuation(amgain); - } - radio.setStereoLevel(StereoLevel); - radio.setHighCutLevel(HighCutLevel); - radio.setHighCutOffset(HighCutOffset); - radio.clearRDS(fullsearchrds); - radio.setMute(); - if (!StereoToggle) radio.setMono(true); - radio.setSoftmuteFM(softmutefm); - radio.setSoftmuteAM(softmuteam); - radio.setAMNoiseBlanker(amnb); - radio.setFMNoiseBlanker(fmnb); - radio.setAudio(audiomode); - radio.setDeemphasis(fmdeemphasis); - radio.setAGC(fmagc); - radio.setAMAGC(amagc); - if (fmsi) radio.setFMSI(2); else radio.setFMSI(1); LowLevelInit = true; BuildDisplay(); @@ -1624,7 +1622,7 @@ void loop() { } doLog(); DoMemoryPosTune(); - radio.clearRDS(fullsearchrds); + radio.clearRDS(); autologged = false; ShowMemoryPos(); } else { @@ -1735,7 +1733,7 @@ void loop() { dropout = true; if (radio.afmethodB) { afmethodBold = true; - radio.clearRDS(fullsearchrds); + radio.clearRDS(); } } if (XDRGTKUSB || XDRGTKTCP) DataPrint("T" + String((frequency + ConverterSet * 100) * 10) + "\n"); @@ -1756,7 +1754,7 @@ void loop() { dropout = true; if (radio.afmethodB) { afmethodBold = true; - radio.clearRDS(fullsearchrds); + radio.clearRDS(); } if (XDRGTKUSB || XDRGTKTCP) DataPrint("T" + String((frequency + ConverterSet * 100) * 10) + "\n"); if (screenmute) { @@ -1776,7 +1774,7 @@ void loop() { dropout = true; if (radio.afmethodB) { afmethodBold = true; - radio.clearRDS(fullsearchrds); + radio.clearRDS(); } if (XDRGTKUSB || XDRGTKTCP) DataPrint("T" + String((frequency + ConverterSet * 100) * 10) + "\n"); store = true; @@ -2367,7 +2365,7 @@ void SelectBand() { tftReplace(ALEFT, "kHz", "MHz", 258, 76, ActiveColor, ActiveColorSmooth, BackgroundColor, 28); } - if (!leave) radio.clearRDS(fullsearchrds); + if (!leave) radio.clearRDS(); ShowFreq(0); if (!screenmute) { @@ -2690,7 +2688,7 @@ void KeyUp() { if (band == BAND_FM) DataPrint("M0\nT" + String(frequency * 10) + "\n"); else if (band == BAND_OIRT) DataPrint("M0\nT" + String(frequency_OIRT * 10) + "\n"); else DataPrint("M1\nT" + String(frequency_AM) + "\n"); } if (!memorystore) { - if (!memtune) radio.clearRDS(fullsearchrds); + if (!memtune) radio.clearRDS(); memtune = false; ShowFreq(0); store = true; @@ -2751,7 +2749,7 @@ void KeyDown() { if (band == BAND_FM) DataPrint("M0\nT" + String(frequency * 10) + "\n"); else if (band == BAND_OIRT) DataPrint("M0\nT" + String(frequency_OIRT * 10) + "\n"); else DataPrint("M1\nT" + String(frequency_AM) + "\n"); } if (!memorystore) { - if (!memtune) radio.clearRDS(fullsearchrds); + if (!memtune) radio.clearRDS(); memtune = false; ShowFreq(0); store = true; @@ -2797,7 +2795,7 @@ void ShowMemoryPos() { void DoMemoryPosTune() { if (spispeed == 7) tft.setSPISpeed(50); - radio.clearRDS(fullsearchrds); + radio.clearRDS(); if (IsStationEmpty()) { memoryposstatus = MEM_DARK; @@ -3639,7 +3637,7 @@ void TuneUp() { radio.SetFreqAM(frequency_AM); frequency_SW = frequency_AM; } - radio.clearRDS(fullsearchrds); + radio.clearRDS(); if (RDSSPYUSB) Serial.print("G:\r\nRESET-------\r\n\r\n"); if (RDSSPYTCP) RemoteClient.print("G:\r\nRESET-------\r\n\r\n"); } @@ -3726,7 +3724,7 @@ void TuneDown() { radio.SetFreqAM(frequency_AM); frequency_SW = frequency_AM; } - radio.clearRDS(fullsearchrds); + radio.clearRDS(); if (RDSSPYUSB) Serial.print("G:\r\nRESET-------\r\n\r\n"); if (RDSSPYTCP) RemoteClient.print("G:\r\nRESET-------\r\n\r\n"); } @@ -3904,7 +3902,7 @@ uint8_t doAutoMemory(uint16_t startfreq, uint16_t stopfreq, uint8_t startmem, ui percent = (currentIteration * 100) / totalIterations; radio.SetFreq(frequency); - radio.clearRDS(fullsearchrds); + radio.clearRDS(); delay(50); radio.getStatus(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus, &CN); if ((USN < fmscansens * 30) && (WAM < 230) && (OStatus < 80 && OStatus > -80)) { @@ -3982,7 +3980,7 @@ uint8_t doAutoMemory(uint16_t startfreq, uint16_t stopfreq, uint8_t startmem, ui frequency = _current; radio.SetFreq(frequency); - radio.clearRDS(fullsearchrds); + radio.clearRDS(); radio.setUnMute(); SQ = false; diff --git a/src/nonvolatile.cpp b/src/nonvolatile.cpp index a6bab61..4e04ee0 100644 --- a/src/nonvolatile.cpp +++ b/src/nonvolatile.cpp @@ -193,7 +193,7 @@ void loadData() { amgain = EEPROM.readByte(EE_BYTE_AM_RF_GAIN); radio.rds.sortaf = EEPROM.readByte(EE_BYTE_SORTAF); stationlistid = EEPROM.readByte(EE_BYTE_STATIONLISTID); - fmdeemphasis = EEPROM.readByte(EE_BYTE_FM_DEEMPHASIS); + fmdeemphasis = (RADIO_FM_DEEMPHASIS)EEPROM.readByte(EE_BYTE_FM_DEEMPHASIS); BWsetFM = EEPROM.readByte(EE_BYTE_BWSET_FM); BWsetAM = EEPROM.readByte(EE_BYTE_BWSET_AM); nowToggleSWMIBand = EEPROM.readByte(EE_BYTE_BANDAUTOSW); diff --git a/src/rds.cpp b/src/rds.cpp index 5f96122..bfee637 100644 --- a/src/rds.cpp +++ b/src/rds.cpp @@ -349,7 +349,7 @@ void ShowErrors() { void showPI() { if ((radio.rds.region != 0 && (String(radio.rds.picode) != PIold || radio.rds.stationIDtext != stationIDold || radio.rds.stationStatetext != stationStateold)) || (radio.rds.region == 0 && String(radio.rds.picode) != PIold)) { if (!rdsstatscreen && !afscreen && !radio.rds.rdsAerror && !radio.rds.rdsBerror && !radio.rds.rdsCerror && !radio.rds.rdsDerror && radio.rds.rdsA != radio.rds.correctPI && PIold.length() > 1) { - radio.clearRDS(fullsearchrds); + radio.clearRDS(); if (RDSSPYUSB) Serial.print("G:\r\nRESET-------\r\n\r\n"); if (RDSSPYTCP) RemoteClient.print("G:\r\nRESET-------\r\n\r\n"); } diff --git a/src/rtc.cpp b/src/rtc.cpp index 457c183..e35da0f 100644 --- a/src/rtc.cpp +++ b/src/rtc.cpp @@ -6,7 +6,7 @@ bool rtcset; bool NTPupdated; ESP32Time rtc; -RTC_NOINIT_ATTR bool rx_rtc_avail = false; +RTC_DATA_ATTR bool rx_rtc_avail = false; inline int16_t readFromModule(byte address) { Wire.beginTransmission(RX8010SJ_ADDRESS);