mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-27 04:33:04 +00:00
Fixed uptime rollover in UI
This commit is contained in:
@@ -37,6 +37,8 @@ void AmsWebServer::loop() {
|
||||
|
||||
|
||||
void AmsWebServer::setData(AmsData& data) {
|
||||
millis64(); // Make sure it catch all those rollovers
|
||||
|
||||
this->data.apply(data);
|
||||
|
||||
if(maxPwr == 0 && data.getListType() > 1 && config->hasConfig() && config->getMainFuse() > 0 && config->getDistributionSystem() > 0) {
|
||||
@@ -351,11 +353,10 @@ void AmsWebServer::dataJson() {
|
||||
json["po_pct"] = -1;
|
||||
}
|
||||
|
||||
unsigned long now = millis();
|
||||
json["id"] = WiFi.macAddress();
|
||||
json["maxPower"] = maxPwr;
|
||||
json["meterType"] = config->getMeterType();
|
||||
json["currentMillis"] = now;
|
||||
json["uptime_seconds"] = millis64() / 1000;
|
||||
double vcc = hw.getVcc();
|
||||
json["vcc"] = serialized(String(vcc, 3));
|
||||
|
||||
@@ -383,6 +384,7 @@ void AmsWebServer::dataJson() {
|
||||
}
|
||||
json["status"]["esp"] = espStatus;
|
||||
|
||||
unsigned long now = millis();
|
||||
String hanStatus;
|
||||
if(config->getMeterType() == 0) {
|
||||
hanStatus = "secondary";
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "AmsConfiguration.h"
|
||||
#include "HwTools.h"
|
||||
#include "AmsData.h"
|
||||
#include "Uptime.h"
|
||||
|
||||
#if defined(ARDUINO) && ARDUINO >= 100
|
||||
#include "Arduino.h"
|
||||
@@ -33,7 +34,7 @@ public:
|
||||
void setData(AmsData& data);
|
||||
|
||||
private:
|
||||
int maxPwr;
|
||||
int maxPwr = 0;
|
||||
HwTools hw;
|
||||
AmsConfiguration* config;
|
||||
AmsData data;
|
||||
|
||||
Reference in New Issue
Block a user