mirror of https://github.com/arendst/Tasmota.git
Restore AddLog_P to max 700 chars
Changed maximum chars in ``AddLog_P`` logging restored from 128 to 700 (MAX_LOGSZ) to solve broken error messages
This commit is contained in:
parent
84e053ab09
commit
bc384a3858
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -3,7 +3,14 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
## [Unreleased] - Development
|
||||
|
||||
## [9.2.0.3]
|
||||
## [9.2.0.4]
|
||||
### Added
|
||||
- Function ``AddLog`` to provide logging for up to 128 (LOGSZ) characters to save stack space
|
||||
|
||||
### Changed
|
||||
- Maximum chars in ``AddLog_P`` logging restored from 128 to 700 (MAX_LOGSZ) to solve broken error messages
|
||||
|
||||
## [9.2.0.3] 20210122
|
||||
### Added
|
||||
- Support for time proportioned (``#define USE_TIMEPROP``) and optional PID (``#define USE_PID``) relay control (#10412)
|
||||
- Support rotary encoder on Shelly Dimmer (#10407)
|
||||
|
@ -55,7 +62,7 @@ All notable changes to this project will be documented in this file.
|
|||
- Replaced RA8876 GPIO selection from ``SPI CS`` by ``RA8876 CS``
|
||||
|
||||
### Changed
|
||||
- Maximum chars in AddLog_P logging reduced from 700 to 128 (LOGSZ) to enhance stability
|
||||
- Maximum chars in ``AddLog_P`` logging reduced from 700 to 128 (LOGSZ) to enhance stability
|
||||
- Disabled ``USE_LIGHT`` light support for ZBBridge saving 17.6kB (#10374)
|
||||
|
||||
## [9.2.0.1] 20201229
|
||||
|
|
|
@ -56,7 +56,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
|
|||
|
||||
[Complete list](BUILDS.md) of available feature and sensors.
|
||||
|
||||
## Changelog v9.2.0.3
|
||||
## Changelog v9.2.0.4
|
||||
### Added
|
||||
- Command ``CTRange`` to specify the visible CT range the bulb is capable of [#10311](https://github.com/arendst/Tasmota/issues/10311)
|
||||
- Command ``RuleTimer0`` to access all RuleTimers at once [#10352](https://github.com/arendst/Tasmota/issues/10352)
|
||||
|
|
|
@ -2204,8 +2204,8 @@ void AddLogData(uint32_t loglevel, const char* log_data) {
|
|||
}
|
||||
}
|
||||
|
||||
void AddLog_P(uint32_t loglevel, PGM_P formatP, ...)
|
||||
{
|
||||
void AddLog(uint32_t loglevel, PGM_P formatP, ...) {
|
||||
// To save stack space support logging for max text length of 128 characters
|
||||
char log_data[LOGSZ +4];
|
||||
|
||||
va_list arg;
|
||||
|
@ -2219,13 +2219,25 @@ void AddLog_P(uint32_t loglevel, PGM_P formatP, ...)
|
|||
static uint32_t max_len = 0;
|
||||
if (len > max_len) {
|
||||
max_len = len;
|
||||
Serial.printf("PRF: AddLog_P %d\n", max_len);
|
||||
Serial.printf("PRF: AddLog %d\n", max_len);
|
||||
}
|
||||
#endif
|
||||
|
||||
AddLogData(loglevel, log_data);
|
||||
}
|
||||
|
||||
void AddLog_P(uint32_t loglevel, PGM_P formatP, ...) {
|
||||
// Use more stack space to support logging for max text length of 700 characters
|
||||
char log_data[MAX_LOGSZ];
|
||||
|
||||
va_list arg;
|
||||
va_start(arg, formatP);
|
||||
uint32_t len = vsnprintf_P(log_data, sizeof(log_data), formatP, arg);
|
||||
va_end(arg);
|
||||
|
||||
AddLogData(loglevel, log_data);
|
||||
}
|
||||
|
||||
void AddLog_Debug(PGM_P formatP, ...)
|
||||
{
|
||||
char log_data[MAX_LOGSZ];
|
||||
|
@ -2235,15 +2247,6 @@ void AddLog_Debug(PGM_P formatP, ...)
|
|||
uint32_t len = vsnprintf_P(log_data, sizeof(log_data), formatP, arg);
|
||||
va_end(arg);
|
||||
|
||||
#ifdef DEBUG_TASMOTA_CORE
|
||||
// Profile max_len
|
||||
static uint32_t max_len = 0;
|
||||
if (len > max_len) {
|
||||
max_len = len;
|
||||
Serial.printf("PRF: AddLog_Debug %d\n", max_len);
|
||||
}
|
||||
#endif
|
||||
|
||||
AddLogData(LOG_LEVEL_DEBUG, log_data);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,6 @@
|
|||
#ifndef _TASMOTA_VERSION_H_
|
||||
#define _TASMOTA_VERSION_H_
|
||||
|
||||
const uint32_t VERSION = 0x09020003;
|
||||
const uint32_t VERSION = 0x09020004;
|
||||
|
||||
#endif // _TASMOTA_VERSION_H_
|
||||
|
|
|
@ -184,29 +184,26 @@ bool TimepropCommand()
|
|||
bool serviced = true;
|
||||
uint8_t ua_prefix_len = strlen(D_CMND_TIMEPROP); // to detect prefix of command
|
||||
/*
|
||||
snprintf_P(log_data, sizeof(log_data), "Command called: "
|
||||
"index: %d data_len: %d payload: %d topic: %s data: %s\n",
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("Command called: "
|
||||
"index: %d data_len: %d payload: %d topic: %s data: %s"),
|
||||
XdrvMailbox.index,
|
||||
XdrvMailbox.data_len,
|
||||
XdrvMailbox.payload,
|
||||
(XdrvMailbox.payload >= 0 ? XdrvMailbox.topic : ""),
|
||||
(XdrvMailbox.data_len >= 0 ? XdrvMailbox.data : ""));
|
||||
|
||||
AddLog(LOG_LEVEL_INFO);
|
||||
*/
|
||||
if (0 == strncasecmp_P(XdrvMailbox.topic, PSTR(D_CMND_TIMEPROP), ua_prefix_len)) {
|
||||
// command starts with timeprop_
|
||||
int command_code = GetCommandCode(command, sizeof(command), XdrvMailbox.topic + ua_prefix_len, kTimepropCommands);
|
||||
if (CMND_TIMEPROP_SETPOWER == command_code) {
|
||||
/*
|
||||
snprintf_P(log_data, sizeof(log_data), "Timeprop command timeprop_setpower: "
|
||||
"index: %d data_len: %d payload: %d topic: %s data: %s",
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("Timeprop command timeprop_setpower: "
|
||||
"index: %d data_len: %d payload: %d topic: %s data: %s"),
|
||||
XdrvMailbox.index,
|
||||
XdrvMailbox.data_len,
|
||||
XdrvMailbox.payload,
|
||||
(XdrvMailbox.payload >= 0 ? XdrvMailbox.topic : ""),
|
||||
(XdrvMailbox.data_len >= 0 ? XdrvMailbox.data : ""));
|
||||
AddLog(LOG_LEVEL_INFO);
|
||||
*/
|
||||
if (XdrvMailbox.index >=0 && XdrvMailbox.index < TIMEPROP_NUM_OUTPUTS) {
|
||||
timeprops[XdrvMailbox.index].setPower( atof(XdrvMailbox.data), Tprop.current_time_secs );
|
||||
|
|
Loading…
Reference in New Issue