From 2701c8a0df4a3467c1895e7ef7f64dc04402de27 Mon Sep 17 00:00:00 2001 From: proddy Date: Sun, 17 Mar 2019 22:40:13 +0100 Subject: [PATCH] change verbose logging to find duplicates --- src/ems.cpp | 6 +++--- src/ems.h | 4 ++-- src/emsuart.h | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ems.cpp b/src/ems.cpp index 6f0b23e28..1724e2b76 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -410,7 +410,7 @@ void _debugPrintTelegram(const char * prefix, uint8_t * data, uint8_t len, const if (EMS_Sys_Status.emsLogging <= EMS_SYS_LOGGING_BASIC) return; - char output_str[300] = {0}; // roughly EMS_MAX_TELEGRAM_LENGTH*3 + 20 + char output_str[200] = {0}; char buffer[16] = {0}; unsigned long upt = millis(); @@ -668,7 +668,7 @@ void _ems_processTelegram(uint8_t * telegram, uint8_t length) { // print detailed telegram data if (EMS_Sys_Status.emsLogging >= EMS_SYS_LOGGING_THERMOSTAT) { - char output_str[300] = {0}; // roughly EMS_MAX_TELEGRAM_LENGTH*3 + 20 + char output_str[200] = {0}; char buffer[16] = {0}; char color_s[20] = {0}; @@ -740,7 +740,7 @@ void _ems_processTelegram(uint8_t * telegram, uint8_t length) { if (typeFound && (commonType || forUs)) { if ((EMS_Types[i].processType_cb) != (void *)NULL) { // print non-verbose message - if ((EMS_Sys_Status.emsLogging == EMS_SYS_LOGGING_BASIC) || (EMS_Sys_Status.emsLogging == EMS_SYS_LOGGING_VERBOSE)) { + if (EMS_Sys_Status.emsLogging == EMS_SYS_LOGGING_BASIC) { myDebug("<--- %s(0x%02X) received", EMS_Types[i].typeString, type); } // call callback function to process it diff --git a/src/ems.h b/src/ems.h index e5e4af523..0b4dc20be 100644 --- a/src/ems.h +++ b/src/ems.h @@ -19,8 +19,8 @@ #define EMS_MIN_TELEGRAM_LENGTH 6 // minimal length for a validation telegram, including CRC -// max length of a telegram, including CRC, for Rx and Tx. -#define EMS_MAX_TELEGRAM_LENGTH 99 +// max length of a telegram, including CRC, for Rx and Tx. Data size is 32, so reserving 40 to be safe +#define EMS_MAX_TELEGRAM_LENGTH 40 // default values #define EMS_VALUE_INT_ON 1 // boolean true diff --git a/src/emsuart.h b/src/emsuart.h index e8e371909..e1fc9498c 100644 --- a/src/emsuart.h +++ b/src/emsuart.h @@ -10,15 +10,15 @@ #include #define EMSUART_UART 0 // UART 0 -#define EMSUART_CONFIG 0x1c // 8N1 (8 bits, no stop bits, 1 parity) +#define EMSUART_CONFIG 0x1C // 8N1 (8 bits, no stop bits, 1 parity) #define EMSUART_BAUD 9600 // uart baud rate for the EMS circuit -#define EMS_MAXBUFFERS 4 // 4 buffers for circular filling to avoid collisions -#define EMS_MAXBUFFERSIZE 128 // max size of the buffer. packets are max 32 bytes +#define EMS_MAXBUFFERS 10 // 4 buffers for circular filling to avoid collisions +#define EMS_MAXBUFFERSIZE 32 // max size of the buffer. packets are max 32 bytes -// this is how long we drop the Tx signal to create a 11-bit Break of zeros +// this is how long we drop the Tx signal to create a 11-bit Break of zeros (BRK) // At 9600 baud, 11 bits will be 1144 microseconds -// the BRK from Boiler is roughly 1.039ms, so accounting for hardware lag using around 2078 (for half-duplex) - 8 (lag) +// the BRK from Boiler master is roughly 1.039ms, so accounting for hardware lag using around 2078 (for half-duplex) - 8 (lag) #define EMS_TX_BRK_WAIT 2070 #define EMSUART_recvTaskPrio 1