From cb09041279e7de551b8147451fd5e7fc5570b9a7 Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 12 Nov 2019 08:50:31 +0100 Subject: [PATCH] mem debugging --- platformio.ini | 11 +++++++++-- src/ems.cpp | 7 ++++--- src/ems.h | 11 +++++------ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/platformio.ini b/platformio.ini index b89693979..9134007a5 100644 --- a/platformio.ini +++ b/platformio.ini @@ -3,7 +3,8 @@ ; [platformio] -default_envs = release +;default_envs = release +default_envs = debug [common] ; custom build options are: @@ -15,7 +16,8 @@ default_envs = release custom_flags = ;general_flags = -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH -DVTABLES_IN_FLASH -general_flags = -fno-exceptions -lstdc++ -DNO_GLOBAL_EEPROM -O2 -DBEARSSL_SSL_BASIC +;general_flags = -fno-exceptions -lstdc++ -DNO_GLOBAL_EEPROM -O2 -DBEARSSL_SSL_BASIC +general_flags = [env] framework = arduino @@ -42,6 +44,9 @@ monitor_speed = 115200 upload_protocol = espota upload_port = ems-esp.local +# These following targets are used by TravisCI to build the firmware versions on Release +# Do not modify + [env:travis] board = esp12e build_flags = ${common.general_flags} @@ -67,6 +72,8 @@ board = nodemcu build_flags = ${common.general_flags} extra_scripts = scripts/main_script.py +# These two targets (release and debug) can be modified + [env:debug] board = d1_mini build_type = debug diff --git a/src/ems.cpp b/src/ems.cpp index fa66d6aa1..da60b7b86 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -709,18 +709,19 @@ void _createValidate() { new_EMS_TxTelegram.action = EMS_TX_TELEGRAM_VALIDATE; // copy old Write record - new_EMS_TxTelegram.type_validate = EMS_TxTelegram.type; // save the original type in the type_validate, increase we need to re-try - new_EMS_TxTelegram.type = EMS_TxTelegram.type_validate; // new type is the validate type - + new_EMS_TxTelegram.type_validate = EMS_TxTelegram.type; // save the original type in the type_validate, increase we need to re-try + new_EMS_TxTelegram.type = EMS_TxTelegram.type_validate; // new type is the validate type new_EMS_TxTelegram.dest = EMS_TxTelegram.dest; new_EMS_TxTelegram.comparisonValue = EMS_TxTelegram.comparisonValue; new_EMS_TxTelegram.comparisonPostRead = EMS_TxTelegram.comparisonPostRead; new_EMS_TxTelegram.comparisonOffset = EMS_TxTelegram.comparisonOffset; + new_EMS_TxTelegram.forceRefresh = EMS_TxTelegram.forceRefresh; // this is what is different new_EMS_TxTelegram.offset = EMS_TxTelegram.comparisonOffset; // location of byte to fetch new_EMS_TxTelegram.dataValue = 1; // fetch single byte new_EMS_TxTelegram.length = EMS_MIN_TELEGRAM_LENGTH; // is always 6 bytes long (including CRC at end) + new_EMS_TxTelegram.timestamp = millis(); // remove old telegram from queue and add this new read one EMS_TxQueue.shift(); // remove from queue diff --git a/src/ems.h b/src/ems.h index c38916cbd..52659aa12 100644 --- a/src/ems.h +++ b/src/ems.h @@ -247,19 +247,18 @@ const _EMS_Device_Types EMS_Devices_Types[] = { // for storing all recognised EMS devices typedef struct { _EMS_DEVICE_TYPE device_type; // type - uint8_t product_id; // product id for looking up details in _EMS_Devices + uint8_t product_id; // product id for looking up details in EMS_Devices uint8_t device_id; // the device_id uint8_t device_index; // where it is in the EMS_Devices table char version[10]; // the version number XX.XX bool known; // is this a known device? } _Detected_Device; -#define EMS_DEVICE_FLAG_NONE 0 // no flags set +#define EMS_DEVICE_FLAG_NONE 0 // no flags set +#define EMS_DEVICE_FLAG_SM10 10 // solar module1 +#define EMS_DEVICE_FLAG_SM100 11 // solar module2 -#define EMS_DEVICE_FLAG_SM10 10 -#define EMS_DEVICE_FLAG_SM100 11 - -// group flags for thermostats +// group flags specific for thermostats #define EMS_DEVICE_FLAG_NO_WRITE 0x80 // top bit set if can't write yet #define EMS_DEVICE_FLAG_EASY 1 #define EMS_DEVICE_FLAG_RC10 2