Update on communication and AF tune
This commit is contained in:
+11
-1
@@ -656,6 +656,16 @@ void loop() {
|
|||||||
Communication();
|
Communication();
|
||||||
|
|
||||||
if (!menu && !afscreen) {
|
if (!menu && !afscreen) {
|
||||||
|
|
||||||
|
if (af && dropout) {
|
||||||
|
frequency = radio.TestAF();
|
||||||
|
if (freqold != frequency) {
|
||||||
|
ShowFreq(0);
|
||||||
|
if (XDRGTKUSB == true || XDRGTKTCP == true) DataPrint("T" + String(frequency * 10));
|
||||||
|
store = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (band == BAND_FM && af && radio.rds.correctPI != 0) {
|
if (band == BAND_FM && af && radio.rds.correctPI != 0) {
|
||||||
if ((aftest && millis() >= aftimer + 3000) || ((USN > 250 || WAM > 250) && millis() >= aftimer + 1000)) {
|
if ((aftest && millis() >= aftimer + 3000) || ((USN > 250 || WAM > 250) && millis() >= aftimer + 1000)) {
|
||||||
aftimer = millis();
|
aftimer = millis();
|
||||||
@@ -2482,7 +2492,7 @@ 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(String(BW * 1000));
|
Udp.print(String(BW * 1000));
|
||||||
Udp.endPacket();
|
Udp.endPacket();
|
||||||
}
|
}
|
||||||
|
|||||||
+52
-60
@@ -4,7 +4,7 @@
|
|||||||
#include <EEPROM.h>
|
#include <EEPROM.h>
|
||||||
|
|
||||||
void Communication() {
|
void Communication() {
|
||||||
if (menu == false) {
|
if (!menu) {
|
||||||
if (wifi) {
|
if (wifi) {
|
||||||
int packetSize = Udp.parsePacket();
|
int packetSize = Udp.parsePacket();
|
||||||
if (packetSize) {
|
if (packetSize) {
|
||||||
@@ -55,72 +55,57 @@ void Communication() {
|
|||||||
if (Server.hasClient()) Server.available().stop();
|
if (Server.hasClient()) Server.available().stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wificonnected == true && !RemoteClient.connected()) {
|
if (wificonnected && !RemoteClient.connected()) {
|
||||||
wificonnected = false;
|
wificonnected = false;
|
||||||
RDSSPYTCP = false;
|
RDSSPYTCP = false;
|
||||||
XDRGTKTCP = false;
|
XDRGTKTCP = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (XDRGTKTCP == false && wificonnected == true && RemoteClient.available()) {
|
if (!RDSSPYTCP && !XDRGTKTCP && RemoteClient.available()) {
|
||||||
String data_str = RemoteClient.readStringUntil('\n');
|
String data_str = RemoteClient.readStringUntil('\n');
|
||||||
if (data_str.length() > 30 && data_str.equals(cryptedpassword)) {
|
if (data_str.indexOf("?F") != -1 || data_str.indexOf("*F") != -1) {
|
||||||
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;
|
RDSSPYTCP = true;
|
||||||
} else if (RDSSPYTCP == true) {
|
RDSSPYUSB = false;
|
||||||
int symPos = data_str.indexOf("*F");
|
} else {
|
||||||
if (symPos >= 5) {
|
if (data_str.equals(cryptedpassword)) {
|
||||||
String freq = data_str.substring(0, symPos);
|
radio.setFMABandw();
|
||||||
freq = freq.substring(0, freq.length() - 1);
|
|
||||||
frequency = freq.toInt();
|
|
||||||
radio.SetFreq(frequency);
|
|
||||||
radio.clearRDS(fullsearchrds);
|
|
||||||
if (band != BAND_FM) {
|
if (band != BAND_FM) {
|
||||||
band = BAND_FM;
|
band = BAND_FM;
|
||||||
SelectBand();
|
SelectBand();
|
||||||
}
|
}
|
||||||
ShowFreq(0);
|
XDRGTKTCP = true;
|
||||||
|
RemoteClient.print("o1,0\n");
|
||||||
store = true;
|
store = true;
|
||||||
|
} else {
|
||||||
|
RemoteClient.print("a0\n");
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
RemoteClient.print("a0\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (XDRGTKUSB == false && Serial.available())
|
if (RDSSPYTCP && RemoteClient.available()) {
|
||||||
{
|
String data_str = RemoteClient.readStringUntil('\n');
|
||||||
String data_str = Serial.readStringUntil('\n');
|
|
||||||
if (data_str.length() > 1 && data_str == ("*D*R?F")) RDSSPYUSB = true;
|
|
||||||
int symPos = data_str.indexOf("*F");
|
int symPos = data_str.indexOf("*F");
|
||||||
if (symPos >= 5) {
|
if (symPos >= 5) {
|
||||||
String freq = data_str.substring(0, symPos);
|
String freq = data_str.substring(0, symPos);
|
||||||
freq = freq.substring(0, freq.length() - 1);
|
freq = freq.substring(0, freq.length() - 1);
|
||||||
frequency = freq.toInt();
|
frequency = freq.toInt();
|
||||||
radio.SetFreq(frequency);
|
radio.SetFreq(frequency);
|
||||||
|
radio.clearRDS(fullsearchrds);
|
||||||
if (band != BAND_FM) {
|
if (band != BAND_FM) {
|
||||||
band = BAND_FM;
|
band = BAND_FM;
|
||||||
BWreset = true;
|
SelectBand();
|
||||||
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);
|
ShowFreq(0);
|
||||||
store = true;
|
store = true;
|
||||||
}
|
}
|
||||||
if (data_str.charAt(0) == 'x') {
|
}
|
||||||
|
|
||||||
|
if (!RDSSPYUSB && !XDRGTKUSB && Serial.available()) {
|
||||||
|
String data_str = Serial.readStringUntil('\n');
|
||||||
|
if (data_str.indexOf("?F") != -1 || data_str.indexOf("*F") != -1) {
|
||||||
|
RDSSPYUSB = true;
|
||||||
|
RDSSPYTCP = false;
|
||||||
|
} else if (data_str.charAt(0) == 'x') {
|
||||||
radio.setFMABandw();
|
radio.setFMABandw();
|
||||||
if (band != BAND_FM) {
|
if (band != BAND_FM) {
|
||||||
band = BAND_FM;
|
band = BAND_FM;
|
||||||
@@ -128,20 +113,27 @@ void Communication() {
|
|||||||
}
|
}
|
||||||
Serial.print("OK\nT" + String(frequency * 10) + "\n");
|
Serial.print("OK\nT" + String(frequency * 10) + "\n");
|
||||||
XDRGTKUSB = true;
|
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 (RDSSPYUSB && Serial.available()) {
|
||||||
|
String data_str = Serial.readStringUntil('\n');
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (XDRGTKUSB || XDRGTKTCP) XDRGTKRoutine();
|
if (XDRGTKUSB || XDRGTKTCP) XDRGTKRoutine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -307,7 +299,7 @@ void XDRGTKRoutine() {
|
|||||||
case 'T':
|
case 'T':
|
||||||
unsigned int freqtemp;
|
unsigned int freqtemp;
|
||||||
freqtemp = atoi(buff + 1);
|
freqtemp = atoi(buff + 1);
|
||||||
if (seek == true) seek = false;
|
if (seek) seek = false;
|
||||||
if (freqtemp >= LWLowEdgeSet && freqtemp <= LWHighEdgeSet) {
|
if (freqtemp >= LWLowEdgeSet && freqtemp <= LWHighEdgeSet) {
|
||||||
frequency_AM = freqtemp;
|
frequency_AM = freqtemp;
|
||||||
if (band != BAND_LW) {
|
if (band != BAND_LW) {
|
||||||
@@ -412,7 +404,7 @@ void XDRGTKRoutine() {
|
|||||||
BWset = 16;
|
BWset = 16;
|
||||||
}
|
}
|
||||||
doBW();
|
doBW();
|
||||||
if (screenmute == false) {
|
if (!screenmute) {
|
||||||
tft.drawRoundRect(10, 30, 300, 170, 5, ActiveColor);
|
tft.drawRoundRect(10, 30, 300, 170, 5, ActiveColor);
|
||||||
tft.fillRoundRect(12, 32, 296, 166, 5, BackgroundColor);
|
tft.fillRoundRect(12, 32, 296, 166, 5, BackgroundColor);
|
||||||
tftPrint(0, myLanguage[language][34], 160, 100, ActiveColor, ActiveColorSmooth, 28);
|
tftPrint(0, myLanguage[language][34], 160, 100, ActiveColor, ActiveColorSmooth, 28);
|
||||||
@@ -437,12 +429,12 @@ void XDRGTKRoutine() {
|
|||||||
VolSet = atoi(buff + 1);
|
VolSet = atoi(buff + 1);
|
||||||
if (VolSet == 0) {
|
if (VolSet == 0) {
|
||||||
radio.setMute();
|
radio.setMute();
|
||||||
if (screenmute == false) tft.drawBitmap(92, 4, Speaker, 26, 22, PrimaryColor);
|
if (!screenmute) tft.drawBitmap(92, 4, Speaker, 26, 22, PrimaryColor);
|
||||||
XDRMute = true;
|
XDRMute = true;
|
||||||
SQ = true;
|
SQ = true;
|
||||||
} else {
|
} else {
|
||||||
radio.setUnMute();
|
radio.setUnMute();
|
||||||
if (screenmute == false) tft.drawBitmap(92, 4, Speaker, 26, 22, GreyoutColor);
|
if (!screenmute) tft.drawBitmap(92, 4, Speaker, 26, 22, GreyoutColor);
|
||||||
radio.setVolume((VolSet - 40) / 10);
|
radio.setVolume((VolSet - 40) / 10);
|
||||||
XDRMute = false;
|
XDRMute = false;
|
||||||
}
|
}
|
||||||
@@ -460,7 +452,7 @@ void XDRGTKRoutine() {
|
|||||||
store = true;
|
store = true;
|
||||||
XDRMute = false;
|
XDRMute = false;
|
||||||
radio.setUnMute();
|
radio.setUnMute();
|
||||||
if (screenmute == false) tft.drawBitmap(92, 4, Speaker, 26, 22, GreyoutColor);
|
if (!screenmute) tft.drawBitmap(92, 4, Speaker, 26, 22, GreyoutColor);
|
||||||
VolSet = EEPROM.readInt(EE_BYTE_VOLSET);
|
VolSet = EEPROM.readInt(EE_BYTE_VOLSET);
|
||||||
LowLevelSet = EEPROM.readInt(EE_BYTE_LOWLEVELSET);
|
LowLevelSet = EEPROM.readInt(EE_BYTE_LOWLEVELSET);
|
||||||
softmuteam = EEPROM.readByte(EE_BYTE_SOFTMUTEAM);
|
softmuteam = EEPROM.readByte(EE_BYTE_SOFTMUTEAM);
|
||||||
@@ -510,9 +502,9 @@ void XDRGTKRoutine() {
|
|||||||
if (band > BAND_GAP) {
|
if (band > BAND_GAP) {
|
||||||
DataPrint("Sm");
|
DataPrint("Sm");
|
||||||
} else {
|
} else {
|
||||||
if (StereoToggle == false) {
|
if (!StereoToggle) {
|
||||||
DataPrint("SS");
|
DataPrint("SS");
|
||||||
} else if (Stereostatus == true) {
|
} else if (Stereostatus) {
|
||||||
DataPrint("Ss");
|
DataPrint("Ss");
|
||||||
} else {
|
} else {
|
||||||
DataPrint("Sm");
|
DataPrint("Sm");
|
||||||
@@ -549,9 +541,9 @@ void tryWiFi() {
|
|||||||
wifi = true;
|
wifi = true;
|
||||||
} else {
|
} else {
|
||||||
if (!setupmode) tftPrint(0, myLanguage[language][56], 155, 128, SignificantColor, SignificantColorSmooth, 28);
|
if (!setupmode) tftPrint(0, myLanguage[language][56], 155, 128, SignificantColor, SignificantColorSmooth, 28);
|
||||||
Server.end();
|
Server.end();
|
||||||
Udp.stop();
|
Udp.stop();
|
||||||
WiFi.mode(WIFI_OFF);
|
WiFi.mode(WIFI_OFF);
|
||||||
wifi = false;
|
wifi = false;
|
||||||
XDRGTKTCP = false;
|
XDRGTKTCP = false;
|
||||||
RDSSPYTCP = false;
|
RDSSPYTCP = false;
|
||||||
|
|||||||
+2
-3
@@ -571,11 +571,10 @@ void readRds() {
|
|||||||
tft.fillCircle(162, 41, 5, SignificantColor);
|
tft.fillCircle(162, 41, 5, SignificantColor);
|
||||||
tft.fillCircle(200, 41, 5, SignificantColor);
|
tft.fillCircle(200, 41, 5, SignificantColor);
|
||||||
}
|
}
|
||||||
dropout = true;
|
if (radio.rds.correctPI != 0) dropout = true;
|
||||||
aftest = true;
|
|
||||||
aftimer = millis();
|
aftimer = millis();
|
||||||
} else {
|
} else {
|
||||||
if (dropout == true && PIold.length() != 0) {
|
if (dropout == true) {
|
||||||
if (advancedRDS) tftPrint(-1, PIold, 244, 75, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(-1, PIold, 244, 187, PrimaryColor, PrimaryColorSmooth, 28);
|
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, 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);
|
if (advancedRDS) tftPrint(-1, PTYold, 38, 109, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, PTYold, 38, 163, PrimaryColor, PrimaryColorSmooth, 16);
|
||||||
|
|||||||
Reference in New Issue
Block a user