From ed6203e114b2d88fff6d4027cce11194768e7c9b Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sun, 20 Apr 2025 14:36:22 +0200 Subject: [PATCH] - Allow command `WebRefresh` minimum from 1000 to 400 mSec - Fix command JsonPP when showing log buffer data like in GUI console and ESP8266 Telnet. --- CHANGELOG.md | 1 + RELEASENOTES.md | 1 + tasmota/tasmota_support/support_command.ino | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d6c5e826..49a4bb5be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file. ### Breaking Changed ### Changed +- Allow command `WebRefresh` minimum from 1000 to 400 mSec ### Fixed - Berry `bytes().asstring()` now truncates a string if buffer contains NULL (#23311) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 86b3063f0..4c1e62743 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -122,6 +122,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm ### Breaking Changed ### Changed +- Allow command `WebRefresh` minimum from 1000 to 400 mSec ### Fixed - Berry `bytes().asstring()` now truncates a string if buffer contains NULL [#23311](https://github.com/arendst/Tasmota/issues/23311) diff --git a/tasmota/tasmota_support/support_command.ino b/tasmota/tasmota_support/support_command.ino index c5e33d5d0..a1f02b4d7 100644 --- a/tasmota/tasmota_support/support_command.ino +++ b/tasmota/tasmota_support/support_command.ino @@ -673,6 +673,8 @@ void CmndJsonPP(void) { Settings->mbflag2.json_pretty_print = XdrvMailbox.payload; } else if (XdrvMailbox.data_len) { +/* + // This fails displaying JsonPP from log buffer messages uint32_t last_json_pretty_print = Settings->mbflag2.json_pretty_print; if (0 == Settings->mbflag2.json_pretty_print) { Settings->mbflag2.json_pretty_print = 1; // Default 1 indent if not set @@ -689,6 +691,24 @@ void CmndJsonPP(void) { } ResponseClear(); return; +*/ + uint32_t last_json_pretty_print = Settings->mbflag2.json_pretty_print; + if (0 == Settings->mbflag2.json_pretty_print) { + Settings->mbflag2.json_pretty_print = 1; // Default 1 indent if not set + } + char cmnds[strlen(XdrvMailbox.data) + 32]; + if (0 == last_json_pretty_print) { // No need if JsonPP is already set + bool backlog = (0 == strncasecmp_P(XdrvMailbox.data, PSTR(D_CMND_BACKLOG), strlen(D_CMND_BACKLOG))); + snprintf_P(cmnds, sizeof(cmnds), PSTR("%s%s;_Delay %d;_JsonPP %d"), + (!backlog) ? "Backlog " : "", // We need backlog to provide delay and restore JsonPP state + XdrvMailbox.data, + Settings->web_refresh / 98, // To serve log buffer messages we need to delay a little over WebRefresh time + last_json_pretty_print); // Restore JsonPP after execution of backlog commands + } + ExecuteCommand((0 == last_json_pretty_print) ? cmnds : XdrvMailbox.data, SRC_IGNORE); + ResponseClear(); + return; + } ResponseCmndNumber(Settings->mbflag2.json_pretty_print); }