last update is now set after poll full frame
This commit is contained in:
parent
d9bf0ab2e9
commit
25094ae5b6
@ -72,9 +72,7 @@ void VeDirectFrameHandler::loop()
|
||||
{
|
||||
unsigned long now = millis();
|
||||
|
||||
if (millis() - _lastPoll > (_pollInterval * 1000)) {
|
||||
Serial.print(F("Start polling ve.direct interface... "));
|
||||
|
||||
if (millis() - getLastUpdate() > (_pollInterval * 1000)) {
|
||||
while ( Serial2.available()) {
|
||||
if ((millis() - now) > 500) {
|
||||
now = millis();
|
||||
@ -82,8 +80,6 @@ void VeDirectFrameHandler::loop()
|
||||
}
|
||||
rxData(Serial2.read());
|
||||
}
|
||||
_lastPoll = millis();
|
||||
Serial.println(F("done"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,7 +240,7 @@ bool VeDirectFrameHandler::hexRxEvent(uint8_t inbyte) {
|
||||
|
||||
uint32_t VeDirectFrameHandler::getLastUpdate()
|
||||
{
|
||||
return _lastUpdate;
|
||||
return _lastPoll;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -253,7 +249,7 @@ uint32_t VeDirectFrameHandler::getLastUpdate()
|
||||
*/
|
||||
void VeDirectFrameHandler::setLastUpdate()
|
||||
{
|
||||
_lastUpdate = millis();
|
||||
_lastPoll = millis();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -74,7 +74,6 @@ private:
|
||||
void frameEndEvent(bool);
|
||||
void logE(const char *, const char *);
|
||||
bool hexRxEvent(uint8_t);
|
||||
uint32_t _lastUpdate = 0;
|
||||
uint32_t _pollInterval;
|
||||
uint32_t _lastPoll = 0;
|
||||
};
|
||||
|
||||
@ -107,6 +107,7 @@ void WebApiWsVedirectLiveClass::generateJsonResponse(JsonVariant& root)
|
||||
}
|
||||
root[F("data_age")] = (millis() - VeDirect.getLastUpdate() ) / 1000;
|
||||
root[F("age_critical")] = ((millis() - VeDirect.getLastUpdate()) / 1000) > Configuration.get().Vedirect_PollInterval * 5;
|
||||
root[F("poll_intervall")] = Configuration.get().Vedirect_PollInterval;
|
||||
|
||||
if (VeDirect.getLastUpdate() > _newestVedirectTimestamp) {
|
||||
_newestVedirectTimestamp = VeDirect.getLastUpdate();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user