some code refactors
This commit is contained in:
+1
-2
@@ -10,6 +10,7 @@
|
|||||||
#include "rtc.hpp"
|
#include "rtc.hpp"
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
|
#include "logbook.h"
|
||||||
|
|
||||||
void ShowAdvancedRDS();
|
void ShowAdvancedRDS();
|
||||||
void readRds();
|
void readRds();
|
||||||
@@ -22,5 +23,3 @@ void ShowAFEON();
|
|||||||
void showCT();
|
void showCT();
|
||||||
void ShowErrors();
|
void ShowErrors();
|
||||||
void ShowRDSStatistics();
|
void ShowRDSStatistics();
|
||||||
|
|
||||||
extern bool isDST(time_t t);
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// This is ancient
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
|||||||
+1
-2
@@ -25,8 +25,7 @@ void RdsPiBuffer::clear() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RdsPiBuffer::State RdsPiBuffer::getState(uint16_t value) {
|
RdsPiBuffer::State RdsPiBuffer::getState(uint16_t value) {
|
||||||
uint8_t count = 0;
|
uint8_t count = 0, correctCount = 0;
|
||||||
uint8_t correctCount = 0;
|
|
||||||
|
|
||||||
for (uint8_t i = 0; i < this->fill; i++) {
|
for (uint8_t i = 0; i < this->fill; i++) {
|
||||||
if (this->buff[i] == value) {
|
if (this->buff[i] == value) {
|
||||||
|
|||||||
+2
-2
@@ -128,14 +128,13 @@ void TEF6686::init(byte TEF) {
|
|||||||
// Start the firmware
|
// Start the firmware
|
||||||
devTEF_Set_Cmd(TEF_INIT, 0, 0);
|
devTEF_Set_Cmd(TEF_INIT, 0, 0);
|
||||||
|
|
||||||
while(devTEF_APPL_Get_Operation_Status() != 1) delay(1); // Wait for it to load
|
while(devTEF_APPL_Get_Operation_Status() != 1) delay(2); // Wait for it to load
|
||||||
|
|
||||||
if(clock != 9216000) devTEF_Set_Cmd(TEF_APPL, Cmd_Set_ReferenceClock, 3, (clock >> 16) & 0xffff, clock & 0xffff, (clock == 55466670) ? 1 : 0);
|
if(clock != 9216000) devTEF_Set_Cmd(TEF_APPL, Cmd_Set_ReferenceClock, 3, (clock >> 16) & 0xffff, clock & 0xffff, (clock == 55466670) ? 1 : 0);
|
||||||
devTEF_Set_Cmd(TEF_APPL, Cmd_Set_Activate, 1, 1); // Setup done, start radio
|
devTEF_Set_Cmd(TEF_APPL, Cmd_Set_Activate, 1, 1); // Setup done, start radio
|
||||||
|
|
||||||
while(devTEF_APPL_Get_Operation_Status() != 2) delay(1); // Wait for it to start
|
while(devTEF_APPL_Get_Operation_Status() != 2) delay(1); // Wait for it to start
|
||||||
|
|
||||||
Wire.setClock(old_clock);
|
|
||||||
devTEF_Set_Cmd(TEF_FM, Cmd_Set_LevelStep, 7, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffc, 0xfff8, 0x0);
|
devTEF_Set_Cmd(TEF_FM, Cmd_Set_LevelStep, 7, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffc, 0xfff8, 0x0);
|
||||||
devTEF_Set_Cmd(TEF_FM, Cmd_Set_Highcut_Mph, 3, 0, 360, 300);
|
devTEF_Set_Cmd(TEF_FM, Cmd_Set_Highcut_Mph, 3, 0, 360, 300);
|
||||||
devTEF_Set_Cmd(TEF_FM, Cmd_Set_Highcut_Max, 2, 0, 4000);
|
devTEF_Set_Cmd(TEF_FM, Cmd_Set_Highcut_Max, 2, 0, 4000);
|
||||||
@@ -148,6 +147,7 @@ void TEF6686::init(byte TEF) {
|
|||||||
devTEF_Set_Cmd(TEF_FM, Cmd_Set_StHiBlend_Max, 2, 0, 4000);
|
devTEF_Set_Cmd(TEF_FM, Cmd_Set_StHiBlend_Max, 2, 0, 4000);
|
||||||
devTEF_Set_Cmd(TEF_AUDIO, Cmd_Set_Ana_Out, 2, 128, 1);
|
devTEF_Set_Cmd(TEF_AUDIO, Cmd_Set_Ana_Out, 2, 128, 1);
|
||||||
devTEF_Set_Cmd(TEF_AUDIO, Cmd_Set_Output_Source, 2, 128, 224);
|
devTEF_Set_Cmd(TEF_AUDIO, Cmd_Set_Output_Source, 2, 128, 224);
|
||||||
|
Wire.setClock(old_clock);
|
||||||
|
|
||||||
uint16_t device = getIdentification(NULL, NULL);
|
uint16_t device = getIdentification(NULL, NULL);
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ bool devTEF_Get_Cmd(TEF_MODULE module, uint8_t cmd, uint8_t *receive, uint16_t l
|
|||||||
|
|
||||||
uint8_t devTEF_APPL_Get_Operation_Status() {
|
uint8_t devTEF_APPL_Get_Operation_Status() {
|
||||||
uint8_t buf[2];
|
uint8_t buf[2];
|
||||||
while(!devTEF_Get_Cmd(TEF_APPL, Cmd_Get_Operation_Status, buf, sizeof(buf))) delay(1);
|
while(!devTEF_Get_Cmd(TEF_APPL, Cmd_Get_Operation_Status, buf, sizeof(buf))) delay(2);
|
||||||
return Convert8bto16b(buf);
|
return Convert8bto16b(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -2282,7 +2282,7 @@ void Seek(bool mode) {
|
|||||||
|
|
||||||
if (!screenmute) tft.drawBitmap(249, 4, Speaker, 28, 24, PrimaryColor);
|
if (!screenmute) tft.drawBitmap(249, 4, Speaker, 28, 24, PrimaryColor);
|
||||||
if (!mode) TuneDown(); else TuneUp();
|
if (!mode) TuneDown(); else TuneUp();
|
||||||
delay(50);
|
delay(55);
|
||||||
|
|
||||||
ShowFreq(0);
|
ShowFreq(0);
|
||||||
if (XDRGTKUSB || XDRGTKTCP) {
|
if (XDRGTKUSB || XDRGTKTCP) {
|
||||||
@@ -2375,8 +2375,7 @@ uint8_t doAutoMemory(uint16_t startfreq, uint16_t stopfreq, uint8_t startmem, ui
|
|||||||
error = 1;
|
error = 1;
|
||||||
stopScanning = true;
|
stopScanning = true;
|
||||||
break;
|
break;
|
||||||
}
|
} dostore = false;
|
||||||
dostore = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+68
-281
File diff suppressed because it is too large
Load Diff
+25
-42
@@ -37,7 +37,7 @@ void read_encoder() {
|
|||||||
|
|
||||||
static uint8_t old_AB = 3;
|
static uint8_t old_AB = 3;
|
||||||
static int8_t encval = 0;
|
static int8_t encval = 0;
|
||||||
static const int8_t enc_states[] = {0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0};
|
constexpr int8_t enc_states[] = {0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0};
|
||||||
|
|
||||||
old_AB <<= 2;
|
old_AB <<= 2;
|
||||||
if (digitalRead(ROTARY_PIN_A)) old_AB |= 0x02;
|
if (digitalRead(ROTARY_PIN_A)) old_AB |= 0x02;
|
||||||
@@ -124,10 +124,8 @@ void later_setup_periph() {
|
|||||||
Wire.endTransmission();
|
Wire.endTransmission();
|
||||||
} else console.print("XL9555 found not found on address " + String(XL9555_ADDRESS, HEX) + ". Numpad will not work");
|
} 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?
|
// 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);
|
if(tef_found) radio.init(TEF);
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t device, hw, sw;
|
uint16_t device, hw, sw;
|
||||||
device = radio.getIdentification(&hw, &sw);
|
device = radio.getIdentification(&hw, &sw);
|
||||||
@@ -172,8 +170,7 @@ void later_setup_periph() {
|
|||||||
if(fmsi) radio.setFMSI(2);
|
if(fmsi) radio.setFMSI(2);
|
||||||
|
|
||||||
if(rx_rtc_avail) {
|
if(rx_rtc_avail) {
|
||||||
bool reset = init_rtc();
|
if(init_rtc()) console.print("RX8010SJ was reset, no time");
|
||||||
if(reset) console.print("RX8010SJ was reset, no time");
|
|
||||||
else {
|
else {
|
||||||
rtcset = true;
|
rtcset = true;
|
||||||
console.print("RX8010SJ is used as a time source");
|
console.print("RX8010SJ is used as a time source");
|
||||||
@@ -187,7 +184,7 @@ void later_setup_periph() {
|
|||||||
void setup() {
|
void setup() {
|
||||||
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);
|
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);
|
||||||
|
|
||||||
analogWriteFrequency(6700); // six seven
|
analogWriteFrequency(6700); // sick in the head seven
|
||||||
|
|
||||||
EEPROM.begin(EE_TOTAL_CNT);
|
EEPROM.begin(EE_TOTAL_CNT);
|
||||||
|
|
||||||
@@ -254,7 +251,7 @@ void setup() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
tft.init();
|
tft.init(); // have to reinit display because of how the reset pin works: toggling it from 1 to 0 makes it reset, when the esp32 stops, the pin goes off, and when we start we bring it up and accidentally restart the display: thanks very much
|
||||||
|
|
||||||
tft.loadFont(FONT16_CHS, 0);
|
tft.loadFont(FONT16_CHS, 0);
|
||||||
tft.loadFont(FONT48, 1);
|
tft.loadFont(FONT48, 1);
|
||||||
@@ -587,8 +584,7 @@ void doLog() {
|
|||||||
|
|
||||||
delay(DELAY_UI_UPDATE_MS);
|
delay(DELAY_UI_UPDATE_MS);
|
||||||
ShowFreq(0);
|
ShowFreq(0);
|
||||||
}
|
} autologged = true;
|
||||||
autologged = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -736,8 +732,8 @@ void ShowSignalLevel() {
|
|||||||
|
|
||||||
int SStatusprint = 0;
|
int SStatusprint = 0;
|
||||||
if (unit == 0) SStatusprint = SStatus;
|
if (unit == 0) SStatusprint = SStatus;
|
||||||
if (unit == 1) SStatusprint = ((SStatus * 100) + 10875) / 100;
|
else if (unit == 1) SStatusprint = ((SStatus * 100) + 10875) / 100;
|
||||||
if (unit == 2) SStatusprint = round((float(SStatus) / 10.0 - 10.0 * log10(75) - 90.0) * 10.0);
|
else if (unit == 2) SStatusprint = round((float(SStatus) / 10.0 - 10.0 * log10(75) - 90.0) * 10.0);
|
||||||
|
|
||||||
static int DisplayedSignalSegments = 0;
|
static int DisplayedSignalSegments = 0;
|
||||||
if (SStatusprint > (SStatusold + 3) || SStatusprint < (SStatusold - 3)) {
|
if (SStatusprint > (SStatusold + 3) || SStatusprint < (SStatusold - 3)) {
|
||||||
@@ -831,8 +827,7 @@ void ShowRSSI() {
|
|||||||
} else if (rssi < -70) {
|
} else if (rssi < -70) {
|
||||||
tft.drawBitmap(WIFI_ICON_X, WIFI_ICON_Y, WiFi4, WIFI_ICON_WIDTH, WIFI_ICON_HEIGHT, GreyoutColor);
|
tft.drawBitmap(WIFI_ICON_X, WIFI_ICON_Y, WiFi4, WIFI_ICON_WIDTH, WIFI_ICON_HEIGHT, GreyoutColor);
|
||||||
tft.drawBitmap(WIFI_ICON_X, WIFI_ICON_Y, WiFi1, WIFI_ICON_WIDTH, WIFI_ICON_HEIGHT, WifiColorLow);
|
tft.drawBitmap(WIFI_ICON_X, WIFI_ICON_Y, WiFi1, WIFI_ICON_WIDTH, WIFI_ICON_HEIGHT, WifiColorLow);
|
||||||
}
|
} rssiold = rssi;
|
||||||
rssiold = rssi;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -844,12 +839,12 @@ void ShowBW() {
|
|||||||
if(BW == 0) panic("BW is 0");
|
if(BW == 0) panic("BW is 0");
|
||||||
else if(BW > 311) panic("BW larger than 311");
|
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), String(BW), 203, 4, BWAutoColor, BWAutoColorSmooth, BackgroundColor, 28); else tftReplace(ARIGHT, String(BWOld), String(BW), 203, 4, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 28);
|
||||||
BWOld = BW;
|
BWOld = BW;
|
||||||
BWreset = false;
|
BWreset = false;
|
||||||
if (wifi) {
|
if (wifi) {
|
||||||
Udp.beginPacket(remoteip, 9030);
|
Udp.beginPacket(remoteip, 9030);
|
||||||
Udp.print("from=TEF_tuner_" + String(stationlistid, DEC) + ";bandwidth=" + String(BW * 1000));
|
Udp.print("from=TEF_tuner_" + String(stationlistid) + ";bandwidth=" + String(BW * 1000));
|
||||||
Udp.endPacket();
|
Udp.endPacket();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -860,10 +855,10 @@ void ShowOffset() {
|
|||||||
if (millis() >= offsetupdatetimer + TIMER_OFFSET_TIMER) offsetupdatetimer = millis();
|
if (millis() >= offsetupdatetimer + TIMER_OFFSET_TIMER) offsetupdatetimer = millis();
|
||||||
else return;
|
else return;
|
||||||
|
|
||||||
int baseX = 13; // Left boundary
|
constexpr int baseX = 13; // Left boundary
|
||||||
int baseY = 2; // Top boundary
|
constexpr int baseY = 2; // Top boundary
|
||||||
int width = 4; // Max width
|
constexpr int width = 4; // Max width
|
||||||
int height = 26; // Max height
|
constexpr int height = 26; // Max height
|
||||||
|
|
||||||
int centerX = baseX + width / 2; // Center dot X
|
int centerX = baseX + width / 2; // Center dot X
|
||||||
int centerY = baseY + height / 2; // Center dot Y
|
int centerY = baseY + height / 2; // Center dot Y
|
||||||
@@ -934,8 +929,7 @@ void ShowOffset() {
|
|||||||
tft.fillCircle(centerX, centerY, 3, GreyoutColor);
|
tft.fillCircle(centerX, centerY, 3, GreyoutColor);
|
||||||
tuned = false;
|
tuned = false;
|
||||||
}
|
}
|
||||||
}
|
} OStatusold = OStatus;
|
||||||
OStatusold = OStatus;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -998,11 +992,8 @@ void GetData() {
|
|||||||
showPTY();
|
showPTY();
|
||||||
showRadioText();
|
showRadioText();
|
||||||
if (millis() >= tuningtimer + 200) doAF();
|
if (millis() >= tuningtimer + 200) doAF();
|
||||||
}
|
} showPI();
|
||||||
showPI();
|
} ShowStereoStatus();
|
||||||
}
|
|
||||||
|
|
||||||
ShowStereoStatus();
|
|
||||||
|
|
||||||
if (!screenmute) {
|
if (!screenmute) {
|
||||||
showCT();
|
showCT();
|
||||||
@@ -1019,6 +1010,7 @@ inline __attribute__((always_inline)) const char* getBWButtonLabel(byte temp, bo
|
|||||||
if (temp == BW_OK_BUTTON) return "OK";
|
if (temp == BW_OK_BUTTON) return "OK";
|
||||||
return isFM ? BWButtonLabelsFM[temp - 1] : BWButtonLabelsAM[temp - 1];
|
return isFM ? BWButtonLabelsFM[temp - 1] : BWButtonLabelsAM[temp - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline __attribute__((always_inline)) bool shouldHighlightBWButton(byte temp, byte set) {
|
inline __attribute__((always_inline)) bool shouldHighlightBWButton(byte temp, byte set) {
|
||||||
return (set == temp) || (temp == 17 && set == 0) || (temp == 18 && !iMSset) || (temp == 19 && !EQset);
|
return (set == temp) || (temp == 17 && set == 0) || (temp == 18 && !iMSset) || (temp == 19 && !EQset);
|
||||||
}
|
}
|
||||||
@@ -1069,13 +1061,9 @@ void loop() {
|
|||||||
if(i2c_pc_control) {
|
if(i2c_pc_control) {
|
||||||
total_pc_control();
|
total_pc_control();
|
||||||
if(i2c_pc_control) return;
|
if(i2c_pc_control) return;
|
||||||
if(EEPROM.readByte(EE_BYTE_CONTROLMODE)) {
|
|
||||||
saveData();
|
|
||||||
esp_restart();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wifiPoll(); // He really lost it
|
wifiPoll(); //
|
||||||
|
|
||||||
handleWiFi();
|
handleWiFi();
|
||||||
handleTouch();
|
handleTouch();
|
||||||
@@ -1194,8 +1182,8 @@ void loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!foundmemaf) {
|
if (!foundmemaf) {
|
||||||
frequency = freqold;
|
|
||||||
radio.SetFreq(frequency);
|
radio.SetFreq(frequency);
|
||||||
|
frequency = freqold;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!screenmute) {
|
if (!screenmute) {
|
||||||
@@ -1224,8 +1212,7 @@ void loop() {
|
|||||||
if (screenmute) {
|
if (screenmute) {
|
||||||
freqold = frequency;
|
freqold = frequency;
|
||||||
dropout = false;
|
dropout = false;
|
||||||
}
|
} store = true;
|
||||||
store = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (band == BAND_FM && af != 0 && radio.rds.correctPI != 0) {
|
if (band == BAND_FM && af != 0 && radio.rds.correctPI != 0) {
|
||||||
@@ -1244,8 +1231,7 @@ void loop() {
|
|||||||
if (screenmute) {
|
if (screenmute) {
|
||||||
freqold = frequency;
|
freqold = frequency;
|
||||||
dropout = false;
|
dropout = false;
|
||||||
}
|
} store = true;
|
||||||
store = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1300,8 +1286,7 @@ void loop() {
|
|||||||
tftPrint16(ALEFT, "RT", 3, 221, ActiveColor, ActiveColorSmooth);
|
tftPrint16(ALEFT, "RT", 3, 221, ActiveColor, ActiveColorSmooth);
|
||||||
tftPrint16(ALEFT, "PTY", 3, 163, ActiveColor, ActiveColorSmooth);
|
tftPrint16(ALEFT, "PTY", 3, 163, ActiveColor, ActiveColorSmooth);
|
||||||
if (!showaudio) tft.drawLine(16, 143, 189, 143, GreyoutColor); else tft.drawLine(16, 143, 189, 143, ActiveColor);
|
if (!showaudio) tft.drawLine(16, 143, 189, 143, GreyoutColor); else tft.drawLine(16, 143, 189, 143, ActiveColor);
|
||||||
}
|
} LowLevelInit = true;
|
||||||
LowLevelInit = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((SStatus / 10 <= LowLevelSet) && band < BAND_GAP) {
|
if ((SStatus / 10 <= LowLevelSet) && band < BAND_GAP) {
|
||||||
@@ -1333,8 +1318,7 @@ void loop() {
|
|||||||
tftPrint16(ALEFT, "PTY", 3, 163, GreyoutColor, BackgroundColor);
|
tftPrint16(ALEFT, "PTY", 3, 163, GreyoutColor, BackgroundColor);
|
||||||
tft.drawLine(16, 143, 189, 143, GreyoutColor);
|
tft.drawLine(16, 143, 189, 143, GreyoutColor);
|
||||||
tft.drawBitmap(68, 5, RDSLogo, 35, 22, GreyoutColor);
|
tft.drawBitmap(68, 5, RDSLogo, 35, 22, GreyoutColor);
|
||||||
}
|
} LowLevelInit = false;
|
||||||
LowLevelInit = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!BWtune && !menu && (screenmute || radio.rds.correctPI != 0)) readRds();
|
if (!BWtune && !menu && (screenmute || radio.rds.correctPI != 0)) readRds();
|
||||||
@@ -1349,7 +1333,6 @@ void loop() {
|
|||||||
GetData();
|
GetData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (af || (!screenmute || (screenmute && (XDRGTKTCP || XDRGTKUSB)))) {
|
if (af || (!screenmute || (screenmute && (XDRGTKTCP || XDRGTKUSB)))) {
|
||||||
if (band < BAND_GAP) radio.getStatus(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus);
|
if (band < BAND_GAP) radio.getStatus(&SStatus, &USN, &WAM, &OStatus, &BW, &MStatus);
|
||||||
|
|||||||
+13
-21
@@ -127,7 +127,7 @@ void doAF() {
|
|||||||
if (radio.af_counter != af_counterold && radio.rds.hasAF) {
|
if (radio.af_counter != af_counterold && radio.rds.hasAF) {
|
||||||
if (wifi) {
|
if (wifi) {
|
||||||
Udp.beginPacket(remoteip, 9030);
|
Udp.beginPacket(remoteip, 9030);
|
||||||
Udp.print("from=TEF_tuner_" + String(stationlistid, DEC) + ";AF=");
|
Udp.print("from=TEF_tuner_" + String(stationlistid) + ";AF=");
|
||||||
|
|
||||||
for (byte af_scan = 0; af_scan < radio.af_counter; af_scan++) {
|
for (byte af_scan = 0; af_scan < radio.af_counter; af_scan++) {
|
||||||
if (wifi) {
|
if (wifi) {
|
||||||
@@ -254,7 +254,7 @@ void readRds() {
|
|||||||
|
|
||||||
sprintf(hexbuf, "%X%X", (erroutput >> 4) & 0xF, erroutput & 0xF);
|
sprintf(hexbuf, "%X%X", (erroutput >> 4) & 0xF, erroutput & 0xF);
|
||||||
XDRGTKRDS += hexbuf;
|
XDRGTKRDS += hexbuf;
|
||||||
XDRGTKRDS += '\n';
|
XDRGTKRDS += F('\n');
|
||||||
|
|
||||||
if (XDRGTKRDS.changed(0)) {
|
if (XDRGTKRDS.changed(0)) {
|
||||||
uint8_t piError = radio.rds.rdsErr >> 14;
|
uint8_t piError = radio.rds.rdsErr >> 14;
|
||||||
@@ -491,7 +491,7 @@ void showCT() {
|
|||||||
char dateStr[9];
|
char dateStr[9];
|
||||||
time_t t = rtc.getEpoch();
|
time_t t = rtc.getEpoch();
|
||||||
|
|
||||||
t += Timezone * 3600; // Convert offset from hours to seconds
|
t += Timezone * 3600;
|
||||||
if (autoDST && isDST(t)) t += 3600;
|
if (autoDST && isDST(t)) t += 3600;
|
||||||
|
|
||||||
auto localtm = localtime(&t);
|
auto localtm = localtime(&t);
|
||||||
@@ -511,9 +511,7 @@ void showCT() {
|
|||||||
if (hour < 0 || hour > 23) hour = 0;
|
if (hour < 0 || hour > 23) hour = 0;
|
||||||
|
|
||||||
snprintf(timeStr, sizeof(timeStr), "%02d:%02d:%02d", hour, localtm->tm_min, localtm->tm_sec);
|
snprintf(timeStr, sizeof(timeStr), "%02d:%02d:%02d", hour, localtm->tm_min, localtm->tm_sec);
|
||||||
|
} rds_clock = String(timeStr);
|
||||||
}
|
|
||||||
rds_clock = String(timeStr);
|
|
||||||
|
|
||||||
if (clockampm) strftime(dateStr, sizeof(dateStr), "%m-%d-%y", localtm);
|
if (clockampm) strftime(dateStr, sizeof(dateStr), "%m-%d-%y", localtm);
|
||||||
else strftime(dateStr, sizeof(dateStr), "%d-%m-%y", localtm);
|
else strftime(dateStr, sizeof(dateStr), "%d-%m-%y", localtm);
|
||||||
@@ -548,11 +546,8 @@ void showRadioText() {
|
|||||||
if (RThex[i] < 0x10) Udp.print("0");
|
if (RThex[i] < 0x10) Udp.print("0");
|
||||||
if (RThex[i] == ' ') RThex[i] = '_';
|
if (RThex[i] == ' ') RThex[i] = '_';
|
||||||
Udp.print(String(RThex[i], HEX));
|
Udp.print(String(RThex[i], HEX));
|
||||||
}
|
} Udp.endPacket();
|
||||||
Udp.endPacket();
|
} RTold = RTString;
|
||||||
}
|
|
||||||
|
|
||||||
RTold = RTString;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -711,8 +706,7 @@ void ShowAFEON() {
|
|||||||
uint8_t nibble = (radio.rds.aid[y] >> (4 * (3 - z))) & 0xF;
|
uint8_t nibble = (radio.rds.aid[y] >> (4 * (3 - z))) & 0xF;
|
||||||
if (nibble < 10) id[z] = nibble + '0';
|
if (nibble < 10) id[z] = nibble + '0';
|
||||||
else id[z] = nibble - 10 + 'A';
|
else id[z] = nibble - 10 + 'A';
|
||||||
}
|
} id[4] = '\0';
|
||||||
id[4] = '\0';
|
|
||||||
|
|
||||||
AIDStringTemp += String(id);
|
AIDStringTemp += String(id);
|
||||||
AIDStringTemp += ": ";
|
AIDStringTemp += ": ";
|
||||||
@@ -733,9 +727,7 @@ void ShowAFEON() {
|
|||||||
AIDWidth = FullLineSprite.textWidth(AIDString);
|
AIDWidth = FullLineSprite.textWidth(AIDString);
|
||||||
AIDStringold = AIDString;
|
AIDStringold = AIDString;
|
||||||
}
|
}
|
||||||
}
|
} aidDisplay.update(AIDString, true, ActiveColor, ActiveColorSmooth, 0, 0, BackgroundColor);
|
||||||
|
|
||||||
aidDisplay.update(AIDString, true, ActiveColor, ActiveColorSmooth, 0, 0, BackgroundColor);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -784,7 +776,7 @@ void ShowRDSStatistics() {
|
|||||||
if (lastX >= 0 && (lastX != xpos || lastY != ypos)) tft.fillCircle(lastX - 55, lastY + 7, 2, SignificantColor);
|
if (lastX >= 0 && (lastX != xpos || lastY != ypos)) tft.fillCircle(lastX - 55, lastY + 7, 2, SignificantColor);
|
||||||
|
|
||||||
tftReplace(ARIGHT, oldBuf, newBuf, xpos, ypos, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 16);
|
tftReplace(ARIGHT, oldBuf, newBuf, xpos, ypos, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 16);
|
||||||
tftPrint(ACENTER, "%", xposPct, ypos, ActiveColor, ActiveColorSmooth, 16);
|
tftPrint(ACENTER, F("%"), xposPct, ypos, ActiveColor, ActiveColorSmooth, 16);
|
||||||
|
|
||||||
tft.fillCircle(xpos - 55, ypos + 7, 2, InsignificantColor);
|
tft.fillCircle(xpos - 55, ypos + 7, 2, InsignificantColor);
|
||||||
|
|
||||||
@@ -796,11 +788,11 @@ void ShowRDSStatistics() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String HexString = String(((radio.rds.rdsA >> 12) & 0xF), HEX) + String(((radio.rds.rdsA >> 8) & 0xF), HEX) + String(((radio.rds.rdsA >> 4) & 0xF), HEX) + String((radio.rds.rdsA & 0xF), HEX);
|
String HexString = String(((radio.rds.rdsA >> 12) & 0xF), HEX) + String(((radio.rds.rdsA >> 8) & 0xF), HEX) + String(((radio.rds.rdsA >> 4) & 0xF), HEX) + String((radio.rds.rdsA & 0xF), HEX);
|
||||||
HexString += " ";
|
HexString += F(" ");
|
||||||
HexString += String(((radio.rds.rdsB >> 12) & 0xF), HEX) + String(((radio.rds.rdsB >> 8) & 0xF), HEX) + String(((radio.rds.rdsB >> 4) & 0xF), HEX) + String((radio.rds.rdsB & 0xF), HEX);
|
HexString += String(((radio.rds.rdsB >> 12) & 0xF), HEX) + String(((radio.rds.rdsB >> 8) & 0xF), HEX) + String(((radio.rds.rdsB >> 4) & 0xF), HEX) + String((radio.rds.rdsB & 0xF), HEX);
|
||||||
HexString += " ";
|
HexString += F(" ");
|
||||||
HexString += String(((radio.rds.rdsC >> 12) & 0xF), HEX) + String(((radio.rds.rdsC >> 8) & 0xF), HEX) + String(((radio.rds.rdsC >> 4) & 0xF), HEX) + String((radio.rds.rdsC & 0xF), HEX);
|
HexString += String(((radio.rds.rdsC >> 12) & 0xF), HEX) + String(((radio.rds.rdsC >> 8) & 0xF), HEX) + String(((radio.rds.rdsC >> 4) & 0xF), HEX) + String((radio.rds.rdsC & 0xF), HEX);
|
||||||
HexString += " ";
|
HexString += F(" ");
|
||||||
HexString += String(((radio.rds.rdsD >> 12) & 0xF), HEX) + String(((radio.rds.rdsD >> 8) & 0xF), HEX) + String(((radio.rds.rdsD >> 4) & 0xF), HEX) + String((radio.rds.rdsD & 0xF), HEX);
|
HexString += String(((radio.rds.rdsD >> 12) & 0xF), HEX) + String(((radio.rds.rdsD >> 8) & 0xF), HEX) + String(((radio.rds.rdsD >> 4) & 0xF), HEX) + String((radio.rds.rdsD & 0xF), HEX);
|
||||||
HexString.toUpperCase();
|
HexString.toUpperCase();
|
||||||
|
|
||||||
@@ -836,7 +828,7 @@ void ShowRDSStatistics() {
|
|||||||
|
|
||||||
int berPercent = (int)(smoothBER * 100.0);
|
int berPercent = (int)(smoothBER * 100.0);
|
||||||
if (berPercentold != berPercent) {
|
if (berPercentold != berPercent) {
|
||||||
tftReplace(ARIGHT, String(berPercentold) + "%", String(berPercent) + "%", 318, 34, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 16);
|
tftReplace(ARIGHT, String(berPercentold) + F("%"), String(berPercent) + F("%"), 318, 34, PrimaryColor, PrimaryColorSmooth, BackgroundColor, 16);
|
||||||
berPercentold = berPercent;
|
berPercentold = berPercent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -118,7 +118,7 @@ bool init_rtc() {
|
|||||||
writeToModule(0x1F, 0);
|
writeToModule(0x1F, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
sync_from_rx_rtc(1); // mystery offset
|
sync_from_rx_rtc(1); // mystery offset, without it the time is offset by one second
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-10
@@ -159,11 +159,9 @@ void doTouchEvent(uint16_t x, uint16_t y) {
|
|||||||
doBW();
|
doBW();
|
||||||
BWtune = false;
|
BWtune = false;
|
||||||
bwtouchtune = false;
|
bwtouchtune = false;
|
||||||
if (advancedRDS) {
|
if (advancedRDS) BuildAdvancedRDS();
|
||||||
BuildAdvancedRDS();
|
else if (afscreen) BuildAFScreen();
|
||||||
} else if (afscreen) {
|
else {
|
||||||
BuildAFScreen();
|
|
||||||
} else {
|
|
||||||
BuildDisplay();
|
BuildDisplay();
|
||||||
SelectBand();
|
SelectBand();
|
||||||
}
|
}
|
||||||
@@ -173,8 +171,7 @@ void doTouchEvent(uint16_t x, uint16_t y) {
|
|||||||
showBWSelector();
|
showBWSelector();
|
||||||
doBW();
|
doBW();
|
||||||
bwtouchtune = false;
|
bwtouchtune = false;
|
||||||
}
|
} return;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!BWtune && !menu && !advancedRDS && !seek && !afscreen) {
|
if (!BWtune && !menu && !advancedRDS && !seek && !afscreen) {
|
||||||
@@ -188,9 +185,7 @@ void doTouchEvent(uint16_t x, uint16_t y) {
|
|||||||
} else if (x > 0 && x < 30 && y > 25 && y < 90) {
|
} else if (x > 0 && x < 30 && y > 25 && y < 90) {
|
||||||
doTuneMode();
|
doTuneMode();
|
||||||
return;
|
return;
|
||||||
} else if (x > 250 && x < 320 && y > 50 && y < 80) {
|
} else if (x > 250 && x < 320 && y > 50 && y < 80) toggleiMSEQ();
|
||||||
toggleiMSEQ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!BWtune && !menu && advancedRDS && !seek && !afscreen) {
|
if (!BWtune && !menu && advancedRDS && !seek && !afscreen) {
|
||||||
|
|||||||
Reference in New Issue
Block a user