Effort to get rid of PrepLog_P

Effort to get rid of PrepLog_P now syslog and mqttlog are async
This commit is contained in:
Theo Arends 2020-12-18 16:49:11 +01:00
parent 2eb4eef08c
commit bafcee4b05
7 changed files with 13 additions and 11 deletions

View File

@ -2012,9 +2012,9 @@ void AddLog(uint32_t loglevel) {
TasmotaGlobal.log_buffer_pointer++; // Index 0 is not allowed as it is the end of char string
}
}
TasmotaGlobal.prepped_loglevel = 0;
// TasmotaGlobal.prepped_loglevel = 0;
}
/*
void PrepLog_P(uint32_t loglevel, PGM_P formatP, ...)
{
va_list arg;
@ -2024,13 +2024,14 @@ void PrepLog_P(uint32_t loglevel, PGM_P formatP, ...)
TasmotaGlobal.prepped_loglevel = loglevel;
}
*/
void AddLog_P(uint32_t loglevel, PGM_P formatP, ...)
{
/*
if (TasmotaGlobal.prepped_loglevel) {
AddLog(TasmotaGlobal.prepped_loglevel);
}
*/
va_list arg;
va_start(arg, formatP);
vsnprintf_P(TasmotaGlobal.log_data, sizeof(TasmotaGlobal.log_data), formatP, arg);

View File

@ -897,10 +897,11 @@ void Every100mSeconds(void)
// As the max amount of sleep = 250 mSec this loop will shift in time...
power_t power_now;
/*
if (TasmotaGlobal.prepped_loglevel) {
AddLog(TasmotaGlobal.prepped_loglevel);
}
*/
if (TasmotaGlobal.latching_relay_pulse) {
TasmotaGlobal.latching_relay_pulse--;
if (!TasmotaGlobal.latching_relay_pulse) SetLatchingRelay(0, 0);

View File

@ -153,7 +153,7 @@ struct {
uint8_t module_type; // Current copy of Settings.module or user template type
uint8_t last_source; // Last command source
uint8_t shutters_present; // Number of actual define shutters
uint8_t prepped_loglevel; // Delayed log level message
// uint8_t prepped_loglevel; // Delayed log level message
#ifndef SUPPORT_IF_STATEMENT
uint8_t backlog_index; // Command backlog index

View File

@ -104,7 +104,7 @@ void HueRespondToMSearch(void)
snprintf_P(message, sizeof(message), PSTR(D_FAILED_TO_SEND_RESPONSE));
}
// Do not use AddLog_P( here (interrupt routine) if syslog or mqttlog is enabled. UDP/TCP will force exception 9
PrepLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_HUE " %s " D_TO " %s:%d"),
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_HUE " %s " D_TO " %s:%d"),
message, udp_remote_ip.toString().c_str(), udp_remote_port);
udp_response_mutex = false;

View File

@ -75,7 +75,7 @@ void WemoRespondToMSearch(int echo_type)
snprintf_P(message, sizeof(message), PSTR(D_FAILED_TO_SEND_RESPONSE));
}
// Do not use AddLog_P( here (interrupt routine) if syslog or mqttlog is enabled. UDP/TCP will force exception 9
PrepLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_WEMO " " D_JSON_TYPE " %d, %s " D_TO " %s:%d"),
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_WEMO " " D_JSON_TYPE " %d, %s " D_TO " %s:%d"),
echo_type, message, udp_remote_ip.toString().c_str(), udp_remote_port);
udp_response_mutex = false;

View File

@ -297,8 +297,8 @@ public:
snprintf_P(message, sizeof(message), PSTR(D_FAILED_TO_SEND_RESPONSE));
}
// Do not use AddLog_P here (interrupt routine) if syslog or mqttlog is enabled. UDP/TCP will force exception 9
PrepLog_P(LOG_LEVEL_DEBUG, PSTR("WMO: WeMo Type %d, %s to %s:%d"),
echo_type, message, udp_remote_ip.toString().c_str(), udp_remote_port);
AddLog_P(LOG_LEVEL_DEBUG, PSTR("WMO: WeMo Type %d, %s to %s:%d"),
echo_type, message, udp_remote_ip.toString().c_str(), udp_remote_port);
}
void HandleServerLoop() {

View File

@ -52,7 +52,7 @@ bool DhtWaitState(uint32_t sensor, uint32_t level)
unsigned long timeout = micros() + 100;
while (digitalRead(Dht[sensor].pin) != level) {
if (TimeReachedUsec(timeout)) {
PrepLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DHT D_TIMEOUT_WAITING_FOR " %s " D_PULSE),
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DHT D_TIMEOUT_WAITING_FOR " %s " D_PULSE),
(level) ? D_START_SIGNAL_HIGH : D_START_SIGNAL_LOW);
return false;
}