From 81866b793297542148bf1564746fa0afb8f5bd3d Mon Sep 17 00:00:00 2001 From: john30 Date: Tue, 31 Jan 2017 08:05:35 +0100 Subject: [PATCH] include undecodable field name in loadScanConfigFile error message and use decimal value of SW/HW field on decode error of any of those two (still experimental due to the message itself still not being decodeable) --- src/ebusd/main.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ebusd/main.cpp b/src/ebusd/main.cpp index 888d99b5..1f2cfcae 100644 --- a/src/ebusd/main.cpp +++ b/src/ebusd/main.cpp @@ -849,13 +849,21 @@ result_t loadScanConfigFile(MessageMap* messages, unsigned char address, SymbolS out.str(""); offset = (unsigned char)(offset+(*identFields)[field++]->getLength(partType)); result = (*identFields)[field]->read(partType, data, offset, sw, 0); // software version number + if (result==RESULT_ERR_OUT_OF_RANGE) { + sw = (data[(partType==pt_masterData ? 5 : 1)+offset]<<16)|data[(partType==pt_masterData ? 5 : 1)+offset+1]; + result = RESULT_OK; + } } if (result == RESULT_OK) { offset = (unsigned char)(offset+(*identFields)[field++]->getLength(partType)); result = (*identFields)[field]->read(partType, data, offset, hw, 0); // hardware version number + if (result==RESULT_ERR_OUT_OF_RANGE) { + hw = (data[(partType==pt_masterData ? 5 : 1)+offset]<<16)|data[(partType==pt_masterData ? 5 : 1)+offset+1]; + result = RESULT_OK; + } } if (result != RESULT_OK) { - logError(lf_main, "unable to load scan config %2.2x: decode %s", address, getResultCode(result)); + logError(lf_main, "unable to load scan config %2.2x: decode field %s %s", address, identFields->getName(field).c_str(), getResultCode(result)); return result; } vector files;