Forgotten }

This commit is contained in:
Sjef Verhoeven PE5PVB
2023-07-20 23:09:39 +02:00
parent dccdc27b4b
commit 34eed40a18
+93 -90
View File
@@ -3036,7 +3036,7 @@ void ShowAdvancedRDS() {
sprite2.pushSprite(35, 150);
}
} else {
if (millis() - rtplusticker >= 50)
if (millis() - rtplusticker >= 50) {
if (xPos4 == 0) {
if (millis() - rtplustickerhold >= 2000) {
xPos4 --;
@@ -3054,8 +3054,10 @@ void ShowAdvancedRDS() {
sprite2.pushSprite(35, 150);
rtplusticker = millis();
}
}
rtplusstringold = rtplusstring;
if (TPold != radio.rds.hasTP) {
if (radio.rds.hasTP == true) tftPrint(-1, "TP", 6, 51, SecondaryColor, SecondaryColorSmooth, FONT16); else tftPrint(-1, "TP", 6, 51, GreyoutColor, BackgroundColor, FONT16);
TPold = radio.rds.hasTP;
@@ -3109,9 +3111,9 @@ void ShowAdvancedRDS() {
if (radio.rds.hasTMC == true) tftPrint(-1, "TMC", 90, 51, SecondaryColor, SecondaryColorSmooth, FONT16); else tftPrint(-1, "TMC", 90, 51, GreyoutColor, BackgroundColor, FONT16);
hastmcold = radio.rds.hasTMC;
}
}
}
void doAF() {
void doAF() {
if (radio.af_counter != af_counterold && radio.rds.hasAF == true) {
if (wifi) {
Udp.beginPacket(remoteip, 9030);
@@ -3131,9 +3133,9 @@ void ShowAdvancedRDS() {
Udp.endPacket();
}
}
}
}
void showECC() {
void showECC() {
if (ECCold != radio.rds.ECC) {
String ECC;
if (radio.rds.picode[0] == '1') {
@@ -3230,9 +3232,9 @@ void ShowAdvancedRDS() {
}
ECCold = radio.rds.ECC;
}
}
}
void showPI() {
void showPI() {
if (strcmp(radio.rds.picode, radioIdPrevious)) {
if (advancedRDS) {
tftReplace(-1, PIold, radio.rds.picode, 244, 76, PrimaryColor, PrimaryColorSmooth, FONT28);
@@ -3249,9 +3251,9 @@ void ShowAdvancedRDS() {
}
strcpy(radioIdPrevious, radio.rds.picode);
}
}
}
void showPTY() {
void showPTY() {
if (strcmp(radio.rds.stationType, programTypePrevious)) {
if (advancedRDS) tftReplace(-1, PTYold, radio.rds.stationType, 38, 109, PrimaryColor, PrimaryColorSmooth, FONT16); else tftReplace(-1, PTYold, radio.rds.stationType, 38, 170, PrimaryColor, PrimaryColorSmooth, FONT16);
PTYold = radio.rds.stationType;
@@ -3263,9 +3265,9 @@ void ShowAdvancedRDS() {
}
strcpy(programTypePrevious, radio.rds.stationType);
}
}
}
void showPS() {
void showPS() {
if (radio.rds.stationName != programServicePrevious) {
if (advancedRDS) {
tftReplace(-1, PSold, radio.rds.stationName, 38, 76, PrimaryColor, PrimaryColorSmooth, FONT28);
@@ -3292,9 +3294,9 @@ void ShowAdvancedRDS() {
}
programServicePrevious = radio.rds.stationName;
}
}
}
void showRadioText() {
void showRadioText() {
if (radio.rds.hasRT && RDSstatus) {
if (advancedRDS && radio.rds.stationText.length() < 20) {
xPos = 0;
@@ -3364,9 +3366,9 @@ void ShowAdvancedRDS() {
}
tft.drawLine(0, 239, 320, 239, FrameColor);
RTold = radio.rds.stationText + " " + radio.rds.stationText32;
}
}
void BuildMenu() {
void BuildMenu() {
advancedRDS = false;
tft.fillScreen(BackgroundColor);
tft.drawRect(0, 0, 320, 240, FrameColor);
@@ -3491,9 +3493,9 @@ void ShowAdvancedRDS() {
break;
}
analogWrite(SMETERPIN, 0);
}
}
void MuteScreen(bool setting) {
void MuteScreen(bool setting) {
if (!setting && screenmute) {
screenmute = false;
setupmode = true;
@@ -3507,9 +3509,9 @@ void ShowAdvancedRDS() {
analogWrite(CONTRASTPIN, 0);
tft.writecommand(0x10);
}
}
}
void ShowAFEON() {
void ShowAFEON() {
if (radio.rds.hasAF) {
if (hasafold == false) {
tftPrint(-1, myLanguage[language][87], 6, 54, BackgroundColor, BackgroundColor, FONT16);
@@ -3573,9 +3575,9 @@ void ShowAdvancedRDS() {
if (i == 10) i = 254;
}
}
}
}
void BuildAFScreen() {
void BuildAFScreen() {
if (!afscreen && RDSstatus) {
tft.drawRoundRect(20, 30, 274, 170, 5, ActiveColor);
tft.fillRoundRect(22, 32, 270, 166, 5, BackgroundColor);
@@ -3613,9 +3615,9 @@ void ShowAdvancedRDS() {
programServicePrevious = "0";
for (byte i = 0; i < 11; i++) eonpsold[i] = "";
}
}
}
void BuildAdvancedRDS() {
void BuildAdvancedRDS() {
afscreen = false;
afpage = false;
afpagenr = 0;
@@ -3733,9 +3735,9 @@ void ShowAdvancedRDS() {
BWreset = true;
pinstringold = "";
ShowMemoryPos();
}
}
void BuildDisplay() {
void BuildDisplay() {
afscreen = false;
advancedRDS = false;
if (theme == 0) {
@@ -3846,9 +3848,9 @@ void ShowAdvancedRDS() {
strcpy(radioIdPrevious, "0");
programServicePrevious = "0";
BWreset = true;
}
}
void ShowFreq(int mode) {
void ShowFreq(int mode) {
if (screenmute == false) {
if (setupmode == false) {
if (band == 1) { // Fix Me :take care of 9K/10K Step
@@ -3941,9 +3943,9 @@ void ShowAdvancedRDS() {
Udp.endPacket();
}
}
}
}
void ShowSignalLevel() {
void ShowSignalLevel() {
if (screenmute == false) {
if (millis() >= snrupdatetimer + TIMER_SNR_TIMER) {
snrupdatetimer = millis();
@@ -4010,18 +4012,18 @@ void ShowAdvancedRDS() {
}
}
}
}
}
void ShowRDSLogo(bool RDSstatus) {
void ShowRDSLogo(bool RDSstatus) {
if (screenmute == false) {
if (RDSstatus != RDSstatusold) {
if (RDSstatus) tft.drawBitmap(139, 5, RDSLogo, 35, 22, InsignificantColor); else tft.drawBitmap(139, 5, RDSLogo, 35, 22, GreyoutColor);
RDSstatusold = RDSstatus;
}
}
}
}
void ShowStereoStatus() {
void ShowStereoStatus() {
if (StereoToggle == true) {
if (band == BAND_FM) Stereostatus = radio.getStereoStatus(); else Stereostatus = 0;
if (Stereostatus != Stereostatusold) {
@@ -4041,9 +4043,9 @@ void ShowAdvancedRDS() {
Stereostatusold = Stereostatus;
}
}
}
}
void ShowOffset() {
void ShowOffset() {
if (OStatus != OStatusold) {
if (millis() >= offsetupdatetimer + TIMER_OFFSET_TIMER) {
offsetupdatetimer = millis();
@@ -4142,9 +4144,9 @@ void ShowAdvancedRDS() {
}
OStatusold = OStatus;
}
}
}
void ShowBW() {
void ShowBW() {
if (millis() >= bwupdatetimer + TIMER_BW_TIMER) {
bwupdatetimer = millis();
} else {
@@ -4162,9 +4164,9 @@ void ShowAdvancedRDS() {
Udp.endPacket();
}
}
}
}
void ShowModLevel() {
void ShowModLevel() {
if (showmodulation) {
int segments;
@@ -4192,9 +4194,9 @@ void ShowAdvancedRDS() {
peakholdmillis = millis();
}
}
}
}
void doSquelch() {
void doSquelch() {
if (XDRGTKUSB == false && XDRGTKTCP == false) {
Squelch = analogRead(PIN_POT) / 4 - 100;
if (Squelch > 920) Squelch = 920;
@@ -4284,9 +4286,10 @@ void ShowAdvancedRDS() {
}
}
}
}
Squelchold = Squelch;
}
void updateBW() {
void updateBW() {
if (BWset == 0) {
if (screenmute == false && advancedRDS == false && afscreen == false) {
tft.drawRoundRect(248, 35, 70, 20, 5, ActiveColor);
@@ -4299,9 +4302,9 @@ void ShowAdvancedRDS() {
tftPrint(0, "AUTO BW", 282, 38, GreyoutColor, BackgroundColor, FONT16);
}
}
}
}
void updateiMS() {
void updateiMS() {
if (band == BAND_FM) {
if (iMSset == 0) {
if (screenmute == false) {
@@ -4317,9 +4320,9 @@ void ShowAdvancedRDS() {
radio.setiMS(0);
}
}
}
}
void updateEQ() {
void updateEQ() {
if (band == BAND_FM) {
if (EQset == 0) {
if (screenmute == false) {
@@ -4335,9 +4338,9 @@ void ShowAdvancedRDS() {
radio.setEQ(0);
}
}
}
}
void updateSWMIBand() {
void updateSWMIBand() {
switch (SWMIBandPos) {
case SW_MI_BAND_11M:
case SW_MI_BAND_13M:
@@ -4361,9 +4364,9 @@ void ShowAdvancedRDS() {
tftPrint(-1, SWMIBandstringold, 50, 51, BackgroundColor, BackgroundColor, FONT16);
break;
}
}
}
void doBW() {
void doBW() {
if (band == BAND_FM) {
if (BWset > 16) BWset = 0;
@@ -4455,9 +4458,9 @@ void ShowAdvancedRDS() {
}
updateBW();
BWreset = true;
}
}
void doTuneMode() {
void doTuneMode() {
switch (tunemode) {
case TUNE_MAN:
if (band == BAND_FM) {
@@ -4487,9 +4490,9 @@ void ShowAdvancedRDS() {
ShowFreq(0);
EEPROM.writeByte(EE_BYTE_TUNEMODE, tunemode);
EEPROM.commit();
}
}
void ShowTuneMode() {
void ShowTuneMode() {
switch (tunemode) {
case TUNE_MAN:
if (band == BAND_SW) {
@@ -4551,9 +4554,9 @@ void ShowAdvancedRDS() {
tftPrint(0, "MEM", 22, 82, GreyoutColor, BackgroundColor, FONT16);
break;
}
}
}
void ShowRSSI() {
void ShowRSSI() {
if (wifi) rssi = WiFi.RSSI(); else rssi = 0;
if (rssiold != rssi) {
rssiold = rssi;
@@ -4572,9 +4575,9 @@ void ShowAdvancedRDS() {
tft.drawBitmap(272, 4, WiFi1, 25, 25, PrimaryColor);
}
}
}
}
void ShowBattery() {
void ShowBattery() {
if (millis() >= batupdatetimer + TIMER_BAT_TIMER) {
batupdatetimer = millis();
} else {
@@ -4602,9 +4605,9 @@ void ShowAdvancedRDS() {
}
batteryold = battery;
}
}
}
void Communication() {
void Communication() {
if (menu == false) {
if (wifi) {
int packetSize = Udp.parsePacket();
@@ -4754,15 +4757,15 @@ void ShowAdvancedRDS() {
}
if (XDRGTKUSB || XDRGTKTCP) XDRGTKRoutine();
}
}
}
void DataPrint(String string) {
void DataPrint(String string) {
if (XDRGTKUSB) Serial.print(string);
if (XDRGTKTCP) RemoteClient.print(string);
}
}
void XDRGTKRoutine() {
void XDRGTKRoutine() {
if (XDRGTKUSB) {
if (Serial.available())
{
@@ -5139,9 +5142,9 @@ void ShowAdvancedRDS() {
}
}
DataPrint(String(((SStatus * 100) + 10875) / 1000) + "." + String(((SStatus * 100) + 10875) / 100 % 10) + ", " + String(WAM / 10) + ", " + String(SNR) + "\n");
}
}
void TuneUp() {
void TuneUp() {
aftest = true;
aftimer = millis();
unsigned int temp = 0;
@@ -5220,9 +5223,9 @@ void ShowAdvancedRDS() {
radio.clearRDS(fullsearchrds);
if (RDSSPYUSB == true) Serial.print("G:\r\nRESET-------\r\n\r\n");
if (RDSSPYTCP == true) RemoteClient.print("G:\r\nRESET-------\r\n\r\n");
}
}
void TuneDown() {
void TuneDown() {
aftest = true;
aftimer = millis();
unsigned int temp = 0;
@@ -5301,9 +5304,9 @@ void ShowAdvancedRDS() {
radio.clearRDS(fullsearchrds);
if (RDSSPYUSB == true) Serial.print("G:\r\nRESET-------\r\n\r\n");
if (RDSSPYTCP == true) RemoteClient.print("G:\r\nRESET-------\r\n\r\n");
}
}
void EdgeBeeper() {
void EdgeBeeper() {
bool x = radio.mute;
radio.tone(50, -5, 2000);
if (x) {
@@ -5313,9 +5316,9 @@ void ShowAdvancedRDS() {
radio.setUnMute();
if (screenmute == false) tft.drawBitmap(110, 5, Speaker, 26, 22, GreyoutColor);
}
}
}
void Seek(bool mode) {
void Seek(bool mode) {
if (band == BAND_FM) {
radio.setMute();
if (screenmute == false) tft.drawBitmap(110, 5, Speaker, 26, 22, PrimaryColor);
@@ -5338,9 +5341,9 @@ void ShowAdvancedRDS() {
if (RDSSPYTCP == true) RemoteClient.print("G:\r\nRESET-------\r\n\r\n");
}
}
}
}
void SetTunerPatch() {
void SetTunerPatch() {
if (TEF != 101 && TEF != 102 && TEF != 205) {
radio.init(102);
uint16_t device;
@@ -5358,9 +5361,9 @@ void ShowAdvancedRDS() {
while (true);
for (;;);
}
}
}
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) {
case 0: // Default PE5PVB theme
PrimaryColor = 0xFFE0;
@@ -5499,9 +5502,9 @@ void ShowAdvancedRDS() {
CurrentThemeString = myLanguage[language][85];
break;
}
}
}
void read_encoder() {
void read_encoder() {
static uint8_t old_AB = 3;
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};
@@ -5529,9 +5532,9 @@ void ShowAdvancedRDS() {
encval = 0;
}
}
}
}
void tryWiFi() {
void tryWiFi() {
if (!setupmode) {
tft.drawRoundRect(1, 60, 319, 140, 5, ActiveColor);
tft.fillRoundRect(3, 62, 315, 136, 5, BackgroundColor);
@@ -5549,9 +5552,9 @@ void ShowAdvancedRDS() {
XDRGTKTCP = false;
RDSSPYTCP = false;
}
}
}
void passwordcrypt() {
void passwordcrypt() {
int generated = 0;
while (generated < 16)
{
@@ -5563,9 +5566,9 @@ void ShowAdvancedRDS() {
}
salt = saltkey + XDRGTK_key;
cryptedpassword = String(sha1(salt));
}
}
void DefaultSettings() {
void DefaultSettings() {
EEPROM.writeByte(EE_BYTE_CHECKBYTE, EE_CHECKBYTE_VALUE);
EEPROM.writeUInt(EE_UINT16_FREQUENCY_FM, 10000);
EEPROM.writeInt(EE_BYTE_VOLSET, 0);
@@ -5626,9 +5629,9 @@ void ShowAdvancedRDS() {
EEPROM.writeByte(EE_BYTE_AF, 0);
EEPROM.writeByte(EE_BYTE_STEREO, 1);
EEPROM.commit();
}
}
void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, const uint8_t* font) {
void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, const uint8_t* font) {
tft.loadFont(font);
tft.setTextColor(color, smoothcolor, false);
switch (offset) {
@@ -5638,9 +5641,9 @@ void ShowAdvancedRDS() {
}
tft.drawString(text, x, y, 1);
tft.unloadFont();
}
}
void tftReplace(int8_t offset, const String & textold, const String & text, int16_t x, int16_t y, int color, int smoothcolor, const uint8_t* font) {
void tftReplace(int8_t offset, const String & textold, const String & text, int16_t x, int16_t y, int color, int smoothcolor, const uint8_t* font) {
tft.loadFont(font);
tft.setTextColor(BackgroundColor, BackgroundColor, false);
switch (offset) {
@@ -5657,4 +5660,4 @@ void ShowAdvancedRDS() {
}
tft.drawString(text, x, y);
tft.unloadFont();
}
}