- Allow command WebRefresh minimum from 1000 to 400 mSec

- Fix command JsonPP <command> when showing log buffer data like in GUI console and ESP8266 Telnet.
This commit is contained in:
Theo Arends 2025-04-20 14:36:22 +02:00
parent 015fa1da89
commit ed6203e114
3 changed files with 22 additions and 0 deletions

View File

@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
### Breaking Changed ### Breaking Changed
### Changed ### Changed
- Allow command `WebRefresh` minimum from 1000 to 400 mSec
### Fixed ### Fixed
- Berry `bytes().asstring()` now truncates a string if buffer contains NULL (#23311) - Berry `bytes().asstring()` now truncates a string if buffer contains NULL (#23311)

View File

@ -122,6 +122,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
### Breaking Changed ### Breaking Changed
### Changed ### Changed
- Allow command `WebRefresh` minimum from 1000 to 400 mSec
### Fixed ### Fixed
- Berry `bytes().asstring()` now truncates a string if buffer contains NULL [#23311](https://github.com/arendst/Tasmota/issues/23311) - Berry `bytes().asstring()` now truncates a string if buffer contains NULL [#23311](https://github.com/arendst/Tasmota/issues/23311)

View File

@ -673,6 +673,8 @@ void CmndJsonPP(void) {
Settings->mbflag2.json_pretty_print = XdrvMailbox.payload; Settings->mbflag2.json_pretty_print = XdrvMailbox.payload;
} }
else if (XdrvMailbox.data_len) { else if (XdrvMailbox.data_len) {
/*
// This fails displaying JsonPP from log buffer messages
uint32_t last_json_pretty_print = Settings->mbflag2.json_pretty_print; uint32_t last_json_pretty_print = Settings->mbflag2.json_pretty_print;
if (0 == Settings->mbflag2.json_pretty_print) { if (0 == Settings->mbflag2.json_pretty_print) {
Settings->mbflag2.json_pretty_print = 1; // Default 1 indent if not set Settings->mbflag2.json_pretty_print = 1; // Default 1 indent if not set
@ -689,6 +691,24 @@ void CmndJsonPP(void) {
} }
ResponseClear(); ResponseClear();
return; 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); ResponseCmndNumber(Settings->mbflag2.json_pretty_print);
} }