mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-22 10:41:21 +00:00
Fixed a couple of things before release
This commit is contained in:
parent
d697f7e37f
commit
0b86761d2c
@ -70,9 +70,9 @@ bool AmsDataStorage::update(AmsData* data) {
|
||||
}
|
||||
|
||||
for(int i = last.Day; i < tm.Day; i++) {
|
||||
//if(debugger->isActive(RemoteDebug::DEBUG)) {
|
||||
if(debugger->isActive(RemoteDebug::DEBUG)) {
|
||||
debugger->printf("(AmsDataStorage) Clearing day: %d\n", i);
|
||||
//}
|
||||
}
|
||||
setDay(i, 0);
|
||||
}
|
||||
}
|
||||
@ -97,9 +97,9 @@ bool AmsDataStorage::update(AmsData* data) {
|
||||
int16_t val = (((data->getActiveImportCounter() * 1000) - day.activeImport) - ((data->getActiveExportCounter() * 1000) - day.activeExport));
|
||||
setHour(tm.Hour, val);
|
||||
|
||||
//if(debugger->isActive(RemoteDebug::INFO)) {
|
||||
if(debugger->isActive(RemoteDebug::INFO)) {
|
||||
debugger->printf("(AmsDataStorage) Usage for hour %d: %d\n", tm.Hour, val);
|
||||
//}
|
||||
}
|
||||
|
||||
day.activeImport = data->getActiveImportCounter() * 1000;
|
||||
day.activeExport = data->getActiveExportCounter() * 1000;
|
||||
@ -111,9 +111,9 @@ bool AmsDataStorage::update(AmsData* data) {
|
||||
float ipm = im / mins;
|
||||
float epm = ex / mins;
|
||||
|
||||
//if(debugger->isActive(RemoteDebug::DEBUG)) {
|
||||
if(debugger->isActive(RemoteDebug::DEBUG)) {
|
||||
debugger->printf("(AmsDataStorage) Since last day update, minutes: %.1f, import: %d (%.2f/min), export: %d (%.2f/min)\n", mins, im, ipm, ex, epm);
|
||||
//}
|
||||
}
|
||||
|
||||
breakTime(day.lastMeterReadTime, tm);
|
||||
day.lastMeterReadTime = day.lastMeterReadTime - (tm.Minute * 60) - tm.Second;
|
||||
@ -128,9 +128,9 @@ bool AmsDataStorage::update(AmsData* data) {
|
||||
float val = ((ipm * minutes) - (epm * minutes));
|
||||
setHour(last.Hour, val);
|
||||
|
||||
//if(debugger->isActive(RemoteDebug::INFO)) {
|
||||
if(debugger->isActive(RemoteDebug::INFO)) {
|
||||
debugger->printf("(AmsDataStorage) Estimated usage for hour %u: %.1f (%lu)\n", last.Hour, val, cur);
|
||||
//}
|
||||
}
|
||||
|
||||
day.activeImport += ipm * minutes;
|
||||
day.activeExport += epm * minutes;
|
||||
@ -159,9 +159,9 @@ bool AmsDataStorage::update(AmsData* data) {
|
||||
} else if(now - month.lastMeterReadTime < 87000) {
|
||||
int32_t val = (month.activeImport == 0 ? 0 : ((data->getActiveImportCounter() * 1000) - month.activeImport) - ((data->getActiveExportCounter() * 1000) - month.activeExport));
|
||||
|
||||
//if(debugger->isActive(RemoteDebug::INFO)) {
|
||||
if(debugger->isActive(RemoteDebug::INFO)) {
|
||||
debugger->printf("(AmsDataStorage) Usage for day %d: %d\n", tm.Day, val);
|
||||
//}
|
||||
}
|
||||
|
||||
time_t yesterday = now - 3600;
|
||||
breakTime(yesterday, tm);
|
||||
@ -177,9 +177,9 @@ bool AmsDataStorage::update(AmsData* data) {
|
||||
float iph = im / hrs;
|
||||
float eph = ex / hrs;
|
||||
|
||||
//if(debugger->isActive(RemoteDebug::DEBUG)) {
|
||||
if(debugger->isActive(RemoteDebug::DEBUG)) {
|
||||
debugger->printf("(AmsDataStorage) Since last month update, hours: %.1f, import: %d (%.2f/hr), export: %d (%.2f/hr)\n", hrs, im, iph, ex, eph);
|
||||
//}
|
||||
}
|
||||
|
||||
if(tz != NULL) {
|
||||
breakTime(tz->toLocal(month.lastMeterReadTime), tm);
|
||||
@ -207,9 +207,9 @@ bool AmsDataStorage::update(AmsData* data) {
|
||||
float val = ((iph * hours) - (eph * hours));
|
||||
setDay(last.Day, val);
|
||||
|
||||
//if(debugger->isActive(RemoteDebug::INFO)) {
|
||||
if(debugger->isActive(RemoteDebug::INFO)) {
|
||||
debugger->printf("(AmsDataStorage) Estimated usage for day %u: %.1f (%lu)\n", last.Day, val, cur);
|
||||
//}
|
||||
}
|
||||
|
||||
month.activeImport += iph * hours;
|
||||
month.activeExport += eph * hours;
|
||||
|
||||
@ -456,7 +456,6 @@ void loop() {
|
||||
config.ackEntsoeChange();
|
||||
}
|
||||
ws.loop();
|
||||
readHanPort(); // TODO: Move to bottom
|
||||
}
|
||||
if(mqtt != NULL) { // Run loop regardless, to let MQTT do its work.
|
||||
mqtt->loop();
|
||||
@ -483,6 +482,7 @@ void loop() {
|
||||
hc = NULL;
|
||||
}
|
||||
|
||||
readHanPort();
|
||||
delay(1); // Needed for auto modem sleep
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user