From fa299198fc12a042d6e0a6c3ec4f5d6f809051e3 Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Thu, 13 Oct 2022 20:33:59 +0200 Subject: [PATCH] Fixed all build warnings --- src/AmsConfiguration.cpp | 2 +- src/LNG.cpp | 16 ++++++++-------- src/ams/DsmrParser.cpp | 1 - src/ams/GcmParser.cpp | 2 +- src/ams/HdlcParser.cpp | 2 -- src/ams/LlcParser.cpp | 1 - src/ams/MbusParser.cpp | 2 -- src/entsoe/DnbCurrParser.cpp | 2 +- 8 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/AmsConfiguration.cpp b/src/AmsConfiguration.cpp index 3f391e99..450c7c06 100644 --- a/src/AmsConfiguration.cpp +++ b/src/AmsConfiguration.cpp @@ -743,7 +743,7 @@ bool AmsConfiguration::relocateConfig86() { } bool AmsConfiguration::relocateConfig87() { - MeterConfig87 meter87; + MeterConfig87 meter87 = {0,0,0,0,0,0,0}; MeterConfig meter; EEPROM.begin(EEPROM_SIZE); EEPROM.get(CONFIG_METER_START_87, meter87); diff --git a/src/LNG.cpp b/src/LNG.cpp index b5c9817b..f3ec7cd5 100644 --- a/src/LNG.cpp +++ b/src/LNG.cpp @@ -25,38 +25,38 @@ LNG::LNG(const char* payload, uint8_t useMeterType, MeterConfig* meterConfig, Da if(descriptor->obis[3] == 7) { if(descriptor->obis[4] == 0) { o170 = ntohl(item->dlu.data); - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %d (dlu)", ntohl(item->dlu.data)); + if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %lu (dlu)", ntohl(item->dlu.data)); } } else if(descriptor->obis[3] == 8) { if(descriptor->obis[4] == 0) { activeImportCounter = ntohl(item->dlu.data) / 1000.0; listType = listType >= 3 ? listType : 3; - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %d (dlu)", ntohl(item->dlu.data)); + if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %lu (dlu)", ntohl(item->dlu.data)); } else if(descriptor->obis[4] == 1) { o181 = ntohl(item->dlu.data); - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %d (dlu)", ntohl(item->dlu.data)); + if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %lu (dlu)", ntohl(item->dlu.data)); } else if(descriptor->obis[4] == 2) { o182 = ntohl(item->dlu.data); - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %d (dlu)", ntohl(item->dlu.data)); + if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %lu (dlu)", ntohl(item->dlu.data)); } } } else if(descriptor->obis[2] == 2) { if(descriptor->obis[3] == 7) { if(descriptor->obis[4] == 0) { o270 = ntohl(item->dlu.data); - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %d (dlu)", ntohl(item->dlu.data)); + if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %lu (dlu)", ntohl(item->dlu.data)); } } else if(descriptor->obis[3] == 8) { if(descriptor->obis[4] == 0) { activeExportCounter = ntohl(item->dlu.data) / 1000.0; listType = listType >= 3 ? listType : 3; - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %d (dlu)", ntohl(item->dlu.data)); + if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %lu (dlu)", ntohl(item->dlu.data)); } else if(descriptor->obis[4] == 1) { o281 = ntohl(item->dlu.data); - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %d (dlu)", ntohl(item->dlu.data)); + if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %lu (dlu)", ntohl(item->dlu.data)); } else if(descriptor->obis[4] == 2) { o282 = ntohl(item->dlu.data); - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %d (dlu)", ntohl(item->dlu.data)); + if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %lu (dlu)", ntohl(item->dlu.data)); } } } else if(descriptor->obis[2] == 96) { diff --git a/src/ams/DsmrParser.cpp b/src/ams/DsmrParser.cpp index 8ef8ef98..e6b006b1 100644 --- a/src/ams/DsmrParser.cpp +++ b/src/ams/DsmrParser.cpp @@ -4,7 +4,6 @@ int8_t DSMRParser::parse(uint8_t *buf, DataParserContext &ctx, bool verified) { uint16_t crcPos = 0; bool reachedEnd = verified; uint8_t lastByte = 0x00; - int c = 0; for(int pos = 0; pos < ctx.length; pos++) { uint8_t b = *(buf+pos); if(pos == 0 && b != '/') return DATA_PARSE_BOUNDRY_FLAG_MISSING; diff --git a/src/ams/GcmParser.cpp b/src/ams/GcmParser.cpp index 5ac92bfc..5f9e2bd5 100644 --- a/src/ams/GcmParser.cpp +++ b/src/ams/GcmParser.cpp @@ -27,7 +27,7 @@ int8_t GCMParser::parse(uint8_t *d, DataParserContext &ctx) { memcpy(ctx.system_title, ptr, systemTitleLength); memcpy(initialization_vector, ctx.system_title, systemTitleLength); - int len; + int len = 0; int headersize = 2 + systemTitleLength; ptr += systemTitleLength; if(((*ptr) & 0xFF) == 0x81) { diff --git a/src/ams/HdlcParser.cpp b/src/ams/HdlcParser.cpp index a82fd4bc..68a65ae1 100644 --- a/src/ams/HdlcParser.cpp +++ b/src/ams/HdlcParser.cpp @@ -5,8 +5,6 @@ int8_t HDLCParser::parse(uint8_t *d, DataParserContext &ctx) { int len; - uint8_t flag = *d; - uint8_t* ptr; if(ctx.length < 3) return DATA_PARSE_INCOMPLETE; diff --git a/src/ams/LlcParser.cpp b/src/ams/LlcParser.cpp index 3f348844..c6d41a56 100644 --- a/src/ams/LlcParser.cpp +++ b/src/ams/LlcParser.cpp @@ -1,7 +1,6 @@ #include "LlcParser.h" int8_t LLCParser::parse(uint8_t *buf, DataParserContext &ctx) { - LLCHeader* llc = (LLCHeader*) buf; ctx.length -= 3; return 3; } \ No newline at end of file diff --git a/src/ams/MbusParser.cpp b/src/ams/MbusParser.cpp index 731ffcaf..4a090da9 100644 --- a/src/ams/MbusParser.cpp +++ b/src/ams/MbusParser.cpp @@ -5,8 +5,6 @@ int8_t MBUSParser::parse(uint8_t *d, DataParserContext &ctx) { int headersize = 3; int footersize = 1; - uint8_t flag = *d; - uint8_t* ptr; // https://m-bus.com/documentation-wired/06-application-layer diff --git a/src/entsoe/DnbCurrParser.cpp b/src/entsoe/DnbCurrParser.cpp index c85dfb44..4c576ef1 100644 --- a/src/entsoe/DnbCurrParser.cpp +++ b/src/entsoe/DnbCurrParser.cpp @@ -22,7 +22,7 @@ void DnbCurrParser::flush() { } size_t DnbCurrParser::write(const uint8_t *buffer, size_t size) { - for(int i = 0; i < size; i++) { + for(size_t i = 0; i < size; i++) { write(buffer[i]); } return size;