Final changes before 2.0

This commit is contained in:
Gunnar Skjold 2021-12-10 08:19:48 +01:00
parent db859e3ff5
commit d697f7e37f
3 changed files with 7 additions and 4 deletions

View File

@ -86,6 +86,9 @@ bool AmsDataStorage::update(AmsData* data) {
day.activeImport = data->getActiveImportCounter() * 1000;
day.activeExport = data->getActiveExportCounter() * 1000;
day.lastMeterReadTime = now;
if(debugger->isActive(RemoteDebug::WARNING)) {
debugger->printf("(AmsDataStorage) Too long since last day update, clearing data\n");
}
for(int i = 0; i<24; i++) {
setHour(i, 0);
}
@ -148,7 +151,7 @@ bool AmsDataStorage::update(AmsData* data) {
month.activeExport = data->getActiveExportCounter() * 1000;
month.lastMeterReadTime = now;
if(debugger->isActive(RemoteDebug::WARNING)) {
debugger->printf("(AmsDataStorage) Too long since last update, clearing data\n");
debugger->printf("(AmsDataStorage) Too long since last month update, clearing data\n");
}
for(int i = 0; i<31; i++) {
setDay(i, 0);
@ -217,7 +220,7 @@ bool AmsDataStorage::update(AmsData* data) {
return true;
}
void AmsDataStorage::setHour(uint8_t hour, int16_t val) {
void AmsDataStorage::setHour(uint8_t hour, int32_t val) {
if(hour < 0) return;
day.points[hour] = val / 10;
}

View File

@ -42,7 +42,7 @@ private:
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
RemoteDebug* debugger;
void setHour(uint8_t, int16_t);
void setHour(uint8_t, int32_t);
void setDay(uint8_t, int32_t);
};

View File

@ -138,7 +138,7 @@ int HDLC_validate(const uint8_t* d, int length, HDLCConfig* config, CosemDateTim
ptr += 3;
headersize += 3;
}
len = ceil(len/16.0) * 16;
//len = ceil(len/16.0) * 16; // Technically GCM is 128bit blocks. This works for Austrian meters, but not Danish...
if(len + headersize + footersize > length)
return HDLC_FRAME_INCOMPLETE;