Fix XDRGTK and more
- Font update - XDR GTK fixed both WiFi and USB - RDS Spy can now also connect over wifi (port 7373) - Memory cleanup - More....
This commit is contained in:
+236
-194
@@ -12,13 +12,9 @@
|
|||||||
#include "src/language.h"
|
#include "src/language.h"
|
||||||
|
|
||||||
#define GFXFF 1
|
#define GFXFF 1
|
||||||
#define FONT24 &Aura2Regular24pt7b
|
#define FONT24 &Aura2ProRegular24pt7b
|
||||||
#define FONT14 &Aura2Regular14pt8b
|
#define FONT14 &Aura2ProRegular14pt8b
|
||||||
#define FONT7 &Aura2Pro_Light7pt8b
|
#define FONT7 &Aura2ProRegular7pt8b
|
||||||
#define FONTDEC &Digital7num36pt7b
|
|
||||||
|
|
||||||
//#define GUI2_FONT8 &Aura2Regular8pt8b
|
|
||||||
//#define GUI2_FONT12 &Aura2Regular12pt8b
|
|
||||||
|
|
||||||
#define TFT_GREYOUT 0x38E7
|
#define TFT_GREYOUT 0x38E7
|
||||||
#define ROTARY_PIN_A 34
|
#define ROTARY_PIN_A 34
|
||||||
@@ -43,7 +39,8 @@ TFT_eSPI tft = TFT_eSPI(240, 320);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool edgebeep;
|
bool edgebeep;
|
||||||
bool RDSSpy;
|
bool RDSSPYUSB;
|
||||||
|
bool RDSSPYTCP;
|
||||||
bool BWreset;
|
bool BWreset;
|
||||||
bool change2;
|
bool change2;
|
||||||
bool cleanup;
|
bool cleanup;
|
||||||
@@ -77,6 +74,7 @@ bool XDRGTKdata;
|
|||||||
bool wifi;
|
bool wifi;
|
||||||
bool wificonnected;
|
bool wificonnected;
|
||||||
bool XDRGTKTCP;
|
bool XDRGTKTCP;
|
||||||
|
bool XDRGTKUSB;
|
||||||
byte region;
|
byte region;
|
||||||
byte regionold;
|
byte regionold;
|
||||||
byte language;
|
byte language;
|
||||||
@@ -471,7 +469,9 @@ void setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
if (digitalRead(PWRBUTTON) == LOW && USBstatus == false) PWRButtonPress();
|
Communication();
|
||||||
|
|
||||||
|
if (digitalRead(PWRBUTTON) == LOW && XDRGTKUSB == false && XDRGTKTCP == false) PWRButtonPress();
|
||||||
|
|
||||||
if (power == true) {
|
if (power == true) {
|
||||||
if (seek == true) Seek(direction);
|
if (seek == true) Seek(direction);
|
||||||
@@ -553,9 +553,6 @@ void loop() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (USBmode) RDSSpyRoutine(); else XDRGTKRoutine();
|
|
||||||
if (wifi) WiFihandler();
|
|
||||||
|
|
||||||
if (menu == true && menuopen == true && menupage == 1 && menuoption == 110) {
|
if (menu == true && menuopen == true && menupage == 1 && menuoption == 110) {
|
||||||
if (band == BAND_FM) radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus); else radio.getStatusAM(SStatus, USN, WAM, OStatus, BW, MStatus);
|
if (band == BAND_FM) radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus); else radio.getStatusAM(SStatus, USN, WAM, OStatus, BW, MStatus);
|
||||||
if (millis() >= lowsignaltimer + 500 || change2 == true) {
|
if (millis() >= lowsignaltimer + 500 || change2 == true) {
|
||||||
@@ -795,7 +792,7 @@ void ModeButtonPress() {
|
|||||||
if (counter - counterold <= 1000) {
|
if (counter - counterold <= 1000) {
|
||||||
doTuneMode();
|
doTuneMode();
|
||||||
} else {
|
} else {
|
||||||
if (USBstatus == true && USBmode == false) {
|
if (USBstatus == true && (XDRGTKUSB == true || XDRGTKTCP == true)) {
|
||||||
ShowFreq(1);
|
ShowFreq(1);
|
||||||
tft.setFreeFont(FONT14);
|
tft.setFreeFont(FONT14);
|
||||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||||
@@ -1151,8 +1148,6 @@ void ButtonPress() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Serial.println(menupage);
|
|
||||||
Serial.println(menuoption);
|
|
||||||
if (menupage == 2 && menuoption == 190 && wifi == true) {
|
if (menupage == 2 && menuoption == 190 && wifi == true) {
|
||||||
tryWiFi();
|
tryWiFi();
|
||||||
delay(2000);
|
delay(2000);
|
||||||
@@ -1187,7 +1182,7 @@ void KeyUp() {
|
|||||||
EEPROM.commit();
|
EEPROM.commit();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (USBstatus == true) if (band == BAND_FM) Serial.println("T" + String(frequency * 10)); else Serial.println("T" + String(frequency_AM));
|
if (XDRGTKUSB == true || XDRGTKTCP == true) if (band == BAND_FM) DataPrint("T" + String(frequency * 10)); else DataPrint("T" + String(frequency_AM));
|
||||||
radio.clearRDS(fullsearchrds);
|
radio.clearRDS(fullsearchrds);
|
||||||
change = 0;
|
change = 0;
|
||||||
ShowFreq(0);
|
ShowFreq(0);
|
||||||
@@ -1432,7 +1427,7 @@ void KeyDown() {
|
|||||||
EEPROM.commit();
|
EEPROM.commit();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (USBstatus == true) if (band == BAND_FM) Serial.println("T" + String(frequency * 10)); else Serial.println("T" + String(frequency_AM));
|
if (XDRGTKUSB == true || XDRGTKTCP == true) if (band == BAND_FM) DataPrint("T" + String(frequency * 10)); else DataPrint("T" + String(frequency_AM));
|
||||||
radio.clearRDS(fullsearchrds);
|
radio.clearRDS(fullsearchrds);
|
||||||
change = 0;
|
change = 0;
|
||||||
ShowFreq(0);
|
ShowFreq(0);
|
||||||
@@ -1712,7 +1707,7 @@ void readRds() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RDSstatus == 1 && USBstatus == true && USBmode == true) {
|
if ((RDSstatus == 1 && RDSSPYUSB == true) || (RDSstatus == 1 && RDSSPYTCP == true)) {
|
||||||
RDSSPYRDS = "G:\r\n";
|
RDSSPYRDS = "G:\r\n";
|
||||||
RDSSPYRDS += String(((radio.rds.rdsA >> 8) >> 4) & 0xF, HEX) + String((radio.rds.rdsA >> 8) & 0xF, HEX);
|
RDSSPYRDS += String(((radio.rds.rdsA >> 8) >> 4) & 0xF, HEX) + String((radio.rds.rdsA >> 8) & 0xF, HEX);
|
||||||
RDSSPYRDS += String(((radio.rds.rdsA) >> 4) & 0xF, HEX) + String((radio.rds.rdsA) & 0xF, HEX);
|
RDSSPYRDS += String(((radio.rds.rdsA) >> 4) & 0xF, HEX) + String((radio.rds.rdsA) & 0xF, HEX);
|
||||||
@@ -1725,17 +1720,17 @@ void readRds() {
|
|||||||
RDSSPYRDS += "\r\n\r\n";
|
RDSSPYRDS += "\r\n\r\n";
|
||||||
|
|
||||||
if (RDSSPYRDS != RDSSPYRDSold) {
|
if (RDSSPYRDS != RDSSPYRDSold) {
|
||||||
|
if (RDSSPYUSB) Serial.print(RDSSPYRDS); else RemoteClient.print(RDSSPYRDS);
|
||||||
RDSSPYRDSold = RDSSPYRDS;
|
RDSSPYRDSold = RDSSPYRDS;
|
||||||
Serial.print(RDSSPYRDS);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RDSstatus == 1 && USBstatus == true && USBmode == false) {
|
if ((RDSstatus == 1 && XDRGTKUSB == true) || (RDSstatus == 1 && XDRGTKTCP == true)) {
|
||||||
Serial.print ("P");
|
DataPrint ("P");
|
||||||
Serial.print (String(((radio.rds.rdsA >> 8) >> 4) & 0xF, HEX) + String((radio.rds.rdsA >> 8) & 0xF, HEX));
|
DataPrint (String(((radio.rds.rdsA >> 8) >> 4) & 0xF, HEX) + String((radio.rds.rdsA >> 8) & 0xF, HEX));
|
||||||
Serial.print (String(((radio.rds.rdsA) >> 4) & 0xF, HEX) + String((radio.rds.rdsA) & 0xF, HEX));
|
DataPrint (String(((radio.rds.rdsA) >> 4) & 0xF, HEX) + String((radio.rds.rdsA) & 0xF, HEX));
|
||||||
if (radio.rds.correct == false) Serial.print("?");
|
if (radio.rds.correct == false) DataPrint("?");
|
||||||
Serial.print ("\n");
|
DataPrint ("\n");
|
||||||
|
|
||||||
XDRGTKRDS = "R";
|
XDRGTKRDS = "R";
|
||||||
XDRGTKRDS += String(((radio.rds.rdsB >> 8) >> 4) & 0xF, HEX) + String((radio.rds.rdsB >> 8) & 0xF, HEX);
|
XDRGTKRDS += String(((radio.rds.rdsB >> 8) >> 4) & 0xF, HEX) + String((radio.rds.rdsB >> 8) & 0xF, HEX);
|
||||||
@@ -1748,7 +1743,7 @@ void readRds() {
|
|||||||
XDRGTKRDS += "\n";
|
XDRGTKRDS += "\n";
|
||||||
|
|
||||||
if (XDRGTKRDS != XDRGTKRDSold) {
|
if (XDRGTKRDS != XDRGTKRDSold) {
|
||||||
Serial.print(XDRGTKRDS);
|
DataPrint(XDRGTKRDS);
|
||||||
XDRGTKRDSold = XDRGTKRDS;
|
XDRGTKRDSold = XDRGTKRDS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1965,20 +1960,21 @@ void BuildMenu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MuteScreen(int setting) {
|
void MuteScreen(int setting) {
|
||||||
if (setting == 0) {
|
if (setting == 0 && screenmute == 1) {
|
||||||
screenmute = 0;
|
screenmute = 0;
|
||||||
setupmode = true;
|
setupmode = true;
|
||||||
BuildDisplay();
|
BuildDisplay();
|
||||||
setupmode = false;
|
setupmode = false;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (setting == 1 && screenmute == 0) {
|
||||||
screenmute = 1;
|
screenmute = 1;
|
||||||
tft.setFreeFont(FONT14);
|
tft.setFreeFont(FONT14);
|
||||||
tft.fillScreen(TFT_BLACK);
|
tft.fillScreen(TFT_BLACK);
|
||||||
tft.drawRect(0, 0, 320, 240, TFT_BLUE);
|
tft.drawRect(0, 0, 320, 240, TFT_BLUE);
|
||||||
tft.setTextColor(TFT_WHITE);
|
tft.setTextColor(TFT_WHITE);
|
||||||
tft.drawCentreString(myLanguage[language][31], 160, 30, GFXFF);
|
tft.drawCentreString(myLanguage[language][31], 160, 30, GFXFF);
|
||||||
tft.setFreeFont(FONT7);
|
tft.drawCentreString(myLanguage[language][32], 160, 90, GFXFF);
|
||||||
tft.drawCentreString(myLanguage[language][32], 160, 60, GFXFF);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2503,7 +2499,7 @@ void ShowModLevel() {
|
|||||||
|
|
||||||
void doSquelch() {
|
void doSquelch() {
|
||||||
tft.setFreeFont(FONT7);
|
tft.setFreeFont(FONT7);
|
||||||
if (USBstatus == false) {
|
if (XDRGTKUSB == false && XDRGTKTCP == false) {
|
||||||
Squelch = analogRead(PIN_POT) / 4 - 100;
|
Squelch = analogRead(PIN_POT) / 4 - 100;
|
||||||
if (Squelch > 920) Squelch = 920;
|
if (Squelch > 920) Squelch = 920;
|
||||||
|
|
||||||
@@ -2527,7 +2523,7 @@ void doSquelch() {
|
|||||||
Squelchold = Squelch;
|
Squelchold = Squelch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (seek == false && USBstatus == true) {
|
if (seek == false && (XDRGTKUSB == true || XDRGTKTCP == true)) {
|
||||||
if (XDRMute == false) {
|
if (XDRMute == false) {
|
||||||
if (Squelch != -1) {
|
if (Squelch != -1) {
|
||||||
if (Squelch < SStatus || Squelch == -100) {
|
if (Squelch < SStatus || Squelch == -100) {
|
||||||
@@ -2817,12 +2813,74 @@ void ShowUSBstatus() {
|
|||||||
if (USBstatus == true) tft.drawBitmap(272, 6, USBLogo, 43, 21, TFT_SKYBLUE); else tft.drawBitmap(272, 6, USBLogo, 43, 21, TFT_GREYOUT);
|
if (USBstatus == true) tft.drawBitmap(272, 6, USBLogo, 43, 21, TFT_SKYBLUE); else tft.drawBitmap(272, 6, USBLogo, 43, 21, TFT_GREYOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RDSSpyRoutine() {
|
void Communication() {
|
||||||
if (Serial.available()) {
|
if (menu == false) {
|
||||||
|
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');
|
||||||
|
int data = data_str.toInt();
|
||||||
|
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() < 5 && data_str == ("*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');
|
String data_str = Serial.readStringUntil('\n');
|
||||||
int data = data_str.toInt();
|
int data = data_str.toInt();
|
||||||
if (data_str.length() > 1 && data_str == ("*D*R?F")) {
|
if (data_str.length() > 1 && data_str == ("*D*R?F"))
|
||||||
|
{
|
||||||
USBstatus = true;
|
USBstatus = true;
|
||||||
|
RDSSPYUSB = true;
|
||||||
ShowUSBstatus();
|
ShowUSBstatus();
|
||||||
}
|
}
|
||||||
int symPos = data_str.indexOf("*F");
|
int symPos = data_str.indexOf("*F");
|
||||||
@@ -2831,10 +2889,8 @@ void RDSSpyRoutine() {
|
|||||||
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 != 0) {
|
band = BAND_FM;
|
||||||
band = 0;
|
|
||||||
LowLevelInit == false;
|
|
||||||
BWreset = true;
|
BWreset = true;
|
||||||
BWset = 0;
|
BWset = 0;
|
||||||
radio.power(0);
|
radio.power(0);
|
||||||
@@ -2849,16 +2905,38 @@ void RDSSpyRoutine() {
|
|||||||
ShowFreq(0);
|
ShowFreq(0);
|
||||||
store = true;
|
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");
|
||||||
|
USBstatus = true;
|
||||||
|
XDRGTKUSB = true;
|
||||||
|
ShowUSBstatus();
|
||||||
|
if (menu == true) ModeButtonPress();
|
||||||
|
if (Squelch != Squelchold) {
|
||||||
|
if (screenmute == false) {
|
||||||
|
tft.setFreeFont(FONT7);
|
||||||
|
tft.setTextColor(TFT_BLACK);
|
||||||
|
if (Squelchold == -100) tft.drawCentreString(myLanguage[language][33], 224, 167, GFXFF); else if (Squelchold > 920) tft.drawCentreString("ST", 224, 167, GFXFF); else tft.drawCentreString(String(Squelchold / 10), 224, 167, GFXFF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (XDRGTKUSB || XDRGTKTCP) XDRGTKRoutine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XDRGTKprint(String string) {
|
|
||||||
if (USBmode == 0 && USBstatus == true) Serial.print(string);
|
void DataPrint(String string) {
|
||||||
|
if (XDRGTKUSB) Serial.print(string);
|
||||||
if (XDRGTKTCP) RemoteClient.print(string);
|
if (XDRGTKTCP) RemoteClient.print(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XDRGTKRoutine() {
|
void XDRGTKRoutine() {
|
||||||
if (!USBmode) {
|
if (XDRGTKUSB) {
|
||||||
if (Serial.available())
|
if (Serial.available())
|
||||||
{
|
{
|
||||||
buff[buff_pos] = Serial.read();
|
buff[buff_pos] = Serial.read();
|
||||||
@@ -2888,52 +2966,31 @@ void XDRGTKRoutine() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (XDRGTKdata) {
|
if (XDRGTKdata) {
|
||||||
switch (buff[0]) {
|
switch (buff[0])
|
||||||
case 'x':
|
{
|
||||||
XDRGTKprint("OK\n");
|
|
||||||
if (band != BAND_FM) {
|
|
||||||
band = BAND_FM;
|
|
||||||
SelectBand();
|
|
||||||
}
|
|
||||||
XDRGTKprint("T" + String(frequency * 10) + "A0\nD0\nG00\n");
|
|
||||||
USBstatus = true;
|
|
||||||
ShowUSBstatus();
|
|
||||||
if (menu == true) ModeButtonPress();
|
|
||||||
if (Squelch != Squelchold) {
|
|
||||||
if (screenmute == false) {
|
|
||||||
tft.setFreeFont(FONT7);
|
|
||||||
tft.setTextColor(TFT_BLACK);
|
|
||||||
if (Squelchold == -100) tft.drawCentreString(myLanguage[language][33], 224, 167, GFXFF); else if (Squelchold > 920) tft.drawCentreString("ST", 224, 167, GFXFF); else tft.drawCentreString(String(Squelchold / 10), 224, 167, GFXFF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'A':
|
case 'A':
|
||||||
|
int AGC;
|
||||||
AGC = atol(buff + 1);
|
AGC = atol(buff + 1);
|
||||||
XDRGTKprint("A" + String(AGC) + "\n");
|
DataPrint("A" + String(AGC) + "\n");
|
||||||
radio.setAGC(AGC);
|
radio.setAGC(AGC);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
byte scanmethod;
|
byte scanmethod;
|
||||||
scanmethod = atol(buff + 1);
|
scanmethod = atol(buff + 1);
|
||||||
if (seek == false) {
|
|
||||||
if (scanmethod == 1) {
|
if (scanmethod == 1) {
|
||||||
XDRGTKprint("C1\n");
|
DataPrint("C1\n");
|
||||||
direction = true;
|
direction = false;
|
||||||
seek = true;
|
|
||||||
Seek(direction);
|
Seek(direction);
|
||||||
|
ShowFreq(0);
|
||||||
}
|
}
|
||||||
if (scanmethod == 2) {
|
if (scanmethod == 2) {
|
||||||
XDRGTKprint("C2\n");
|
DataPrint("C2\n");
|
||||||
direction = false;
|
direction = true;
|
||||||
seek = true;
|
|
||||||
Seek(direction);
|
Seek(direction);
|
||||||
|
ShowFreq(0);
|
||||||
}
|
}
|
||||||
} else {
|
DataPrint("C0\n");
|
||||||
seek = false;
|
|
||||||
}
|
|
||||||
XDRGTKprint("C0\n");
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'N':
|
case 'N':
|
||||||
@@ -2942,20 +2999,23 @@ void XDRGTKRoutine() {
|
|||||||
|
|
||||||
case 'D':
|
case 'D':
|
||||||
DeEmphasis = atol(buff + 1);
|
DeEmphasis = atol(buff + 1);
|
||||||
XDRGTKprint("D" + String(DeEmphasis) + "\n");
|
DataPrint("D" + String(DeEmphasis) + "\n");
|
||||||
radio.setDeemphasis(DeEmphasis);
|
radio.setDeemphasis(DeEmphasis);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'F':
|
case 'F':
|
||||||
XDRBWset = atol(buff + 1);
|
XDRBWset = atol(buff + 1);
|
||||||
if (XDRBWset < 16) {
|
DataPrint("F" + String(XDRBWset) + "\n");
|
||||||
|
if (XDRBWset < 0) {
|
||||||
XDRBWsetold = XDRBWset;
|
XDRBWsetold = XDRBWset;
|
||||||
|
BWset = 0;
|
||||||
|
} else if (XDRBWset < 16) {
|
||||||
BWset = XDRBWset + 1;
|
BWset = XDRBWset + 1;
|
||||||
|
XDRBWsetold = XDRBWset;
|
||||||
} else {
|
} else {
|
||||||
XDRBWset = XDRBWsetold;
|
XDRBWset = XDRBWsetold;
|
||||||
}
|
}
|
||||||
doBW();
|
doBW();
|
||||||
XDRGTKprint("F" + String(XDRBWset) + "\n");
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'G':
|
case 'G':
|
||||||
@@ -2963,44 +3023,61 @@ void XDRGTKRoutine() {
|
|||||||
if (LevelOffset == 0) {
|
if (LevelOffset == 0) {
|
||||||
MuteScreen(0);
|
MuteScreen(0);
|
||||||
LowLevelSet = EEPROM.readInt(47);
|
LowLevelSet = EEPROM.readInt(47);
|
||||||
XDRGTKprint("G00\n");
|
DataPrint("G00\n");
|
||||||
}
|
}
|
||||||
if (LevelOffset == 10) {
|
if (LevelOffset == 10) {
|
||||||
MuteScreen(1);
|
MuteScreen(1);
|
||||||
LowLevelSet = EEPROM.readInt(47);
|
LowLevelSet = EEPROM.readInt(47);
|
||||||
XDRGTKprint("G10\n");
|
DataPrint("G10\n");
|
||||||
}
|
}
|
||||||
if (LevelOffset == 1) {
|
if (LevelOffset == 1) {
|
||||||
MuteScreen(0);
|
MuteScreen(0);
|
||||||
LowLevelSet = 120;
|
LowLevelSet = 120;
|
||||||
XDRGTKprint("G01\n");
|
DataPrint("G01\n");
|
||||||
}
|
}
|
||||||
if (LevelOffset == 11) {
|
if (LevelOffset == 11) {
|
||||||
LowLevelSet = 120;
|
LowLevelSet = 120;
|
||||||
MuteScreen(1);
|
MuteScreen(1);
|
||||||
XDRGTKprint("G11\n");
|
DataPrint("G11\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'M':
|
case 'M':
|
||||||
byte XDRband;
|
byte XDRband;
|
||||||
XDRband = atol(buff + 1);
|
XDRband = atol(buff + 1);
|
||||||
if (XDRband == BAND_FM) { // here XDRGTK need add four bands switch too
|
if (XDRband == 0) DataPrint("M0\n"); else DataPrint("M1\n");
|
||||||
band = BAND_FM;
|
if (XDRband == 1) {
|
||||||
SelectBand();
|
if (frequency_AM >= LWLowEdgeSet && frequency_AM <= LWHighEdgeSet) {
|
||||||
XDRGTKprint("M0\nT" + String(frequency * 10) + "\n");
|
if (band != BAND_LW) {
|
||||||
} else if (XDRband == BAND_LW) {
|
|
||||||
band = BAND_LW;
|
band = BAND_LW;
|
||||||
SelectBand();
|
SelectBand();
|
||||||
XDRGTKprint("M1\nT" + String(frequency_AM) + "\n");
|
}
|
||||||
} else if (XDRband == BAND_MW) {
|
}
|
||||||
|
if (frequency_AM >= MWLowEdgeSet && frequency_AM <= MWHighEdgeSet) {
|
||||||
|
if (band != BAND_MW) {
|
||||||
band = BAND_MW;
|
band = BAND_MW;
|
||||||
SelectBand();
|
SelectBand();
|
||||||
XDRGTKprint("M2\nT" + String(frequency_AM) + "\n");
|
}
|
||||||
} else if (XDRband == BAND_SW) {
|
}
|
||||||
|
if (frequency_AM >= SWLowEdgeSet && frequency_AM <= SWHighEdgeSet) {
|
||||||
|
if (band != BAND_SW) {
|
||||||
band = BAND_SW;
|
band = BAND_SW;
|
||||||
SelectBand();
|
SelectBand();
|
||||||
XDRGTKprint("M3\nT" + String(frequency_AM) + "\n");
|
}
|
||||||
|
}
|
||||||
|
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 = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -3013,44 +3090,54 @@ void XDRGTKRoutine() {
|
|||||||
if (band != BAND_LW) {
|
if (band != BAND_LW) {
|
||||||
band = BAND_LW;
|
band = BAND_LW;
|
||||||
SelectBand();
|
SelectBand();
|
||||||
} else {
|
|
||||||
radio.SetFreqAM(frequency_AM);
|
|
||||||
}
|
}
|
||||||
XDRGTKprint("M1\n");
|
radio.SetFreqAM(frequency_AM);
|
||||||
} else if (freqtemp >= MWLowEdgeSet && freqtemp <= MWHighEdgeSet) {
|
DataPrint("M1\n");
|
||||||
|
}
|
||||||
|
if (freqtemp >= MWLowEdgeSet && freqtemp <= MWHighEdgeSet) {
|
||||||
frequency_AM = freqtemp;
|
frequency_AM = freqtemp;
|
||||||
if (band != BAND_MW) {
|
if (band != BAND_MW) {
|
||||||
band = BAND_MW;
|
band = BAND_MW;
|
||||||
SelectBand();
|
SelectBand();
|
||||||
} else {
|
|
||||||
radio.SetFreqAM(frequency_AM);
|
|
||||||
}
|
}
|
||||||
XDRGTKprint("M2\n");
|
radio.SetFreqAM(frequency_AM);
|
||||||
} else if (freqtemp >= SWLowEdgeSet && freqtemp <= SWHighEdgeSet) {
|
DataPrint("M1\n");
|
||||||
|
}
|
||||||
|
if (freqtemp >= SWLowEdgeSet && freqtemp <= SWHighEdgeSet) {
|
||||||
frequency_AM = freqtemp;
|
frequency_AM = freqtemp;
|
||||||
if (band != BAND_SW) {
|
if (band != BAND_SW) {
|
||||||
band = BAND_SW;
|
band = BAND_SW;
|
||||||
SelectBand();
|
SelectBand();
|
||||||
} else {
|
|
||||||
radio.SetFreqAM(frequency_AM);
|
|
||||||
}
|
}
|
||||||
XDRGTKprint("M3\n");
|
radio.SetFreqAM(frequency_AM);
|
||||||
} else if (freqtemp >= FREQ_FM_START && freqtemp < FREQ_FM_END) {
|
DataPrint("M1\n");
|
||||||
|
}
|
||||||
|
if (freqtemp >= FREQ_FM_START && freqtemp < FREQ_FM_END) {
|
||||||
frequency = freqtemp / 10;
|
frequency = freqtemp / 10;
|
||||||
if (band != BAND_FM) {
|
if (band != BAND_FM) {
|
||||||
band = BAND_FM;
|
band = BAND_FM;
|
||||||
SelectBand();
|
SelectBand();
|
||||||
XDRGTKprint("M0\n");
|
}
|
||||||
} else {
|
|
||||||
radio.SetFreq(frequency);
|
radio.SetFreq(frequency);
|
||||||
}
|
|
||||||
}
|
|
||||||
if (band == BAND_FM) XDRGTKprint("T" + String(frequency * 10) + "\n"); else XDRGTKprint("T" + String(frequency_AM) + "\n");
|
|
||||||
radio.clearRDS(fullsearchrds);
|
radio.clearRDS(fullsearchrds);
|
||||||
RDSstatus = 0;
|
RDSstatus = 0;
|
||||||
|
DataPrint("M0\n");
|
||||||
|
}
|
||||||
|
if (band == BAND_FM) DataPrint("T" + String(frequency * 10) + "\n"); else DataPrint("T" + String(frequency_AM) + "\n");
|
||||||
ShowFreq(0);
|
ShowFreq(0);
|
||||||
break;
|
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':
|
case 'S':
|
||||||
if (buff[1] == 'a') {
|
if (buff[1] == 'a') {
|
||||||
scanner_start = (atol(buff + 2) + 5) / 10;
|
scanner_start = (atol(buff + 2) + 5) / 10;
|
||||||
@@ -3063,7 +3150,7 @@ void XDRGTKRoutine() {
|
|||||||
} else if (scanner_start > 0 && scanner_end > 0 && scanner_step > 0 && scanner_filter >= 0) {
|
} else if (scanner_start > 0 && scanner_end > 0 && scanner_step > 0 && scanner_filter >= 0) {
|
||||||
frequencyold = frequency;
|
frequencyold = frequency;
|
||||||
radio.SetFreq(scanner_start);
|
radio.SetFreq(scanner_start);
|
||||||
XDRGTKprint("U");
|
DataPrint("U");
|
||||||
if (scanner_filter < 0) {
|
if (scanner_filter < 0) {
|
||||||
BWset = 0;
|
BWset = 0;
|
||||||
} else if (scanner_filter == 0) {
|
} else if (scanner_filter == 0) {
|
||||||
@@ -3110,14 +3197,14 @@ void XDRGTKRoutine() {
|
|||||||
frequencyold = frequency / 10;
|
frequencyold = frequency / 10;
|
||||||
for (freq_scan = scanner_start; freq_scan <= scanner_end; freq_scan += scanner_step) {
|
for (freq_scan = scanner_start; freq_scan <= scanner_end; freq_scan += scanner_step) {
|
||||||
radio.SetFreq(freq_scan);
|
radio.SetFreq(freq_scan);
|
||||||
XDRGTKprint(String(freq_scan * 10, DEC));
|
DataPrint(String(freq_scan * 10, DEC));
|
||||||
XDRGTKprint("=");
|
DataPrint("=");
|
||||||
delay(10);
|
delay(10);
|
||||||
if (band == BAND_FM) radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus); else radio.getStatusAM(SStatus, USN, WAM, OStatus, BW, MStatus);
|
if (band == BAND_FM) radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus); else radio.getStatusAM(SStatus, USN, WAM, OStatus, BW, MStatus);
|
||||||
XDRGTKprint(String((SStatus / 10) + 10, DEC));
|
DataPrint(String((SStatus / 10) + 10, DEC));
|
||||||
XDRGTKprint(",");
|
DataPrint(",");
|
||||||
}
|
}
|
||||||
XDRGTKprint("\n");
|
DataPrint("\n");
|
||||||
if (screenmute == false) {
|
if (screenmute == false) {
|
||||||
tft.setTextColor(TFT_BLACK);
|
tft.setTextColor(TFT_BLACK);
|
||||||
tft.drawCentreString(myLanguage[language][34], 140, 60, GFXFF);
|
tft.drawCentreString(myLanguage[language][34], 140, 60, GFXFF);
|
||||||
@@ -3139,60 +3226,68 @@ void XDRGTKRoutine() {
|
|||||||
radio.setVolume((VolSet - 70) / 10);
|
radio.setVolume((VolSet - 70) / 10);
|
||||||
XDRMute = false;
|
XDRMute = false;
|
||||||
}
|
}
|
||||||
XDRGTKprint("Y" + String(VolSet) + "\n");
|
DataPrint("Y" + String(VolSet) + "\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'x':
|
||||||
|
DataPrint("OK\nT" + String(frequency * 10) + "\n");
|
||||||
|
store = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'X':
|
case 'X':
|
||||||
XDRGTKprint("X\n");
|
XDRGTKTCP = false;
|
||||||
ESP.restart();
|
store = true;
|
||||||
|
XDRMute = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Z':
|
case 'Z':
|
||||||
byte iMSEQX;
|
byte iMSEQX;
|
||||||
iMSEQX = atol(buff + 1);
|
iMSEQX = atol(buff + 1);
|
||||||
if (iMSEQX == 0) {
|
switch (iMSEQX) {
|
||||||
|
case 0:
|
||||||
iMSset = 1;
|
iMSset = 1;
|
||||||
EQset = 1;
|
EQset = 1;
|
||||||
iMSEQ = 2;
|
iMSEQ = 2;
|
||||||
}
|
break;
|
||||||
if (iMSEQX == 1) {
|
|
||||||
|
case 1:
|
||||||
iMSset = 0;
|
iMSset = 0;
|
||||||
EQset = 1;
|
EQset = 1;
|
||||||
iMSEQ = 3;
|
iMSEQ = 3;
|
||||||
}
|
break;
|
||||||
if (iMSEQX == 2) {
|
|
||||||
|
case 2:
|
||||||
iMSset = 1;
|
iMSset = 1;
|
||||||
EQset = 0;
|
EQset = 0;
|
||||||
iMSEQ = 4;
|
iMSEQ = 4;
|
||||||
}
|
break;
|
||||||
if (iMSEQX == 3) {
|
|
||||||
|
case 3:
|
||||||
iMSset = 0;
|
iMSset = 0;
|
||||||
EQset = 0;
|
EQset = 0;
|
||||||
iMSEQ = 1;
|
iMSEQ = 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
updateiMS();
|
updateiMS();
|
||||||
updateEQ();
|
updateEQ();
|
||||||
XDRGTKprint("Z" + String(iMSEQX) + "\n");
|
DataPrint("Z" + String(iMSEQX) + "\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
XDRGTKdata = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (USBstatus == true) {
|
if (band != BAND_FM) {
|
||||||
Stereostatus = radio.getStereoStatus();
|
DataPrint("Sm");
|
||||||
|
} else {
|
||||||
if (StereoToggle == false) {
|
if (StereoToggle == false) {
|
||||||
XDRGTKprint("SS");
|
DataPrint("SS");
|
||||||
} else if (Stereostatus == true && band == BAND_FM) {
|
} else if (Stereostatus == true) {
|
||||||
XDRGTKprint("Ss");
|
DataPrint("Ss");
|
||||||
} else {
|
} else {
|
||||||
XDRGTKprint("Sm");
|
DataPrint("Sm");
|
||||||
}
|
}
|
||||||
if (SStatus > (SStatusold + 10) || SStatus < (SStatusold - 10)) {
|
|
||||||
XDRGTKprint(String(((SStatus * 100) + 10875) / 1000) + "." + String(((SStatus * 100) + 10875) / 100 % 10));
|
|
||||||
} else {
|
|
||||||
XDRGTKprint(String(((SStatusold * 100) + 10875) / 1000) + "." + String(((SStatus * 100) + 10875) / 100 % 10));
|
|
||||||
}
|
|
||||||
XDRGTKprint("," + String(WAM / 10, DEC) + "," + String(SNR, DEC) + "\n");
|
|
||||||
}
|
}
|
||||||
|
DataPrint(String(((SStatus * 100) + 10875) / 1000) + "." + String(((SStatus * 100) + 10875) / 100 % 10) + "," + String(WAM / 10) + "," + String(SNR) + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TuneUp() {
|
void TuneUp() {
|
||||||
@@ -3255,7 +3350,7 @@ void TuneUp() {
|
|||||||
frequency_SW = frequency_AM;
|
frequency_SW = frequency_AM;
|
||||||
}
|
}
|
||||||
radio.clearRDS(fullsearchrds);
|
radio.clearRDS(fullsearchrds);
|
||||||
if (RDSstatus == 1 && USBstatus == true && USBmode == true) Serial.print("G:\r\nRESET-------\r\n\r\n");
|
if (RDSSPYUSB == true || RDSSPYTCP == true) DataPrint("G:\r\nRESET-------\r\n\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TuneDown() {
|
void TuneDown() {
|
||||||
@@ -3318,7 +3413,7 @@ void TuneDown() {
|
|||||||
frequency_SW = frequency_AM;
|
frequency_SW = frequency_AM;
|
||||||
}
|
}
|
||||||
radio.clearRDS(fullsearchrds);
|
radio.clearRDS(fullsearchrds);
|
||||||
if (RDSstatus == 1 && USBstatus == true && USBmode == true) Serial.print("G:\r\nRESET-------\r\n\r\n");
|
if (RDSSPYUSB == true || RDSSPYTCP == true) DataPrint("G:\r\nRESET-------\r\n\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void EdgeBeeper() {
|
void EdgeBeeper() {
|
||||||
@@ -3333,7 +3428,7 @@ void Seek(bool mode) {
|
|||||||
if (mode == false) TuneDown(); else TuneUp();
|
if (mode == false) TuneDown(); else TuneUp();
|
||||||
delay(50);
|
delay(50);
|
||||||
ShowFreq(0);
|
ShowFreq(0);
|
||||||
if (USBstatus == true) if (band == BAND_FM) Serial.print("T" + String(frequency * 10) + "\n"); else Serial.print("T" + String(frequency_AM) + "\n");
|
if (XDRGTKUSB == true || XDRGTKTCP == true) if (band == BAND_FM) DataPrint("T" + String(frequency * 10) + "\n"); else DataPrint("T" + String(frequency_AM) + "\n");
|
||||||
radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus);
|
radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus);
|
||||||
|
|
||||||
if ((USN < 200) && (WAM < 230) && (OStatus < 80 && OStatus > -80) && (Squelch < SStatus || Squelch == 920)) {
|
if ((USN < 200) && (WAM < 230) && (OStatus < 80 && OStatus > -80) && (Squelch < SStatus || Squelch == 920)) {
|
||||||
@@ -3342,6 +3437,7 @@ void Seek(bool mode) {
|
|||||||
store = true;
|
store = true;
|
||||||
} else {
|
} else {
|
||||||
seek = true;
|
seek = true;
|
||||||
|
if (RDSSPYUSB == true || RDSSPYTCP == true) DataPrint("G:\r\nRESET-------\r\n\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3416,60 +3512,6 @@ void tryWiFi() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WiFihandler() {
|
|
||||||
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;
|
|
||||||
XDRGTKTCP = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (XDRGTKTCP == false && wificonnected == true && RemoteClient.available()) {
|
|
||||||
String data_str = RemoteClient.readStringUntil('\n');
|
|
||||||
int data = data_str.toInt();
|
|
||||||
if (data_str.length() > 30 && data_str.equals(cryptedpassword))
|
|
||||||
{
|
|
||||||
if (band != BAND_FM) {
|
|
||||||
band = BAND_FM;
|
|
||||||
SelectBand();
|
|
||||||
}
|
|
||||||
XDRGTKTCP = true;
|
|
||||||
RemoteClient.print("o1,0\n");
|
|
||||||
} else if (RDSSpy == false && XDRGTKTCP == false && data_str.length() < 5 && data_str == ("*R?F"))
|
|
||||||
{
|
|
||||||
RDSSpy = true;
|
|
||||||
} else if (RDSSpy == 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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
RemoteClient.print("a0\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void passwordcrypt() {
|
void passwordcrypt() {
|
||||||
int generated = 0;
|
int generated = 0;
|
||||||
while (generated < 16)
|
while (generated < 16)
|
||||||
|
|||||||
+5978
-10841
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user