From 49b5ae71cac893baa13a50c16b60a71df723009d Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Wed, 9 Jun 2021 10:14:39 +0200 Subject: [PATCH] Change command ``Modules`` layout of JSON message changed to single line --- CHANGELOG.md | 5 ++++- RELEASENOTES.md | 2 ++ tasmota/support.ino | 11 +++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe282c6e5..55316dfb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,14 @@ All notable changes to this project will be documented in this file. ## [Unreleased] - Development ## [9.4.0.5] +### Added +- Preliminary support for Esp32C3 - RiscV based + ### Changed - Allow longer MQTT response messages by removing fixed memory buffer with size 1040 to heap allocated buffer - Command ``Timers`` layout of JSON message changed to single line - Command ``Gpio`` layout of JSON message changed to single line -- Add preliminary support for Esp32C3 - RiscV based +- Command ``Modules`` layout of JSON message changed to single line ## [9.4.0.4] ### Added diff --git a/RELEASENOTES.md b/RELEASENOTES.md index ca5b3449d..1a6eb61df 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -89,6 +89,7 @@ The binaries can be downloaded from either https://github.com/arendst/Tasmota/tr - Define ``USER_BACKLOG`` to store commands at compile time to be executed at firmware load or when executing command ``reset`` - LVGL support for TrueType fonts via FreeType library - Support for BM8563 RTC chip (I2C) found in M5Stack Core2 and M5StickC +- Preliminary support for Esp32C3 - RiscV based ### Breaking Changed @@ -97,6 +98,7 @@ The binaries can be downloaded from either https://github.com/arendst/Tasmota/tr - Allow longer MQTT response messages by removing fixed memory buffer with size 1040 to heap allocated buffer - Command ``Timers`` layout of JSON message changed to single line - Command ``Gpio`` layout of JSON message changed to single line +- Command ``Modules`` layout of JSON message changed to single line ### Fixed diff --git a/tasmota/support.ino b/tasmota/support.ino index d438bd6fc..cd717b960 100644 --- a/tasmota/support.ino +++ b/tasmota/support.ino @@ -2387,9 +2387,6 @@ void AddLogData(uint32_t loglevel, const char* log_data) { Serial.printf("%s%s\r\n", mxtime, log_data); } - uint32_t log_data_len = strlen(log_data) + strlen(mxtime) + 4; // 4 = log_buffer_pointer + '\1' + '\0' - if (log_data_len > LOG_BUFFER_SIZE) { return; } // log_data too big for buffer - discard logging - uint32_t highest_loglevel = Settings.weblog_level; if (Settings.mqttlog_level > highest_loglevel) { highest_loglevel = Settings.mqttlog_level; } if (TasmotaGlobal.syslog_level > highest_loglevel) { highest_loglevel = TasmotaGlobal.syslog_level; } @@ -2400,12 +2397,18 @@ void AddLogData(uint32_t loglevel, const char* log_data) { (TasmotaGlobal.masterlog_level <= highest_loglevel)) { // Delimited, zero-terminated buffer of log lines. // Each entry has this format: [index][loglevel][log data]['\1'] + + uint32_t log_data_len = strlen(log_data); + if (log_data_len + 64 > LOG_BUFFER_SIZE) { + sprintf_P((char*)log_data + 128, PSTR(" ... truncated %d"), log_data_len); + } + TasmotaGlobal.log_buffer_pointer &= 0xFF; if (!TasmotaGlobal.log_buffer_pointer) { TasmotaGlobal.log_buffer_pointer++; // Index 0 is not allowed as it is the end of char string } while (TasmotaGlobal.log_buffer_pointer == TasmotaGlobal.log_buffer[0] || // If log already holds the next index, remove it - strlen(TasmotaGlobal.log_buffer) + log_data_len > LOG_BUFFER_SIZE) + strlen(TasmotaGlobal.log_buffer) + strlen(log_data) + strlen(mxtime) + 4 > LOG_BUFFER_SIZE) // 4 = log_buffer_pointer + '\1' + '\0' { char* it = TasmotaGlobal.log_buffer; it++; // Skip log_buffer_pointer