mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-04-30 05:35:50 +00:00
Final changes before 2.0
This commit is contained in:
@@ -86,6 +86,9 @@ bool AmsDataStorage::update(AmsData* data) {
|
|||||||
day.activeImport = data->getActiveImportCounter() * 1000;
|
day.activeImport = data->getActiveImportCounter() * 1000;
|
||||||
day.activeExport = data->getActiveExportCounter() * 1000;
|
day.activeExport = data->getActiveExportCounter() * 1000;
|
||||||
day.lastMeterReadTime = now;
|
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++) {
|
for(int i = 0; i<24; i++) {
|
||||||
setHour(i, 0);
|
setHour(i, 0);
|
||||||
}
|
}
|
||||||
@@ -148,7 +151,7 @@ bool AmsDataStorage::update(AmsData* data) {
|
|||||||
month.activeExport = data->getActiveExportCounter() * 1000;
|
month.activeExport = data->getActiveExportCounter() * 1000;
|
||||||
month.lastMeterReadTime = now;
|
month.lastMeterReadTime = now;
|
||||||
if(debugger->isActive(RemoteDebug::WARNING)) {
|
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++) {
|
for(int i = 0; i<31; i++) {
|
||||||
setDay(i, 0);
|
setDay(i, 0);
|
||||||
@@ -217,7 +220,7 @@ bool AmsDataStorage::update(AmsData* data) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmsDataStorage::setHour(uint8_t hour, int16_t val) {
|
void AmsDataStorage::setHour(uint8_t hour, int32_t val) {
|
||||||
if(hour < 0) return;
|
if(hour < 0) return;
|
||||||
day.points[hour] = val / 10;
|
day.points[hour] = val / 10;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
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;
|
RemoteDebug* debugger;
|
||||||
void setHour(uint8_t, int16_t);
|
void setHour(uint8_t, int32_t);
|
||||||
void setDay(uint8_t, int32_t);
|
void setDay(uint8_t, int32_t);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ int HDLC_validate(const uint8_t* d, int length, HDLCConfig* config, CosemDateTim
|
|||||||
ptr += 3;
|
ptr += 3;
|
||||||
headersize += 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)
|
if(len + headersize + footersize > length)
|
||||||
return HDLC_FRAME_INCOMPLETE;
|
return HDLC_FRAME_INCOMPLETE;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user