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

@ -164,7 +164,7 @@ class Inverter {
if (getFwVersion() == 0)
enqueCommand<InfoCommand>(InverterDevInform_All); // firmware version
enqueCommand<InfoCommand>(RealTimeRunData_Debug); // live data
if (actPowerLimit == 0xffff)
if ((actPowerLimit == 0xffff) && isConnected)
enqueCommand<InfoCommand>(SystemConfigPara); // power limit info
}
return _commandQueue.front().get()->getCmd();
@ -220,9 +220,11 @@ class Inverter {
return 0;
}
bool setDevControlRequest() {
if(isConnected)
bool setDevControlRequest(uint8_t cmd) {
if(isConnected) {
mDevControlRequest = true;
devControlCmd = cmd;
}
return isConnected;
}
@ -333,16 +335,23 @@ class Inverter {
}
}
bool isAvailable(uint32_t timestamp, record_t<> *rec) {
DPRINTLN(DBG_VERBOSE, F("hmInverter.h:isAvailable"));
return ((timestamp - rec->ts) < INACT_THRES_SEC);
bool isAvailable(uint32_t timestamp) {
if((timestamp - recordMeas.ts) < INACT_THRES_SEC)
return true;
if((timestamp - recordInfo.ts) < INACT_THRES_SEC)
return true;
if((timestamp - recordConfig.ts) < INACT_THRES_SEC)
return true;
if((timestamp - recordAlarm.ts) < INACT_THRES_SEC)
return true;
return false;
}
bool isProducing(uint32_t timestamp, record_t<> *rec) {
bool isProducing(uint32_t timestamp) {
DPRINTLN(DBG_VERBOSE, F("hmInverter.h:isProducing"));
if(isAvailable(timestamp, rec)) {
uint8_t pos = getPosByChFld(CH0, FLD_PAC, rec);
return (getValue(pos, rec) > INACT_PWR_THRESH);
if(isAvailable(timestamp)) {
uint8_t pos = getPosByChFld(CH0, FLD_PAC, &recordMeas);
return (getValue(pos, &recordMeas) > INACT_PWR_THRESH);
}
return false;
}