faster wake up

This commit is contained in:
2026-01-18 14:32:42 +01:00
parent 0ee9fc32c3
commit 766dffccc6
14 changed files with 82 additions and 82 deletions

View File

@@ -1,10 +1,6 @@
#pragma once #pragma once
#ifndef DEEPELEC_DP_66X
#define FORBIDDEN_TUNER(x) ((x) != 102 && (x) != 205) #define FORBIDDEN_TUNER(x) ((x) != 102 && (x) != 205)
#else
#define FORBIDDEN_TUNER(x) ((x) != 102)
#endif
void Tuner_Patch(byte TEF); void Tuner_Patch(byte TEF);
bool Tuner_WriteBuffer(unsigned char *buf, uint16_t len); bool Tuner_WriteBuffer(unsigned char *buf, uint16_t len);

View File

@@ -1,6 +1,7 @@
#pragma once #pragma once
#include "globals.h" #include "globals.h"
#include "nonvolatile.h"
#include <Hash.h> #include <Hash.h>
void Communication(); void Communication();
@@ -35,4 +36,3 @@ extern void TuneUp();
extern void TuneDown(); extern void TuneDown();
extern void ShowTuneMode(); extern void ShowTuneMode();
extern const char* textUI(uint16_t number); extern const char* textUI(uint16_t number);
extern void saveData();

View File

@@ -315,7 +315,7 @@
#define EE_BYTE_AMSCANSENS 2200 #define EE_BYTE_AMSCANSENS 2200
#define EE_BYTE_FMSCANSENS 2201 #define EE_BYTE_FMSCANSENS 2201
#define EE_BYTE_FREQFONT 2202 #define EE_BYTE_FREQFONT 2202
#define EE_BYTE_SKIN 2203 // Empty space, this was not used
#define EE_BYTE_XDRGTKMUTE 2204 #define EE_BYTE_XDRGTKMUTE 2204
#define EE_BYTE_FMAGC 2205 #define EE_BYTE_FMAGC 2205
#define EE_BYTE_AMAGC 2206 #define EE_BYTE_AMAGC 2206

View File

@@ -96,7 +96,6 @@ extern byte charwidth;
extern byte chipmodel; extern byte chipmodel;
extern byte hardwaremodel; extern byte hardwaremodel;
extern byte ContrastSet; extern byte ContrastSet;
extern byte CurrentSkin;
extern byte CurrentTheme; extern byte CurrentTheme;
extern byte displayflip; extern byte displayflip;
extern byte eonptyold[20]; extern byte eonptyold[20];
@@ -172,7 +171,7 @@ extern int batupdatetimer;
extern int berPercentold; extern int berPercentold;
extern int BWAutoColor; extern int BWAutoColor;
extern int BWAutoColorSmooth; extern int BWAutoColorSmooth;
extern int BWOld; extern uint16_t BWOld;
extern int bwupdatetimer; extern int bwupdatetimer;
extern int DisplayedSegments; extern int DisplayedSegments;
extern int ForceMono; extern int ForceMono;

View File

@@ -1,3 +1,4 @@
#pragma once
#include <EEPROM.h> #include <EEPROM.h>
#include "globals.h" #include "globals.h"
#include "logbook.h" #include "logbook.h"

View File

@@ -20,12 +20,15 @@ build_flags =
-Wl,--gc-sections -Wl,--gc-sections
-Werror -Werror
-Wno-error=missing-field-initializers -Wno-error=missing-field-initializers
-std=gnu++17
monitor_filters = monitor_filters =
esp32_exception_decoder esp32_exception_decoder
default default
build_unflags = build_unflags =
-fexceptions -fexceptions
-frtti -frtti
-std=gnu++11
-std=gnu++14
extra_scripts = pre:extra_script.py extra_scripts = pre:extra_script.py

View File

@@ -104,6 +104,8 @@ uint16_t TEF6686::TestAF() {
} }
void TEF6686::init(byte TEF) { void TEF6686::init(byte TEF) {
auto old_clock = Wire.getClock();
Wire.setClock(400000);
Tuner_Reset(); Tuner_Reset();
while(devTEF_APPL_Get_Operation_Status() != 0) delay(2); while(devTEF_APPL_Get_Operation_Status() != 0) delay(2);
@@ -132,6 +134,7 @@ void TEF6686::init(byte TEF) {
while(devTEF_APPL_Get_Operation_Status() != 2) delay(2); // Wait for it to start while(devTEF_APPL_Get_Operation_Status() != 2) delay(2); // Wait for it to start
Wire.setClock(old_clock);
devTEF_Set_Cmd(TEF_FM, Cmd_Set_Highcut_Mph, 6, 0, 360, 300); devTEF_Set_Cmd(TEF_FM, Cmd_Set_Highcut_Mph, 6, 0, 360, 300);
devTEF_Set_Cmd(TEF_FM, Cmd_Set_Highcut_Max, 4, 0, 4000); devTEF_Set_Cmd(TEF_FM, Cmd_Set_Highcut_Max, 4, 0, 4000);
devTEF_Set_Cmd(TEF_FM, Cmd_Set_LowCut_Max, 4, 0, 100); devTEF_Set_Cmd(TEF_FM, Cmd_Set_LowCut_Max, 4, 0, 100);

View File

@@ -1,8 +1,6 @@
#include "globals.h" #include "globals.h"
#include "Tuner_Patch_Lithio_V102_p224.h" #include "Tuner_Patch_Lithio_V102_p224.h"
#ifndef DEEPELEC_DP_66X
#include "Tuner_Patch_Lithio_V205_p512.h" #include "Tuner_Patch_Lithio_V205_p512.h"
#endif
#include <Wire.h> #include <Wire.h>
bool Tuner_WriteBuffer(unsigned char *buf, uint16_t len) { bool Tuner_WriteBuffer(unsigned char *buf, uint16_t len) {
@@ -64,11 +62,9 @@ void Tuner_Patch(byte TEF) {
case 102: case 102:
Tuner_Patch_Load(pPatchBytes102, PatchSize102); Tuner_Patch_Load(pPatchBytes102, PatchSize102);
break; break;
#ifndef DEEPELEC_DP_66X
case 205: case 205:
Tuner_Patch_Load(pPatchBytes205, PatchSize205); Tuner_Patch_Load(pPatchBytes205, PatchSize205);
break; break;
#endif
} }
Wire.beginTransmission(TEF668X_ADDRESS); Wire.beginTransmission(TEF668X_ADDRESS);
Wire.write(0x1c); Wire.write(0x1c);
@@ -84,11 +80,9 @@ void Tuner_Patch(byte TEF) {
case 102: case 102:
Tuner_Patch_Load(pLutBytes102, LutSize102); Tuner_Patch_Load(pLutBytes102, LutSize102);
break; break;
#ifndef DEEPELEC_DP_66X
case 205: case 205:
Tuner_Patch_Load(pLutBytes205, LutSize205); Tuner_Patch_Load(pLutBytes205, LutSize205);
break; break;
#endif
} }
Wire.beginTransmission(TEF668X_ADDRESS); Wire.beginTransmission(TEF668X_ADDRESS);
Wire.write(0x1c); Wire.write(0x1c);

View File

@@ -83,7 +83,6 @@ byte charwidth = 8;
byte chipmodel; byte chipmodel;
byte hardwaremodel; byte hardwaremodel;
byte ContrastSet; byte ContrastSet;
byte CurrentSkin;
byte CurrentTheme; byte CurrentTheme;
byte displayflip; byte displayflip;
byte eonptyold[20]; byte eonptyold[20];
@@ -159,7 +158,7 @@ int batupdatetimer;
int berPercentold; int berPercentold;
int BWAutoColor; int BWAutoColor;
int BWAutoColorSmooth; int BWAutoColorSmooth;
int BWOld; uint16_t BWOld;
int bwupdatetimer; int bwupdatetimer;
int DisplayedSegments; int DisplayedSegments;
int ForceMono; int ForceMono;

View File

@@ -8,7 +8,7 @@ bool setWiFiConnectParam = false;
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: // Default PE5PVB theme case 0: // Essence
PrimaryColor = Yellow; PrimaryColor = Yellow;
PrimaryColorSmooth = YellowSmooth; PrimaryColorSmooth = YellowSmooth;
SecondaryColor = Skyblue; SecondaryColor = Skyblue;
@@ -2845,7 +2845,7 @@ void BuildMenu() {
tftPrint(ACENTER, textUI(29), 160, 6, PrimaryColor, PrimaryColorSmooth, 16); tftPrint(ACENTER, textUI(29), 160, 6, PrimaryColor, PrimaryColorSmooth, 16);
} else { } else {
tftPrint(ALEFT, textUI(181), (hardwaremodel == PORTABLE_TOUCH_ILI9341 ? 20 : 8), 6, PrimaryColor, PrimaryColorSmooth, 16); tftPrint(ALEFT, textUI(181), (hardwaremodel == PORTABLE_TOUCH_ILI9341 ? 20 : 8), 6, PrimaryColor, PrimaryColorSmooth, 16);
tftPrint(ARIGHT, textUI(189 + menupage - 1), 312, 6, ActiveColor, ActiveColorSmooth, 16); tftPrint(ARIGHT, textUI(186 + menupage - 1), 312, 6, ActiveColor, ActiveColorSmooth, 16);
} }
if (hardwaremodel == PORTABLE_TOUCH_ILI9341) { if (hardwaremodel == PORTABLE_TOUCH_ILI9341) {

View File

@@ -406,11 +406,9 @@ void sendUDPlog() {
String CHIP = ""; String CHIP = "";
switch (chipmodel) { switch (chipmodel) {
case 0: CHIP = "TEF6686"; break; case 0: CHIP = "TEF6686"; break;
#ifndef DEEPELEC_DP_66X
case 1: CHIP = "TEF6687"; break; case 1: CHIP = "TEF6687"; break;
case 2: CHIP = "TEF6688"; break; case 2: CHIP = "TEF6688"; break;
case 3: CHIP = "TEF6689"; break; case 3: CHIP = "TEF6689"; break;
#endif
} }
String RTPLUS = ""; String RTPLUS = "";

View File

@@ -24,7 +24,18 @@ using fs::FS;
#pragma endregion #pragma endregion
Console console(&tft); Console console(&tft);
bool gpio_chip = false; RTC_NOINIT_ATTR bool gpio_chip = false;
RTC_NOINIT_ATTR bool tef_found = false;
template<typename... Args>
void panic(Args... args) {
radio.power(1);
tft.fillScreen(TFT_RED);
console.reset();
(console.print(args), ...);
while (true);
}
#pragma region helpers #pragma region helpers
inline void Round30K(unsigned int freq) { inline void Round30K(unsigned int freq) {
@@ -66,7 +77,7 @@ inline void deepSleep() {
MuteScreen(1); MuteScreen(1);
StoreFrequency(); StoreFrequency();
radio.power(1); radio.power(1);
esp_sleep_enable_ext0_wakeup((gpio_num_t)ROTARY_BUTTON, LOW); esp_sleep_enable_ext0_wakeup((gpio_num_t)ROTARY_PIN_A, LOW);
esp_deep_sleep_start(); esp_deep_sleep_start();
} }
@@ -96,7 +107,7 @@ inline void EdgeBeeper() {
radio.tone(50, -5, 2000); radio.tone(50, -5, 2000);
} }
inline const char* textUI(uint16_t number) { const char* textUI(uint16_t number) {
if (number >= language_entrynumber) return "Overflow"; if (number >= language_entrynumber) return "Overflow";
else return (const char*)pgm_read_ptr(&(myLanguage[language][number])); else return (const char*)pgm_read_ptr(&(myLanguage[language][number]));
} }
@@ -167,6 +178,9 @@ void ShowBW() {
else if(!BWtune) return; else if(!BWtune) return;
if (BW != BWOld || BWreset) { if (BW != BWOld || BWreset) {
if(BW == 0) panic("BW is 0");
else if(BW > 311) panic("BW larger than 311");
if(BWset == 0) tftReplace(ARIGHT, String(BWOld, DEC), String(BW, DEC), 203, 4, BWAutoColor, BWAutoColorSmooth, BackgroundColor, 28); else tftReplace(ARIGHT, String (BWOld, DEC), String(BW, DEC), 203, 4, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 28); if(BWset == 0) tftReplace(ARIGHT, String(BWOld, DEC), String(BW, DEC), 203, 4, BWAutoColor, BWAutoColorSmooth, BackgroundColor, 28); else tftReplace(ARIGHT, String (BWOld, DEC), String(BW, DEC), 203, 4, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 28);
BWOld = BW; BWOld = BW;
BWreset = false; BWreset = false;
@@ -1156,26 +1170,8 @@ void MuteScreen(bool setting) {
} }
#pragma endregion #pragma endregion
void read_encoder(); void setup_periph() {
void setup() { Wire.setClock(400000);
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);
gpio_set_drive_capability((gpio_num_t) 5, GPIO_DRIVE_CAP_0);
gpio_set_drive_capability((gpio_num_t) 16, GPIO_DRIVE_CAP_0);
gpio_set_drive_capability((gpio_num_t) 17, GPIO_DRIVE_CAP_0);
gpio_set_drive_capability((gpio_num_t) 18, GPIO_DRIVE_CAP_0);
gpio_set_drive_capability((gpio_num_t) 19, GPIO_DRIVE_CAP_0);
gpio_set_drive_capability((gpio_num_t) 21, GPIO_DRIVE_CAP_0);
gpio_set_drive_capability((gpio_num_t) 22, GPIO_DRIVE_CAP_0);
gpio_set_drive_capability((gpio_num_t) 23, GPIO_DRIVE_CAP_0);
setupmode = true;
bool tef_found = false;
Wire.begin();
Wire.setClock(100000);
delay(1);
Serial.begin(115200); Serial.begin(115200);
Serial.println(); Serial.println();
byte error, address; byte error, address;
@@ -1208,13 +1204,40 @@ void setup() {
Serial.flush(); Serial.flush();
Serial.end(); Serial.end();
Wire.setClock(100000);
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);
}
}
void read_encoder();
void setup() {
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);
gpio_set_drive_capability((gpio_num_t) 5, GPIO_DRIVE_CAP_0);
gpio_set_drive_capability((gpio_num_t) 16, GPIO_DRIVE_CAP_0);
gpio_set_drive_capability((gpio_num_t) 17, GPIO_DRIVE_CAP_0);
gpio_set_drive_capability((gpio_num_t) 18, GPIO_DRIVE_CAP_0);
gpio_set_drive_capability((gpio_num_t) 19, GPIO_DRIVE_CAP_0);
gpio_set_drive_capability((gpio_num_t) 21, GPIO_DRIVE_CAP_0);
gpio_set_drive_capability((gpio_num_t) 22, GPIO_DRIVE_CAP_0);
gpio_set_drive_capability((gpio_num_t) 23, GPIO_DRIVE_CAP_0);
EEPROM.begin(EE_TOTAL_CNT); EEPROM.begin(EE_TOTAL_CNT);
setupmode = true;
Wire.begin();
Wire.setClock(100000);
loadData(); loadData();
if (spispeed == SPI_SPEED_DEFAULT) tft.setSPISpeed(SPI_FREQUENCY / 1000000); if (spispeed == SPI_SPEED_DEFAULT) tft.setSPISpeed(SPI_FREQUENCY / 1000000);
else if (spispeed == 7) setAutoSpeedSPI(); else if (spispeed == 7) setAutoSpeedSPI();
else tft.setSPISpeed(spispeed * 10); else tft.setSPISpeed(spispeed * 10);
if(esp_reset_reason() != ESP_RST_DEEPSLEEP) setup_periph();
LWLowEdgeSet = FREQ_LW_LOW_EDGE_MIN; LWLowEdgeSet = FREQ_LW_LOW_EDGE_MIN;
LWHighEdgeSet = FREQ_LW_HIGH_EDGE_MAX; LWHighEdgeSet = FREQ_LW_HIGH_EDGE_MAX;
MWLowEdgeSet = mwstepsize == false ? FREQ_MW_LOW_EDGE_MIN_9K : FREQ_MW_LOW_EDGE_MIN_10K; MWLowEdgeSet = mwstepsize == false ? FREQ_MW_LOW_EDGE_MIN_9K : FREQ_MW_LOW_EDGE_MIN_10K;
@@ -1436,9 +1459,6 @@ void setup() {
TEF = EEPROM.readByte(EE_BYTE_TEF); TEF = EEPROM.readByte(EE_BYTE_TEF);
if(FORBIDDEN_TUNER(TEF)) SetTunerPatch(); if(FORBIDDEN_TUNER(TEF)) SetTunerPatch();
// 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; uint16_t device, hw, sw;
radio.getIdentification(&device, &hw, &sw); radio.getIdentification(&device, &hw, &sw);
if (TEF != (highByte(hw) * 100 + highByte(sw))) SetTunerPatch(); if (TEF != (highByte(hw) * 100 + highByte(sw))) SetTunerPatch();
@@ -1448,7 +1468,6 @@ void setup() {
fmsi = false; fmsi = false;
chipmodel = 0; chipmodel = 0;
console.print("Detected a TEF6686 Lithio"); console.print("Detected a TEF6686 Lithio");
#ifndef DEEPELEC_DP_66X
} else if (lowByte(device) == 1) { } else if (lowByte(device) == 1) {
fullsearchrds = true; fullsearchrds = true;
chipmodel = 1; chipmodel = 1;
@@ -1462,7 +1481,6 @@ void setup() {
fullsearchrds = true; fullsearchrds = true;
chipmodel = 3; chipmodel = 3;
console.print("Detected a TEF6689 Lithio FMSI DR"); console.print("Detected a TEF6689 Lithio FMSI DR");
#endif
} }
console.print("Chip Patch: v" + String(TEF)); console.print("Chip Patch: v" + String(TEF));
@@ -3078,11 +3096,8 @@ void ShowSignalLevel() {
void ShowOffset() { void ShowOffset() {
if (OStatus != OStatusold) { if (OStatus != OStatusold) {
if (millis() >= offsetupdatetimer + TIMER_OFFSET_TIMER) { if (millis() >= offsetupdatetimer + TIMER_OFFSET_TIMER) offsetupdatetimer = millis();
offsetupdatetimer = millis(); else return;
} else {
return;
}
int baseX = 13; // Left boundary int baseX = 13; // Left boundary
int baseY = 2; // Top boundary int baseY = 2; // Top boundary
@@ -3206,9 +3221,7 @@ void ShowModLevel() {
float h = map(i, gradientStart, gradientEnd, hsv1.h, hsv2.h); float h = map(i, gradientStart, gradientEnd, hsv1.h, hsv2.h);
float s = map(i, gradientStart, gradientEnd, hsv1.s * 100, hsv2.s * 100) / 100.0; float s = map(i, gradientStart, gradientEnd, hsv1.s * 100, hsv2.s * 100) / 100.0;
float v = map(i, gradientStart, gradientEnd, hsv1.v * 100, hsv2.v * 100) / 100.0; float v = map(i, gradientStart, gradientEnd, hsv1.v * 100, hsv2.v * 100) / 100.0;
tft.fillRect(16 + 2 * i, 133, 2, 6, HSVtoRGB565(h, s, v));
uint16_t gradientColor = HSVtoRGB565(h, s, v);
tft.fillRect(16 + 2 * i, 133, 2, 6, gradientColor);
} }
} }
@@ -3234,7 +3247,7 @@ void doSquelch() {
if (unit == 0) SquelchShow = Squelch / 10; if (unit == 0) SquelchShow = Squelch / 10;
if (unit == 1) SquelchShow = ((Squelch * 100) + 10875) / 1000; if (unit == 1) SquelchShow = ((Squelch * 100) + 10875) / 1000;
if (unit == 2) SquelchShow = round((float(Squelch) / 10.0 - 10.0 * log10(75) - 90.0) * 10.0) / 10; if (unit == 2) SquelchShow = round(((float)Squelch / 10.0 - 10.0 * log10(75) - 90.0) * 10.0) / 10;
if (Squelch > 920) Squelch = 920; if (Squelch > 920) Squelch = 920;
if (autosquelch) { if (autosquelch) {
@@ -3415,12 +3428,10 @@ void doTuneMode() {
else tunemode = TUNE_AUTO; else tunemode = TUNE_AUTO;
} else tunemode = TUNE_AUTO; } else tunemode = TUNE_AUTO;
break; break;
case TUNE_MI_BAND: case TUNE_MI_BAND:
case TUNE_AUTO: case TUNE_AUTO:
tunemode = TUNE_MEM; tunemode = TUNE_MEM;
break; break;
case TUNE_MEM: case TUNE_MEM:
if (!bandforbidden) tunemode = TUNE_MAN; if (!bandforbidden) tunemode = TUNE_MAN;
break; break;
@@ -3506,7 +3517,7 @@ void ShowBattery() {
if (millis() >= batupdatetimer + TIMER_BAT_TIMER) batupdatetimer = millis(); if (millis() >= batupdatetimer + TIMER_BAT_TIMER) batupdatetimer = millis();
else return; else return;
float v = analogReadMilliVolts(BATTERY_PIN) * 0.002; float v = analogReadMilliVolts(BATTERY_PIN) * 0.002; // 0.002 converts to volts plus corrects the /2 voltage divider
byte battery = map(constrain(v, BATTERY_LOW_VALUE, BATTERY_FULL_VALUE), BATTERY_LOW_VALUE, BATTERY_FULL_VALUE, 0, BAT_LEVEL_STAGE); byte battery = map(constrain(v, BATTERY_LOW_VALUE, BATTERY_FULL_VALUE), BATTERY_LOW_VALUE, BATTERY_FULL_VALUE, 0, BAT_LEVEL_STAGE);
byte batteryprobe = map(constrain(v, BATTERY_LOW_VALUE, BATTERY_FULL_VALUE), BATTERY_LOW_VALUE, BATTERY_FULL_VALUE, 0, 20); byte batteryprobe = map(constrain(v, BATTERY_LOW_VALUE, BATTERY_FULL_VALUE), BATTERY_LOW_VALUE, BATTERY_FULL_VALUE, 0, 20);
if (batteryold != batteryprobe) { if (batteryold != batteryprobe) {
@@ -3785,7 +3796,7 @@ void read_encoder() {
old_AB <<= 2; old_AB <<= 2;
if (digitalRead(ROTARY_PIN_A)) old_AB |= 0x02; if (digitalRead(ROTARY_PIN_A)) old_AB |= 0x02;
if (digitalRead(ROTARY_PIN_B)) old_AB |= 0x01; if (digitalRead(ROTARY_PIN_B)) old_AB |= 0x01;
encval += enc_states[( old_AB & 0x0f )]; encval += enc_states[old_AB & 0xf];
if (!(255 - old_AB)) encval = 0; if (!(255 - old_AB)) encval = 0;
if (encval > 3) { if (encval > 3) {
@@ -3803,8 +3814,7 @@ void read_encoder() {
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 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) {
uint8_t selectedFont = 0; uint8_t selectedFont = 0;
if (fontsize == 16) selectedFont = 0; if (fontsize == 28) selectedFont = 1;
else if (fontsize == 28) selectedFont = 1;
else if (fontsize == 48) selectedFont = 2; else if (fontsize == 48) selectedFont = 2;
switch (offset) { switch (offset) {
@@ -3825,8 +3835,7 @@ void tftReplace(int8_t offset, const String & textold, const String & text, int1
void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, uint8_t fontsize) { void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, uint8_t fontsize) {
uint8_t selectedFont = 0; uint8_t selectedFont = 0;
if (fontsize == 16) selectedFont = 0; if (fontsize == 28) selectedFont = 1;
else if (fontsize == 28) selectedFont = 1;
else if (fontsize == 48) selectedFont = 2; else if (fontsize == 48) selectedFont = 2;
tft.setTextColor(color, smoothcolor, (fontsize == 52 ? true : false)); tft.setTextColor(color, smoothcolor, (fontsize == 52 ? true : false));

View File

@@ -97,7 +97,6 @@ void saveData() {
EEPROM.writeByte(EE_BYTE_AMSCANSENS, amscansens); EEPROM.writeByte(EE_BYTE_AMSCANSENS, amscansens);
EEPROM.writeByte(EE_BYTE_FMSCANSENS, fmscansens); EEPROM.writeByte(EE_BYTE_FMSCANSENS, fmscansens);
EEPROM.writeByte(EE_BYTE_FREQFONT, freqfont); EEPROM.writeByte(EE_BYTE_FREQFONT, freqfont);
EEPROM.writeByte(EE_BYTE_SKIN, CurrentSkin);
EEPROM.writeByte(EE_BYTE_XDRGTKMUTE, XDRGTKMuteScreen); EEPROM.writeByte(EE_BYTE_XDRGTKMUTE, XDRGTKMuteScreen);
EEPROM.writeByte(EE_BYTE_FMAGC, fmagc); EEPROM.writeByte(EE_BYTE_FMAGC, fmagc);
EEPROM.writeByte(EE_BYTE_AMAGC, amagc); EEPROM.writeByte(EE_BYTE_AMAGC, amagc);
@@ -205,7 +204,6 @@ void loadData() {
amscansens = EEPROM.readByte(EE_BYTE_AMSCANSENS); amscansens = EEPROM.readByte(EE_BYTE_AMSCANSENS);
fmscansens = EEPROM.readByte(EE_BYTE_FMSCANSENS); fmscansens = EEPROM.readByte(EE_BYTE_FMSCANSENS);
freqfont = EEPROM.readByte(EE_BYTE_FREQFONT); freqfont = EEPROM.readByte(EE_BYTE_FREQFONT);
CurrentSkin = EEPROM.readByte(EE_BYTE_SKIN);
XDRGTKMuteScreen = EEPROM.readByte(EE_BYTE_XDRGTKMUTE); XDRGTKMuteScreen = EEPROM.readByte(EE_BYTE_XDRGTKMUTE);
fmagc = EEPROM.readByte(EE_BYTE_FMAGC); fmagc = EEPROM.readByte(EE_BYTE_FMAGC);
amagc = EEPROM.readByte(EE_BYTE_AMAGC); amagc = EEPROM.readByte(EE_BYTE_AMAGC);
@@ -249,27 +247,27 @@ 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, 50); EEPROM.writeByte(EE_BYTE_CONTRASTSET, 20);
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);
EEPROM.writeByte(EE_BYTE_HIGHCUTLEVEL, 70); EEPROM.writeByte(EE_BYTE_HIGHCUTLEVEL, 70);
EEPROM.writeByte(EE_BYTE_HIGHCUTOFFSET, 0); EEPROM.writeByte(EE_BYTE_HIGHCUTOFFSET, 0);
EEPROM.writeByte(EE_BYTE_LEVELOFFSET, 0); EEPROM.writeByte(EE_BYTE_LEVELOFFSET, 0);
EEPROM.writeByte(EE_BYTE_RTBUFFER, 1); 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, 0);
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, 1); EEPROM.writeByte(EE_BYTE_SHOWRDSERRORS, 0);
EEPROM.writeByte(EE_BYTE_TEF, 0); EEPROM.writeByte(EE_BYTE_TEF, 0);
EEPROM.writeByte(EE_BYTE_STEPSIZE, 0); EEPROM.writeByte(EE_BYTE_STEPSIZE, 0);
EEPROM.writeByte(EE_BYTE_TUNEMODE, 0); EEPROM.writeByte(EE_BYTE_TUNEMODE, 0);
EEPROM.writeByte(EE_BYTE_IMSSET, 1); EEPROM.writeByte(EE_BYTE_IMSSET, 1);
EEPROM.writeByte(EE_BYTE_EQSET, 1); EEPROM.writeByte(EE_BYTE_EQSET, 1);
EEPROM.writeByte(EE_BYTE_BAND, BAND_FM); EEPROM.writeByte(EE_BYTE_BAND, BAND_FM);
EEPROM.writeByte(EE_BYTE_LOWLEVELSET, -15); EEPROM.writeByte(EE_BYTE_LOWLEVELSET, -10);
EEPROM.writeByte(EE_BYTE_MEMORYPOS, 0); EEPROM.writeByte(EE_BYTE_MEMORYPOS, 0);
EEPROM.writeByte(EE_BYTE_REGION, 0); EEPROM.writeByte(EE_BYTE_REGION, 0);
EEPROM.writeByte(EE_BYTE_RDS_UNDERSCORE, 0); EEPROM.writeByte(EE_BYTE_RDS_UNDERSCORE, 0);
@@ -277,9 +275,9 @@ void DefaultSettings() {
EEPROM.writeByte(EE_BYTE_WIFI, 0); EEPROM.writeByte(EE_BYTE_WIFI, 0);
EEPROM.writeByte(EE_BYTE_SUBNETCLIENT, 1); EEPROM.writeByte(EE_BYTE_SUBNETCLIENT, 1);
EEPROM.writeByte(EE_BYTE_SHOWSWMIBAND, 1); EEPROM.writeByte(EE_BYTE_SHOWSWMIBAND, 1);
EEPROM.writeByte(EE_BYTE_RDS_FILTER, 1); EEPROM.writeByte(EE_BYTE_RDS_FILTER, 0);
EEPROM.writeByte(EE_BYTE_RDS_PIERRORS, 0); EEPROM.writeByte(EE_BYTE_RDS_PIERRORS, 0);
EEPROM.writeUInt(EE_UINT16_FREQUENCY_LW, 180); EEPROM.writeUInt(EE_UINT16_FREQUENCY_LW, 225);
EEPROM.writeUInt(EE_UINT16_FREQUENCY_MW, 540); EEPROM.writeUInt(EE_UINT16_FREQUENCY_MW, 540);
EEPROM.writeUInt(EE_UINT16_FREQUENCY_SW, 1800); EEPROM.writeUInt(EE_UINT16_FREQUENCY_SW, 1800);
EEPROM.writeString(EE_STRING_XDRGTK_KEY, "password"); EEPROM.writeString(EE_STRING_XDRGTK_KEY, "password");
@@ -292,14 +290,14 @@ void DefaultSettings() {
EEPROM.writeUInt(EE_UINT16_LOWEDGEOIRTSET, 0); EEPROM.writeUInt(EE_UINT16_LOWEDGEOIRTSET, 0);
EEPROM.writeUInt(EE_UINT16_HIGHEDGEOIRTSET, 0); EEPROM.writeUInt(EE_UINT16_HIGHEDGEOIRTSET, 0);
EEPROM.writeByte(EE_BYTE_POWEROPTIONS, 1); EEPROM.writeByte(EE_BYTE_POWEROPTIONS, 1);
EEPROM.writeByte(EE_BYTE_CURRENTTHEME, 0); EEPROM.writeByte(EE_BYTE_CURRENTTHEME, 3);
EEPROM.writeByte(EE_BYTE_FMDEFAULTSTEPSIZE, 1); EEPROM.writeByte(EE_BYTE_FMDEFAULTSTEPSIZE, 1);
EEPROM.writeByte(EE_BYTE_SCREENSAVERSET, 0); EEPROM.writeByte(EE_BYTE_SCREENSAVERSET, 0);
EEPROM.writeInt(EE_INT16_AMLEVELOFFSET, 0); EEPROM.writeInt(EE_INT16_AMLEVELOFFSET, 0);
EEPROM.writeByte(EE_BYTE_UNIT, 0); EEPROM.writeByte(EE_BYTE_UNIT, 0);
EEPROM.writeByte(EE_BYTE_AF, 0); EEPROM.writeByte(EE_BYTE_AF, 0);
EEPROM.writeByte(EE_BYTE_STEREO, 1); EEPROM.writeByte(EE_BYTE_STEREO, 1);
EEPROM.writeByte(EE_BYTE_BATTERY_OPTIONS, BATTERY_VALUE); EEPROM.writeByte(EE_BYTE_BATTERY_OPTIONS, BATTERY_PERCENT);
EEPROM.writeByte(EE_BYTE_AM_CO_DECT, 100); EEPROM.writeByte(EE_BYTE_AM_CO_DECT, 100);
EEPROM.writeByte(EE_BYTE_AM_CO_DECT_COUNT, 3); EEPROM.writeByte(EE_BYTE_AM_CO_DECT_COUNT, 3);
EEPROM.writeByte(EE_BYTE_AM_RF_GAIN, 0); EEPROM.writeByte(EE_BYTE_AM_RF_GAIN, 0);
@@ -309,16 +307,15 @@ void DefaultSettings() {
EEPROM.writeByte(EE_BYTE_BWSET_FM, 0); EEPROM.writeByte(EE_BYTE_BWSET_FM, 0);
EEPROM.writeByte(EE_BYTE_BWSET_AM, 2); EEPROM.writeByte(EE_BYTE_BWSET_AM, 2);
EEPROM.writeByte(EE_BYTE_BANDAUTOSW, 0); EEPROM.writeByte(EE_BYTE_BANDAUTOSW, 0);
EEPROM.writeByte(EE_BYTE_FASTPS, 1); EEPROM.writeByte(EE_BYTE_FASTPS, 0);
EEPROM.writeByte(EE_BYTE_TOT, 0); EEPROM.writeByte(EE_BYTE_TOT, 0);
EEPROM.writeByte(EE_BYTE_MWREGION, 0); EEPROM.writeByte(EE_BYTE_MWREGION, 0);
EEPROM.writeByte(EE_BYTE_AMSCANSENS, 4); EEPROM.writeByte(EE_BYTE_AMSCANSENS, 4);
EEPROM.writeByte(EE_BYTE_FMSCANSENS, 4); EEPROM.writeByte(EE_BYTE_FMSCANSENS, 4);
EEPROM.writeByte(EE_BYTE_FREQFONT, 3); EEPROM.writeByte(EE_BYTE_FREQFONT, 3);
EEPROM.writeByte(EE_BYTE_SKIN, 0);
EEPROM.writeByte(EE_BYTE_XDRGTKMUTE, 0); EEPROM.writeByte(EE_BYTE_XDRGTKMUTE, 0);
EEPROM.writeByte(EE_BYTE_FMAGC, 92); EEPROM.writeByte(EE_BYTE_FMAGC, 92);
EEPROM.writeByte(EE_BYTE_AMAGC, 100); EEPROM.writeByte(EE_BYTE_AMAGC, 102);
EEPROM.writeByte(EE_BYTE_FMSI, 1); EEPROM.writeByte(EE_BYTE_FMSI, 1);
EEPROM.writeByte(EE_BYTE_SCANSTART, 0); EEPROM.writeByte(EE_BYTE_SCANSTART, 0);
EEPROM.writeByte(EE_BYTE_SCANSTOP, 9); EEPROM.writeByte(EE_BYTE_SCANSTOP, 9);
@@ -327,7 +324,6 @@ void DefaultSettings() {
EEPROM.writeByte(EE_BYTE_SCANCANCEL, 0); EEPROM.writeByte(EE_BYTE_SCANCANCEL, 0);
EEPROM.writeByte(EE_BYTE_SCANMUTE, 0); EEPROM.writeByte(EE_BYTE_SCANMUTE, 0);
EEPROM.writeByte(EE_BYTE_AUTOSQUELCH, 0); EEPROM.writeByte(EE_BYTE_AUTOSQUELCH, 0);
EEPROM.writeByte(EE_BYTE_LONGBANDPRESS, 0);
EEPROM.writeByte(EE_BYTE_SHOWCLOCK, 1); EEPROM.writeByte(EE_BYTE_SHOWCLOCK, 1);
EEPROM.writeByte(EE_BYTE_SHOWLONGPS, 1); EEPROM.writeByte(EE_BYTE_SHOWLONGPS, 1);
EEPROM.writeUInt(EE_UINT16_MEMSTARTFREQ, 875); EEPROM.writeUInt(EE_UINT16_MEMSTARTFREQ, 875);
@@ -355,11 +351,13 @@ void DefaultSettings() {
EEPROM.writeByte(EE_BYTE_INVERTDISPLAY, 0); EEPROM.writeByte(EE_BYTE_INVERTDISPLAY, 0);
EEPROM.writeByte(EE_BYTE_DISPLAYFLIP, 1); EEPROM.writeByte(EE_BYTE_DISPLAYFLIP, 1);
EEPROM.writeByte(EE_BYTE_HARDWARE_MODEL, PORTABLE_TOUCH_ILI9341); EEPROM.writeByte(EE_BYTE_HARDWARE_MODEL, PORTABLE_TOUCH_ILI9341);
EEPROM.writeByte(EE_BYTE_LONGBANDPRESS, SCREENOFF);
#else #else
EEPROM.writeByte(EE_BYTE_ROTARYMODE, 0); EEPROM.writeByte(EE_BYTE_ROTARYMODE, 0);
EEPROM.writeByte(EE_BYTE_INVERTDISPLAY, 1); EEPROM.writeByte(EE_BYTE_INVERTDISPLAY, 1);
EEPROM.writeByte(EE_BYTE_DISPLAYFLIP, 0); EEPROM.writeByte(EE_BYTE_DISPLAYFLIP, 0);
EEPROM.writeByte(EE_BYTE_HARDWARE_MODEL, BASE_ILI9341); EEPROM.writeByte(EE_BYTE_HARDWARE_MODEL, BASE_ILI9341);
EEPROM.writeByte(EE_BYTE_LONGBANDPRESS, STANDBY);
#endif #endif
for (int i = 0; i < EE_PRESETS_CNT; i++) { for (int i = 0; i < EE_PRESETS_CNT; i++) {

View File

@@ -6,7 +6,7 @@ bool rtcset;
bool NTPupdated; bool NTPupdated;
ESP32Time rtc; ESP32Time rtc;
bool rx_rtc_avail = false; RTC_NOINIT_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);