From 44e3a29810b3e37d50114d7495631ece6bd4de56 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 23 Jan 2021 17:24:54 +0100 Subject: [PATCH] Refactor AddLog usage --- tasmota/sendemail.ino | 16 ++++++------- tasmota/xdrv_04_light.ino | 22 ++++++++--------- tasmota/xdrv_05_irremote.ino | 4 ++-- tasmota/xdrv_05_irremote_full.ino | 14 +++++------ tasmota/xdrv_06_snfbridge.ino | 2 +- tasmota/xdrv_10_rules.ino | 10 ++++---- tasmota/xdrv_11_knx.ino | 40 +++++++++++++++---------------- tasmota/xdrv_19_ps16dz_dimmer.ino | 12 +++++----- tasmota/xdrv_20_hue.ino | 3 +-- tasmota/xdrv_21_wemo.ino | 1 - tasmota/xdrv_44_miel_hvac.ino | 12 +++++----- tasmota/xsns_01_counter.ino | 2 +- 12 files changed, 68 insertions(+), 70 deletions(-) diff --git a/tasmota/sendemail.ino b/tasmota/sendemail.ino index 788a52a5c..cd7f849ce 100644 --- a/tasmota/sendemail.ino +++ b/tasmota/sendemail.ino @@ -80,7 +80,7 @@ uint16_t SendMail(char *buffer) { cmd=endcmd+1; #ifdef DEBUG_EMAIL_PORT - AddLog_P(LOG_LEVEL_INFO, PSTR("mailsize: %d"),blen); + AddLog(LOG_LEVEL_INFO, PSTR("mailsize: %d"),blen); #endif mserv=strtok(params,":"); @@ -148,7 +148,7 @@ uint16_t SendMail(char *buffer) { #ifdef DEBUG_EMAIL_PORT - AddLog_P(LOG_LEVEL_INFO, PSTR("%s - %d - %s - %s"),mserv,port,user,passwd); + AddLog(LOG_LEVEL_INFO, PSTR("%s - %d - %s - %s"),mserv,port,user,passwd); #endif // 2 seconds timeout @@ -216,12 +216,12 @@ String buffer; client->setTimeout(timeout); // smtp connect #ifdef DEBUG_EMAIL_PORT - AddLog_P(LOG_LEVEL_INFO, PSTR("Connecting: %s on port %d"),host.c_str(),port); + AddLog(LOG_LEVEL_INFO, PSTR("Connecting: %s on port %d"),host.c_str(),port); #endif if (!client->connect(host.c_str(), port)) { #ifdef DEBUG_EMAIL_PORT - AddLog_P(LOG_LEVEL_INFO, PSTR("Connection failed")); + AddLog(LOG_LEVEL_INFO, PSTR("Connection failed")); #endif goto exit; } @@ -458,7 +458,7 @@ void attach_Array(char *aname) { g_client->print(F("Content-Type: text/plain\r\n")); if (array && alen) { #ifdef DEBUG_EMAIL_PORT - AddLog_P(LOG_LEVEL_INFO, PSTR("array found %d"),alen); + AddLog(LOG_LEVEL_INFO, PSTR("array found %d"),alen); #endif char buff[64]; sprintf_P(buff,PSTR("Content-Disposition: attachment; filename=\"%s.txt\"\r\n\r\n"), aname); @@ -545,7 +545,7 @@ uint16_t SendMail(char *buffer) { // return if not enough memory uint32_t mem=ESP.getFreeHeap(); - //AddLog_P(LOG_LEVEL_INFO, PSTR("heap: %d"),mem); + //AddLog(LOG_LEVEL_INFO, PSTR("heap: %d"),mem); if (mem>> calcGammaBulbs In %03X,%03X,%03X,%03X,%03X"), cur_col_10[0], cur_col_10[1], cur_col_10[2], cur_col_10[3], cur_col_10[4]); + // AddLog(LOG_LEVEL_INFO, PSTR(">>> calcGammaBulbs In %03X,%03X,%03X,%03X,%03X"), cur_col_10[0], cur_col_10[1], cur_col_10[2], cur_col_10[3], cur_col_10[4]); rgbwwtable_applied_white = calcGammaBulbs(cur_col_10); // true means that one PWM channel is used for CT - // AddLog_P(LOG_LEVEL_INFO, PSTR(">>> calcGammaBulbs Out %03X,%03X,%03X,%03X,%03X"), cur_col_10[0], cur_col_10[1], cur_col_10[2], cur_col_10[3], cur_col_10[4]); + // AddLog(LOG_LEVEL_INFO, PSTR(">>> calcGammaBulbs Out %03X,%03X,%03X,%03X,%03X"), cur_col_10[0], cur_col_10[1], cur_col_10[2], cur_col_10[3], cur_col_10[4]); } // Apply RGBWWTable only if not Settings.flag4.white_blend_mode @@ -1768,7 +1768,7 @@ void LightAnimate(void) } if (Light.fade_running) { if (LightApplyFade()) { - // AddLog_P(LOG_LEVEL_INFO, PSTR("LightApplyFade %d %d %d %d %d"), + // AddLog(LOG_LEVEL_INFO, PSTR("LightApplyFade %d %d %d %d %d"), // Light.fade_cur_10[0], Light.fade_cur_10[1], Light.fade_cur_10[2], Light.fade_cur_10[3], Light.fade_cur_10[4]); LightSetOutputs(Light.fade_cur_10); @@ -1854,7 +1854,7 @@ bool LightApplyFade(void) { // did the value chanegd and needs to be applied if (Settings.save_data) { // Also postpone the save_data for the duration of the Fade (in seconds) uint32_t delay_seconds = 1 + (Light.fade_duration + 999) / 1000; // add one more second - // AddLog_P(LOG_LEVEL_INFO, PSTR("delay_seconds %d, save_data_counter %d"), delay_seconds, TasmotaGlobal.save_data_counter); + // AddLog(LOG_LEVEL_INFO, PSTR("delay_seconds %d, save_data_counter %d"), delay_seconds, TasmotaGlobal.save_data_counter); if (TasmotaGlobal.save_data_counter < delay_seconds) { TasmotaGlobal.save_data_counter = delay_seconds; // pospone } @@ -1904,7 +1904,7 @@ void LightApplyPower(uint8_t new_color[LST_MAX], power_t power) { } } // #ifdef DEBUG_LIGHT - // AddLog_P(LOG_LEVEL_DEBUG_MORE, "Animate>> Light.power=%d Light.new_color=[%d,%d,%d,%d,%d]", + // AddLog(LOG_LEVEL_DEBUG_MORE, "Animate>> Light.power=%d Light.new_color=[%d,%d,%d,%d,%d]", // Light.power, Light.new_color[0], Light.new_color[1], Light.new_color[2], // Light.new_color[3], Light.new_color[4]); // #endif @@ -1930,7 +1930,7 @@ void LightSetOutputs(const uint16_t *cur_col_10) { if (TasmotaGlobal.light_type < LT_PWM6) { // only for direct PWM lights, not for Tuya, Armtronix... for (uint32_t i = 0; i < (Light.subtype - Light.pwm_offset); i++) { if (PinUsed(GPIO_PWM1, i)) { - //AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "Cur_Col%d 10 bits %d"), i, cur_col_10[i]); + //AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "Cur_Col%d 10 bits %d"), i, cur_col_10[i]); uint16_t cur_col = cur_col_10[i + Light.pwm_offset]; if (!isChannelCT(i)) { // if CT don't use pwm_min and pwm_max cur_col = cur_col > 0 ? changeUIntScale(cur_col, 0, Settings.pwm_range, Light.pwm_min, Light.pwm_max) : 0; // shrink to the range of pwm_min..pwm_max @@ -1942,7 +1942,7 @@ void LightSetOutputs(const uint16_t *cur_col_10) { } } // char msg[24]; -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("LGT: Channels %s"), ToHex_P((const unsigned char *)cur_col_10, 10, msg, sizeof(msg))); +// AddLog(LOG_LEVEL_DEBUG, PSTR("LGT: Channels %s"), ToHex_P((const unsigned char *)cur_col_10, 10, msg, sizeof(msg))); // Some devices need scaled RGB like Sonoff L1 uint32_t max = (cur_col_10[0] > cur_col_10[1] && cur_col_10[0] > cur_col_10[2]) ? cur_col_10[0] : (cur_col_10[1] > cur_col_10[2]) ? cur_col_10[1] : cur_col_10[2]; // 0..1023 @@ -1950,7 +1950,7 @@ void LightSetOutputs(const uint16_t *cur_col_10) { for (uint32_t i = 0; i < 3; i++) { scale_col[i] = (0 == max) ? 255 : changeUIntScale(cur_col_10[i], 0, max, 0, 255); } -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("LGT: CurCol %03X %03X %03X, ScaleCol %02X %02X %02X, Max %02X"), +// AddLog(LOG_LEVEL_DEBUG, PSTR("LGT: CurCol %03X %03X %03X, ScaleCol %02X %02X %02X, Max %02X"), // cur_col_10[0], cur_col_10[1], cur_col_10[2], scale_col[0], scale_col[1], scale_col[2], max); uint8_t cur_col[LST_MAX]; @@ -2110,10 +2110,10 @@ bool calcGammaBulbs(uint16_t cur_col_10[5]) { calcGammaBulb5Channels_8(*(pivot+1), to10); vct_pivot_t *pivot1 = pivot + 1; - // AddLog_P(LOG_LEVEL_INFO, PSTR("+++ from_ct %d, to_ct %d [%03X,%03X,%03X,%03X,%03X] - [%03X,%03X,%03X,%03X,%03X]"), + // AddLog(LOG_LEVEL_INFO, PSTR("+++ from_ct %d, to_ct %d [%03X,%03X,%03X,%03X,%03X] - [%03X,%03X,%03X,%03X,%03X]"), // *from_ct, *(from_ct+1), (*pivot)[0], (*pivot)[1], (*pivot)[2], (*pivot)[3], (*pivot)[4], // (*pivot1)[0], (*pivot1)[1], (*pivot1)[2], (*pivot1)[3], (*pivot1)[4]); - // AddLog_P(LOG_LEVEL_INFO, PSTR("+++ from10 [%03X,%03X,%03X,%03X,%03X] - to 10 [%03X,%03X,%03X,%03X,%03X]"), + // AddLog(LOG_LEVEL_INFO, PSTR("+++ from10 [%03X,%03X,%03X,%03X,%03X] - to 10 [%03X,%03X,%03X,%03X,%03X]"), // from10[0],from10[0],from10[0],from10[0],from10[4], // to10[0],to10[0],to10[0],to10[0],to10[4]); diff --git a/tasmota/xdrv_05_irremote.ino b/tasmota/xdrv_05_irremote.ino index 378405925..66760f865 100644 --- a/tasmota/xdrv_05_irremote.ino +++ b/tasmota/xdrv_05_irremote.ino @@ -161,7 +161,7 @@ void IrReceiveInit(void) irrecv->setUnknownThreshold(Settings.param[P_IR_UNKNOW_THRESHOLD]); irrecv->enableIRIn(); // Start the receiver - // AddLog_P(LOG_LEVEL_DEBUG, PSTR("IrReceive initialized")); + // AddLog(LOG_LEVEL_DEBUG, PSTR("IrReceive initialized")); } void IrReceiveCheck(void) @@ -293,7 +293,7 @@ uint32_t IrRemoteCmndIrSendJson(void) char dvalue[64]; char hvalue[20]; - AddLog_P(LOG_LEVEL_DEBUG, PSTR("IRS: protocol_text %s, protocol %s, bits %d, data %s (0x%s), repeat %d, protocol_code %d"), + AddLog(LOG_LEVEL_DEBUG, PSTR("IRS: protocol_text %s, protocol %s, bits %d, data %s (0x%s), repeat %d, protocol_code %d"), protocol_text, protocol, bits, ulltoa(data, dvalue, 10), Uint64toHex(data, hvalue, bits), repeat, protocol_code); #ifdef USE_IR_RECEIVE diff --git a/tasmota/xdrv_05_irremote_full.ino b/tasmota/xdrv_05_irremote_full.ino index bed0e8199..745529e3d 100644 --- a/tasmota/xdrv_05_irremote_full.ino +++ b/tasmota/xdrv_05_irremote_full.ino @@ -446,7 +446,7 @@ uint32_t IrRemoteCmndIrHvacJson(void) if (val = root[PSTR(D_JSON_IRHVAC_SWINGV)]) { state.swingv = IRac::strToSwingV(val.getStr()); } if (val = root[PSTR(D_JSON_IRHVAC_SWINGH)]) { state.swingh = IRac::strToSwingH(val.getStr()); } state.degrees = root.getFloat(PSTR(D_JSON_IRHVAC_TEMP), state.degrees); - // AddLog_P(LOG_LEVEL_DEBUG, PSTR("model %d, mode %d, fanspeed %d, swingv %d, swingh %d"), + // AddLog(LOG_LEVEL_DEBUG, PSTR("model %d, mode %d, fanspeed %d, swingv %d, swingh %d"), // state.model, state.mode, state.fanspeed, state.swingv, state.swingh); // if and how we should handle the state for IRremote @@ -532,7 +532,7 @@ uint32_t IrRemoteCmndIrSendJson(void) char dvalue[32]; char hvalue[32]; - // AddLog_P(LOG_LEVEL_DEBUG, PSTR("IRS: protocol %d, bits %d, data 0x%s (%s), repeat %d"), + // AddLog(LOG_LEVEL_DEBUG, PSTR("IRS: protocol %d, bits %d, data 0x%s (%s), repeat %d"), // protocol, bits, ulltoa(data, dvalue, 10), Uint64toHex(data, hvalue, bits), repeat); if (!IR_RCV_WHILE_SENDING && (irrecv != nullptr)) { irrecv->disableIRIn(); } @@ -617,7 +617,7 @@ uint32_t IrRemoteSendRawFormatted(char ** pp, uint32_t count, uint32_t repeat) { } if (!IR_RCV_WHILE_SENDING && (irrecv != nullptr)) { irrecv->disableIRIn(); } for (uint32_t r = 0; r <= repeat; r++) { - // AddLog_P(LOG_LEVEL_DEBUG, PSTR("sendRaw count=%d, space=%d, mark=%d, freq=%d"), count, space, mark, freq); + // AddLog(LOG_LEVEL_DEBUG, PSTR("sendRaw count=%d, space=%d, mark=%d, freq=%d"), count, space, mark, freq); irsend->sendRaw(raw_array, i, freq); if (r < repeat) { // if it's not the last message irsend->space(40000); // since we don't know the inter-message gap, place an arbitrary 40ms gap @@ -644,7 +644,7 @@ uint32_t IrRemoteSendRawFormatted(char ** pp, uint32_t count, uint32_t repeat) { raw_array[i++] = parm[2]; // Trailing mark if (!IR_RCV_WHILE_SENDING && (irrecv != nullptr)) { irrecv->disableIRIn(); } for (uint32_t r = 0; r <= repeat; r++) { - // AddLog_P(LOG_LEVEL_DEBUG, PSTR("sendRaw %d %d %d %d %d %d"), raw_array[0], raw_array[1], raw_array[2], raw_array[3], raw_array[4], raw_array[5]); + // AddLog(LOG_LEVEL_DEBUG, PSTR("sendRaw %d %d %d %d %d %d"), raw_array[0], raw_array[1], raw_array[2], raw_array[3], raw_array[4], raw_array[5]); irsend->sendRaw(raw_array, i, freq); if (r < repeat) { // if it's not the last message irsend->space(inter_message); // since we don't know the inter-message gap, place an arbitrary 40ms gap @@ -710,13 +710,13 @@ uint32_t IrRemoteSendRawStandard(char ** pp, uint16_t freq, uint32_t count, uint } else { count++; } - // AddLog_P(LOG_LEVEL_DEBUG, PSTR("IrRemoteSendRawStandard: count_1 = %d"), count); + // AddLog(LOG_LEVEL_DEBUG, PSTR("IrRemoteSendRawStandard: count_1 = %d"), count); arr = (uint16_t*) malloc(count * sizeof(uint16_t)); if (nullptr == arr) { return IE_MEMORY; } count = IrRemoteParseRawCompact(*pp, arr, count); - // AddLog_P(LOG_LEVEL_DEBUG, PSTR("IrRemoteSendRawStandard: count_2 = %d"), count); - // AddLog_P(LOG_LEVEL_DEBUG, PSTR("Arr %d %d %d %d %d %d %d %d"), arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], arr[7]); + // AddLog(LOG_LEVEL_DEBUG, PSTR("IrRemoteSendRawStandard: count_2 = %d"), count); + // AddLog(LOG_LEVEL_DEBUG, PSTR("Arr %d %d %d %d %d %d %d %d"), arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], arr[7]); if (0 == count) { return IE_INVALID_RAWDATA; } if (!IR_RCV_WHILE_SENDING && (irrecv != nullptr)) { irrecv->disableIRIn(); } diff --git a/tasmota/xdrv_06_snfbridge.ino b/tasmota/xdrv_06_snfbridge.ino index bb77d64c2..405e5e74b 100644 --- a/tasmota/xdrv_06_snfbridge.ino +++ b/tasmota/xdrv_06_snfbridge.ino @@ -147,7 +147,7 @@ uint32_t SnfBrUpdateFirmware(uint8_t* data, uint32_t size) { uint32_t error = rf_erase_flash(); // 10, 11 if (error) { return error; } -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("RFB: Erased")); +// AddLog(LOG_LEVEL_DEBUG, PSTR("RFB: Erased")); return rf_search_and_write(data, size); } diff --git a/tasmota/xdrv_10_rules.ino b/tasmota/xdrv_10_rules.ino index 59b5c7252..80bdd95df 100644 --- a/tasmota/xdrv_10_rules.ino +++ b/tasmota/xdrv_10_rules.ino @@ -388,8 +388,8 @@ int32_t SetRule(uint32_t idx, const char *content, bool append = false) { memcpy(&Settings.rules[idx][2], buf_out, len_compressed); Settings.rules[idx][len_compressed + 2] = 0; // add NULL termination AddLog(LOG_LEVEL_INFO, PSTR("RUL: Compressed from %d to %d (-%d%%)"), len_in, len_compressed, 100 - changeUIntScale(len_compressed, 0, len_in, 0, 100)); - // AddLog_P(LOG_LEVEL_INFO, PSTR("RUL: First bytes: %02X%02X%02X%02X"), Settings.rules[idx][0], Settings.rules[idx][1], Settings.rules[idx][2], Settings.rules[idx][3]); - // AddLog_P(LOG_LEVEL_INFO, PSTR("RUL: GetRuleLenStorage = %d"), GetRuleLenStorage(idx)); + // AddLog(LOG_LEVEL_INFO, PSTR("RUL: First bytes: %02X%02X%02X%02X"), Settings.rules[idx][0], Settings.rules[idx][1], Settings.rules[idx][2], Settings.rules[idx][3]); + // AddLog(LOG_LEVEL_INFO, PSTR("RUL: GetRuleLenStorage = %d"), GetRuleLenStorage(idx)); } else { len_compressed = -1; // failed // clear rule cache, so it will be reloaded from Settings @@ -513,7 +513,7 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule, bool stop_all JsonParserObject obj = parser.getRootObject(); if (!obj) { // AddLog_P(LOG_LEVEL_DEBUG, PSTR("RUL: Event too long (%d)"), event.length()); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("RUL: No valid JSON (%s)"), buf.c_str()); + AddLog(LOG_LEVEL_DEBUG, PSTR("RUL: No valid JSON (%s)"), buf.c_str()); return false; // No valid JSON data } String subtype; @@ -770,7 +770,7 @@ bool RuleSetProcess(uint8_t rule_set, String &event_saved) char command[commands.length() +1]; strlcpy(command, commands.c_str(), sizeof(command)); - AddLog_P(LOG_LEVEL_INFO, PSTR("RUL: %s performs \"%s\""), event_trigger.c_str(), command); + AddLog(LOG_LEVEL_INFO, PSTR("RUL: %s performs \"%s\""), event_trigger.c_str(), command); // Response_P(S_JSON_COMMAND_SVALUE, D_CMND_RULE, D_JSON_INITIATED); // MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR(D_CMND_RULE)); @@ -2123,7 +2123,7 @@ void CmndRule(void) } else { last_index = rule_len; // until the end of the rule } - AddLog_P(LOG_LEVEL_INFO, PSTR("RUL: Rule%d %s%s"), + AddLog(LOG_LEVEL_INFO, PSTR("RUL: Rule%d %s%s"), index, 0 == start_index ? PSTR("") : PSTR("+"), rule.substring(start_index, last_index).c_str()); start_index = last_index + 1; diff --git a/tasmota/xdrv_11_knx.ino b/tasmota/xdrv_11_knx.ino index 0a8442e3b..a474d058f 100644 --- a/tasmota/xdrv_11_knx.ino +++ b/tasmota/xdrv_11_knx.ino @@ -255,7 +255,7 @@ void KNX_ADD_GA( uint8_t GAop, uint8_t GA_FNUM, uint8_t GA_AREA, uint8_t GA_FDEF Settings.knx_GA_registered++; - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_ADD " GA #%d: %s " D_TO " %d/%d/%d"), + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_ADD " GA #%d: %s " D_TO " %d/%d/%d"), Settings.knx_GA_registered, device_param_ga[GAop-1], GA_FNUM, GA_AREA, GA_FDEF ); @@ -304,7 +304,7 @@ void KNX_DEL_GA( uint8_t GAnum ) Settings.knx_GA_registered--; - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_DELETE " GA #%d"), + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_DELETE " GA #%d"), GAnum ); } @@ -336,7 +336,7 @@ void KNX_ADD_CB( uint8_t CBop, uint8_t CB_FNUM, uint8_t CB_AREA, uint8_t CB_FDEF Settings.knx_CB_registered++; - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_ADD " CB #%d: %d/%d/%d " D_TO " %s"), + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_ADD " CB #%d: %d/%d/%d " D_TO " %s"), Settings.knx_CB_registered, CB_FNUM, CB_AREA, CB_FDEF, device_param_cb[CBop-1] ); @@ -392,7 +392,7 @@ void KNX_DEL_CB( uint8_t CBnum ) device_param[oldparam-1].CB_id = KNX_Empty; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_DELETE " CB #%d"), CBnum ); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_DELETE " CB #%d"), CBnum ); } @@ -449,7 +449,7 @@ bool KNX_CONFIG_NOT_MATCH(void) void KNXStart(void) { knx.start(nullptr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_START)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_START)); } @@ -522,7 +522,7 @@ void KNX_INIT(void) if (KNX_CONFIG_NOT_MATCH()) { Settings.knx_GA_registered = 0; Settings.knx_CB_registered = 0; - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_DELETE " " D_KNX_PARAMETERS)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_DELETE " " D_KNX_PARAMETERS)); } // Register Group Addresses to listen to @@ -564,7 +564,7 @@ void KNX_CB_Action(message_t const &msg, void *arg) float tempvar = knx.data_to_4byte_float(msg.data); dtostrfd(tempvar,2,tempchar); } - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_KNX D_RECEIVED_FROM " %d.%d.%d " D_COMMAND " %s: %s " D_TO " %s"), + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_KNX D_RECEIVED_FROM " %d.%d.%d " D_COMMAND " %s: %s " D_TO " %s"), msg.received_on.ga.area, msg.received_on.ga.line, msg.received_on.ga.member, (msg.ct == KNX_CT_WRITE) ? D_KNX_COMMAND_WRITE : (msg.ct == KNX_CT_READ) ? D_KNX_COMMAND_READ : D_KNX_COMMAND_OTHER, tempchar, @@ -748,7 +748,7 @@ void KnxUpdatePowerState(uint8_t device, power_t state) knx.write_1bit(KNX_addr, device_param[device -1].last_state); } - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"), + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"), device_param_ga[device -1], device_param[device -1].last_state, KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member); @@ -782,7 +782,7 @@ void KnxSendButtonPower(void) knx.write_1bit(KNX_addr, !(state == 0)); } - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"), + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"), device_param_ga[device + 7], !(state == 0), KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member); @@ -813,7 +813,7 @@ void KnxSensor(uint8_t sensor_type, float value) knx.write_4byte_float(KNX_addr, value); } - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s " D_SENT_TO " %d.%d.%d "), + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s " D_SENT_TO " %d.%d.%d "), device_param_ga[sensor_type -1], KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member); @@ -886,7 +886,7 @@ void HandleKNXConfiguration(void) { if (!HttpCheckPriviledgedAccess()) { return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_KNX)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_KNX)); char tmp[100]; String stmp; @@ -1038,7 +1038,7 @@ void KNX_Save_Settings(void) Settings.flag.knx_enabled = Webserver->hasArg("b1"); Settings.flag.knx_enable_enhancement = Webserver->hasArg("b2"); - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_ENABLED ": %d, " D_KNX_ENHANCEMENT ": %d"), + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_ENABLED ": %d, " D_KNX_ENHANCEMENT ": %d"), Settings.flag.knx_enabled, Settings.flag.knx_enable_enhancement ); stmp = Webserver->arg("area"); @@ -1049,26 +1049,26 @@ void KNX_Save_Settings(void) KNX_addr.pa.member = stmp.toInt(); Settings.knx_physsical_addr = KNX_addr.value; knx.physical_address_set( KNX_addr ); // Set Physical KNX Address of the device - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_KNX_PHYSICAL_ADDRESS ": %d.%d.%d "), + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_KNX_PHYSICAL_ADDRESS ": %d.%d.%d "), KNX_addr.pa.area, KNX_addr.pa.line, KNX_addr.pa.member ); - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX "GA: %d"), + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX "GA: %d"), Settings.knx_GA_registered ); for (uint32_t i = 0; i < Settings.knx_GA_registered ; ++i) { KNX_addr.value = Settings.knx_GA_addr[i]; - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX "GA #%d: %s " D_TO " %d/%d/%d"), + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX "GA #%d: %s " D_TO " %d/%d/%d"), i+1, device_param_ga[Settings.knx_GA_param[i]-1], KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member ); } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX "CB: %d"), + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX "CB: %d"), Settings.knx_CB_registered ); for (uint32_t i = 0; i < Settings.knx_CB_registered ; ++i) { KNX_addr.value = Settings.knx_CB_addr[i]; - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX "CB #%d: %d/%d/%d " D_TO " %s"), + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX "CB #%d: %d/%d/%d " D_TO " %s"), i+1, KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member, device_param_cb[Settings.knx_CB_param[i]-1] ); @@ -1097,7 +1097,7 @@ void CmndKnxTxCmnd(void) knx.write_1bit(KNX_addr, !(XdrvMailbox.payload == 0)); } - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"), + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"), device_param_ga[XdrvMailbox.index + KNX_SLOT1 -2], !(XdrvMailbox.payload == 0), KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member); @@ -1126,7 +1126,7 @@ void CmndKnxTxVal(void) knx.write_4byte_float(KNX_addr, tempvar); } - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %s " D_SENT_TO " %d.%d.%d"), + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %s " D_SENT_TO " %d.%d.%d"), device_param_ga[XdrvMailbox.index + KNX_SLOT1 -2], XdrvMailbox.data, KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member); @@ -1153,7 +1153,7 @@ void CmndKnxTxScene(void) knx.write_1byte_uint(KNX_addr, tempvar); } - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %s " D_SENT_TO " %d.%d.%d"), + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %s " D_SENT_TO " %d.%d.%d"), device_param_ga[KNX_SCENE-1], XdrvMailbox.data, KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member); ResponseCmndIdxChar (XdrvMailbox.data); diff --git a/tasmota/xdrv_19_ps16dz_dimmer.ino b/tasmota/xdrv_19_ps16dz_dimmer.ino index b44a6da1b..5c32168a2 100644 --- a/tasmota/xdrv_19_ps16dz_dimmer.ino +++ b/tasmota/xdrv_19_ps16dz_dimmer.ino @@ -43,7 +43,7 @@ struct PS16DZ { void PS16DZSerialSend(const char *tx_buffer) { -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("PSZ: Send %s"), tx_buffer); +// AddLog(LOG_LEVEL_DEBUG, PSTR("PSZ: Send %s"), tx_buffer); PS16DZSerial->print(tx_buffer); PS16DZSerial->write(0x1B); @@ -96,7 +96,7 @@ void PS16DZSerialInput(void) Ps16dz.rx_buffer[Ps16dz.byte_counter++] = 0x00; // AT+RESULT="sequence":"1554682835320" -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("PSZ: Rcvd %s"), Ps16dz.rx_buffer); +// AddLog(LOG_LEVEL_DEBUG, PSTR("PSZ: Rcvd %s"), Ps16dz.rx_buffer); if (!strncmp(Ps16dz.rx_buffer+3, "RESULT", 6)) { @@ -118,7 +118,7 @@ void PS16DZSerialInput(void) if (!strncmp(token2, "\"switch\"", 8)) { bool switch_state = !strncmp(token3, "\"on\"", 4) ? true : false; -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("PSZ: Switch %d"), switch_state); +// AddLog(LOG_LEVEL_DEBUG, PSTR("PSZ: Switch %d"), switch_state); is_switch_change = (switch_state != TasmotaGlobal.power); if (is_switch_change) { @@ -128,7 +128,7 @@ void PS16DZSerialInput(void) else if (!strncmp(token2, "\"bright\"", 8)) { Ps16dz.dimmer = atoi(token3); -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("PSZ: Brightness %d"), Ps16dz.dimmer); +// AddLog(LOG_LEVEL_DEBUG, PSTR("PSZ: Brightness %d"), Ps16dz.dimmer); is_brightness_change = Ps16dz.dimmer != Settings.light_dimmer; if (TasmotaGlobal.power && (Ps16dz.dimmer > 0) && is_brightness_change) { @@ -138,7 +138,7 @@ void PS16DZSerialInput(void) } else if (!strncmp(token2, "\"sequence\"", 10)) { -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("PSZ: Sequence %s"), token3); +// AddLog(LOG_LEVEL_DEBUG, PSTR("PSZ: Sequence %s"), token3); } token = strtok_r(nullptr, ",", &end_str); @@ -146,7 +146,7 @@ void PS16DZSerialInput(void) if (!is_brightness_change) { -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("PSZ: Update")); +// AddLog(LOG_LEVEL_DEBUG, PSTR("PSZ: Update")); PS16DZSerialSendOk(); } diff --git a/tasmota/xdrv_20_hue.ino b/tasmota/xdrv_20_hue.ino index e7395484c..4e677157d 100644 --- a/tasmota/xdrv_20_hue.ino +++ b/tasmota/xdrv_20_hue.ino @@ -222,7 +222,6 @@ void HueRespondToMSearch(void) } else { 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 AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_HUE " %s " D_TO " %s:%d"), message, udp_remote_ip.toString().c_str(), udp_remote_port); } @@ -1007,7 +1006,7 @@ void HueGroups(String *path) */ String response(F("{}")); uint8_t maxhue = (TasmotaGlobal.devices_present > MAX_HUE_DEVICES) ? MAX_HUE_DEVICES : TasmotaGlobal.devices_present; - //AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE " HueGroups (%s)"), path->c_str()); + //AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE " HueGroups (%s)"), path->c_str()); if (path->endsWith(F("/0"))) { UnishoxStrings msg(HUE_LIGHTS); diff --git a/tasmota/xdrv_21_wemo.ino b/tasmota/xdrv_21_wemo.ino index c6dbe75dd..43ddd164d 100644 --- a/tasmota/xdrv_21_wemo.ino +++ b/tasmota/xdrv_21_wemo.ino @@ -73,7 +73,6 @@ void WemoRespondToMSearch(int echo_type) } else { 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 AddLog(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); } diff --git a/tasmota/xdrv_44_miel_hvac.ino b/tasmota/xdrv_44_miel_hvac.ino index 8bd6119de..189b00d1a 100644 --- a/tasmota/xdrv_44_miel_hvac.ino +++ b/tasmota/xdrv_44_miel_hvac.ino @@ -366,7 +366,7 @@ miel_hvac_parse(struct miel_hvac_softc *sc, uint8_t byte) case MIEL_HVAC_P_MIDDLE1: if (byte != MIEL_HVAC_H_MIDDLE1) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME + AddLog(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME ": parse state MIDDLE1 expected %02x got %02x" ", restarting"), MIEL_HVAC_H_MIDDLE1, byte); return (MIEL_HVAC_P_START); @@ -377,7 +377,7 @@ miel_hvac_parse(struct miel_hvac_softc *sc, uint8_t byte) case MIEL_HVAC_P_MIDDLE2: if (byte != MIEL_HVAC_H_MIDDLE2) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME + AddLog(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME ": parse state MIDDLE2 expected %02x got %02x" ", restarting"), MIEL_HVAC_H_MIDDLE2, byte); return (MIEL_HVAC_P_START); @@ -388,7 +388,7 @@ miel_hvac_parse(struct miel_hvac_softc *sc, uint8_t byte) case MIEL_HVAC_P_LEN: if (byte == 0) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME + AddLog(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME ": skipping 0 byte message type 0x%02x"), p->p_type); return (MIEL_HVAC_P_SKIP_CKSUM); @@ -403,14 +403,14 @@ miel_hvac_parse(struct miel_hvac_softc *sc, uint8_t byte) case MIEL_HVAC_H_TYPE_UPDATED: break; default: - AddLog_P(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME + AddLog(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME ": skipping unknown message type 0x%02x"), p->p_type); return (MIEL_HVAC_P_SKIP); } if (byte > sizeof(p->p_data)) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME + AddLog(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME ": skipping %u data bytes of message type 0x%02x"), p->p_len, p->p_type); return (MIEL_HVAC_P_SKIP); @@ -427,7 +427,7 @@ miel_hvac_parse(struct miel_hvac_softc *sc, uint8_t byte) case MIEL_HVAC_P_CKSUM: if (miel_hvac_cksum_fini(p->p_sum) != byte) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME + AddLog(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME ": checksum failed, restarting")); return (MIEL_HVAC_P_START); } diff --git a/tasmota/xsns_01_counter.ino b/tasmota/xsns_01_counter.ino index 77d630851..ef3b13e4c 100644 --- a/tasmota/xsns_01_counter.ino +++ b/tasmota/xsns_01_counter.ino @@ -264,7 +264,7 @@ void SyncACDimmer(void) #ifdef ESP32 analogWrite(Pin(GPIO_PWM1, i), 5); #endif // ESP32 - //AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("CNT: [%d] dimm_time_CCs %d, current_cycle_CC: %d, timelag %lu, lastcc %lu, currentSteps %d, curr %d"), i, ac_zero_cross_dimmer.dimm_timeClockCycles,ac_zero_cross_dimmer.current_cycle_ClockCycles , timelag_ClockCycles, ac_zero_cross_dimmer.currentCycleCount, ac_zero_cross_dimmer.currentSteps, Light.fade_cur_10[i]); + //AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("CNT: [%d] dimm_time_CCs %d, current_cycle_CC: %d, timelag %lu, lastcc %lu, currentSteps %d, curr %d"), i, ac_zero_cross_dimmer.dimm_timeClockCycles,ac_zero_cross_dimmer.current_cycle_ClockCycles , timelag_ClockCycles, ac_zero_cross_dimmer.currentCycleCount, ac_zero_cross_dimmer.currentSteps, Light.fade_cur_10[i]); } } }