diff --git a/lib/MeterCommunicators/src/KmpCommunicator.cpp b/lib/MeterCommunicators/src/KmpCommunicator.cpp index eedc8ec2..d1b75aed 100644 --- a/lib/MeterCommunicators/src/KmpCommunicator.cpp +++ b/lib/MeterCommunicators/src/KmpCommunicator.cpp @@ -19,12 +19,25 @@ void KmpCommunicator::configure(MeterConfig& meterConfig) { bool KmpCommunicator::loop() { uint64_t now = millis64(); bool ret = talker->loop(); + int lastError = getLastError(); if(ret) { #if defined(AMS_REMOTE_DEBUG) if (debugger->isActive(RemoteDebug::VERBOSE)) #endif debugger->printf_P(PSTR("Successful loop\n")); Serial.flush(); + } else if(lastError < 0 && lastError != DATA_PARSE_INCOMPLETE) { + #if defined(AMS_REMOTE_DEBUG) + if (debugger->isActive(RemoteDebug::DEBUG)) + #endif + debugger->printf_P(PSTR("Error code: %d\n"), getLastError()); + #if defined(AMS_REMOTE_DEBUG) + if (debugger->isActive(RemoteDebug::VERBOSE)) + #endif + { + debugger->printf_P(PSTR(" payload:\n")); + debugPrint(hanBuffer, 0, hanBufferSize); + } } return ret; } diff --git a/platformio.ini b/platformio.ini index bc9aeff8..dd70e22a 100755 --- a/platformio.ini +++ b/platformio.ini @@ -38,7 +38,7 @@ platform = https://github.com/tasmota/platform-espressif32/releases/download/202 framework = arduino board = esp32dev board_build.f_cpu = 160000000L -build_flags = ${common.build_flags} -D AMS_REMOTE_DEBUG=1 +build_flags = ${common.build_flags} lib_ldf_mode = off lib_compat_mode = off lib_deps = ${esp32.lib_deps} @@ -57,7 +57,12 @@ board_build.variant = esp32s2 board_build.flash_mode = qio board_build.f_cpu = 160000000L board_build.f_flash = 40000000L -build_flags = ${common.build_flags} -D AMS_REMOTE_DEBUG=1 +build_flags = + ${common.build_flags} + -D AMS_REMOTE_DEBUG=1 + -D AMS_KMP=1 + -L precompiled/esp32s2 + -lKmpTalker lib_ldf_mode = off lib_compat_mode = off lib_deps = ${esp32.lib_deps} @@ -69,7 +74,13 @@ platform = https://github.com/tasmota/platform-espressif32/releases/download/202 framework = arduino board = esp32-solo1 board_build.f_cpu = 160000000L -build_flags = ${common.build_flags} -DFRAMEWORK_ARDUINO_SOLO1 -D AMS_REMOTE_DEBUG=1 +build_flags = + ${common.build_flags} + -DFRAMEWORK_ARDUINO_SOLO1 + -D AMS_REMOTE_DEBUG=1 + -D AMS_KMP=1 + -L precompiled/esp32 + -lKmpTalker lib_ldf_mode = off lib_compat_mode = off lib_deps = ${esp32.lib_deps} @@ -93,7 +104,12 @@ platform = https://github.com/tasmota/platform-espressif32/releases/download/202 framework = arduino board = esp32-s3-devkitc-1 board_build.mcu = esp32s3 -build_flags = ${common.build_flags} -D AMS_REMOTE_DEBUG=1 +build_flags = + ${common.build_flags} + -D AMS_REMOTE_DEBUG=1 + -D AMS_KMP=1 + -L precompiled/esp32s3 + -lKmpTalker lib_ldf_mode = off lib_compat_mode = off lib_deps = ${esp32.lib_deps} diff --git a/precompiled/esp32/libKmpTalker.a b/precompiled/esp32/libKmpTalker.a index a9b4e81c..c44146b5 100644 Binary files a/precompiled/esp32/libKmpTalker.a and b/precompiled/esp32/libKmpTalker.a differ diff --git a/precompiled/esp32c3/libKmpTalker.a b/precompiled/esp32c3/libKmpTalker.a index bbd6a847..abfe545c 100644 Binary files a/precompiled/esp32c3/libKmpTalker.a and b/precompiled/esp32c3/libKmpTalker.a differ diff --git a/precompiled/esp32s2/libKmpTalker.a b/precompiled/esp32s2/libKmpTalker.a index cbf94838..ada36275 100644 Binary files a/precompiled/esp32s2/libKmpTalker.a and b/precompiled/esp32s2/libKmpTalker.a differ diff --git a/precompiled/esp32s3/libKmpTalker.a b/precompiled/esp32s3/libKmpTalker.a index 7e43c0ca..bacb17ec 100644 Binary files a/precompiled/esp32s3/libKmpTalker.a and b/precompiled/esp32s3/libKmpTalker.a differ diff --git a/precompiled/esp8266/libKmpTalker.a b/precompiled/esp8266/libKmpTalker.a index 0bdbd4bf..443d96a9 100644 Binary files a/precompiled/esp8266/libKmpTalker.a and b/precompiled/esp8266/libKmpTalker.a differ