mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 18:56:38 +00:00
Changed maximum chars in AddLog_P logging
Changed maximum chars in AddLog_P logging reduced from 700 to 128 (LOGSZ) to enhance stability
This commit is contained in:
parent
0ab125853a
commit
2b7d605696
@ -20,6 +20,9 @@ All notable changes to this project will be documented in this file.
|
||||
- Replaced SSD1351 GPIO selection from ``SPI CS`` by ``SSD1351 CS``
|
||||
- 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
|
||||
|
||||
## [9.2.0.1] 20201229
|
||||
### Added
|
||||
- Milliseconds to console output (#10152)
|
||||
|
@ -1321,7 +1321,7 @@ void DumpConvertTable(void) {
|
||||
ResponseAppend_P(PSTR(","));
|
||||
}
|
||||
jsflg = true;
|
||||
if ((ResponseAppend_P(PSTR("\"%d\":\"%d\""), i, data) > (LOGSZ - TOPSZ)) || (i == ARRAY_SIZE(kGpioConvert) -1)) {
|
||||
if ((ResponseAppend_P(PSTR("\"%d\":\"%d\""), i, data) > (MAX_LOGSZ - TOPSZ)) || (i == ARRAY_SIZE(kGpioConvert) -1)) {
|
||||
ResponseJsonEndEnd();
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, XdrvMailbox.command);
|
||||
jsflg = false;
|
||||
@ -1336,7 +1336,7 @@ void DumpConvertTable(void) {
|
||||
ResponseAppend_P(PSTR(","));
|
||||
}
|
||||
jsflg = true;
|
||||
if ((ResponseAppend_P(PSTR("\"%d\":\"%d\""), i, data) > (LOGSZ - TOPSZ)) || (i == ARRAY_SIZE(kAdcNiceList) -1)) {
|
||||
if ((ResponseAppend_P(PSTR("\"%d\":\"%d\""), i, data) > (MAX_LOGSZ - TOPSZ)) || (i == ARRAY_SIZE(kAdcNiceList) -1)) {
|
||||
ResponseJsonEndEnd();
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, XdrvMailbox.command);
|
||||
jsflg = false;
|
||||
@ -2065,7 +2065,7 @@ bool NeedLogRefresh(uint32_t req_loglevel, uint32_t index) {
|
||||
#endif // ESP32
|
||||
|
||||
// Skip initial buffer fill
|
||||
if (strlen(TasmotaGlobal.log_buffer) < LOG_BUFFER_SIZE - LOGSZ) { return false; }
|
||||
if (strlen(TasmotaGlobal.log_buffer) < LOG_BUFFER_SIZE - MAX_LOGSZ) { return false; }
|
||||
|
||||
char* line;
|
||||
size_t len;
|
||||
@ -2172,13 +2172,13 @@ void AddLogData(uint32_t loglevel, const char* log_data) {
|
||||
|
||||
void AddLog_P(uint32_t loglevel, PGM_P formatP, ...)
|
||||
{
|
||||
char log_data[132];
|
||||
char log_data[LOGSZ +4];
|
||||
|
||||
va_list arg;
|
||||
va_start(arg, formatP);
|
||||
uint32_t len = vsnprintf_P(log_data, 129, formatP, arg);
|
||||
uint32_t len = vsnprintf_P(log_data, LOGSZ +1, formatP, arg);
|
||||
va_end(arg);
|
||||
if (len > 128) { strcat(log_data, "..."); } // Actual data is more
|
||||
if (len > LOGSZ) { strcat(log_data, "..."); } // Actual data is more
|
||||
|
||||
#ifdef DEBUG_TASMOTA_CORE
|
||||
// Profile max_len
|
||||
@ -2194,7 +2194,7 @@ void AddLog_P(uint32_t loglevel, PGM_P formatP, ...)
|
||||
|
||||
void AddLog_Debug(PGM_P formatP, ...)
|
||||
{
|
||||
char log_data[LOGSZ];
|
||||
char log_data[MAX_LOGSZ];
|
||||
|
||||
va_list arg;
|
||||
va_start(arg, formatP);
|
||||
|
@ -1124,7 +1124,7 @@ void CmndModules(void)
|
||||
}
|
||||
jsflg = true;
|
||||
uint32_t j = i ? midx +1 : 0;
|
||||
if ((ResponseAppend_P(PSTR("\"%d\":\"%s\""), j, AnyModuleName(midx).c_str()) > (LOGSZ - TOPSZ)) || (i == sizeof(kModuleNiceList))) {
|
||||
if ((ResponseAppend_P(PSTR("\"%d\":\"%s\""), j, AnyModuleName(midx).c_str()) > (MAX_LOGSZ - TOPSZ)) || (i == sizeof(kModuleNiceList))) {
|
||||
ResponseJsonEndEnd();
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, XdrvMailbox.command);
|
||||
jsflg = false;
|
||||
@ -1192,7 +1192,7 @@ void CmndGpio(void)
|
||||
sensor_names = kSensorNamesFixed;
|
||||
}
|
||||
char stemp1[TOPSZ];
|
||||
if ((ResponseAppend_P(PSTR("\"" D_CMND_GPIO "%d\":{\"%d\":\"%s%s\"}"), i, sensor_type, GetTextIndexed(stemp1, sizeof(stemp1), sensor_name_idx, sensor_names), sindex) > (LOGSZ - TOPSZ)) || (i == ARRAY_SIZE(Settings.my_gp.io) -1)) {
|
||||
if ((ResponseAppend_P(PSTR("\"" D_CMND_GPIO "%d\":{\"%d\":\"%s%s\"}"), i, sensor_type, GetTextIndexed(stemp1, sizeof(stemp1), sensor_name_idx, sensor_names), sindex) > (MAX_LOGSZ - TOPSZ)) || (i == ARRAY_SIZE(Settings.my_gp.io) -1)) {
|
||||
ResponseJsonEnd();
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, XdrvMailbox.command);
|
||||
jsflg2 = true;
|
||||
@ -1227,7 +1227,7 @@ void ShowGpios(const uint16_t *NiceList, uint32_t size, uint32_t offset, uint32_
|
||||
}
|
||||
jsflg = true;
|
||||
char stemp1[TOPSZ];
|
||||
if ((ResponseAppend_P(PSTR("\"%d\":\"%s\""), ridx, GetTextIndexed(stemp1, sizeof(stemp1), midx, kSensorNames)) > (LOGSZ - TOPSZ)) || (i == size -1)) {
|
||||
if ((ResponseAppend_P(PSTR("\"%d\":\"%s\""), ridx, GetTextIndexed(stemp1, sizeof(stemp1), midx, kSensorNames)) > (MAX_LOGSZ - TOPSZ)) || (i == size -1)) {
|
||||
ResponseJsonEndEnd();
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, XdrvMailbox.command);
|
||||
jsflg = false;
|
||||
|
@ -135,7 +135,8 @@ const uint16_t INPUT_BUFFER_SIZE = 520; // Max number of characters in seria
|
||||
const uint16_t FLOATSZ = 16; // Max number of characters in float result from dtostrfd (max 32)
|
||||
const uint16_t CMDSZ = 24; // Max number of characters in command
|
||||
const uint16_t TOPSZ = 151; // Max number of characters in topic string
|
||||
const uint16_t LOGSZ = 700; // Max number of characters in log
|
||||
const uint16_t LOGSZ = 128; // Max number of characters in AddLog_P log
|
||||
const uint16_t MAX_LOGSZ = 700; // Max number of characters in log
|
||||
const uint16_t MIN_MESSZ = 1040; // Min number of characters in MQTT message (1200 - TOPSZ - 9 header bytes)
|
||||
|
||||
const uint8_t SENSOR_MAX_MISS = 5; // Max number of missed sensor reads before deciding it's offline
|
||||
|
@ -1927,7 +1927,7 @@ void OtherSaveSettings(void)
|
||||
char tmp[300]; // Needs to hold complete ESP32 template of minimal 230 chars
|
||||
char webindex[5];
|
||||
char friendlyname[TOPSZ];
|
||||
char message[LOGSZ];
|
||||
char message[MAX_LOGSZ];
|
||||
|
||||
WebGetArg("dn", tmp, sizeof(tmp));
|
||||
SettingsUpdateText(SET_DEVICENAME, (!strlen(tmp)) ? "" : (!strcmp(tmp,"1")) ? SettingsText(SET_FRIENDLYNAME1) : tmp);
|
||||
|
@ -321,7 +321,7 @@ void MqttPublish(const char* topic, bool retained) {
|
||||
}
|
||||
}
|
||||
|
||||
char log_data[LOGSZ];
|
||||
char log_data[MAX_LOGSZ];
|
||||
snprintf_P(log_data, sizeof(log_data), PSTR("%s%s = %s"), slog_type, (Settings.flag.mqtt_enabled) ? topic : strrchr(topic,'/')+1, TasmotaGlobal.mqtt_data); // SetOption3 - Enable MQTT
|
||||
if (strlen(log_data) >= (sizeof(log_data) - strlen(sretained) -1)) {
|
||||
log_data[sizeof(log_data) - strlen(sretained) -5] = '\0';
|
||||
|
@ -3696,7 +3696,7 @@ void toLogN(const char *cp, uint8_t len) {
|
||||
void toLogEOL(const char *s1,const char *str) {
|
||||
if (!str) return;
|
||||
uint8_t index = 0;
|
||||
char log_data[LOGSZ];
|
||||
char log_data[MAX_LOGSZ];
|
||||
char *cp = log_data;
|
||||
strcpy(cp, s1);
|
||||
cp += strlen(s1);
|
||||
@ -5768,7 +5768,7 @@ void Script_Check_Hue(String *response) {
|
||||
Script_AddLog_P(LOG_LEVEL_DEBUG, PSTR("Hue: %d"), hue_devs);
|
||||
toLog(">>>>");
|
||||
toLog(response->c_str());
|
||||
toLog(response->c_str()+LOGSZ);
|
||||
toLog(response->c_str()+MAX_LOGSZ);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -370,7 +370,7 @@ void TryResponseAppend_P(const char *format, ...)
|
||||
{
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR("%s (%u/%u):"), kHAssError1, dlen, slen);
|
||||
va_start(args, format);
|
||||
char log_data[LOGSZ];
|
||||
char log_data[MAX_LOGSZ];
|
||||
vsnprintf_P(log_data, sizeof(log_data), format, args);
|
||||
AddLogData(LOG_LEVEL_ERROR, log_data);
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ void TuyaSendCmd(uint8_t cmd, uint8_t payload[] = nullptr, uint16_t payload_len
|
||||
TuyaSerial->write(cmd); // Tuya command
|
||||
TuyaSerial->write(payload_len >> 8); // following data length (Hi)
|
||||
TuyaSerial->write(payload_len & 0xFF); // following data length (Lo)
|
||||
char log_data[LOGSZ];
|
||||
char log_data[MAX_LOGSZ];
|
||||
snprintf_P(log_data, sizeof(log_data), PSTR("TYA: Send \"55aa00%02x%02x%02x"), cmd, payload_len >> 8, payload_len & 0xFF);
|
||||
for (uint32_t i = 0; i < payload_len; ++i) {
|
||||
TuyaSerial->write(payload[i]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user