You've already forked TEF6686_ESP32
Seperate RDS and communication from INO
Squelch now show dBuV, dBf, dBm
This commit is contained in:
1867
TEF6686_ESP32.ino
1867
TEF6686_ESP32.ino
File diff suppressed because it is too large
Load Diff
556
src/comms.cpp
Normal file
556
src/comms.cpp
Normal file
@@ -0,0 +1,556 @@
|
||||
#include "comms.h"
|
||||
#include "language.h"
|
||||
#include "constants.h"
|
||||
#include <EEPROM.h>
|
||||
|
||||
void Communication() {
|
||||
if (menu == false) {
|
||||
if (wifi) {
|
||||
int packetSize = Udp.parsePacket();
|
||||
if (packetSize) {
|
||||
char packetBuffer[packetSize];
|
||||
Udp.read(packetBuffer, packetSize);
|
||||
Udp.endPacket();
|
||||
String packet = String(packetBuffer);
|
||||
if (strcmp(packetBuffer, "from=StationList;freq=?;bandwidth=?") == 0) {
|
||||
ShowFreq(0);
|
||||
} else {
|
||||
int symPos = packet.indexOf("freq=");
|
||||
String stlfreq = packet.substring(symPos + 5, packetSize);
|
||||
if ((stlfreq.toInt()) / 10000 > 6500 && (stlfreq.toInt()) / 10000 < 10800) {
|
||||
if (band != BAND_FM) {
|
||||
band = BAND_FM;
|
||||
SelectBand();
|
||||
}
|
||||
frequency = (stlfreq.toInt()) / 10000;
|
||||
radio.SetFreq(frequency);
|
||||
}
|
||||
|
||||
// To Do: AM
|
||||
// if ((stlfreq.toInt()) / 1000 > 144 && (stlfreq.toInt()) / 1000 < 27000) {
|
||||
// if (band != 5) {
|
||||
// band = 5;
|
||||
// SelectBand();
|
||||
// }
|
||||
// frequency5 = (stlfreq.toInt()) / 1000;
|
||||
// radio.SetFreqAM(frequency5);
|
||||
// }
|
||||
radio.clearRDS(fullsearchrds);
|
||||
ShowFreq(0);
|
||||
store = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Server.hasClient()) {
|
||||
if (RemoteClient.connected()) {
|
||||
Server.available().stop();
|
||||
} else {
|
||||
wificonnected = true;
|
||||
RemoteClient = Server.available();
|
||||
passwordcrypt();
|
||||
RemoteClient.print(saltkey + "\n");
|
||||
}
|
||||
} else {
|
||||
if (Server.hasClient()) Server.available().stop();
|
||||
}
|
||||
|
||||
if (wificonnected == true && !RemoteClient.connected()) {
|
||||
wificonnected = false;
|
||||
RDSSPYTCP = false;
|
||||
XDRGTKTCP = false;
|
||||
}
|
||||
|
||||
if (XDRGTKTCP == false && wificonnected == true && RemoteClient.available()) {
|
||||
String data_str = RemoteClient.readStringUntil('\n');
|
||||
if (data_str.length() > 30 && data_str.equals(cryptedpassword)) {
|
||||
radio.setFMABandw();
|
||||
if (band != BAND_FM) {
|
||||
band = BAND_FM;
|
||||
SelectBand();
|
||||
}
|
||||
XDRGTKTCP = true;
|
||||
RemoteClient.print("o1,0\n");
|
||||
store = true;
|
||||
} else if (RDSSPYTCP == false && XDRGTKTCP == false && data_str.length() > 1 && data_str == ("*D*R?F")) {
|
||||
RDSSPYTCP = true;
|
||||
} else if (RDSSPYTCP == true) {
|
||||
int symPos = data_str.indexOf("*F");
|
||||
if (symPos >= 5) {
|
||||
String freq = data_str.substring(0, symPos);
|
||||
freq = freq.substring(0, freq.length() - 1);
|
||||
frequency = freq.toInt();
|
||||
radio.SetFreq(frequency);
|
||||
radio.clearRDS(fullsearchrds);
|
||||
if (band != BAND_FM) {
|
||||
band = BAND_FM;
|
||||
SelectBand();
|
||||
}
|
||||
ShowFreq(0);
|
||||
store = true;
|
||||
}
|
||||
} else {
|
||||
RemoteClient.print("a0\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (XDRGTKUSB == false && Serial.available())
|
||||
{
|
||||
String data_str = Serial.readStringUntil('\n');
|
||||
if (data_str.length() > 1 && data_str == ("*D*R?F")) RDSSPYUSB = true;
|
||||
int symPos = data_str.indexOf("*F");
|
||||
if (symPos >= 5) {
|
||||
String freq = data_str.substring(0, symPos);
|
||||
freq = freq.substring(0, freq.length() - 1);
|
||||
frequency = freq.toInt();
|
||||
radio.SetFreq(frequency);
|
||||
if (band != BAND_FM) {
|
||||
band = BAND_FM;
|
||||
BWreset = true;
|
||||
BWset = 0;
|
||||
radio.power(0);
|
||||
delay(50);
|
||||
radio.SetFreq(frequency);
|
||||
radio.clearRDS(fullsearchrds);
|
||||
freqold = frequency_AM;
|
||||
doBW();
|
||||
radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus, SNR);
|
||||
if (screenmute == false) radio.clearRDS(fullsearchrds); BuildDisplay();
|
||||
}
|
||||
ShowFreq(0);
|
||||
store = true;
|
||||
}
|
||||
if (data_str.charAt(0) == 'x') {
|
||||
radio.setFMABandw();
|
||||
if (band != BAND_FM) {
|
||||
band = BAND_FM;
|
||||
SelectBand();
|
||||
}
|
||||
Serial.print("OK\nT" + String(frequency * 10) + "\n");
|
||||
XDRGTKUSB = true;
|
||||
if (menu == true) ModeButtonPress();
|
||||
if (Squelch != Squelchold) {
|
||||
if (screenmute == false) {
|
||||
if (Squelchold == -100) {
|
||||
tftPrint(-1, myLanguage[language][33], 235, 145, BackgroundColor, BackgroundColor, 16);
|
||||
} else if (Squelchold > 920) {
|
||||
tftPrint(-1, "ST", 235, 145, BackgroundColor, BackgroundColor, 16);
|
||||
} else {
|
||||
tftPrint(-1, String(Squelchold / 10), 235, 145, BackgroundColor, BackgroundColor, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (XDRGTKUSB || XDRGTKTCP) XDRGTKRoutine();
|
||||
}
|
||||
}
|
||||
|
||||
void XDRGTKRoutine() {
|
||||
if (XDRGTKUSB) {
|
||||
if (Serial.available())
|
||||
{
|
||||
buff[buff_pos] = Serial.read();
|
||||
if (buff[buff_pos] != '\n' && buff_pos != 16 - 1)
|
||||
{
|
||||
buff_pos++;
|
||||
} else {
|
||||
buff[buff_pos] = 0;
|
||||
buff_pos = 0;
|
||||
XDRGTKdata = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (XDRGTKTCP) {
|
||||
if (RemoteClient.available() > 0) {
|
||||
buff[buff_pos] = RemoteClient.read();
|
||||
if (buff[buff_pos] != '\n' && buff_pos != 16 - 1)
|
||||
{
|
||||
buff_pos++;
|
||||
} else {
|
||||
buff[buff_pos] = 0;
|
||||
buff_pos = 0;
|
||||
XDRGTKdata = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (XDRGTKdata) {
|
||||
switch (buff[0])
|
||||
{
|
||||
case 'A':
|
||||
int AGC;
|
||||
AGC = atol(buff + 1);
|
||||
DataPrint("A" + String(AGC) + "\n");
|
||||
radio.setAGC(AGC);
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
byte scanmethod;
|
||||
scanmethod = atol(buff + 1);
|
||||
if (scanmethod == 1) {
|
||||
DataPrint("C1\n");
|
||||
direction = false;
|
||||
Seek(direction);
|
||||
ShowFreq(0);
|
||||
}
|
||||
if (scanmethod == 2) {
|
||||
DataPrint("C2\n");
|
||||
direction = true;
|
||||
Seek(direction);
|
||||
ShowFreq(0);
|
||||
}
|
||||
DataPrint("C0\n");
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
doStereoToggle();
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
DeEmphasis = atol(buff + 1);
|
||||
DataPrint("D" + String(DeEmphasis) + "\n");
|
||||
radio.setDeemphasis(DeEmphasis);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
XDRBWset = atol(buff + 1);
|
||||
DataPrint("F" + String(XDRBWset) + "\n");
|
||||
if (XDRBWset < 0) {
|
||||
XDRBWsetold = XDRBWset;
|
||||
BWset = 0;
|
||||
} else if (XDRBWset < 16) {
|
||||
BWset = XDRBWset + 1;
|
||||
XDRBWsetold = XDRBWset;
|
||||
} else {
|
||||
XDRBWset = XDRBWsetold;
|
||||
}
|
||||
doBW();
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
byte offsetg;
|
||||
offsetg = atol(buff + 1);
|
||||
if (offsetg == 0) {
|
||||
MuteScreen(0);
|
||||
LowLevelSet = EEPROM.readInt(EE_BYTE_LOWLEVELSET);
|
||||
softmuteam = EEPROM.readByte(EE_BYTE_SOFTMUTEAM);
|
||||
softmutefm = EEPROM.readByte(EE_BYTE_SOFTMUTEFM);
|
||||
radio.setSoftmuteFM(softmutefm);
|
||||
radio.setSoftmuteAM(softmuteam);
|
||||
DataPrint("G00\n");
|
||||
}
|
||||
if (offsetg == 10) {
|
||||
MuteScreen(1);
|
||||
LowLevelSet = EEPROM.readInt(EE_BYTE_LOWLEVELSET);
|
||||
softmuteam = EEPROM.readByte(EE_BYTE_SOFTMUTEAM);
|
||||
softmutefm = EEPROM.readByte(EE_BYTE_SOFTMUTEFM);
|
||||
radio.setSoftmuteFM(softmutefm);
|
||||
radio.setSoftmuteAM(softmuteam);
|
||||
DataPrint("G10\n");
|
||||
}
|
||||
if (offsetg == 1) {
|
||||
MuteScreen(0);
|
||||
radio.setSoftmuteFM(1);
|
||||
radio.setSoftmuteAM(1);
|
||||
DataPrint("G01\n");
|
||||
}
|
||||
if (offsetg == 11) {
|
||||
MuteScreen(1);
|
||||
radio.setSoftmuteFM(1);
|
||||
radio.setSoftmuteAM(1);
|
||||
DataPrint("G11\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
byte XDRband;
|
||||
XDRband = atol(buff + 1);
|
||||
if (XDRband == 0) DataPrint("M0\n"); else DataPrint("M1\n");
|
||||
if (XDRband == 1) {
|
||||
if (frequency_AM >= LWLowEdgeSet && frequency_AM <= LWHighEdgeSet) {
|
||||
if (band != BAND_LW) {
|
||||
band = BAND_LW;
|
||||
SelectBand();
|
||||
}
|
||||
}
|
||||
if (frequency_AM >= MWLowEdgeSet && frequency_AM <= MWHighEdgeSet) {
|
||||
if (band != BAND_MW) {
|
||||
band = BAND_MW;
|
||||
SelectBand();
|
||||
}
|
||||
}
|
||||
if (frequency_AM >= SWLowEdgeSet && frequency_AM <= SWHighEdgeSet) {
|
||||
if (band != BAND_SW) {
|
||||
band = BAND_SW;
|
||||
SelectBand();
|
||||
}
|
||||
}
|
||||
radio.SetFreqAM(frequency_AM);
|
||||
DataPrint("M1\n");
|
||||
DataPrint("T" + String(frequency_AM) + "\n");
|
||||
} else {
|
||||
if (band != BAND_FM) {
|
||||
band = BAND_FM;
|
||||
SelectBand();
|
||||
}
|
||||
DataPrint("M0\n");
|
||||
DataPrint("T" + String(frequency * 10) + "\n");
|
||||
radio.SetFreq(frequency);
|
||||
radio.clearRDS(fullsearchrds);
|
||||
RDSstatus = false;
|
||||
}
|
||||
store = true;
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
unsigned int freqtemp;
|
||||
freqtemp = atoi(buff + 1);
|
||||
if (seek == true) seek = false;
|
||||
if (freqtemp >= LWLowEdgeSet && freqtemp <= LWHighEdgeSet) {
|
||||
frequency_AM = freqtemp;
|
||||
if (band != BAND_LW) {
|
||||
band = BAND_LW;
|
||||
SelectBand();
|
||||
}
|
||||
radio.SetFreqAM(frequency_AM);
|
||||
DataPrint("M1\n");
|
||||
}
|
||||
if (freqtemp >= MWLowEdgeSet && freqtemp <= MWHighEdgeSet) {
|
||||
frequency_AM = freqtemp;
|
||||
if (band != BAND_MW) {
|
||||
band = BAND_MW;
|
||||
SelectBand();
|
||||
}
|
||||
radio.SetFreqAM(frequency_AM);
|
||||
DataPrint("M1\n");
|
||||
}
|
||||
if (freqtemp >= SWLowEdgeSet && freqtemp <= SWHighEdgeSet) {
|
||||
frequency_AM = freqtemp;
|
||||
if (band != BAND_SW) {
|
||||
band = BAND_SW;
|
||||
SelectBand();
|
||||
}
|
||||
radio.SetFreqAM(frequency_AM);
|
||||
DataPrint("M1\n");
|
||||
}
|
||||
if (freqtemp >= FREQ_FM_START && freqtemp <= FREQ_FM_END) {
|
||||
frequency = freqtemp / 10;
|
||||
if (band != BAND_FM) {
|
||||
band = BAND_FM;
|
||||
SelectBand();
|
||||
}
|
||||
radio.SetFreq(frequency);
|
||||
DataPrint("M0\n");
|
||||
}
|
||||
if (band == BAND_FM) DataPrint("T" + String(frequency * 10) + "\n"); else DataPrint("T" + String(frequency_AM) + "\n");
|
||||
ShowFreq(0);
|
||||
radio.clearRDS(fullsearchrds);
|
||||
RDSstatus = false;
|
||||
store = true;
|
||||
aftest = true;
|
||||
aftimer = millis();
|
||||
break;
|
||||
|
||||
case 'Q':
|
||||
Squelch = atoi(buff + 1);
|
||||
if (Squelch == -1) {
|
||||
DataPrint("Q - 1\n");
|
||||
} else {
|
||||
Squelch *= 10;
|
||||
DataPrint("Q\n");
|
||||
DataPrint(String(Squelch / 10));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
if (buff[1] == 'a') {
|
||||
scanner_start = (atol(buff + 2) + 5) / 10;
|
||||
} else if (buff[1] == 'b') {
|
||||
scanner_end = (atol(buff + 2) + 5) / 10;
|
||||
} else if (buff[1] == 'c') {
|
||||
scanner_step = (atol(buff + 2) + 5) / 10;
|
||||
} else if (buff[1] == 'f') {
|
||||
scanner_filter = atol(buff + 2);
|
||||
} else if (scanner_start > 0 && scanner_end > 0 && scanner_step > 0 && scanner_filter >= 0) {
|
||||
frequencyold = frequency;
|
||||
DataPrint("U");
|
||||
if (scanner_filter < 0) {
|
||||
BWset = 0;
|
||||
} else if (scanner_filter == 0) {
|
||||
BWset = 1;
|
||||
} else if (scanner_filter == 26) {
|
||||
BWset = 2;
|
||||
} else if (scanner_filter == 1) {
|
||||
BWset = 3;
|
||||
} else if (scanner_filter == 28) {
|
||||
BWset = 4;
|
||||
} else if (scanner_filter == 29) {
|
||||
BWset = 5;
|
||||
} else if (scanner_filter == 3) {
|
||||
BWset = 6;
|
||||
} else if (scanner_filter == 4) {
|
||||
BWset = 7;
|
||||
} else if (scanner_filter == 5) {
|
||||
BWset = 8;
|
||||
} else if (scanner_filter == 7) {
|
||||
BWset = 9;
|
||||
} else if (scanner_filter == 8) {
|
||||
BWset = 10;
|
||||
} else if (scanner_filter == 9) {
|
||||
BWset = 11;
|
||||
} else if (scanner_filter == 10) {
|
||||
BWset = 12;
|
||||
} else if (scanner_filter == 11) {
|
||||
BWset = 13;
|
||||
} else if (scanner_filter == 12) {
|
||||
BWset = 14;
|
||||
} else if (scanner_filter == 13) {
|
||||
BWset = 15;
|
||||
} else if (scanner_filter == 15) {
|
||||
BWset = 16;
|
||||
}
|
||||
doBW();
|
||||
if (screenmute == false) {
|
||||
tft.drawRoundRect(10, 30, 300, 170, 5, ActiveColor);
|
||||
tft.fillRoundRect(12, 32, 296, 166, 5, BackgroundColor);
|
||||
tftPrint(0, myLanguage[language][34], 160, 100, ActiveColor, ActiveColorSmooth, 28);
|
||||
}
|
||||
frequencyold = frequency;
|
||||
for (freq_scan = scanner_start; freq_scan <= scanner_end; freq_scan += scanner_step) {
|
||||
DataPrint(String(freq_scan * 10, DEC));
|
||||
DataPrint(" = ");
|
||||
if (band < BAND_GAP) radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus, SNR); else radio.getStatusAM(SStatus, USN, WAM, OStatus, BW, MStatus, SNR);
|
||||
DataPrint(String((radio.CheckSignal(freq_scan) / 10) + 10, DEC));
|
||||
DataPrint(", ");
|
||||
}
|
||||
DataPrint("\n");
|
||||
radio.SetFreq(frequencyold);
|
||||
BuildDisplay();
|
||||
radio.setFMABandw();
|
||||
BWset = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'Y':
|
||||
VolSet = atoi(buff + 1);
|
||||
if (VolSet == 0) {
|
||||
radio.setMute();
|
||||
if (screenmute == false) tft.drawBitmap(92, 4, Speaker, 26, 22, PrimaryColor);
|
||||
XDRMute = true;
|
||||
SQ = true;
|
||||
} else {
|
||||
radio.setUnMute();
|
||||
if (screenmute == false) tft.drawBitmap(92, 4, Speaker, 26, 22, GreyoutColor);
|
||||
radio.setVolume((VolSet - 40) / 10);
|
||||
XDRMute = false;
|
||||
}
|
||||
DataPrint("Y" + String(VolSet) + "\n");
|
||||
VolSet /= 10;
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
DataPrint("OK\nT" + String(frequency * 10) + "\n");
|
||||
break;
|
||||
|
||||
case 'X':
|
||||
XDRGTKTCP = false;
|
||||
XDRGTKUSB = false;
|
||||
store = true;
|
||||
XDRMute = false;
|
||||
radio.setUnMute();
|
||||
if (screenmute == false) tft.drawBitmap(92, 4, Speaker, 26, 22, GreyoutColor);
|
||||
VolSet = EEPROM.readInt(EE_BYTE_VOLSET);
|
||||
LowLevelSet = EEPROM.readInt(EE_BYTE_LOWLEVELSET);
|
||||
softmuteam = EEPROM.readByte(EE_BYTE_SOFTMUTEAM);
|
||||
softmutefm = EEPROM.readByte(EE_BYTE_SOFTMUTEFM);
|
||||
radio.setVolume(VolSet);
|
||||
radio.setSoftmuteFM(softmutefm);
|
||||
radio.setSoftmuteAM(softmuteam);
|
||||
if (screenmute) MuteScreen(0);
|
||||
break;
|
||||
|
||||
case 'Z':
|
||||
byte iMSEQX;
|
||||
iMSEQX = atol(buff + 1);
|
||||
switch (iMSEQX) {
|
||||
case 0:
|
||||
iMSset = 1;
|
||||
EQset = 1;
|
||||
iMSEQ = 2;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
iMSset = 0;
|
||||
EQset = 1;
|
||||
iMSEQ = 3;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
iMSset = 1;
|
||||
EQset = 0;
|
||||
iMSEQ = 4;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
iMSset = 0;
|
||||
EQset = 0;
|
||||
iMSEQ = 1;
|
||||
break;
|
||||
}
|
||||
updateiMS();
|
||||
updateEQ();
|
||||
DataPrint("Z" + String(iMSEQX) + "\n");
|
||||
break;
|
||||
}
|
||||
XDRGTKdata = false;
|
||||
}
|
||||
|
||||
if (band > BAND_GAP) {
|
||||
DataPrint("Sm");
|
||||
} else {
|
||||
if (StereoToggle == false) {
|
||||
DataPrint("SS");
|
||||
} else if (Stereostatus == true) {
|
||||
DataPrint("Ss");
|
||||
} else {
|
||||
DataPrint("Sm");
|
||||
}
|
||||
}
|
||||
DataPrint(String(((SStatus * 100) + 10875) / 1000) + "." + String(((SStatus * 100) + 10875) / 100 % 10) + ", " + String(WAM / 10) + ", " + String(SNR) + "\n");
|
||||
}
|
||||
|
||||
void passwordcrypt() {
|
||||
int generated = 0;
|
||||
while (generated < 16)
|
||||
{
|
||||
byte randomValue = random(0, 26);
|
||||
char letter = randomValue + 'a';
|
||||
if (randomValue > 26) letter = (randomValue - 26);
|
||||
saltkey.setCharAt(generated, letter);
|
||||
generated ++;
|
||||
}
|
||||
salt = saltkey + XDRGTK_key;
|
||||
cryptedpassword = String(sha1(salt));
|
||||
}
|
||||
|
||||
void tryWiFi() {
|
||||
if (!setupmode) {
|
||||
tft.drawRoundRect(1, 60, 319, 140, 5, ActiveColor);
|
||||
tft.fillRoundRect(3, 62, 315, 136, 5, BackgroundColor);
|
||||
tftPrint(0, myLanguage[language][55], 155, 88, ActiveColor, ActiveColorSmooth, 28);
|
||||
}
|
||||
if (wc.autoConnect()) {
|
||||
Server.begin();
|
||||
Udp.begin(9031);
|
||||
remoteip = IPAddress (WiFi.localIP()[0], WiFi.localIP()[1], WiFi.localIP()[2], subnetclient);
|
||||
if (!setupmode) tftPrint(0, myLanguage[language][57], 155, 128, InsignificantColor, InsignificantColorSmooth, 28);
|
||||
wifi = true;
|
||||
} else {
|
||||
if (!setupmode) tftPrint(0, myLanguage[language][56], 155, 128, SignificantColor, SignificantColorSmooth, 28);
|
||||
wifi = false;
|
||||
XDRGTKTCP = false;
|
||||
RDSSPYTCP = false;
|
||||
}
|
||||
}
|
||||
117
src/comms.h
Normal file
117
src/comms.h
Normal file
@@ -0,0 +1,117 @@
|
||||
#ifndef COMMS_H
|
||||
#define COMMS_H
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <TFT_eSPI.h>
|
||||
#include <WiFiClient.h>
|
||||
#include "TEF6686.h"
|
||||
#include <WiFi.h>
|
||||
#include <Hash.h>
|
||||
#include "WiFiConnect.h"
|
||||
#include "WiFiConnectParam.h"
|
||||
|
||||
extern bool aftest;
|
||||
extern bool BWreset;
|
||||
extern bool direction;
|
||||
extern bool fullsearchrds;
|
||||
extern bool menu;
|
||||
extern bool RDSSPYTCP;
|
||||
extern bool RDSSPYUSB;
|
||||
extern bool RDSstatus;
|
||||
extern bool screenmute;
|
||||
extern bool seek;
|
||||
extern bool setupmode;
|
||||
extern bool softmuteam;
|
||||
extern bool softmutefm;
|
||||
extern bool SQ;
|
||||
extern bool StereoToggle;
|
||||
extern bool store;
|
||||
extern bool wifi;
|
||||
extern bool wificonnected;
|
||||
extern bool XDRGTKdata;
|
||||
extern bool XDRGTKTCP;
|
||||
extern bool XDRGTKUSB;
|
||||
extern bool XDRMute;
|
||||
extern bool XDRMute;
|
||||
extern byte band;
|
||||
extern byte BWset;
|
||||
extern byte EQset;
|
||||
extern byte iMSEQ;
|
||||
extern byte iMSset;
|
||||
extern byte language;
|
||||
extern byte subnetclient;
|
||||
extern char buff[16];
|
||||
extern int ActiveColor;
|
||||
extern int ActiveColorSmooth;
|
||||
extern int BackgroundColor;
|
||||
extern int DeEmphasis;
|
||||
extern int freqold;
|
||||
extern int GreyoutColor;
|
||||
extern int InsignificantColor;
|
||||
extern int InsignificantColorSmooth;
|
||||
extern int PrimaryColor;
|
||||
extern int PrimaryColorSmooth;
|
||||
extern int scanner_filter;
|
||||
extern int SignificantColor;
|
||||
extern int SignificantColorSmooth;
|
||||
extern int Squelch;
|
||||
extern int Squelchold;
|
||||
extern int Stereostatus;
|
||||
extern int XDRBWset;
|
||||
extern int XDRBWsetold;
|
||||
extern int16_t OStatus;
|
||||
extern int16_t SStatus;
|
||||
extern int8_t LowLevelSet;
|
||||
extern int8_t VolSet;
|
||||
extern IPAddress remoteip;
|
||||
extern String cryptedpassword;
|
||||
extern String salt;
|
||||
extern String saltkey;
|
||||
extern String XDRGTK_key;
|
||||
extern uint16_t BW;
|
||||
extern uint16_t MStatus;
|
||||
extern uint16_t USN;
|
||||
extern uint16_t WAM;
|
||||
extern uint8_t buff_pos;
|
||||
extern uint8_t SNR;
|
||||
extern unsigned int freq_scan;
|
||||
extern unsigned int frequency;
|
||||
extern unsigned int frequency_AM;
|
||||
extern unsigned int frequencyold;
|
||||
extern unsigned int LWHighEdgeSet;
|
||||
extern unsigned int LWLowEdgeSet;
|
||||
extern unsigned int MWHighEdgeSet;
|
||||
extern unsigned int MWLowEdgeSet;
|
||||
extern unsigned int scanner_end;
|
||||
extern unsigned int scanner_start;
|
||||
extern unsigned int scanner_step;
|
||||
extern unsigned int SWHighEdgeSet;
|
||||
extern unsigned int SWLowEdgeSet;
|
||||
extern unsigned long aftimer;
|
||||
|
||||
extern TFT_eSPI tft;
|
||||
extern TEF6686 radio;
|
||||
extern WiFiClient RemoteClient;
|
||||
extern WiFiUDP Udp;
|
||||
extern WiFiServer Server;
|
||||
extern WiFiConnect wc;
|
||||
|
||||
void Communication();
|
||||
void XDRGTKRoutine();
|
||||
void passwordcrypt();
|
||||
void tryWiFi();
|
||||
|
||||
extern void DataPrint(String string);
|
||||
extern void ShowFreq(int mode);
|
||||
extern void SelectBand();
|
||||
extern void doBW();
|
||||
extern void BuildDisplay();
|
||||
extern void ModeButtonPress();
|
||||
extern void Seek(bool mode);
|
||||
extern void doStereoToggle();
|
||||
extern void MuteScreen(bool setting);
|
||||
extern void updateiMS();
|
||||
extern void updateEQ();
|
||||
extern void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, uint8_t fontsize);
|
||||
|
||||
#endif
|
||||
1344
src/gui.cpp
1344
src/gui.cpp
File diff suppressed because it is too large
Load Diff
14
src/gui.h
14
src/gui.h
@@ -96,17 +96,27 @@ extern int BarInsignificantColor;
|
||||
extern int BarSignificantColor;
|
||||
extern int BatteryValueColor;
|
||||
extern int BatteryValueColorSmooth;
|
||||
extern int BWAutoColor;
|
||||
extern int BWAutoColorSmooth;
|
||||
extern int FrameColor;
|
||||
extern int FrequencyColor;
|
||||
extern int GreyoutColor;
|
||||
extern int InsignificantColor;
|
||||
extern int InsignificantColorSmooth;
|
||||
extern int menuoption;
|
||||
extern int PrimaryColor;
|
||||
extern int PrimaryColorSmooth;
|
||||
extern int RDSColor;
|
||||
extern int RDSColorSmooth;
|
||||
extern int rssiold;
|
||||
extern int SecondaryColor;
|
||||
extern int SecondaryColorSmooth;
|
||||
extern int SignificantColor;
|
||||
extern int SignificantColorSmooth;
|
||||
extern int Squelchold;
|
||||
extern int SStatusold;
|
||||
extern int StereoColor;
|
||||
extern int StereoColorSmooth;
|
||||
extern int16_t SStatus;
|
||||
extern int8_t LevelOffset;
|
||||
extern int8_t LowLevelSet;
|
||||
@@ -122,8 +132,6 @@ extern unsigned int ConverterSet;
|
||||
extern unsigned int HighEdgeSet;
|
||||
extern unsigned int LowEdgeSet;
|
||||
extern unsigned int mappedfreqold[20];
|
||||
extern bool resetFontOnNextCall;
|
||||
extern const uint8_t* currentFont;
|
||||
|
||||
extern TFT_eSPI tft;
|
||||
extern TEF6686 radio;
|
||||
@@ -136,6 +144,7 @@ void BuildDisplay();
|
||||
void MenuUp();
|
||||
void MenuDown();
|
||||
void DoMenu();
|
||||
void doTheme();
|
||||
|
||||
extern void ShowFreq(int mode);
|
||||
extern void ShowBandSelectionFM(bool notglanceview, bool normaldisplay);
|
||||
@@ -149,5 +158,6 @@ extern void updateiMS();
|
||||
extern void updateEQ();
|
||||
extern void doTheme();
|
||||
extern void tryWiFi();
|
||||
extern void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, uint8_t fontsize);
|
||||
|
||||
#endif
|
||||
643
src/rds.cpp
Normal file
643
src/rds.cpp
Normal file
@@ -0,0 +1,643 @@
|
||||
#include "rds.h"
|
||||
#include "language.h"
|
||||
#include "constants.h"
|
||||
#include <TimeLib.h>
|
||||
|
||||
void ShowAdvancedRDS() {
|
||||
if (radio.rds.rdsAerror != errorAold || rdsreset) {
|
||||
if (radio.rds.rdsAerror) tft.fillCircle(86, 41, 5, SignificantColor); else tft.fillCircle(86, 41, 5, InsignificantColor);
|
||||
errorAold = radio.rds.rdsAerror;
|
||||
}
|
||||
|
||||
if (radio.rds.rdsBerror != errorBold || rdsreset) {
|
||||
if (radio.rds.rdsBerror) tft.fillCircle(124, 41, 5, SignificantColor); else tft.fillCircle(124, 41, 5, InsignificantColor);
|
||||
errorBold = radio.rds.rdsBerror;
|
||||
}
|
||||
|
||||
if (radio.rds.rdsCerror != errorCold || rdsreset) {
|
||||
if (radio.rds.rdsCerror) tft.fillCircle(162, 41, 5, SignificantColor); else tft.fillCircle(162, 41, 5, InsignificantColor);
|
||||
errorCold = radio.rds.rdsCerror;
|
||||
}
|
||||
|
||||
if (radio.rds.rdsDerror != errorDold || rdsreset) {
|
||||
if (radio.rds.rdsDerror) tft.fillCircle(200, 41, 5, SignificantColor); else tft.fillCircle(200, 41, 5, InsignificantColor);
|
||||
errorDold = radio.rds.rdsDerror;
|
||||
}
|
||||
|
||||
if (radio.rds.hasDynamicPTY != dynamicPTYold) {
|
||||
if (radio.rds.hasDynamicPTY) tft.fillCircle(310, 137, 5, InsignificantColor); else tft.fillCircle(310, 137, 5, SignificantColor);
|
||||
dynamicPTYold = radio.rds.hasDynamicPTY;
|
||||
}
|
||||
|
||||
if (radio.rds.hasArtificialhead != artheadold) {
|
||||
if (radio.rds.hasArtificialhead) tft.fillCircle(310, 153, 5, InsignificantColor); else tft.fillCircle(310, 153, 5, SignificantColor);
|
||||
artheadold = radio.rds.hasArtificialhead;
|
||||
}
|
||||
|
||||
if (radio.rds.hasCompressed != compressedold) {
|
||||
if (radio.rds.hasCompressed) tft.fillCircle(310, 168, 5, InsignificantColor); else tft.fillCircle(310, 168, 5, SignificantColor);
|
||||
compressedold = radio.rds.hasCompressed;
|
||||
}
|
||||
|
||||
if (radio.rds.hasStereo != rdsstereoold) {
|
||||
if (radio.rds.hasStereo) tft.fillCircle(310, 183, 5, InsignificantColor); else tft.fillCircle(310, 183, 5, SignificantColor);
|
||||
rdsstereoold = radio.rds.hasStereo;
|
||||
}
|
||||
|
||||
if (ptynold != radio.rds.PTYN) {
|
||||
tftPrint(-1, "PTYN N/A", 216, 109, BackgroundColor, BackgroundColor, 16);
|
||||
tftPrint(-1, ptynold, 216, 109, BackgroundColor, BackgroundColor, 16);
|
||||
if (radio.rds.PTYN.length() == 0) radio.rds.PTYN = "PTYN N/A";
|
||||
tftPrint(-1, String(radio.rds.PTYN), 216, 109, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
ptynold = radio.rds.PTYN;
|
||||
}
|
||||
|
||||
if (licold != radio.rds.LIC) {
|
||||
tftPrint(-1, "N/A", 242, 208, BackgroundColor, BackgroundColor, 16);
|
||||
tftPrint(-1, LIColdString, 242, 208, BackgroundColor, BackgroundColor, 16);
|
||||
|
||||
if (radio.rds.LIC > 0 && radio.rds.LIC < 44) {
|
||||
if (radio.rds.hasLIC) tftPrint(-1, myLanguages[radio.rds.LIC], 242, 208, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "N/A", 242, 208, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
LIColdString = myLanguages[radio.rds.LIC];
|
||||
} else {
|
||||
byte lic;
|
||||
switch (radio.rds.LIC) {
|
||||
case 73: lic = 44; break;
|
||||
case 86: lic = 45; break;
|
||||
case 96: lic = 46; break;
|
||||
case 99: lic = 47; break;
|
||||
case 108: lic = 48; break;
|
||||
case 112: lic = 49; break;
|
||||
case 113: lic = 50; break;
|
||||
case 119: lic = 51; break;
|
||||
case 125: lic = 52; break;
|
||||
case 126: lic = 53; break;
|
||||
default: lic = 0; break;
|
||||
}
|
||||
if (radio.rds.hasLIC) tftPrint(-1, myLanguages[lic], 242, 208, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "N/A", 242, 208, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
LIColdString = myLanguages[lic];
|
||||
}
|
||||
licold = radio.rds.LIC;
|
||||
}
|
||||
|
||||
String pinstring = String(radio.rds.pinDay) + " " + String(radio.rds.pinHour) + ":" + (radio.rds.pinMin < 10 ? "0" : "") + String(radio.rds.pinMin);
|
||||
if (pinstringold != pinstring) {
|
||||
tftPrint(-1, "N/A", 242, 223, BackgroundColor, BackgroundColor, 16);
|
||||
tftPrint(-1, pinstringold, 242, 223, BackgroundColor, BackgroundColor, 16);
|
||||
|
||||
if (radio.rds.hasPIN) tftPrint(-1, pinstring, 242, 223, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "N/A", 242, 223, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
pinstringold = pinstring;
|
||||
}
|
||||
|
||||
String afstring;
|
||||
if (radio.rds.hasAF) for (byte i = 0; i < radio.af_counter; i++) afstring += String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10) + (radio.af[i].filler ? "(f)" : "") + (i == radio.af_counter - 1 ? " " : " | "); else afstring = myLanguage[language][87];
|
||||
if (hasafold != radio.rds.hasAF) {
|
||||
if (radio.rds.hasAF) tftPrint(-1, "AF", 47, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "AF", 47, 51, GreyoutColor, BackgroundColor, 16);
|
||||
hasafold = radio.rds.hasAF;
|
||||
}
|
||||
|
||||
if (afstring.length() < 20) {
|
||||
if (afstringold != afstring) {
|
||||
xPos2 = 0;
|
||||
sprite5.fillSprite(BackgroundColor);
|
||||
sprite5.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
sprite5.drawString(afstring, xPos2, 2);
|
||||
sprite5.pushSprite(35, 197);
|
||||
}
|
||||
} else {
|
||||
if (millis() - afticker >= 15) {
|
||||
if (xPos2 == 0) {
|
||||
if (millis() - aftickerhold >= 2000) {
|
||||
xPos2 --;
|
||||
aftickerhold = millis();
|
||||
}
|
||||
} else {
|
||||
xPos2 --;
|
||||
aftickerhold = millis();
|
||||
}
|
||||
if (xPos2 < -tft.textWidth(afstring) + (charWidth * 14)) xPos2 = 0;
|
||||
sprite5.fillSprite(BackgroundColor);
|
||||
sprite5.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
sprite5.drawString(afstring, xPos2, 2);
|
||||
sprite5.pushSprite(35, 197);
|
||||
afticker = millis();
|
||||
}
|
||||
}
|
||||
afstringold = afstring;
|
||||
|
||||
String eonstring;
|
||||
if (radio.rds.hasEON) for (byte i = 0; i < radio.eon_counter; i++) eonstring += String(radio.eon[i].picode) + (radio.eon[i].ps.length() > 0 ? String(": " + String(radio.eon[i].ps)) : "") + (radio.eon[i].mappedfreq > 0 ? String(" " + String(radio.eon[i].mappedfreq / 100) + "." + String((radio.eon[i].mappedfreq % 100) / 10)) : "") + (radio.eon[i].mappedfreq2 > 0 ? String(" / " + String(radio.eon[i].mappedfreq2 / 100) + "." + String((radio.eon[i].mappedfreq2 % 100) / 10)) : "") + (radio.eon[i].mappedfreq3 > 0 ? String(" / " + String(radio.eon[i].mappedfreq3 / 100) + "." + String((radio.eon[i].mappedfreq3 % 100) / 10)) : "") + (i == radio.eon_counter - 1 ? " " : " | "); else eonstring = myLanguage[language][88];
|
||||
if (haseonold != radio.rds.hasEON) {
|
||||
if (radio.rds.hasEON) tftPrint(-1, "EON", 150, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "EON", 150, 51, GreyoutColor, BackgroundColor, 16);
|
||||
haseonold = radio.rds.hasEON;
|
||||
}
|
||||
if (eonstring.length() < 20) {
|
||||
if (eonstringold != eonstring) {
|
||||
xPos3 = 0;
|
||||
sprite3.fillSprite(BackgroundColor);
|
||||
sprite3.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
sprite3.drawString(eonstring, xPos3, 2);
|
||||
sprite3.pushSprite(35, 172);
|
||||
}
|
||||
} else {
|
||||
if (millis() - eonticker >= 15) {
|
||||
if (xPos3 == 0) {
|
||||
if (millis() - eontickerhold >= 2000) {
|
||||
xPos3 --;
|
||||
eontickerhold = millis();
|
||||
}
|
||||
} else {
|
||||
xPos3 --;
|
||||
eontickerhold = millis();
|
||||
}
|
||||
if (xPos3 < -tft.textWidth(eonstring) + (charWidth * 14)) xPos3 = 0;
|
||||
sprite3.fillSprite(BackgroundColor);
|
||||
sprite3.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
sprite3.drawString(eonstring, xPos3, 2);
|
||||
sprite3.pushSprite(35, 172);
|
||||
eonticker = millis();
|
||||
}
|
||||
}
|
||||
eonstringold = eonstring;
|
||||
|
||||
String rtplusstring;
|
||||
if (radio.rds.hasRDSplus) rtplusstring = (radio.rds.rdsplusTag1 != 169 ? String(myLanguage[language][radio.rds.rdsplusTag1]) + ": " + String(radio.rds.RTContent1) : "") + (radio.rds.rdsplusTag2 != 169 ? " - " + String(myLanguage[language][radio.rds.rdsplusTag2]) + ": " + String(radio.rds.RTContent2) : "") + " "; else rtplusstring = myLanguage[language][89];
|
||||
if (hasrtplusold != radio.rds.hasRDSplus) {
|
||||
if (radio.rds.hasRDSplus) tftPrint(-1, "RT+", 122, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "RT+", 122, 51, GreyoutColor, BackgroundColor, 16);
|
||||
hasrtplusold = radio.rds.hasRDSplus;
|
||||
}
|
||||
if (rtplusstring.length() < 20) {
|
||||
if (rtplusstringold != rtplusstring) {
|
||||
xPos4 = 0;
|
||||
sprite4.fillSprite(BackgroundColor);
|
||||
sprite4.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
sprite4.drawString(rtplusstring, xPos4, 2);
|
||||
sprite4.pushSprite(35, 146);
|
||||
}
|
||||
} else {
|
||||
if (millis() - rtplusticker >= 15) {
|
||||
if (xPos4 == 0) {
|
||||
if (millis() - rtplustickerhold >= 2000) {
|
||||
xPos4 --;
|
||||
rtplustickerhold = millis();
|
||||
}
|
||||
} else {
|
||||
xPos4 --;
|
||||
rtplustickerhold = millis();
|
||||
}
|
||||
if (xPos4 < -tft.textWidth(rtplusstring) + (charWidth * 14)) xPos4 = 0;
|
||||
sprite4.fillSprite(BackgroundColor);
|
||||
sprite4.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
sprite4.drawString(rtplusstring, xPos4, 2);
|
||||
sprite4.pushSprite(35, 146);
|
||||
rtplusticker = millis();
|
||||
}
|
||||
}
|
||||
rtplusstringold = rtplusstring;
|
||||
|
||||
if (TPold != radio.rds.hasTP) {
|
||||
if (radio.rds.hasTP == true) tftPrint(-1, "TP", 3, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "TP", 3, 51, GreyoutColor, BackgroundColor, 16);
|
||||
TPold = radio.rds.hasTP;
|
||||
}
|
||||
|
||||
if (TAold != radio.rds.hasTA) {
|
||||
if (radio.rds.hasTA == true) tftPrint(-1, "TA", 25, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "TA", 25, 51, GreyoutColor, BackgroundColor, 16);
|
||||
TAold = radio.rds.hasTA;
|
||||
}
|
||||
|
||||
if (MSold != radio.rds.MS) {
|
||||
switch (radio.rds.MS) {
|
||||
case 0:
|
||||
tftPrint(-1, "M", 183, 51, GreyoutColor, BackgroundColor, 16);
|
||||
tftPrint(-1, "S", 199, 51, GreyoutColor, BackgroundColor, 16);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
tftPrint(-1, "M", 183, 51, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
tftPrint(-1, "S", 199, 51, GreyoutColor, BackgroundColor, 16);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
tftPrint(-1, "M", 183, 51, GreyoutColor, BackgroundColor, 16);
|
||||
tftPrint(-1, "S", 199, 51, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
break;
|
||||
}
|
||||
MSold = radio.rds.MS;
|
||||
}
|
||||
|
||||
rds_clock = ((hour() < 10 ? "0" : "") + String(hour()) + ":" + (minute() < 10 ? "0" : "") + String(minute()));
|
||||
if (rds_clock != rds_clockold) {
|
||||
if (radio.rds.hasCT) {
|
||||
tftReplace(1, rds_clockold, rds_clock, 205, 109, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
tftPrint(-1, "CT", 69, 51, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
} else {
|
||||
tftPrint(1, rds_clock, 205, 109, BackgroundColor, BackgroundColor, 16);
|
||||
tftPrint(-1, "CT", 69, 51, GreyoutColor, BackgroundColor, 16);
|
||||
}
|
||||
rds_clockold = rds_clock;
|
||||
}
|
||||
|
||||
if (rdsblockold != radio.rdsblock) {
|
||||
if (rdsblockold < 33) tft.fillCircle((6 * rdsblockold) + 10, 133, 2, SignificantColor);
|
||||
if (radio.rdsblock < 33) tft.fillCircle((6 * radio.rdsblock) + 10, 133, 2, InsignificantColor);
|
||||
rdsblockold = radio.rdsblock;
|
||||
}
|
||||
|
||||
if (hastmcold != radio.rds.hasTMC) {
|
||||
if (radio.rds.hasTMC == true) tftPrint(-1, "TMC", 89, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "TMC", 89, 51, GreyoutColor, BackgroundColor, 16);
|
||||
hastmcold = radio.rds.hasTMC;
|
||||
}
|
||||
|
||||
rdsreset = false;
|
||||
}
|
||||
|
||||
void doAF() {
|
||||
if (radio.af_counter != af_counterold && radio.rds.hasAF == true) {
|
||||
if (wifi) {
|
||||
Udp.beginPacket(remoteip, 9030);
|
||||
Udp.print("AF=");
|
||||
|
||||
for (byte af_scan = 0; af_scan < radio.af_counter; af_scan++) {
|
||||
if (wifi) {
|
||||
if ((radio.af[af_scan].frequency - 8750) / 10 < 0x10) {
|
||||
Udp.print("0");
|
||||
}
|
||||
Udp.print(String((radio.af[af_scan].frequency - 8750) / 10, HEX));
|
||||
}
|
||||
}
|
||||
af_counterold = radio.af_counter;
|
||||
|
||||
for (int i = 0; i < 25 - radio.af_counter; i++) Udp.print("00");
|
||||
Udp.endPacket();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void showECC() {
|
||||
if (ECCold != radio.rds.ECC) {
|
||||
String ECC;
|
||||
if (radio.rds.picode[0] == '1') {
|
||||
if (radio.rds.ECC == 224) ECC = myCountries[0];
|
||||
if (radio.rds.ECC == 225) ECC = myCountries[1];
|
||||
if (radio.rds.ECC == 226) ECC = myCountries[2];
|
||||
if (radio.rds.ECC == 228) ECC = myCountries[3];
|
||||
} else if (radio.rds.picode[0] == '2') {
|
||||
if (radio.rds.ECC == 224) ECC = myCountries[4];
|
||||
if (radio.rds.ECC == 225) ECC = myCountries[5];
|
||||
if (radio.rds.ECC == 226) ECC = myCountries[6];
|
||||
if (radio.rds.ECC == 227) ECC = myCountries[7];
|
||||
if (radio.rds.ECC == 228) ECC = myCountries[8];
|
||||
} else if (radio.rds.picode[0] == '3') {
|
||||
if (radio.rds.ECC == 224) ECC = myCountries[9];
|
||||
if (radio.rds.ECC == 225) ECC = myCountries[10];
|
||||
if (radio.rds.ECC == 226) ECC = myCountries[11];
|
||||
if (radio.rds.ECC == 227) ECC = myCountries[12];
|
||||
} else if (radio.rds.picode[0] == '4') {
|
||||
if (radio.rds.ECC == 224) ECC = myCountries[13];
|
||||
if (radio.rds.ECC == 225) ECC = myCountries[14];
|
||||
if (radio.rds.ECC == 226) ECC = myCountries[15];
|
||||
if (radio.rds.ECC == 227) ECC = myCountries[16];
|
||||
} else if (radio.rds.picode[0] == '5') {
|
||||
if (radio.rds.ECC == 224) ECC = myCountries[17];
|
||||
if (radio.rds.ECC == 225) ECC = myCountries[18];
|
||||
if (radio.rds.ECC == 226) ECC = myCountries[19];
|
||||
} else if (radio.rds.picode[0] == '6') {
|
||||
if (radio.rds.ECC == 224) ECC = myCountries[20];
|
||||
if (radio.rds.ECC == 225) ECC = myCountries[21];
|
||||
if (radio.rds.ECC == 226) ECC = myCountries[22];
|
||||
if (radio.rds.ECC == 227) ECC = myCountries[23];
|
||||
if (radio.rds.ECC == 228) ECC = myCountries[24];
|
||||
} else if (radio.rds.picode[0] == '7') {
|
||||
if (radio.rds.ECC == 224) ECC = myCountries[25];
|
||||
if (radio.rds.ECC == 225) ECC = myCountries[26];
|
||||
if (radio.rds.ECC == 226) ECC = myCountries[27];
|
||||
} else if (radio.rds.picode[0] == '8') {
|
||||
if (radio.rds.ECC == 224) ECC = myCountries[28];
|
||||
if (radio.rds.ECC == 225) ECC = myCountries[29];
|
||||
if (radio.rds.ECC == 226) ECC = myCountries[30];
|
||||
if (radio.rds.ECC == 227) ECC = myCountries[31];
|
||||
if (radio.rds.ECC == 228) ECC = myCountries[32];
|
||||
} else if (radio.rds.picode[0] == '9') {
|
||||
if (radio.rds.ECC == 224) ECC = myCountries[33];
|
||||
if (radio.rds.ECC == 225) ECC = myCountries[34];
|
||||
if (radio.rds.ECC == 226) ECC = myCountries[35];
|
||||
if (radio.rds.ECC == 227) ECC = myCountries[36];
|
||||
if (radio.rds.ECC == 228) ECC = myCountries[37];
|
||||
} else if (radio.rds.picode[0] == 'A') {
|
||||
if (radio.rds.ECC == 224) ECC = myCountries[38];
|
||||
if (radio.rds.ECC == 225) ECC = myCountries[39];
|
||||
if (radio.rds.ECC == 226) ECC = myCountries[40];
|
||||
if (radio.rds.ECC == 227) ECC = myCountries[41];
|
||||
} else if (radio.rds.picode[0] == 'B') {
|
||||
if (radio.rds.ECC == 224) ECC = myCountries[42];
|
||||
if (radio.rds.ECC == 225) ECC = myCountries[43];
|
||||
if (radio.rds.ECC == 226) ECC = myCountries[44];
|
||||
} else if (radio.rds.picode[0] == 'C') {
|
||||
if (radio.rds.ECC == 224) ECC = myCountries[45];
|
||||
if (radio.rds.ECC == 225) ECC = myCountries[46];
|
||||
if (radio.rds.ECC == 226) ECC = myCountries[47];
|
||||
if (radio.rds.ECC == 227) ECC = myCountries[48];
|
||||
} else if (radio.rds.picode[0] == 'D') {
|
||||
if (radio.rds.ECC == 224) ECC = myCountries[0];
|
||||
if (radio.rds.ECC == 225) ECC = myCountries[49];
|
||||
} else if (radio.rds.picode[0] == 'E') {
|
||||
if (radio.rds.ECC == 224) ECC = myCountries[50];
|
||||
if (radio.rds.ECC == 225) ECC = myCountries[51];
|
||||
if (radio.rds.ECC == 226) ECC = myCountries[52];
|
||||
if (radio.rds.ECC == 227) ECC = myCountries[53];
|
||||
} else if (radio.rds.picode[0] == 'F') {
|
||||
if (radio.rds.ECC == 224) ECC = myCountries[54];
|
||||
if (radio.rds.ECC == 225) ECC = myCountries[55];
|
||||
if (radio.rds.ECC == 226) ECC = myCountries[56];
|
||||
if (radio.rds.ECC == 227) ECC = myCountries[57];
|
||||
if (radio.rds.ECC == 228) ECC = myCountries[58];
|
||||
} else {
|
||||
ECC = myLanguage[language][73];
|
||||
}
|
||||
if (advancedRDS) {
|
||||
tftPrint(-1, "N/A", 242, 193, BackgroundColor, BackgroundColor, 16);
|
||||
tftPrint(-1, ECColdtxt, 242, 193, BackgroundColor, BackgroundColor, 16);
|
||||
if (radio.rds.hasECC) tftPrint(-1, ECC, 242, 193, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "N/A", 242, 193, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
ECColdtxt = ECC;
|
||||
}
|
||||
|
||||
if (wifi) {
|
||||
Udp.beginPacket(remoteip, 9030);
|
||||
Udp.print("ECC=");
|
||||
if (radio.rds.ECC < 0x10) Udp.print("0");
|
||||
Udp.print(String(radio.rds.ECC, HEX));
|
||||
Udp.endPacket();
|
||||
}
|
||||
ECCold = radio.rds.ECC;
|
||||
}
|
||||
}
|
||||
|
||||
void readRds() {
|
||||
radio.readRDS(showrdserrors);
|
||||
if (band < BAND_GAP) {
|
||||
RDSstatus = radio.rds.hasRDS;
|
||||
ShowRDSLogo(RDSstatus);
|
||||
if (!afscreen) {
|
||||
if (!RDSstatus && !screenmute) {
|
||||
if (advancedRDS) tftPrint(-1, PIold, 244, 75, SecondaryColor, SecondaryColorSmooth, 28); else tftPrint(-1, PIold, 244, 187, SecondaryColor, SecondaryColorSmooth, 28);
|
||||
if (advancedRDS) tftPrint(-1, PSold, 38, 75, SecondaryColor, SecondaryColorSmooth, 28); else tftPrint(-1, PSold, 38, 187, SecondaryColor, SecondaryColorSmooth, 28);
|
||||
if (advancedRDS) tftPrint(-1, PTYold, 38, 109, SecondaryColor, SecondaryColorSmooth, 16); else tftPrint(-1, PTYold, 38, 163, SecondaryColor, SecondaryColorSmooth, 16);
|
||||
if (advancedRDS) {
|
||||
tft.fillCircle(86, 41, 5, SignificantColor);
|
||||
tft.fillCircle(124, 41, 5, SignificantColor);
|
||||
tft.fillCircle(162, 41, 5, SignificantColor);
|
||||
tft.fillCircle(200, 41, 5, SignificantColor);
|
||||
}
|
||||
dropout = true;
|
||||
aftest = true;
|
||||
aftimer = millis();
|
||||
} else {
|
||||
if (dropout == true && PIold.length() != 0) {
|
||||
if (advancedRDS) tftPrint(-1, PIold, 244, 75, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(-1, PIold, 244, 187, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
if (advancedRDS) tftPrint(-1, PSold, 38, 75, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(-1, PSold, 38, 187, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
if (advancedRDS) tftPrint(-1, PTYold, 38, 109, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, PTYold, 38, 163, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
dropout = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((RDSstatus && RDSSPYUSB) || (RDSstatus && RDSSPYTCP)) {
|
||||
RDSSPYRDS = "G:\r\n";
|
||||
if (radio.rds.rdsAerror) RDSSPYRDS += "----"; else RDSSPYRDS += String(((radio.rds.rdsA >> 8) >> 4) & 0xF, HEX) + String((radio.rds.rdsA >> 8) & 0xF, HEX) + String(((radio.rds.rdsA) >> 4) & 0xF, HEX) + String((radio.rds.rdsA) & 0xF, HEX);
|
||||
if (radio.rds.rdsBerror) RDSSPYRDS += "----"; else RDSSPYRDS += String(((radio.rds.rdsB >> 8) >> 4) & 0xF, HEX) + String((radio.rds.rdsB >> 8) & 0xF, HEX) + String(((radio.rds.rdsB) >> 4) & 0xF, HEX) + String((radio.rds.rdsB) & 0xF, HEX);
|
||||
if (radio.rds.rdsCerror) RDSSPYRDS += "----"; else RDSSPYRDS += String(((radio.rds.rdsC >> 8) >> 4) & 0xF, HEX) + String((radio.rds.rdsC >> 8) & 0xF, HEX) + String(((radio.rds.rdsC) >> 4) & 0xF, HEX) + String((radio.rds.rdsC) & 0xF, HEX);
|
||||
if (radio.rds.rdsDerror) RDSSPYRDS += "----"; else RDSSPYRDS += String(((radio.rds.rdsD >> 8) >> 4) & 0xF, HEX) + String((radio.rds.rdsD >> 8) & 0xF, HEX) + String(((radio.rds.rdsD) >> 4) & 0xF, HEX) + String((radio.rds.rdsD) & 0xF, HEX);
|
||||
RDSSPYRDS += "\r\n\r\n";
|
||||
|
||||
if (RDSSPYRDS != RDSSPYRDSold) {
|
||||
if (RDSSPYUSB) Serial.print(RDSSPYRDS); else RemoteClient.print(RDSSPYRDS);
|
||||
RDSSPYRDSold = RDSSPYRDS;
|
||||
}
|
||||
}
|
||||
|
||||
if ((RDSstatus && XDRGTKUSB) || (RDSstatus && XDRGTKTCP)) {
|
||||
DataPrint ("P");
|
||||
DataPrint (String(((radio.rds.rdsA >> 8) >> 4) & 0xF, HEX) + String((radio.rds.rdsA >> 8) & 0xF, HEX));
|
||||
DataPrint (String(((radio.rds.rdsA) >> 4) & 0xF, HEX) + String((radio.rds.rdsA) & 0xF, HEX));
|
||||
if (((radio.rds.rdsErr >> 14) & 0x02) > 2) DataPrint("?");
|
||||
if (((radio.rds.rdsErr >> 14) & 0x01) > 1) DataPrint("?");
|
||||
DataPrint ("\n");
|
||||
|
||||
XDRGTKRDS = "R";
|
||||
XDRGTKRDS += String(((radio.rds.rdsB >> 8) >> 4) & 0xF, HEX) + String((radio.rds.rdsB >> 8) & 0xF, HEX);
|
||||
XDRGTKRDS += String(((radio.rds.rdsB) >> 4) & 0xF, HEX) + String((radio.rds.rdsB) & 0xF, HEX);
|
||||
XDRGTKRDS += String(((radio.rds.rdsC >> 8) >> 4) & 0xF, HEX) + String((radio.rds.rdsC >> 8) & 0xF, HEX);
|
||||
XDRGTKRDS += String(((radio.rds.rdsC) >> 4) & 0xF, HEX) + String((radio.rds.rdsC) & 0xF, HEX);
|
||||
XDRGTKRDS += String(((radio.rds.rdsD >> 8) >> 4) & 0xF, HEX) + String((radio.rds.rdsD >> 8) & 0xF, HEX);
|
||||
XDRGTKRDS += String(((radio.rds.rdsD) >> 4) & 0xF, HEX) + String((radio.rds.rdsD) & 0xF, HEX);
|
||||
|
||||
uint8_t erroutput = 0;
|
||||
erroutput |= (highByte(radio.rds.rdsErr) & 0x04) >> 2;
|
||||
erroutput |= (highByte(radio.rds.rdsErr) & 0x02) << 2;
|
||||
erroutput |= (highByte(radio.rds.rdsErr) & 0x01) << 6;
|
||||
erroutput |= (highByte(radio.rds.rdsErr) & 0x08) >> 3;
|
||||
erroutput |= (highByte(radio.rds.rdsErr) & 0x10) >> 1;
|
||||
erroutput |= (highByte(radio.rds.rdsErr) & 0x40) << 1;
|
||||
erroutput |= (highByte(radio.rds.rdsErr) & 0x80) >> 7;
|
||||
erroutput |= (highByte(radio.rds.rdsErr) & 0x20) << 5;
|
||||
|
||||
if (highByte(radio.rds.rdsErr) < 0x10) XDRGTKRDS += "0";
|
||||
XDRGTKRDS += String(erroutput, HEX);
|
||||
XDRGTKRDS += "\n";
|
||||
|
||||
if (XDRGTKRDS != XDRGTKRDSold) {
|
||||
DataPrint(XDRGTKRDS);
|
||||
XDRGTKRDSold = XDRGTKRDS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void showPI() {
|
||||
if (strcmp(radio.rds.picode, radioIdPrevious)) {
|
||||
if (advancedRDS) {
|
||||
tftReplace(-1, PIold, radio.rds.picode, 244, 75, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
} else if (afscreen) {
|
||||
tftReplace(-1, PIold, radio.rds.picode, 30, 201, BWAutoColor, BWAutoColorSmooth, 16);
|
||||
} else {
|
||||
tftReplace(-1, PIold, radio.rds.picode, 244, 187, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
}
|
||||
PIold = radio.rds.picode;
|
||||
if (wifi) {
|
||||
Udp.beginPacket(remoteip, 9030);
|
||||
Udp.print("from=TEF_tuner;PI=" + String(radio.rds.picode, 4));
|
||||
Udp.endPacket();
|
||||
}
|
||||
strcpy(radioIdPrevious, radio.rds.picode);
|
||||
}
|
||||
}
|
||||
|
||||
void showPTY() {
|
||||
if (strcmp(radio.rds.stationType, programTypePrevious)) {
|
||||
if (advancedRDS) tftReplace(-1, PTYold, radio.rds.stationType, 38, 109, PrimaryColor, PrimaryColorSmooth, 16); else tftReplace(-1, PTYold, radio.rds.stationType, 38, 163, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
PTYold = radio.rds.stationType;
|
||||
if (wifi) {
|
||||
Udp.beginPacket(remoteip, 9030);
|
||||
Udp.print("from=TEF_tuner;PTY=");
|
||||
Udp.print(String(radio.rds.stationTypeCode, HEX));
|
||||
Udp.endPacket();
|
||||
}
|
||||
strcpy(programTypePrevious, radio.rds.stationType);
|
||||
}
|
||||
}
|
||||
|
||||
void showPS() {
|
||||
if (radio.rds.stationName != programServicePrevious) {
|
||||
if (advancedRDS) {
|
||||
tftReplace(-1, PSold, radio.rds.stationName, 38, 75, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
} else if (afscreen) {
|
||||
tftReplace(0, PSold, radio.rds.stationName, 160, 201, BWAutoColor, BWAutoColorSmooth, 16);
|
||||
} else {
|
||||
tftReplace(-1, PSold, radio.rds.stationName, 38, 187, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
}
|
||||
PSold = radio.rds.stationName;
|
||||
if (wifi) {
|
||||
Udp.beginPacket(remoteip, 9030);
|
||||
Udp.print("from=TEF_tuner;PS=");
|
||||
char PShex[9];
|
||||
radio.rds.stationName.toCharArray(PShex, 9);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
if (PShex[i] < 0x10) Udp.print("0");
|
||||
if (PShex[i] == 0x20) PShex[i] = '_';
|
||||
Udp.print(String(PShex[i], HEX));
|
||||
}
|
||||
Udp.endPacket();
|
||||
}
|
||||
programServicePrevious = radio.rds.stationName;
|
||||
}
|
||||
}
|
||||
|
||||
void showRadioText() {
|
||||
if (radio.rds.hasRT && radio.rds.stationText.length() > 0) {
|
||||
if (advancedRDS && radio.rds.stationText.length() < 20) {
|
||||
xPos = 0;
|
||||
sprite2.fillSprite(BackgroundColor);
|
||||
if (RDSstatus) sprite2.setTextColor(PrimaryColor, PrimaryColorSmooth, false); else sprite2.setTextColor(SecondaryColor, SecondaryColorSmooth, false);
|
||||
sprite2.drawString(radio.rds.stationText + " " + radio.rds.stationText32, xPos, 2);
|
||||
sprite2.pushSprite(35, 220);
|
||||
} else if (!advancedRDS && radio.rds.stationText.length() < 29) {
|
||||
if (RTold != radio.rds.stationText + " " + radio.rds.stationText32) {
|
||||
xPos = 0;
|
||||
sprite.fillSprite(BackgroundColor);
|
||||
if (RDSstatus) sprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); else sprite.setTextColor(SecondaryColor, SecondaryColorSmooth, false);
|
||||
sprite.drawString(radio.rds.stationText + " " + radio.rds.stationText32, xPos, 2);
|
||||
sprite.pushSprite(38, 220);
|
||||
}
|
||||
} else {
|
||||
if (millis() - rtticker >= 15) {
|
||||
if (xPos == 0) {
|
||||
if (millis() - rttickerhold >= 2000) {
|
||||
xPos --;
|
||||
rttickerhold = millis();
|
||||
}
|
||||
} else {
|
||||
xPos --;
|
||||
rttickerhold = millis();
|
||||
}
|
||||
if (advancedRDS) {
|
||||
if (xPos < -tft.textWidth(radio.rds.stationText + " " + radio.rds.stationText32) + (charWidth * 16)) xPos = 0;
|
||||
sprite2.fillSprite(BackgroundColor);
|
||||
if (RDSstatus) sprite2.setTextColor(PrimaryColor, PrimaryColorSmooth, false); else sprite2.setTextColor(SecondaryColor, SecondaryColorSmooth, false);
|
||||
sprite2.drawString(radio.rds.stationText + " " + radio.rds.stationText32, xPos, 2);
|
||||
sprite2.pushSprite(35, 220);
|
||||
} else {
|
||||
if (xPos < -tft.textWidth(radio.rds.stationText + " " + radio.rds.stationText32) + (charWidth * 26)) xPos = 0;
|
||||
sprite.fillSprite(BackgroundColor);
|
||||
if (RDSstatus) sprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); else sprite.setTextColor(SecondaryColor, SecondaryColorSmooth, false);
|
||||
sprite.drawString(radio.rds.stationText + " " + radio.rds.stationText32, xPos, 2);
|
||||
sprite.pushSprite(38, 220);
|
||||
}
|
||||
rtticker = millis();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wifi) {
|
||||
Udp.beginPacket(remoteip, 9030);
|
||||
Udp.print("from=TEF_tuner;RT1=");
|
||||
char RThex[65];
|
||||
radio.rds.stationText.toCharArray(RThex, 65);
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
if (RThex[i] < 0x10) Udp.print("0");
|
||||
if (RThex[i] == ' ') RThex[i] = '_';
|
||||
Udp.print(String(RThex[i], HEX));
|
||||
}
|
||||
Udp.endPacket();
|
||||
}
|
||||
RTold = radio.rds.stationText + " " + radio.rds.stationText32;
|
||||
}
|
||||
|
||||
void ShowAFEON() {
|
||||
if (radio.rds.hasAF) {
|
||||
if (hasafold == false) {
|
||||
tftPrint(-1, myLanguage[language][87], 6, 54, BackgroundColor, BackgroundColor, 16);
|
||||
tftPrint(-1, "AF:", 4, 32, ActiveColor, ActiveColorSmooth, 16);
|
||||
hasafold = true;
|
||||
}
|
||||
|
||||
if (radio.af_counter > 30) {
|
||||
if (!afpage) {
|
||||
afpage = true;
|
||||
afpagenr = 1;
|
||||
}
|
||||
} else {
|
||||
afpagenr = 0;
|
||||
}
|
||||
|
||||
if (af_counterold != radio.af_counter) {
|
||||
tft.fillRect(2, 48, 166, 150, BackgroundColor);
|
||||
for (byte i = 0; i < radio.af_counter; i++) {
|
||||
byte x = i - (afpagenr == 2 ? 30 : 0);
|
||||
if (radio.af[i].checked) {
|
||||
tftPrint(1, (radio.af[i].filler ? "f " : "") + String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 50 + (x > 9 ? 54 : 0) + (x > 19 ? 54 : 0), 48 + (15 * x) - (x > 9 ? 150 : 0) - (x > 19 ? 150 : 0), InsignificantColor, InsignificantColorSmooth, 16);
|
||||
} else if (!radio.af[i].afvalid) {
|
||||
tftPrint(1, (radio.af[i].filler ? "f " : "") + String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 50 + (x > 9 ? 54 : 0) + (x > 19 ? 54 : 0), 48 + (15 * x) - (x > 9 ? 150 : 0) - (x > 19 ? 150 : 0), SignificantColor, SignificantColorSmooth, 16);
|
||||
} else {
|
||||
tftPrint(1, (radio.af[i].filler ? "f " : "") + String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 50 + (x > 9 ? 54 : 0) + (x > 19 ? 54 : 0), 48 + (15 * x) - (x > 9 ? 150 : 0) - (x > 19 ? 150 : 0), PrimaryColor, PrimaryColorSmooth, 16);
|
||||
}
|
||||
if (i == 29 + (afpagenr == 2 ? 30 : 0)) i = 254;
|
||||
}
|
||||
|
||||
if (radio.af_counter > 10 + (afpagenr == 2 ? 30 : 0)) tft.drawLine(59, 54, 59, 191, SecondaryColor);
|
||||
if (radio.af_counter > 20 + (afpagenr == 2 ? 30 : 0)) tft.drawLine(113, 54, 113, 191, SecondaryColor);
|
||||
if (afpage == true) tftPrint(1, String(afpagenr) + "/2", 315, 222, SecondaryColor, SecondaryColorSmooth, 16);
|
||||
}
|
||||
af_counterold = radio.af_counter;
|
||||
}
|
||||
|
||||
if (radio.rds.hasEON) {
|
||||
if (haseonold == false) {
|
||||
tftPrint(-1, myLanguage[language][88], 184, 48, BackgroundColor, BackgroundColor, 16);
|
||||
tftPrint(-1, "PI:", 170, 32, ActiveColor, ActiveColorSmooth, 16);
|
||||
}
|
||||
haseonold = true;
|
||||
for (byte i = 0; i < radio.eon_counter; i++) {
|
||||
tftPrint(-1, String(radio.eon[i].picode), 170, 48 + (15 * i), PrimaryColor, PrimaryColorSmooth, 16);
|
||||
if (radio.eon[i].ps.length() > 0) {
|
||||
tftPrint(-1, "PS:", 206, 32, ActiveColor, ActiveColorSmooth, 16);
|
||||
if (radio.eon[i].ps != eonpsold[i]) {
|
||||
tftPrint(-1, String(eonpsold[i]), 206, 48 + (15 * i), BackgroundColor, BackgroundColor, 16);
|
||||
eonpsold[i] = radio.eon[i].ps;
|
||||
}
|
||||
tftPrint(-1, String(radio.eon[i].ps), 206, 48 + (15 * i), SecondaryColor, SecondaryColorSmooth, 16);
|
||||
}
|
||||
|
||||
if (radio.eon[i].mappedfreq > 0) {
|
||||
tftPrint(1, "FREQ:", 316, 32, ActiveColor, ActiveColorSmooth, 16);
|
||||
if (radio.eon[i].mappedfreq != mappedfreqold[i]) {
|
||||
tftPrint(1, String(mappedfreqold[i] / 100) + "." + String((mappedfreqold[i] % 100) / 10), 316, 48 + (15 * i), BackgroundColor, BackgroundColor, 16);
|
||||
}
|
||||
tftPrint(1, String(radio.eon[i].mappedfreq / 100) + "." + String((radio.eon[i].mappedfreq % 100) / 10), 316, 48 + (15 * i), PrimaryColor, PrimaryColorSmooth, 16);
|
||||
mappedfreqold[i] = radio.eon[i].mappedfreq;
|
||||
}
|
||||
if (i == 10) i = 254;
|
||||
}
|
||||
}
|
||||
}
|
||||
124
src/rds.h
Normal file
124
src/rds.h
Normal file
@@ -0,0 +1,124 @@
|
||||
#ifndef RDS_H
|
||||
#define RDS_H
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <TFT_eSPI.h>
|
||||
#include <WiFiClient.h>
|
||||
#include "TEF6686.h"
|
||||
#include <WiFi.h>
|
||||
|
||||
extern bool advancedRDS;
|
||||
extern bool afpage;
|
||||
extern bool afscreen;
|
||||
extern bool aftest;
|
||||
extern bool artheadold;
|
||||
extern bool compressedold;
|
||||
extern bool dropout;
|
||||
extern bool dynamicPTYold;
|
||||
extern bool errorAold;
|
||||
extern bool errorBold;
|
||||
extern bool errorCold;
|
||||
extern bool errorDold;
|
||||
extern bool hasafold;
|
||||
extern bool haseonold;
|
||||
extern bool hasrtplusold;
|
||||
extern bool hastmcold;
|
||||
extern bool rdsreset;
|
||||
extern bool RDSSPYTCP;
|
||||
extern bool RDSSPYUSB;
|
||||
extern bool RDSstatus;
|
||||
extern bool rdsstereoold;
|
||||
extern bool screenmute;
|
||||
extern bool setupmode;
|
||||
extern bool showrdserrors;
|
||||
extern bool TAold;
|
||||
extern bool TPold;
|
||||
extern bool wifi;
|
||||
extern bool XDRGTKTCP;
|
||||
extern bool XDRGTKUSB;
|
||||
extern byte af_counterold;
|
||||
extern byte afpagenr;
|
||||
extern byte band;
|
||||
extern byte ECCold;
|
||||
extern byte language;
|
||||
extern byte licold;
|
||||
extern byte MSold;
|
||||
extern byte rdsblockold;
|
||||
extern char programTypePrevious[18];
|
||||
extern char radioIdPrevious[6];
|
||||
extern int ActiveColor;
|
||||
extern int ActiveColorSmooth;
|
||||
extern int BackgroundColor;
|
||||
extern int BWAutoColor;
|
||||
extern int BWAutoColorSmooth;
|
||||
extern int charWidth;
|
||||
extern int GreyoutColor;
|
||||
extern int InsignificantColor;
|
||||
extern int InsignificantColorSmooth;
|
||||
extern int PrimaryColor;
|
||||
extern int PrimaryColorSmooth;
|
||||
extern int SecondaryColor;
|
||||
extern int SecondaryColorSmooth;
|
||||
extern int SignificantColor;
|
||||
extern int SignificantColorSmooth;
|
||||
extern int xPos;
|
||||
extern int xPos2;
|
||||
extern int xPos3;
|
||||
extern int xPos4;
|
||||
extern IPAddress remoteip;
|
||||
extern String afstringold;
|
||||
extern String ECColdtxt;
|
||||
extern String eonpsold[11];
|
||||
extern String eonstringold;
|
||||
extern String LIColdString;
|
||||
extern String pinstringold;
|
||||
extern String PIold;
|
||||
extern String programServicePrevious;
|
||||
extern String PSold;
|
||||
extern String ptynold;
|
||||
extern String PTYold;
|
||||
extern String rds_clock;
|
||||
extern String rds_clockold;
|
||||
extern String RDSSPYRDS;
|
||||
extern String RDSSPYRDSold;
|
||||
extern String RTold;
|
||||
extern String rtplusstringold;
|
||||
extern String XDRGTKRDS;
|
||||
extern String XDRGTKRDSold;
|
||||
extern unsigned int mappedfreqold[20];
|
||||
extern unsigned long afticker;
|
||||
extern unsigned long aftickerhold;
|
||||
extern unsigned long aftimer;
|
||||
extern unsigned long eonticker;
|
||||
extern unsigned long eontickerhold;
|
||||
extern unsigned long rtplusticker;
|
||||
extern unsigned long rtplustickerhold;
|
||||
extern unsigned long rtticker;
|
||||
extern unsigned long rttickerhold;
|
||||
|
||||
extern TFT_eSPI tft;
|
||||
extern TEF6686 radio;
|
||||
extern WiFiClient RemoteClient;
|
||||
extern WiFiUDP Udp;
|
||||
extern TFT_eSprite sprite;
|
||||
extern TFT_eSprite sprite2;
|
||||
extern TFT_eSprite sprite3;
|
||||
extern TFT_eSprite sprite4;
|
||||
extern TFT_eSprite sprite5;
|
||||
|
||||
void ShowAdvancedRDS();
|
||||
void readRds();
|
||||
void showECC();
|
||||
void doAF();
|
||||
void showPI();
|
||||
void showPTY();
|
||||
void showPS();
|
||||
void showRadioText();
|
||||
void ShowAFEON();
|
||||
|
||||
extern void ShowRDSLogo(bool RDSstatus);
|
||||
extern void DataPrint(String string);
|
||||
extern void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, uint8_t fontsize);
|
||||
extern void tftReplace(int8_t offset, const String & textold, const String & text, int16_t x, int16_t y, int color, int smoothcolor, uint8_t fontsize);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user