From bafcee4b0580f16929f68e42d4e58ef1e555151a Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 18 Dec 2020 16:49:11 +0100 Subject: [PATCH] Effort to get rid of PrepLog_P Effort to get rid of PrepLog_P now syslog and mqttlog are async --- tasmota/support.ino | 9 +++++---- tasmota/support_tasmota.ino | 3 ++- tasmota/tasmota.ino | 2 +- tasmota/xdrv_20_hue.ino | 2 +- tasmota/xdrv_21_wemo.ino | 2 +- tasmota/xdrv_21_wemo_multi.ino | 4 ++-- tasmota/xsns_06_dht.ino | 2 +- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/tasmota/support.ino b/tasmota/support.ino index 2905adb6e..a5f18ce59 100644 --- a/tasmota/support.ino +++ b/tasmota/support.ino @@ -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); diff --git a/tasmota/support_tasmota.ino b/tasmota/support_tasmota.ino index 47ac7f3ea..38a8f2547 100644 --- a/tasmota/support_tasmota.ino +++ b/tasmota/support_tasmota.ino @@ -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); diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index 6191c0f6a..2cb0eebd1 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -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 diff --git a/tasmota/xdrv_20_hue.ino b/tasmota/xdrv_20_hue.ino index 5673da526..87557c997 100644 --- a/tasmota/xdrv_20_hue.ino +++ b/tasmota/xdrv_20_hue.ino @@ -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; diff --git a/tasmota/xdrv_21_wemo.ino b/tasmota/xdrv_21_wemo.ino index 6ffb7cd3c..af5d7f176 100644 --- a/tasmota/xdrv_21_wemo.ino +++ b/tasmota/xdrv_21_wemo.ino @@ -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; diff --git a/tasmota/xdrv_21_wemo_multi.ino b/tasmota/xdrv_21_wemo_multi.ino index 01b6d8cac..de8834070 100644 --- a/tasmota/xdrv_21_wemo_multi.ino +++ b/tasmota/xdrv_21_wemo_multi.ino @@ -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() { diff --git a/tasmota/xsns_06_dht.ino b/tasmota/xsns_06_dht.ino index 2fa5ab9bc..a6a584db8 100644 --- a/tasmota/xsns_06_dht.ino +++ b/tasmota/xsns_06_dht.ino @@ -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; }