You've already forked TEF6686_ESP32
Reduced UDP traffic on WiFi
This commit is contained in:
@@ -328,6 +328,7 @@ unsigned long rtplustickerhold;
|
||||
unsigned long rtticker;
|
||||
unsigned long rttickerhold;
|
||||
unsigned long tuningtimer;
|
||||
unsigned long udptimer;
|
||||
|
||||
TEF6686 radio;
|
||||
TFT_eSprite sprite = TFT_eSprite(&tft);
|
||||
@@ -2203,11 +2204,11 @@ void ShowFreq(int mode) {
|
||||
if (wifi) {
|
||||
Udp.beginPacket(remoteip, 9030);
|
||||
if (band == BAND_FM) {
|
||||
Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";RcvLevel=" + String(SStatus / 10) + ";bandwidth=-1;freq=" + String(frequency) + "0000");
|
||||
Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";freq=" + String(frequency) + "0000");
|
||||
} else if (band == BAND_OIRT) {
|
||||
Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";RcvLevel=" + String(SStatus / 10) + ";bandwidth=-1;freq=" + String(frequency_OIRT) + "0000");
|
||||
Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";freq=" + String(frequency_OIRT) + "0000");
|
||||
} else {
|
||||
Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";RcvLevel=" + String(SStatus / 10) + ";bandwidth=-1;freq=" + String(frequency_AM) + "000");
|
||||
Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";freq=" + String(frequency_AM) + "000");
|
||||
}
|
||||
Udp.endPacket();
|
||||
}
|
||||
@@ -2274,7 +2275,8 @@ void ShowSignalLevel() {
|
||||
SStatusold = SStatusprint;
|
||||
}
|
||||
}
|
||||
if (wifi) {
|
||||
if (wifi && millis() >= udptimer + 2000) {
|
||||
udptimer = millis();
|
||||
Udp.beginPacket(remoteip, 9030);
|
||||
Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";RcvLevel=" + String(SStatus / 10));
|
||||
Udp.endPacket();
|
||||
|
||||
24
src/rds.cpp
24
src/rds.cpp
@@ -287,11 +287,11 @@ void doAF() {
|
||||
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();
|
||||
}
|
||||
af_counterold = radio.af_counter;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -772,17 +772,19 @@ void showRadioText() {
|
||||
}
|
||||
|
||||
if (wifi) {
|
||||
Udp.beginPacket(remoteip, 9030);
|
||||
Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";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));
|
||||
if (RTold != (radio.rds.stationText + " " + radio.rds.stationText32)) {
|
||||
Udp.beginPacket(remoteip, 9030);
|
||||
Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";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();
|
||||
}
|
||||
Udp.endPacket();
|
||||
}
|
||||
RTold = radio.rds.stationText + " " + radio.rds.stationText32;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user