way faster wake up from sleep

This commit is contained in:
2026-01-18 21:55:32 +01:00
parent 766dffccc6
commit f9b53f170e
13 changed files with 140 additions and 140 deletions
+2 -2
View File
@@ -542,13 +542,13 @@ class TEF6686 {
void setMono(bool mono); void setMono(bool mono);
bool getStereoStatus(); bool getStereoStatus();
void init(byte TEF); void init(byte TEF);
void clearRDS(bool fullsearchrds); void clearRDS();
void power(bool mode); void power(bool mode);
void setAGC(uint8_t agc); void setAGC(uint8_t agc);
void setAMAGC(uint8_t agc); void setAMAGC(uint8_t agc);
void setiMS(bool mph); void setiMS(bool mph);
void setEQ(bool eq); void setEQ(bool eq);
void setDeemphasis(uint8_t timeconstant); void setDeemphasis(RADIO_FM_DEEMPHASIS timeconstant);
void setAudio(uint8_t audio); void setAudio(uint8_t audio);
void setFMABandw(); void setFMABandw();
void setFMBandw(uint16_t bandwidth); void setFMBandw(uint16_t bandwidth);
+2 -2
View File
@@ -30,7 +30,7 @@ extern bool dynamicPTYold, edgebeep, externaltune;
extern bool findMemoryAF; extern bool findMemoryAF;
extern bool firstTouchHandled; extern bool firstTouchHandled;
extern bool flashing; extern bool flashing;
extern bool fmsi, fullsearchrds; extern bool fmsi;
extern bool hasafold, haseonold; extern bool hasafold, haseonold;
extern bool initdxscan, invertdisplay, leave; extern bool initdxscan, invertdisplay, leave;
extern bool LowLevelInit; extern bool LowLevelInit;
@@ -104,7 +104,7 @@ extern byte fmagc;
extern byte fmscansens; extern byte fmscansens;
extern byte fmdefaultstepsize; extern byte fmdefaultstepsize;
extern byte fmnb; extern byte fmnb;
extern byte fmdeemphasis; extern RADIO_FM_DEEMPHASIS fmdeemphasis;
extern byte freqfont; extern byte freqfont;
extern byte amcodect; extern byte amcodect;
extern byte amcodectcount; extern byte amcodectcount;
+1
View File
@@ -25,6 +25,7 @@
#include "ESP32Time.h" #include "ESP32Time.h"
#include "time.h" #include "time.h"
#include <sys/time.h> #include <sys/time.h>
#include "esp_attr.h"
#ifdef RTC_DATA_ATTR #ifdef RTC_DATA_ATTR
RTC_DATA_ATTR static bool overflow; RTC_DATA_ATTR static bool overflow;
+1 -3
View File
@@ -23,9 +23,7 @@
*/ */
#pragma once #pragma once
#include <time.h>
#include <Arduino.h>
class ESP32Time { class ESP32Time {
public: public:
-1
View File
@@ -16,6 +16,5 @@
"maintainer": true "maintainer": true
} }
], ],
"frameworks": "arduino",
"platforms": "espressif8266, espressif32" "platforms": "espressif8266, espressif32"
} }
+25 -19
View File
@@ -7,6 +7,7 @@
uint8_t dropped_groups = 0; uint8_t dropped_groups = 0;
bool lastBitState = false; bool lastBitState = false;
bool fullsearchrds = false;
uint16_t TEF6686::getBlockA() { uint16_t TEF6686::getBlockA() {
uint16_t blockA; 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_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_Ana_Out, 4, 128, 1);
devTEF_Set_Cmd(TEF_AUDIO, Cmd_Set_Output_Source, 4, 128, 224); 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) { void TEF6686::getIdentification(uint16_t *device, uint16_t *hw_version, uint16_t *sw_version) {
uint8_t buf[6]; uint8_t buf[6];
devTEF_Get_Cmd(TEF_APPL, Cmd_Get_Identification, buf, sizeof(buf)); devTEF_Get_Cmd(TEF_APPL, Cmd_Get_Identification, buf, sizeof(buf));
*device = Convert8bto16b(buf); if(device != NULL) *device = Convert8bto16b(buf);
*hw_version = Convert8bto16b(buf + 2); if(hw_version != NULL) *hw_version = Convert8bto16b(buf + 2);
*sw_version = Convert8bto16b(buf + 4); if(sw_version != NULL) *sw_version = Convert8bto16b(buf + 4);
} }
void TEF6686::power(bool mode) { 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)); r = devTEF_Get_Cmd(TEF_FM, Cmd_Get_Signal_Status, buf, sizeof(buf));
status = Convert8bto16b(buf); status = Convert8bto16b(buf);
bool stereo = 0; bool stereo = false;
if(r) stereo = ((status >> 15) & 1) ? 1 : 0; if(r) stereo = ((status >> 15) & 1) ? 1 : 0;
return stereo; return stereo;
} }
@@ -258,17 +264,17 @@ void TEF6686::setUnMute() {
} }
void TEF6686::setAGC(uint8_t agc) { 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) { 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) { switch (timeconstant) {
case 1: devTEF_Set_Cmd(TEF_FM, Cmd_Set_Deemphasis, 2, 500); break; case DEEMPHASIS_50: 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_75: devTEF_Set_Cmd(TEF_FM, Cmd_Set_Deemphasis, 2, 750); break;
default: devTEF_Set_Cmd(TEF_FM, Cmd_Set_Deemphasis, 2, 0); 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) { 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]; uint8_t buf[14];
devTEF_Get_Cmd(TEF_AM, Cmd_Get_Quality_Data, buf, sizeof(buf)); devTEF_Get_Cmd(TEF_AM, Cmd_Get_Quality_Data, buf, sizeof(buf));
*level = Convert8bto16b(buf + 2); if(level != NULL) *level = Convert8bto16b(buf + 2);
*noise = Convert8bto16b(buf + 4); if(noise != NULL) *noise = Convert8bto16b(buf + 4);
*cochannel = Convert8bto16b(buf + 6); if(cochannel != NULL) *cochannel = Convert8bto16b(buf + 6);
*offset = Convert8bto16b(buf + 8); if(offset != NULL) *offset = Convert8bto16b(buf + 8);
*bandwidth = Convert8bto16b(buf + 10) / 10; if(bandwidth != NULL) *bandwidth = Convert8bto16b(buf + 10) / 10;
*modulation = Convert8bto16b(buf + 12) / 10; if(modulation != NULL) *modulation = Convert8bto16b(buf + 12) / 10;
if (*level < -200) *level = -200; if(level != NULL && *level < -200) *level = -200;
if (*level > 1200) *level = 1200; if(level != NULL && *level > 1200) *level = 1200;
*snr = int(0.46222375 * (float)(*level) / 10 - 0.082495118 * (float)(*noise / 50) / 10) + 10; if(snr != NULL) *snr = int(0.46222375 * (float)(*level) / 10 - 0.082495118 * (float)(*noise / 50) / 10) + 10;
} }
void TEF6686::readRDS(byte showrdserrors) { 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); devTEF_Set_Cmd(TEF_FM, Cmd_Set_RDS, 6, fullsearchrds ? 3 : 1, 1, 0);
rds.piBuffer.clear(); rds.piBuffer.clear();
rds.stationName = rds.stationText = rds.stationNameLong = ""; rds.stationName = rds.stationText = rds.stationNameLong = "";
+7 -8
View File
@@ -47,7 +47,7 @@ void Communication() {
uint16_t freqtemp = packet.substring(2).toInt(); uint16_t freqtemp = packet.substring(2).toInt();
if(BAND_FM) freqtemp -= ConverterSet * 1000; if(BAND_FM) freqtemp -= ConverterSet * 1000;
if(seek) seek = false; if(seek) seek = false;
radio.clearRDS(fullsearchrds); radio.clearRDS();
if(freqtemp >= LowEdgeOIRTSet && freqtemp <= HighEdgeOIRTSet) { if(freqtemp >= LowEdgeOIRTSet && freqtemp <= HighEdgeOIRTSet) {
frequency_OIRT = freqtemp; frequency_OIRT = freqtemp;
@@ -78,8 +78,7 @@ void Communication() {
case 'S': {if (!scandxmode) startFMDXScan(); break;} case 'S': {if (!scandxmode) startFMDXScan(); break;}
case 'E': {if (scandxmode) cancelDXScan(); break;} case 'E': {if (scandxmode) cancelDXScan(); break;}
case 'R': {radio.clearRDS(); break;}
case 'R': {radio.clearRDS(fullsearchrds); break;}
} }
return; return;
} }
@@ -152,7 +151,7 @@ void Communication() {
} }
} }
radio.clearRDS(fullsearchrds); radio.clearRDS();
ShowFreq(0); ShowFreq(0);
store = true; store = true;
externaltune = false; externaltune = false;
@@ -207,7 +206,7 @@ void Communication() {
frequency = freq.toInt(); frequency = freq.toInt();
if (scandxmode) cancelDXScan(); if (scandxmode) cancelDXScan();
radio.SetFreq(frequency); radio.SetFreq(frequency);
radio.clearRDS(fullsearchrds); radio.clearRDS();
if (band != BAND_FM) { if (band != BAND_FM) {
band = BAND_FM; band = BAND_FM;
SelectBand(); SelectBand();
@@ -371,7 +370,7 @@ void Communication() {
if (scandxmode) cancelDXScan(); if (scandxmode) cancelDXScan();
radio.SetFreq(frequency); radio.SetFreq(frequency);
if (afscreen) BuildAdvancedRDS(); if (afscreen) BuildAdvancedRDS();
radio.clearRDS(fullsearchrds); radio.clearRDS();
if (band != BAND_FM) { if (band != BAND_FM) {
band = BAND_FM; band = BAND_FM;
SelectBand(); SelectBand();
@@ -619,7 +618,7 @@ void XDRGTKRoutine() {
DataPrint("M0\n"); DataPrint("M0\n");
DataPrint("T" + String((frequency + ConverterSet * 100) * 10) + "\n"); DataPrint("T" + String((frequency + ConverterSet * 100) * 10) + "\n");
radio.SetFreq(frequency); radio.SetFreq(frequency);
radio.clearRDS(fullsearchrds); radio.clearRDS();
RDSstatus = false; RDSstatus = false;
} }
store = true; store = true;
@@ -630,7 +629,7 @@ void XDRGTKRoutine() {
if(BAND_FM) freqtemp -= ConverterSet * 1000; if(BAND_FM) freqtemp -= ConverterSet * 1000;
if(seek) seek = false; if(seek) seek = false;
radio.clearRDS(fullsearchrds); radio.clearRDS();
if (freqtemp >= LWLowEdgeSet && freqtemp <= LWHighEdgeSet) { if (freqtemp >= LWLowEdgeSet && freqtemp <= LWHighEdgeSet) {
frequency_LW = freqtemp; frequency_LW = freqtemp;
+7 -5
View File
@@ -9,7 +9,9 @@ bool Data_Accelerator = false;
bool advancedRDS, afmethodBold, afpage; bool advancedRDS, afmethodBold, afpage;
bool afscreen, aftest; bool afscreen, aftest;
bool autoDST, autolog, autologged; 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 beepresetstop, BWreset, bwtouchtune;
bool BWtune, change, clockampm; bool BWtune, change, clockampm;
bool direction, dropout; bool direction, dropout;
@@ -17,7 +19,7 @@ bool dynamicPTYold, edgebeep, externaltune;
bool findMemoryAF; bool findMemoryAF;
bool firstTouchHandled = false; bool firstTouchHandled = false;
bool flashing; bool flashing;
bool fmsi, fullsearchrds; RTC_DATA_ATTR bool fmsi;
bool hasafold, haseonold; bool hasafold, haseonold;
bool initdxscan, invertdisplay, leave; bool initdxscan, invertdisplay, leave;
bool LowLevelInit; bool LowLevelInit;
@@ -80,7 +82,7 @@ byte BWsetFM;
byte BWsetRecall; byte BWsetRecall;
byte BWtemp; byte BWtemp;
byte charwidth = 8; byte charwidth = 8;
byte chipmodel; RTC_DATA_ATTR byte chipmodel;
byte hardwaremodel; byte hardwaremodel;
byte ContrastSet; byte ContrastSet;
byte CurrentTheme; byte CurrentTheme;
@@ -91,7 +93,7 @@ byte fmagc;
byte fmscansens; byte fmscansens;
byte fmdefaultstepsize; byte fmdefaultstepsize;
byte fmnb; byte fmnb;
byte fmdeemphasis; RTC_DATA_ATTR RADIO_FM_DEEMPHASIS fmdeemphasis;
byte freqfont; byte freqfont;
byte amcodect; byte amcodect;
byte amcodectcount; byte amcodectcount;
@@ -219,7 +221,7 @@ int8_t LowLevelSet;
int8_t NTPoffset; int8_t NTPoffset;
int8_t CN; int8_t CN;
int8_t CNold; int8_t CNold;
int8_t VolSet; RTC_DATA_ATTR int8_t VolSet;
float batteryVold; float batteryVold;
IPAddress remoteip; IPAddress remoteip;
String AIDString; String AIDString;
+6 -9
View File
@@ -3490,11 +3490,11 @@ void MenuUpDown(bool dir) {
case ITEM7: case ITEM7:
if (dir) { if (dir) {
fmdeemphasis++; fmdeemphasis = (RADIO_FM_DEEMPHASIS)(fmdeemphasis+1);
if (fmdeemphasis > DEEMPHASIS_COUNT - 1) fmdeemphasis = DEEMPHASIS_NONE; if (fmdeemphasis > DEEMPHASIS_COUNT - 1) fmdeemphasis = DEEMPHASIS_NONE;
} else { } else {
fmdeemphasis--; fmdeemphasis = (RADIO_FM_DEEMPHASIS)(fmdeemphasis-1);
if (fmdeemphasis > DEEMPHASIS_COUNT - 1) fmdeemphasis = DEEMPHASIS_COUNT - 1; if (fmdeemphasis > DEEMPHASIS_COUNT - 1) fmdeemphasis = (RADIO_FM_DEEMPHASIS)(DEEMPHASIS_COUNT - 1);
} }
OneBigLineSprite.setTextDatum(TL_DATUM); OneBigLineSprite.setTextDatum(TL_DATUM);
@@ -3952,7 +3952,7 @@ void MenuUpDown(bool dir) {
break; break;
case ITEM9: case ITEM9:
if (fullsearchrds) { if (chipmodel == 1 || chipmodel == 3) {
fmsi = !fmsi; fmsi = !fmsi;
OneBigLineSprite.drawString((fmsi ? textUI(28) : textUI(27)), 135, 0); OneBigLineSprite.drawString((fmsi ? textUI(28) : textUI(27)), 135, 0);
OneBigLineSprite.pushSprite(24, 118); OneBigLineSprite.pushSprite(24, 118);
@@ -5083,13 +5083,10 @@ void DoMenu() {
break; break;
case ITEM9: case ITEM9:
if (fullsearchrds) { if(chipmodel == 1 || chipmodel == 3) {
Infoboxprint(textUI(203)); Infoboxprint(textUI(203));
OneBigLineSprite.drawString((fmsi ? textUI(28) : textUI(27)), 135, 0); OneBigLineSprite.drawString((fmsi ? textUI(28) : textUI(27)), 135, 0);
} else { } else Infoboxprint(textUI(204));
Infoboxprint(textUI(204));
}
OneBigLineSprite.pushSprite(24, 118); OneBigLineSprite.pushSprite(24, 118);
break; break;
+85 -87
View File
@@ -24,8 +24,8 @@ using fs::FS;
#pragma endregion #pragma endregion
Console console(&tft); Console console(&tft);
RTC_NOINIT_ATTR bool gpio_chip = false; RTC_DATA_ATTR bool gpio_chip = false;
RTC_NOINIT_ATTR bool tef_found = false; RTC_DATA_ATTR bool tef_found = false;
template<typename... Args> template<typename... Args>
void panic(Args... args) { void panic(Args... args) {
@@ -838,7 +838,7 @@ void TuneFreq(int temp) {
aftest = true; aftest = true;
aftimer = millis(); aftimer = millis();
radio.clearRDS(fullsearchrds); radio.clearRDS();
if (RDSSPYUSB) Serial.print("G:\r\nRESET-------\r\n\r\n"); if (RDSSPYUSB) Serial.print("G:\r\nRESET-------\r\n\r\n");
if (RDSSPYTCP) RemoteClient.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() { void doBandToggle() {
if (tunemode != TUNE_MEM) { if (tunemode != TUNE_MEM) {
ToggleBand(band); ToggleBand(band);
radio.clearRDS(fullsearchrds); radio.clearRDS();
StoreFrequency(); StoreFrequency();
SelectBand(); SelectBand();
if (XDRGTKUSB || XDRGTKTCP) { 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 (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 (!memorystore) {
if (!memtune) radio.clearRDS(fullsearchrds); if (!memtune) radio.clearRDS();
memtune = false; memtune = false;
ShowFreq(0); ShowFreq(0);
store = true; store = true;
@@ -1089,7 +1089,7 @@ void setAutoSpeedSPI() {
void endMenu() { void endMenu() {
if(rds_settings_changed) { if(rds_settings_changed) {
radio.clearRDS(fullsearchrds); radio.clearRDS();
RDSstatus = false; RDSstatus = false;
} }
rds_settings_changed = menu = false; rds_settings_changed = menu = false;
@@ -1205,11 +1205,77 @@ void setup_periph() {
Serial.end(); Serial.end();
Wire.setClock(100000); 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) { 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? // 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); 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(); void read_encoder();
@@ -1285,7 +1351,6 @@ void setup() {
} }
tft.init(); tft.init();
tft.initDMA();
tft.loadFont(FONT48, 2); tft.loadFont(FONT48, 2);
@@ -1436,56 +1501,11 @@ void setup() {
while (true) delay(1); 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); TEF = EEPROM.readByte(EE_BYTE_TEF);
if(FORBIDDEN_TUNER(TEF)) SetTunerPatch(); if(FORBIDDEN_TUNER(TEF)) SetTunerPatch();
uint16_t device, hw, sw; if(esp_reset_reason() != ESP_RST_DEEPSLEEP) later_setup_periph();
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(!SPIFFS.exists("/logbook.csv")) { if(!SPIFFS.exists("/logbook.csv")) {
handleCreateNewLogbook(); handleCreateNewLogbook();
@@ -1505,28 +1525,6 @@ void setup() {
console.print("Init done."); 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; LowLevelInit = true;
BuildDisplay(); BuildDisplay();
@@ -1624,7 +1622,7 @@ void loop() {
} }
doLog(); doLog();
DoMemoryPosTune(); DoMemoryPosTune();
radio.clearRDS(fullsearchrds); radio.clearRDS();
autologged = false; autologged = false;
ShowMemoryPos(); ShowMemoryPos();
} else { } else {
@@ -1735,7 +1733,7 @@ void loop() {
dropout = true; dropout = true;
if (radio.afmethodB) { if (radio.afmethodB) {
afmethodBold = true; afmethodBold = true;
radio.clearRDS(fullsearchrds); radio.clearRDS();
} }
} }
if (XDRGTKUSB || XDRGTKTCP) DataPrint("T" + String((frequency + ConverterSet * 100) * 10) + "\n"); if (XDRGTKUSB || XDRGTKTCP) DataPrint("T" + String((frequency + ConverterSet * 100) * 10) + "\n");
@@ -1756,7 +1754,7 @@ void loop() {
dropout = true; dropout = true;
if (radio.afmethodB) { if (radio.afmethodB) {
afmethodBold = true; afmethodBold = true;
radio.clearRDS(fullsearchrds); radio.clearRDS();
} }
if (XDRGTKUSB || XDRGTKTCP) DataPrint("T" + String((frequency + ConverterSet * 100) * 10) + "\n"); if (XDRGTKUSB || XDRGTKTCP) DataPrint("T" + String((frequency + ConverterSet * 100) * 10) + "\n");
if (screenmute) { if (screenmute) {
@@ -1776,7 +1774,7 @@ void loop() {
dropout = true; dropout = true;
if (radio.afmethodB) { if (radio.afmethodB) {
afmethodBold = true; afmethodBold = true;
radio.clearRDS(fullsearchrds); radio.clearRDS();
} }
if (XDRGTKUSB || XDRGTKTCP) DataPrint("T" + String((frequency + ConverterSet * 100) * 10) + "\n"); if (XDRGTKUSB || XDRGTKTCP) DataPrint("T" + String((frequency + ConverterSet * 100) * 10) + "\n");
store = true; store = true;
@@ -2367,7 +2365,7 @@ void SelectBand() {
tftReplace(ALEFT, "kHz", "MHz", 258, 76, ActiveColor, ActiveColorSmooth, BackgroundColor, 28); tftReplace(ALEFT, "kHz", "MHz", 258, 76, ActiveColor, ActiveColorSmooth, BackgroundColor, 28);
} }
if (!leave) radio.clearRDS(fullsearchrds); if (!leave) radio.clearRDS();
ShowFreq(0); ShowFreq(0);
if (!screenmute) { 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 (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 (!memorystore) {
if (!memtune) radio.clearRDS(fullsearchrds); if (!memtune) radio.clearRDS();
memtune = false; memtune = false;
ShowFreq(0); ShowFreq(0);
store = true; 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 (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 (!memorystore) {
if (!memtune) radio.clearRDS(fullsearchrds); if (!memtune) radio.clearRDS();
memtune = false; memtune = false;
ShowFreq(0); ShowFreq(0);
store = true; store = true;
@@ -2797,7 +2795,7 @@ void ShowMemoryPos() {
void DoMemoryPosTune() { void DoMemoryPosTune() {
if (spispeed == 7) tft.setSPISpeed(50); if (spispeed == 7) tft.setSPISpeed(50);
radio.clearRDS(fullsearchrds); radio.clearRDS();
if (IsStationEmpty()) { if (IsStationEmpty()) {
memoryposstatus = MEM_DARK; memoryposstatus = MEM_DARK;
@@ -3639,7 +3637,7 @@ void TuneUp() {
radio.SetFreqAM(frequency_AM); radio.SetFreqAM(frequency_AM);
frequency_SW = frequency_AM; frequency_SW = frequency_AM;
} }
radio.clearRDS(fullsearchrds); radio.clearRDS();
if (RDSSPYUSB) Serial.print("G:\r\nRESET-------\r\n\r\n"); if (RDSSPYUSB) Serial.print("G:\r\nRESET-------\r\n\r\n");
if (RDSSPYTCP) RemoteClient.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); radio.SetFreqAM(frequency_AM);
frequency_SW = frequency_AM; frequency_SW = frequency_AM;
} }
radio.clearRDS(fullsearchrds); radio.clearRDS();
if (RDSSPYUSB) Serial.print("G:\r\nRESET-------\r\n\r\n"); if (RDSSPYUSB) Serial.print("G:\r\nRESET-------\r\n\r\n");
if (RDSSPYTCP) RemoteClient.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; percent = (currentIteration * 100) / totalIterations;
radio.SetFreq(frequency); radio.SetFreq(frequency);
radio.clearRDS(fullsearchrds); radio.clearRDS();
delay(50); delay(50);
radio.getStatus(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus, &CN); radio.getStatus(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus, &CN);
if ((USN < fmscansens * 30) && (WAM < 230) && (OStatus < 80 && OStatus > -80)) { 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; frequency = _current;
radio.SetFreq(frequency); radio.SetFreq(frequency);
radio.clearRDS(fullsearchrds); radio.clearRDS();
radio.setUnMute(); radio.setUnMute();
SQ = false; SQ = false;
+1 -1
View File
@@ -193,7 +193,7 @@ void loadData() {
amgain = EEPROM.readByte(EE_BYTE_AM_RF_GAIN); amgain = EEPROM.readByte(EE_BYTE_AM_RF_GAIN);
radio.rds.sortaf = EEPROM.readByte(EE_BYTE_SORTAF); radio.rds.sortaf = EEPROM.readByte(EE_BYTE_SORTAF);
stationlistid = EEPROM.readByte(EE_BYTE_STATIONLISTID); 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); BWsetFM = EEPROM.readByte(EE_BYTE_BWSET_FM);
BWsetAM = EEPROM.readByte(EE_BYTE_BWSET_AM); BWsetAM = EEPROM.readByte(EE_BYTE_BWSET_AM);
nowToggleSWMIBand = EEPROM.readByte(EE_BYTE_BANDAUTOSW); nowToggleSWMIBand = EEPROM.readByte(EE_BYTE_BANDAUTOSW);
+1 -1
View File
@@ -349,7 +349,7 @@ void ShowErrors() {
void showPI() { 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 ((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) { 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 (RDSSPYUSB) Serial.print("G:\r\nRESET-------\r\n\r\n");
if (RDSSPYTCP) RemoteClient.print("G:\r\nRESET-------\r\n\r\n"); if (RDSSPYTCP) RemoteClient.print("G:\r\nRESET-------\r\n\r\n");
} }
+1 -1
View File
@@ -6,7 +6,7 @@ bool rtcset;
bool NTPupdated; bool NTPupdated;
ESP32Time rtc; ESP32Time rtc;
RTC_NOINIT_ATTR bool rx_rtc_avail = false; RTC_DATA_ATTR bool rx_rtc_avail = false;
inline int16_t readFromModule(byte address) { inline int16_t readFromModule(byte address) {
Wire.beginTransmission(RX8010SJ_ADDRESS); Wire.beginTransmission(RX8010SJ_ADDRESS);