Extended UDP protocol
This commit is contained in:
@@ -171,6 +171,7 @@ byte BWsetFM;
|
|||||||
byte BWsetRecall;
|
byte BWsetRecall;
|
||||||
byte BWtemp;
|
byte BWtemp;
|
||||||
byte charwidth = 8;
|
byte charwidth = 8;
|
||||||
|
byte chipmodel;
|
||||||
byte hardwaremodel;
|
byte hardwaremodel;
|
||||||
byte ContrastSet;
|
byte ContrastSet;
|
||||||
byte CurrentSkin;
|
byte CurrentSkin;
|
||||||
@@ -862,19 +863,23 @@ void setup() {
|
|||||||
if (lowByte(device) == 14) {
|
if (lowByte(device) == 14) {
|
||||||
fullsearchrds = false;
|
fullsearchrds = false;
|
||||||
fmsi = false;
|
fmsi = false;
|
||||||
|
chipmodel = 0;
|
||||||
tft.fillRect(152, 230, 16, 6, PrimaryColor);
|
tft.fillRect(152, 230, 16, 6, PrimaryColor);
|
||||||
tftPrint(0, "TEF6686 Lithio", 160, 172, ActiveColor, ActiveColorSmooth, 28);
|
tftPrint(0, "TEF6686 Lithio", 160, 172, ActiveColor, ActiveColorSmooth, 28);
|
||||||
} else if (lowByte(device) == 1) {
|
} else if (lowByte(device) == 1) {
|
||||||
fullsearchrds = true;
|
fullsearchrds = true;
|
||||||
|
chipmodel = 1;
|
||||||
tft.fillRect(152, 230, 16, 6, PrimaryColor);
|
tft.fillRect(152, 230, 16, 6, PrimaryColor);
|
||||||
tftPrint(0, "TEF6687 Lithio FMSI", 160, 172, ActiveColor, ActiveColorSmooth, 28);
|
tftPrint(0, "TEF6687 Lithio FMSI", 160, 172, ActiveColor, ActiveColorSmooth, 28);
|
||||||
} else if (lowByte(device) == 9) {
|
} else if (lowByte(device) == 9) {
|
||||||
fullsearchrds = false;
|
fullsearchrds = false;
|
||||||
|
chipmodel = 2;
|
||||||
fmsi = false;
|
fmsi = false;
|
||||||
tft.fillRect(152, 230, 16, 6, PrimaryColor);
|
tft.fillRect(152, 230, 16, 6, PrimaryColor);
|
||||||
tftPrint(0, "TEF6688 Lithio DR", 160, 172, ActiveColor, ActiveColorSmooth, 28);
|
tftPrint(0, "TEF6688 Lithio DR", 160, 172, ActiveColor, ActiveColorSmooth, 28);
|
||||||
} else if (lowByte(device) == 3) {
|
} else if (lowByte(device) == 3) {
|
||||||
fullsearchrds = true;
|
fullsearchrds = true;
|
||||||
|
chipmodel = 3;
|
||||||
tft.fillRect(152, 230, 16, 6, PrimaryColor);
|
tft.fillRect(152, 230, 16, 6, PrimaryColor);
|
||||||
tftPrint(0, "TEF6689 Lithio FMSI DR", 160, 172, ActiveColor, ActiveColorSmooth, 28);
|
tftPrint(0, "TEF6689 Lithio FMSI DR", 160, 172, ActiveColor, ActiveColorSmooth, 28);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+44
-15
@@ -9,52 +9,80 @@ void Communication() {
|
|||||||
if (!menu) {
|
if (!menu) {
|
||||||
if (wifi) {
|
if (wifi) {
|
||||||
int packetSize = Udp.parsePacket();
|
int packetSize = Udp.parsePacket();
|
||||||
if (packetSize) {
|
if (packetSize > 0) {
|
||||||
char packetBuffer[packetSize];
|
char packetBuffer[packetSize + 1]; // +1 for null terminator
|
||||||
Udp.read(packetBuffer, packetSize);
|
Udp.read(packetBuffer, packetSize);
|
||||||
|
packetBuffer[packetSize] = '\0'; // Ensure valid string
|
||||||
Udp.endPacket();
|
Udp.endPacket();
|
||||||
|
|
||||||
String packet = String(packetBuffer);
|
String packet = String(packetBuffer);
|
||||||
if (strcmp(packetBuffer, "from=StationList;freq=?;bandwidth=?") == 0) {
|
|
||||||
|
if (packet.equals("from=StationList;freq=?;bandwidth=?")) {
|
||||||
ShowFreq(0);
|
ShowFreq(0);
|
||||||
} else {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
externaltune = true;
|
externaltune = true;
|
||||||
|
|
||||||
|
if (packet.charAt(0) == '*') {
|
||||||
|
if (afscreen) BuildAdvancedRDS();
|
||||||
|
char command = packet.charAt(1);
|
||||||
|
switch (command) {
|
||||||
|
case 'U':
|
||||||
|
case 'D':
|
||||||
|
tunemode = TUNE_MAN;
|
||||||
|
ShowTuneMode();
|
||||||
|
if (command == 'U') TuneUp(); else TuneDown();
|
||||||
|
ShowFreq(0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'S': if (!scandxmode) startFMDXScan(); break;
|
||||||
|
case 'E': if (scandxmode) cancelDXScan(); break;
|
||||||
|
|
||||||
|
case 'R': radio.clearRDS(fullsearchrds); break;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int symPos = packet.indexOf("freq=");
|
int symPos = packet.indexOf("freq=");
|
||||||
String stlfreq = packet.substring(symPos + 5, packetSize);
|
|
||||||
|
if (symPos != -1) {
|
||||||
|
String stlfreq = packet.substring(symPos + 5);
|
||||||
|
int freqValue = stlfreq.toInt();
|
||||||
|
|
||||||
if (afscreen) BuildAdvancedRDS();
|
if (afscreen) BuildAdvancedRDS();
|
||||||
|
|
||||||
if ((stlfreq.toInt()) / 10000 > (TEF == 205 ? 6400 : 6500) && (stlfreq.toInt()) / 10000 < 10800) {
|
unsigned int tempfreq;
|
||||||
unsigned int tempfreq = (stlfreq.toInt()) / 10000;
|
if ((freqValue / 10000) > (TEF == 205 ? 6400 : 6500) && (freqValue / 10000) < 10800) {
|
||||||
|
tempfreq = freqValue / 10000;
|
||||||
if (scandxmode) cancelDXScan();
|
if (scandxmode) cancelDXScan();
|
||||||
|
|
||||||
if (tempfreq >= FREQ_FM_OIRT_START && tempfreq <= FREQ_FM_OIRT_END) {
|
if (tempfreq >= FREQ_FM_OIRT_START && tempfreq <= FREQ_FM_OIRT_END) {
|
||||||
if (band != BAND_OIRT) {
|
if (band != BAND_OIRT) {
|
||||||
band = BAND_OIRT;
|
band = BAND_OIRT;
|
||||||
frequency_OIRT = tempfreq;
|
frequency_OIRT = tempfreq;
|
||||||
SelectBand();
|
SelectBand();
|
||||||
}
|
}
|
||||||
|
radio.SetFreq(frequency_OIRT);
|
||||||
} else {
|
} else {
|
||||||
if (band != BAND_FM) {
|
if (band != BAND_FM) {
|
||||||
band = BAND_FM;
|
band = BAND_FM;
|
||||||
frequency = tempfreq;
|
frequency = tempfreq;
|
||||||
SelectBand();
|
SelectBand();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (band == BAND_OIRT) {
|
|
||||||
frequency_OIRT = tempfreq;
|
|
||||||
radio.SetFreq(frequency_OIRT);
|
|
||||||
} else {
|
|
||||||
frequency = tempfreq;
|
|
||||||
radio.SetFreq(frequency);
|
radio.SetFreq(frequency);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stlfreq.toInt()) / 1000 > 144 && (stlfreq.toInt()) / 1000 < 27000) {
|
if ((freqValue / 1000) > 144 && (freqValue / 1000) < 27000) {
|
||||||
|
tempfreq = freqValue / 1000;
|
||||||
if (scandxmode) cancelDXScan();
|
if (scandxmode) cancelDXScan();
|
||||||
if (afscreen || advancedRDS) {
|
if (afscreen || advancedRDS) {
|
||||||
BuildDisplay();
|
BuildDisplay();
|
||||||
SelectBand();
|
SelectBand();
|
||||||
ScreensaverTimerReopen();
|
ScreensaverTimerReopen();
|
||||||
}
|
}
|
||||||
unsigned int tempfreq = (stlfreq.toInt()) / 1000;
|
|
||||||
if (tempfreq >= FREQ_LW_LOW_EDGE_MIN && tempfreq <= FREQ_LW_HIGH_EDGE_MAX) {
|
if (tempfreq >= FREQ_LW_LOW_EDGE_MIN && tempfreq <= FREQ_LW_HIGH_EDGE_MAX) {
|
||||||
frequency_LW = tempfreq;
|
frequency_LW = tempfreq;
|
||||||
if (band != BAND_LW) {
|
if (band != BAND_LW) {
|
||||||
@@ -84,6 +112,7 @@ void Communication() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
radio.clearRDS(fullsearchrds);
|
radio.clearRDS(fullsearchrds);
|
||||||
ShowFreq(0);
|
ShowFreq(0);
|
||||||
store = true;
|
store = true;
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ extern byte scanhold;
|
|||||||
extern byte stepsize;
|
extern byte stepsize;
|
||||||
extern byte subnetclient;
|
extern byte subnetclient;
|
||||||
extern byte TEF;
|
extern byte TEF;
|
||||||
|
extern byte tunemode;
|
||||||
extern char buff[16];
|
extern char buff[16];
|
||||||
extern int ActiveColor;
|
extern int ActiveColor;
|
||||||
extern int ActiveColorSmooth;
|
extern int ActiveColorSmooth;
|
||||||
@@ -154,4 +155,7 @@ extern void handleRoot();
|
|||||||
extern void handleDownloadCSV();
|
extern void handleDownloadCSV();
|
||||||
extern void handleLogo();
|
extern void handleLogo();
|
||||||
extern void Infoboxprint(const char* input);
|
extern void Infoboxprint(const char* input);
|
||||||
|
extern void TuneUp();
|
||||||
|
extern void TuneDown();
|
||||||
|
extern void ShowTuneMode();
|
||||||
#endif
|
#endif
|
||||||
+13
-1
@@ -535,6 +535,15 @@ void sendUDPlog() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set Chipmodel
|
||||||
|
String CHIP = "";
|
||||||
|
switch (chipmodel) {
|
||||||
|
case 0: CHIP = "TEF6686"; break;
|
||||||
|
case 1: CHIP = "TEF6687"; break;
|
||||||
|
case 2: CHIP = "TEF6688"; break;
|
||||||
|
case 3: CHIP = "TEF6689"; break;
|
||||||
|
}
|
||||||
|
|
||||||
// Extract RT+ (RadioText Plus) content if available
|
// Extract RT+ (RadioText Plus) content if available
|
||||||
String RTPLUS = "";
|
String RTPLUS = "";
|
||||||
if (radio.rds.hasRDSplus) {
|
if (radio.rds.hasRDSplus) {
|
||||||
@@ -542,7 +551,10 @@ void sendUDPlog() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Construct the data row to send via UDP
|
// Construct the data row to send via UDP
|
||||||
String row = currentDateTime + "," +
|
String row = CHIP + "," +
|
||||||
|
VERSION + "," +
|
||||||
|
String(scandxmode) + "," +
|
||||||
|
currentDateTime + "," +
|
||||||
frequencyFormatted + "," +
|
frequencyFormatted + "," +
|
||||||
String(radio.rds.picode).substring(0, 4) + "," +
|
String(radio.rds.picode).substring(0, 4) + "," +
|
||||||
signal + "," +
|
signal + "," +
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ extern bool autoDST;
|
|||||||
extern bool clockampm;
|
extern bool clockampm;
|
||||||
extern bool NTPupdated;
|
extern bool NTPupdated;
|
||||||
extern bool rtcset;
|
extern bool rtcset;
|
||||||
|
extern bool scandxmode;
|
||||||
extern byte band;
|
extern byte band;
|
||||||
|
extern byte chipmodel;
|
||||||
extern byte language;
|
extern byte language;
|
||||||
extern byte unit;
|
extern byte unit;
|
||||||
extern int16_t SStatus;
|
extern int16_t SStatus;
|
||||||
|
|||||||
Reference in New Issue
Block a user