Stationlist optimising

This commit is contained in:
Sjef Verhoeven PE5PVB
2023-08-05 00:01:57 +02:00
parent a0e63c701d
commit 0abb52f1a5
+27 -25
View File
@@ -2480,7 +2480,7 @@ void doAF() {
if ((radio.af[af_scan].frequency - 8750) / 10 < 0x10) { if ((radio.af[af_scan].frequency - 8750) / 10 < 0x10) {
Udp.print("0"); Udp.print("0");
} }
Udp.print((radio.af[af_scan].frequency - 8750) / 10, HEX); Udp.print(String((radio.af[af_scan].frequency - 8750) / 10, HEX));
} }
} }
af_counterold = radio.af_counter; af_counterold = radio.af_counter;
@@ -2583,7 +2583,7 @@ void showECC() {
Udp.beginPacket(remoteip, 9030); Udp.beginPacket(remoteip, 9030);
Udp.print("ECC="); Udp.print("ECC=");
if (radio.rds.ECC < 0x10) Udp.print("0"); if (radio.rds.ECC < 0x10) Udp.print("0");
Udp.print(radio.rds.ECC, HEX); Udp.print(String(radio.rds.ECC, HEX));
Udp.endPacket(); Udp.endPacket();
} }
ECCold = radio.rds.ECC; ECCold = radio.rds.ECC;
@@ -2602,7 +2602,7 @@ void showPI() {
PIold = radio.rds.picode; PIold = radio.rds.picode;
if (wifi) { if (wifi) {
Udp.beginPacket(remoteip, 9030); Udp.beginPacket(remoteip, 9030);
Udp.print("from=TEF tuner;PI=" + String(radio.rds.picode, 4)); Udp.print("from=TEF_tuner;PI=" + String(radio.rds.picode, 4));
Udp.endPacket(); Udp.endPacket();
} }
strcpy(radioIdPrevious, radio.rds.picode); strcpy(radioIdPrevious, radio.rds.picode);
@@ -2615,8 +2615,8 @@ void showPTY() {
PTYold = radio.rds.stationType; PTYold = radio.rds.stationType;
if (wifi) { if (wifi) {
Udp.beginPacket(remoteip, 9030); Udp.beginPacket(remoteip, 9030);
Udp.print("from=TEF tuner;PTY="); Udp.print("from=TEF_tuner;PTY=");
Udp.print(radio.rds.stationTypeCode, HEX); Udp.print(String(radio.rds.stationTypeCode, HEX));
Udp.endPacket(); Udp.endPacket();
} }
strcpy(programTypePrevious, radio.rds.stationType); strcpy(programTypePrevious, radio.rds.stationType);
@@ -2635,14 +2635,14 @@ void showPS() {
PSold = radio.rds.stationName; PSold = radio.rds.stationName;
if (wifi) { if (wifi) {
Udp.beginPacket(remoteip, 9030); Udp.beginPacket(remoteip, 9030);
Udp.print("from=TEF tuner;PS="); Udp.print("from=TEF_tuner;PS=");
char PShex[9]; char PShex[9];
radio.rds.stationName.toCharArray(PShex, 9); radio.rds.stationName.toCharArray(PShex, 9);
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
{ {
if (PShex[i] < 0x10) Udp.print("0"); if (PShex[i] < 0x10) Udp.print("0");
if (PShex[i] == 0x20) PShex[i] = '_'; if (PShex[i] == 0x20) PShex[i] = '_';
Udp.print(PShex[i], HEX); Udp.print(String(PShex[i], HEX));
} }
Udp.endPacket(); Udp.endPacket();
} }
@@ -2701,14 +2701,14 @@ void showRadioText() {
if (wifi) { if (wifi) {
Udp.beginPacket(remoteip, 9030); Udp.beginPacket(remoteip, 9030);
Udp.print("from=TEF tuner;RT1="); Udp.print("from=TEF_tuner;RT1=");
char RThex[65]; char RThex[65];
radio.rds.stationText.toCharArray(RThex, 65); radio.rds.stationText.toCharArray(RThex, 65);
for (int i = 0; i < 64; i++) for (int i = 0; i < 64; i++)
{ {
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(RThex[i], HEX); Udp.print(String(RThex[i], HEX));
} }
Udp.endPacket(); Udp.endPacket();
} }
@@ -2899,10 +2899,17 @@ void ShowFreq(int mode) {
if (advancedRDS) sprite2.pushSprite(35, 220); else if (!afscreen) sprite.pushSprite(38, 220); if (advancedRDS) sprite2.pushSprite(35, 220); else if (!afscreen) sprite.pushSprite(38, 220);
if (wifi) { if (wifi) {
String stationprint;
stationprint = "from=TEF_tuner;RcvLevel=";
stationprint += String(SStatus / 10);
stationprint += ";bandwidth=-1;freq=";
if (band > BAND_GAP) {
stationprint += String(frequency_AM) + "000";
} else {
stationprint += String(band == BAND_FM ? frequency : frequency_OIRT) + "0000";
}
Udp.beginPacket(remoteip, 9030); Udp.beginPacket(remoteip, 9030);
Udp.print("from=TEF tuner;freq="); Udp.print(stationprint);
if (band > BAND_GAP) Udp.print(String(frequency_AM) + "000");//;ClearRDS=1");
else Udp.print(String(band == BAND_FM ? frequency : frequency_OIRT) + "0000");//;ClearRDS=1");
Udp.endPacket(); Udp.endPacket();
} }
} }
@@ -2966,15 +2973,14 @@ void ShowSignalLevel() {
tft.fillRect(16 + 2 * constrain(segments, 0, 94), 105, 2 * (94 - constrain(segments, 0, 94)), 6, GreyoutColor); tft.fillRect(16 + 2 * constrain(segments, 0, 94), 105, 2 * (94 - constrain(segments, 0, 94)), 6, GreyoutColor);
} }
SStatusold = SStatusprint; SStatusold = SStatusprint;
if (wifi) {
Udp.beginPacket(remoteip, 9030);
Udp.print("from=TEF tuner;RcvLevel=");
Udp.print(SStatus / 10);
Udp.endPacket();
}
} }
} }
if (wifi) {
Udp.beginPacket(remoteip, 9030);
Udp.print("from=TEF_tuner;RcvLevel=");
Udp.print(String(SStatus / 10));
Udp.endPacket();
}
} }
void ShowRDSLogo(bool RDSstatus) { void ShowRDSLogo(bool RDSstatus) {
@@ -3122,8 +3128,8 @@ void ShowBW() {
BWreset = false; BWreset = false;
if (wifi) { if (wifi) {
Udp.beginPacket(remoteip, 9030); Udp.beginPacket(remoteip, 9030);
Udp.print("from=TEF tuner;Bandwidth="); Udp.print("from=TEF_tuner;Bandwidth=");
Udp.print(BW * 1000); Udp.print(String(BW * 1000));
Udp.endPacket(); Udp.endPacket();
} }
} }
@@ -3604,10 +3610,6 @@ void Communication() {
String packet = String(packetBuffer); String packet = String(packetBuffer);
if (strcmp(packetBuffer, "from=StationList;freq=?;bandwidth=?") == 0) { if (strcmp(packetBuffer, "from=StationList;freq=?;bandwidth=?") == 0) {
ShowFreq(0); ShowFreq(0);
Udp.beginPacket(remoteip, 9030);
Udp.print("from=TEF tuner;Bandwidth=");
Udp.print(BW * 1000);
Udp.endPacket();
} else { } else {
int symPos = packet.indexOf("freq="); int symPos = packet.indexOf("freq=");
String stlfreq = packet.substring(symPos + 5, packetSize); String stlfreq = packet.substring(symPos + 5, packetSize);