You've already forked TEF6686_ESP32
In Poland, we say `to źes dowalił do pieca"
This commit is contained in:
@@ -9,3 +9,4 @@ constexpr int NTP_PACKET_SIZE = 48;
|
||||
void sendNTPpacket(IPAddress &address);
|
||||
void NTPupdate();
|
||||
time_t getNtpTime();
|
||||
void ntpPoll();
|
||||
@@ -10,6 +10,7 @@ void Communication();
|
||||
void XDRGTKRoutine();
|
||||
void passwordcrypt();
|
||||
void tryWiFi();
|
||||
void wifiPoll();
|
||||
void total_pc_control();
|
||||
|
||||
extern void BuildDisplay();
|
||||
|
||||
@@ -571,6 +571,34 @@ static const uint8_t WiFi4[] PROGMEM = {
|
||||
0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
static const uint8_t WiFiX[] PROGMEM = {
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x18, 0x00, 0x00, 0x60,
|
||||
0x0C, 0x00, 0x00, 0xC0,
|
||||
0x06, 0x00, 0x01, 0x80,
|
||||
0x03, 0x00, 0x03, 0x00,
|
||||
0x01, 0x80, 0x06, 0x00,
|
||||
0x00, 0xC0, 0x0C, 0x00,
|
||||
0x00, 0x60, 0x18, 0x00,
|
||||
0x00, 0x30, 0x30, 0x00,
|
||||
0x00, 0x18, 0x60, 0x00,
|
||||
0x00, 0x0C, 0xC0, 0x00,
|
||||
0x00, 0x07, 0x80, 0x00,
|
||||
0x00, 0x07, 0x80, 0x00,
|
||||
0x00, 0x07, 0x80, 0x00,
|
||||
0x00, 0x0C, 0xC0, 0x00,
|
||||
0x00, 0x18, 0x60, 0x00,
|
||||
0x00, 0x30, 0x30, 0x00,
|
||||
0x00, 0x60, 0x18, 0x00,
|
||||
0x00, 0xC0, 0x0C, 0x00,
|
||||
0x01, 0x80, 0x06, 0x00,
|
||||
0x03, 0x00, 0x03, 0x00,
|
||||
0x06, 0x00, 0x01, 0x80,
|
||||
0x0C, 0x00, 0x00, 0xC0,
|
||||
0x18, 0x00, 0x00, 0x60,
|
||||
0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
static const uint16_t radiologo[] PROGMEM = {
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
|
||||
@@ -1,61 +1,86 @@
|
||||
#include "NTPupdate.h"
|
||||
|
||||
// Sends an NTP request packet to the specified server address
|
||||
void sendNTPpacket(IPAddress &address) {
|
||||
byte packetBuffer[NTP_PACKET_SIZE] = {0};
|
||||
byte packetBuffer[NTP_PACKET_SIZE] = {0}; // Initialize buffer with zeros
|
||||
|
||||
// Set NTP packet header fields as per NTP protocol
|
||||
packetBuffer[0] = 0b11100011; // LI, Version, Mode
|
||||
packetBuffer[2] = 6; // Polling interval
|
||||
packetBuffer[3] = 0xEC; // Peer clock precision
|
||||
|
||||
// Root Delay & Root Dispersion fields
|
||||
packetBuffer[12] = 49;
|
||||
packetBuffer[13] = 0x4E;
|
||||
packetBuffer[14] = 49;
|
||||
packetBuffer[15] = 52;
|
||||
|
||||
// Send the NTP request to port 123 (NTP standard port)
|
||||
Udp.beginPacket(address, 123);
|
||||
Udp.write(packetBuffer, NTP_PACKET_SIZE);
|
||||
Udp.endPacket();
|
||||
}
|
||||
|
||||
time_t getNtpTime() {
|
||||
IPAddress ntpServerIP;
|
||||
byte packetBuffer[NTP_PACKET_SIZE];
|
||||
|
||||
while (Udp.parsePacket() > 0);
|
||||
|
||||
if (!WiFi.hostByName(ntpServerName, ntpServerIP)) return 0;
|
||||
|
||||
sendNTPpacket(ntpServerIP);
|
||||
|
||||
uint32_t startWait = millis();
|
||||
while (millis() - startWait < 1500) {
|
||||
if (Udp.parsePacket() >= NTP_PACKET_SIZE) {
|
||||
Udp.read(packetBuffer, NTP_PACKET_SIZE);
|
||||
|
||||
unsigned long secsSince1900 = ((unsigned long)packetBuffer[40] << 24) | ((unsigned long)packetBuffer[41] << 16) | ((unsigned long)packetBuffer[42] << 8) | (unsigned long)packetBuffer[43];
|
||||
|
||||
return secsSince1900 - 2208988800UL;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
static uint8_t _ntpState = 0;
|
||||
static unsigned long _ntpSendMs = 0;
|
||||
static constexpr unsigned long NTP_TIMEOUT_MS = 1500;
|
||||
|
||||
// Starts an NTP request (non-blocking). Call ntpPoll() in loop to process the reply.
|
||||
void NTPupdate() {
|
||||
if (!wifi) {
|
||||
if (!wifi || WiFi.status() != WL_CONNECTED) {
|
||||
NTPupdated = false;
|
||||
return;
|
||||
}
|
||||
|
||||
time_t currentTime = getNtpTime();
|
||||
IPAddress ntpServerIP;
|
||||
|
||||
if (currentTime) {
|
||||
// Clear any previously received UDP packets
|
||||
while (Udp.parsePacket() > 0);
|
||||
|
||||
// Resolve the NTP server's hostname to its IP address
|
||||
if (!WiFi.hostByName(ntpServerName, ntpServerIP)) {
|
||||
NTPupdated = false;
|
||||
radio.rds.ctupdate = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Send an NTP request and enter waiting state
|
||||
sendNTPpacket(ntpServerIP);
|
||||
_ntpState = 1;
|
||||
_ntpSendMs = millis();
|
||||
}
|
||||
|
||||
void ntpPoll() {
|
||||
if (_ntpState != 1) return;
|
||||
|
||||
byte packetBuffer[NTP_PACKET_SIZE];
|
||||
|
||||
if (Udp.parsePacket() >= NTP_PACKET_SIZE) {
|
||||
Udp.read(packetBuffer, NTP_PACKET_SIZE);
|
||||
|
||||
// Extract "seconds since 1900" from the packet (bytes 40-43)
|
||||
unsigned long secsSince1900 =
|
||||
((unsigned long)packetBuffer[40] << 24) |
|
||||
((unsigned long)packetBuffer[41] << 16) |
|
||||
((unsigned long)packetBuffer[42] << 8) |
|
||||
(unsigned long)packetBuffer[43];
|
||||
|
||||
// Convert to UNIX epoch time (seconds since 1970)
|
||||
time_t currentTime = secsSince1900 - 2208988800UL;
|
||||
|
||||
rtc.setTime(currentTime);
|
||||
set_time(currentTime, Timezone);
|
||||
rtcset = true;
|
||||
NTPupdated = true;
|
||||
radio.rds.ctupdate = false;
|
||||
} else {
|
||||
_ntpState = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// Timeout
|
||||
if (millis() - _ntpSendMs >= NTP_TIMEOUT_MS) {
|
||||
NTPupdated = false;
|
||||
radio.rds.ctupdate = true;
|
||||
_ntpState = 0;
|
||||
}
|
||||
}
|
||||
@@ -227,7 +227,7 @@ boolean WiFiConnect::autoConnect(char const *ssidName, char const *ssidPassword,
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean WiFiConnect::startConfigurationPortal() {
|
||||
boolean WiFiConnect::startConfigurationPortal(int8_t cancelPin) {
|
||||
delay(50);
|
||||
|
||||
if (WiFi.status() != WL_CONNECTED) {
|
||||
@@ -269,6 +269,11 @@ boolean WiFiConnect::startConfigurationPortal() {
|
||||
|
||||
server->begin();
|
||||
|
||||
if (cancelPin >= 0) {
|
||||
while (digitalRead(cancelPin) == LOW) delay(10);
|
||||
delay(200);
|
||||
}
|
||||
|
||||
_readyToConnect = false;
|
||||
while (true) {
|
||||
dnsServer->processNextRequest();
|
||||
@@ -282,6 +287,10 @@ boolean WiFiConnect::startConfigurationPortal() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (cancelPin >= 0 && digitalRead(cancelPin) == LOW) {
|
||||
delay(50); // debounce
|
||||
if (digitalRead(cancelPin) == LOW) break;
|
||||
}
|
||||
yield();
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
|
||||
boolean autoConnect();
|
||||
void addParameter(WiFiConnectParam *p);
|
||||
boolean startConfigurationPortal();
|
||||
boolean startConfigurationPortal(int8_t cancelPin);
|
||||
|
||||
private:
|
||||
static constexpr int RETRY_ATTEMPTS = 3;
|
||||
|
||||
100
src/comms.cpp
100
src/comms.cpp
@@ -1,6 +1,7 @@
|
||||
#include "comms.h"
|
||||
#include <EEPROM.h>
|
||||
#include "graphics.h"
|
||||
#include <ESPmDNS.h>
|
||||
|
||||
extern mem presets[];
|
||||
|
||||
@@ -888,38 +889,99 @@ void passwordcrypt() {
|
||||
cryptedpassword = String(sha1(salt));
|
||||
}
|
||||
|
||||
void tryWiFi() {
|
||||
if (!setupmode && wifi) {
|
||||
tft.drawRoundRect(1, 20, 319, 180, 5, ActiveColor);
|
||||
tft.fillRoundRect(3, 22, 315, 176, 5, BackgroundColor);
|
||||
Infoboxprint(textUI(52));
|
||||
}
|
||||
if (wifi) {
|
||||
if (wc.autoConnect()) {
|
||||
static uint8_t _wifiConnState = 0; // 0=idle, 1=connecting
|
||||
static unsigned long _wifiConnMs = 0;
|
||||
static uint8_t _wifiConnRetry = 0;
|
||||
static bool _wifiServicesUp = false;
|
||||
static bool _wifiHandlersSet = false;
|
||||
static constexpr uint8_t WIFI_MAX_RETRIES = 3;
|
||||
static constexpr unsigned long WIFI_TIMEOUT_MS = 10000; // 10s per attempt
|
||||
static constexpr unsigned long WIFI_RECONNECT_MS = 30000; // 30s between reconnect cycles
|
||||
|
||||
static void wifiStartServices() {
|
||||
Server.begin();
|
||||
Udp.begin(9031);
|
||||
if (!_wifiHandlersSet) {
|
||||
webserver.on("/", handleRoot);
|
||||
webserver.on("/downloadCSV", HTTP_GET, handleDownloadCSV);
|
||||
webserver.on("/logo.png", handleLogo);
|
||||
_wifiHandlersSet = true;
|
||||
}
|
||||
webserver.begin();
|
||||
MDNS.begin("tef");
|
||||
NTPupdate();
|
||||
remoteip = IPAddress(WiFi.localIP()[0], WiFi.localIP()[1], WiFi.localIP()[2], subnetclient);
|
||||
if (!setupmode) tftPrint(ACENTER, textUI(54), 155, 128, InsignificantColor, InsignificantColorSmooth, 28);
|
||||
} else {
|
||||
if (!setupmode) tftPrint(ACENTER, textUI(53), 155, 128, SignificantColor, SignificantColorSmooth, 28);
|
||||
Server.end();
|
||||
webserver.stop();
|
||||
Udp.stop();
|
||||
WiFi.mode(WIFI_OFF);
|
||||
wifi = false;
|
||||
XDRGTKTCP = false;
|
||||
RDSSPYTCP = false;
|
||||
_wifiServicesUp = true;
|
||||
if (menu && menupage == CONNECTIVITY) BuildMenu();
|
||||
}
|
||||
} else {
|
||||
|
||||
static void wifiStopServices() {
|
||||
_wifiServicesUp = false;
|
||||
MDNS.end();
|
||||
Server.end();
|
||||
webserver.stop();
|
||||
Udp.stop();
|
||||
}
|
||||
|
||||
void tryWiFi() {
|
||||
if (!wifi) {
|
||||
_wifiConnState = 0;
|
||||
if (_wifiServicesUp) wifiStopServices();
|
||||
WiFi.mode(WIFI_OFF);
|
||||
return;
|
||||
}
|
||||
|
||||
if (WiFi.status() == WL_CONNECTED) {
|
||||
_wifiConnState = 0;
|
||||
if (!_wifiServicesUp) wifiStartServices();
|
||||
return;
|
||||
}
|
||||
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.begin();
|
||||
_wifiConnState = 1;
|
||||
_wifiConnMs = millis();
|
||||
_wifiConnRetry = 0;
|
||||
_wifiServicesUp = false;
|
||||
|
||||
}
|
||||
|
||||
void wifiPoll() {
|
||||
if (!wifi) return;
|
||||
|
||||
if (_wifiConnState == 1) {
|
||||
if (WiFi.status() == WL_CONNECTED) {
|
||||
_wifiConnState = 0;
|
||||
wifiStartServices();
|
||||
return;
|
||||
}
|
||||
|
||||
if (millis() - _wifiConnMs >= WIFI_TIMEOUT_MS) {
|
||||
_wifiConnRetry++;
|
||||
if (_wifiConnRetry < WIFI_MAX_RETRIES) {
|
||||
WiFi.begin();
|
||||
_wifiConnMs = millis();
|
||||
} else {
|
||||
_wifiConnState = 0;
|
||||
_wifiConnMs = millis();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (WiFi.status() == WL_CONNECTED) {
|
||||
if (!_wifiServicesUp) wifiStartServices();
|
||||
return;
|
||||
}
|
||||
|
||||
if (_wifiServicesUp) wifiStopServices();
|
||||
|
||||
if (millis() - _wifiConnMs >= WIFI_RECONNECT_MS) {
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.begin();
|
||||
_wifiConnState = 1;
|
||||
_wifiConnMs = millis();
|
||||
_wifiConnRetry = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
38
src/core.cpp
38
src/core.cpp
@@ -503,34 +503,34 @@ void toggleiMSEQ() {
|
||||
}
|
||||
}
|
||||
|
||||
void TuneFreq(int temp) {
|
||||
bool TuneFreq(int temp) {
|
||||
int newfreq = temp;
|
||||
|
||||
if (band == BAND_FM) {
|
||||
while (newfreq < (LowEdgeSet * 10)) newfreq *= 10;
|
||||
if (newfreq > (HighEdgeSet * 10)) {
|
||||
EdgeBeeper();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (newfreq == frequency) return;
|
||||
if (newfreq == frequency) return true;
|
||||
frequency = newfreq;
|
||||
radio.SetFreq(frequency);
|
||||
} else if (band == BAND_OIRT) {
|
||||
while (newfreq < (LowEdgeOIRTSet * 10)) newfreq *= 10;
|
||||
while (temp < LowEdgeOIRTSet) temp = temp * 10;
|
||||
if (newfreq > HighEdgeOIRTSet) {
|
||||
EdgeBeeper();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (newfreq == frequency_OIRT) return;
|
||||
if (newfreq == frequency_OIRT) return true;
|
||||
frequency_OIRT = newfreq;
|
||||
radio.SetFreq(frequency_OIRT);
|
||||
} else if (band == BAND_LW) {
|
||||
while (newfreq < LWLowEdgeSet) newfreq *= 10;
|
||||
if (newfreq > LWHighEdgeSet) {
|
||||
EdgeBeeper();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (newfreq == frequency_LW) return;
|
||||
if (newfreq == frequency_LW) return true;
|
||||
frequency_AM = newfreq;
|
||||
frequency_LW = newfreq;
|
||||
radio.SetFreqAM(frequency_AM);
|
||||
@@ -538,9 +538,9 @@ void TuneFreq(int temp) {
|
||||
while (newfreq < MWLowEdgeSet) newfreq *= 10;
|
||||
if (newfreq > MWHighEdgeSet) {
|
||||
EdgeBeeper();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (newfreq == frequency_MW) return;
|
||||
if (newfreq == frequency_MW) return true;
|
||||
frequency_AM = newfreq;
|
||||
frequency_MW = newfreq;
|
||||
radio.SetFreqAM(frequency_AM);
|
||||
@@ -548,9 +548,9 @@ void TuneFreq(int temp) {
|
||||
while (newfreq < SWLowEdgeSet) newfreq *= 10;
|
||||
if (newfreq > SWHighEdgeSet) {
|
||||
EdgeBeeper();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (newfreq == frequency_SW) return;
|
||||
if (newfreq == frequency_SW) return true;
|
||||
frequency_AM = newfreq;
|
||||
frequency_SW = newfreq;
|
||||
radio.SetFreqAM(frequency_AM);
|
||||
@@ -562,6 +562,7 @@ void TuneFreq(int temp) {
|
||||
radio.clearRDS();
|
||||
if (RDSSPYUSB) Serial.print("G:\r\nRESET-------\r\n\r\n");
|
||||
if (RDSSPYTCP) RemoteClient.print("G:\r\nRESET-------\r\n\r\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
void ShowNum(int val) {
|
||||
@@ -768,7 +769,7 @@ void NumpadProcess(int num) {
|
||||
BuildMenu();
|
||||
} else if (num == 13) {
|
||||
if (freq_in != 0) {
|
||||
TuneFreq(freq_in);
|
||||
if (TuneFreq(freq_in)) {
|
||||
if (XDRGTKUSB || XDRGTKTCP) {
|
||||
if (band == BAND_FM) DataPrint("M0\nT" + String(frequency * 10) + "\n"); else if (band == BAND_OIRT) DataPrint("M0\nT" + String(frequency_OIRT * 10) + "\n"); else DataPrint("M1\nT" + String(frequency_AM) + "\n");
|
||||
}
|
||||
@@ -778,6 +779,17 @@ void NumpadProcess(int num) {
|
||||
ShowFreq(0);
|
||||
store = true;
|
||||
}
|
||||
} else {
|
||||
ShowNum(freq_in);
|
||||
FrequencySprite.setTextDatum(TR_DATUM);
|
||||
FrequencySprite.fillSprite(BackgroundColor);
|
||||
FrequencySprite.setTextColor(SignificantColor, SignificantColorSmooth, false);
|
||||
FrequencySprite.drawString(String(freq_in) + " ", 218, -6, freqfont);
|
||||
FrequencySprite.pushSprite(46, 46);
|
||||
delay(1000);
|
||||
ShowFreq(0);
|
||||
|
||||
}
|
||||
} else ShowFreq(0);
|
||||
freq_in = 0;
|
||||
} else {
|
||||
|
||||
11
src/gui.cpp
11
src/gui.cpp
@@ -824,7 +824,7 @@ void ShowOneLine(byte position, byte item, bool selected) {
|
||||
case CONNECTIVITY:
|
||||
FullLineSprite.setTextDatum(TL_DATUM);
|
||||
FullLineSprite.setTextColor(ActiveColor, ActiveColorSmooth, false);
|
||||
FullLineSprite.drawString(removeNewline(textUI(48) + (wifi ? " IP: " + String(WiFi.localIP().toString()) : "")), 6, 2);
|
||||
FullLineSprite.drawString(removeNewline(textUI(48) + (wifi && WiFi.status() == WL_CONNECTED ? " IP: " + String(WiFi.localIP().toString()) : "")), 6, 2);
|
||||
|
||||
FullLineSprite.setTextDatum(TR_DATUM);
|
||||
FullLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
@@ -1048,7 +1048,7 @@ void ShowOneLine(byte position, byte item, bool selected) {
|
||||
|
||||
FullLineSprite.setTextDatum(TR_DATUM);
|
||||
FullLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
FullLineSprite.drawString((wifi ? String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC) : "-"), 298, 2);
|
||||
FullLineSprite.drawString((wifi && WiFi.status() == WL_CONNECTED ? String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC) : "-"), 298, 2);
|
||||
break;
|
||||
|
||||
case DXMODE:
|
||||
@@ -1901,7 +1901,7 @@ void ShowOneButton(byte position, byte item, bool selected) {
|
||||
case CONNECTIVITY:
|
||||
PSSprite.setTextDatum(TC_DATUM);
|
||||
PSSprite.setTextColor(ActiveColor, ActiveColorSmooth, false);
|
||||
PSSprite.drawString(shortLine(removeNewline(wifi ? " IP: " + String(WiFi.localIP().toString()) : textUI(48))), 75, 1);
|
||||
PSSprite.drawString(shortLine(removeNewline(wifi && WiFi.status() == WL_CONNECTED ? " IP: " + String(WiFi.localIP().toString()) : textUI(48))), 75, 1);
|
||||
|
||||
PSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
PSSprite.drawString((wifi ? textUI(28) : textUI(27)), 75, 15);
|
||||
@@ -2132,7 +2132,7 @@ void ShowOneButton(byte position, byte item, bool selected) {
|
||||
PSSprite.drawString(shortLine(removeNewline(textUI(55))), 75, 1);
|
||||
|
||||
PSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
PSSprite.drawString((wifi ? String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC) : "-"), 75, 15);
|
||||
PSSprite.drawString((wifi && WiFi.status() == WL_CONNECTED ? String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC) : "-"), 75, 15);
|
||||
break;
|
||||
|
||||
case DXMODE:
|
||||
@@ -5227,7 +5227,8 @@ void DoMenu() {
|
||||
wc.addParameter(&XDRGTK_key_input);
|
||||
setWiFiConnectParam = true;
|
||||
}
|
||||
wc.startConfigurationPortal();
|
||||
tftPrint(ACENTER, textUI(29), 155, 202, ActiveColor, ActiveColorSmooth, 16);
|
||||
wc.startConfigurationPortal(26);
|
||||
XDRGTK_key = XDRGTK_key_input.getValue();
|
||||
EEPROM.writeString(EE_STRING_XDRGTK_KEY, XDRGTK_key);
|
||||
EEPROM.commit();
|
||||
|
||||
11
src/main.cpp
11
src/main.cpp
@@ -413,7 +413,7 @@ void setup() {
|
||||
if (wifi) {
|
||||
console.print("Trying WiFi");
|
||||
tryWiFi();
|
||||
delay(1750);
|
||||
delay(1500);
|
||||
} else {
|
||||
Server.end();
|
||||
Udp.stop();
|
||||
@@ -454,6 +454,7 @@ void setup() {
|
||||
void handleWiFi() {
|
||||
if (wifi && !menu) {
|
||||
webserver.handleClient();
|
||||
ntpPoll();
|
||||
|
||||
if (millis() >= udplogtimer + UDP_LOG_INTERVAL_MS) {
|
||||
sendUDPlog();
|
||||
@@ -830,8 +831,10 @@ void ShowRSSI() {
|
||||
if (wifi) rssi = WiFi.RSSI(); else rssi = 0;
|
||||
if (rssiold != rssi) {
|
||||
if (!wifi && batterydetect) tft.drawBitmap(WIFI_ICON_X, WIFI_ICON_Y, WiFi4, WIFI_ICON_WIDTH, WIFI_ICON_HEIGHT, BackgroundColor);
|
||||
else if (rssi == 0) tft.drawBitmap(WIFI_ICON_X, WIFI_ICON_Y, WiFi4, WIFI_ICON_WIDTH, WIFI_ICON_HEIGHT, GreyoutColor);
|
||||
else if (rssi > -50 && rssi < 0) tft.drawBitmap(WIFI_ICON_X, WIFI_ICON_Y, WiFi4, WIFI_ICON_WIDTH, WIFI_ICON_HEIGHT, WifiColorHigh);
|
||||
else if (rssi == 0) {
|
||||
tft.drawBitmap(WIFI_ICON_X, WIFI_ICON_Y, WiFi4, WIFI_ICON_WIDTH, WIFI_ICON_HEIGHT, GreyoutColor);
|
||||
tft.drawBitmap(282, 3, WiFiX, 30, 25, BarSignificantColor);
|
||||
} else if (rssi > -50 && rssi < 0) tft.drawBitmap(WIFI_ICON_X, WIFI_ICON_Y, WiFi4, WIFI_ICON_WIDTH, WIFI_ICON_HEIGHT, WifiColorHigh);
|
||||
else if (rssi > -60) {
|
||||
tft.drawBitmap(WIFI_ICON_X, WIFI_ICON_Y, WiFi4, WIFI_ICON_WIDTH, WIFI_ICON_HEIGHT, GreyoutColor);
|
||||
tft.drawBitmap(WIFI_ICON_X, WIFI_ICON_Y, WiFi3, WIFI_ICON_WIDTH, WIFI_ICON_HEIGHT, WifiColorHigh);
|
||||
@@ -1085,6 +1088,8 @@ void loop() {
|
||||
}
|
||||
}
|
||||
|
||||
wifiPoll(); // He really lost it
|
||||
|
||||
handleWiFi();
|
||||
handleTouch();
|
||||
Communication();
|
||||
|
||||
Reference in New Issue
Block a user