improved payload handling (retransmit all fragments on CRC error)

improved `isAvailable`, checkes all record structs, inverter becomes available more early because version is check first
fix tickers were not set if NTP is not available
disabled annoying `FlashStringHelper` it gives randomly Expeptions during development, feels more stable since then
moved erase button to the bottom in settings, not nice but more functional
split `tx_count` to `tx_cnt` and `retransmits` in `system.html`
fix mqtt retransmit IP address #602
added debug infos for `scheduler` (web -> `/debug` as trigger prints list of tickers to serial console)
This commit is contained in:
lumapu 2023-01-19 22:43:23 +01:00
parent 3d3e3dc8c6
commit 3adcb68d98
19 changed files with 191 additions and 115 deletions

View file

@ -11,7 +11,7 @@
// NTP CONFIG
#define NTP_PACKET_SIZE 48
#define NTP_RETRIES 5
//-----------------------------------------------------------------------------
ahoywifi::ahoywifi() : mApIp(192, 168, 4, 1) {}
@ -26,6 +26,7 @@ void ahoywifi::setup(settings_t *config, uint32_t *utcTimestamp, appWifiCb cb) {
mStaConn = DISCONNECTED;
mCnt = 0;
mScanActive = false;
mRetries = NTP_RETRIES;
#if defined(ESP8266)
wifiConnectHandler = WiFi.onStationModeConnected(std::bind(&ahoywifi::onConnect, this, std::placeholders::_1));
@ -148,7 +149,17 @@ void ahoywifi::setupStation(void) {
//-----------------------------------------------------------------------------
bool ahoywifi::getNtpTime(void) {
bool ahoywifi::getNtpTime(uint32_t *nxtTrig) {
if(0 != mRetries) {
DPRINTLN(DBG_INFO, "try to getNtpTime");
*nxtTrig = 43200; // check again in 12h (if NTP was successful)
mRetries--;
} else if(0 != *mUtcTimestamp) { // time is availabe, but NTP not
*nxtTrig = 5; // check again 5s
mRetries = NTP_RETRIES;
return true; // true is necessary to enable all timers even if NTP was not reachable
}
if(GOT_IP != mStaConn)
return false;
@ -267,6 +278,7 @@ void ahoywifi::connectionEvent(WiFiStatus_t status) {
setupWifi(); // reconnect with AP / Station setup
mAppWifiCb(false);
DPRINTLN(DBG_INFO, "[WiFi] Connection Lost");
mRetries = NTP_RETRIES;
}
break;