From efaed8046d9afeb325fc643c2a3a68bd9dbf9a00 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 23 Jan 2021 16:26:23 +0100 Subject: [PATCH] Refactor AddLog usage --- tasmota/settings.ino | 32 +-- tasmota/support.ino | 42 ++-- tasmota/support_button.ino | 14 +- tasmota/support_command.ino | 6 +- tasmota/support_device_groups.ino | 30 +-- tasmota/support_esp32.ino | 16 +- tasmota/support_esptool.ino | 2 +- tasmota/support_float.ino | 2 +- tasmota/support_network.ino | 10 +- tasmota/support_rotary.ino | 2 +- tasmota/support_rtc.ino | 6 +- tasmota/support_tasmota.ino | 26 +- tasmota/support_udp.ino | 14 +- tasmota/support_wifi.ino | 50 ++-- tasmota/tasmota.ino | 6 +- tasmota/xdrv_01_webserver.ino | 82 +++---- tasmota/xdrv_02_mqtt.ino | 36 +-- tasmota/xdrv_03_energy.ino | 10 +- tasmota/xdrv_04_light.ino | 48 ++-- tasmota/xdrv_04_light_utils.ino | 2 +- tasmota/xdrv_05_irremote.ino | 2 +- tasmota/xdrv_07_domoticz.ino | 4 +- tasmota/xdrv_09_timers.ino | 2 +- tasmota/xdrv_10_rules.ino | 6 +- tasmota/xdrv_12_home_assistant.ino | 2 +- tasmota/xdrv_13_display.ino | 10 +- tasmota/xdrv_16_tuyamcu.ino | 48 ++-- tasmota/xdrv_17_rcswitch.ino | 4 +- tasmota/xdrv_18_armtronix_dimmers.ino | 10 +- tasmota/xdrv_20_hue.ino | 22 +- tasmota/xdrv_21_wemo.ino | 6 +- tasmota/xdrv_21_wemo_multi.ino | 26 +- tasmota/xdrv_23_zigbee_2_devices.ino | 4 +- tasmota/xdrv_23_zigbee_3_hue.ino | 2 +- tasmota/xdrv_23_zigbee_4_persistence.ino | 24 +- tasmota/xdrv_23_zigbee_4b_eeprom.ino | 24 +- tasmota/xdrv_23_zigbee_5_converters.ino | 2 +- tasmota/xdrv_23_zigbee_7_0_statemachine.ino | 10 +- tasmota/xdrv_23_zigbee_8_parsers.ino | 14 +- tasmota/xdrv_23_zigbee_9_serial.ino | 4 +- tasmota/xdrv_23_zigbee_9a_upload.ino | 46 ++-- tasmota/xdrv_23_zigbee_A_impl.ino | 4 +- tasmota/xdrv_24_buzzer.ino | 2 +- tasmota/xdrv_26_ariluxrf.ino | 2 +- tasmota/xdrv_27_shutter.ino | 50 ++-- tasmota/xdrv_28_pcf8574.ino | 18 +- tasmota/xdrv_29_deepsleep.ino | 6 +- tasmota/xdrv_30_exs_dimmer.ino | 22 +- tasmota/xdrv_31_tasmota_client.ino | 16 +- tasmota/xdrv_33_nrf24l01.ino | 4 +- tasmota/xdrv_36_keeloq.ino | 12 +- tasmota/xdrv_37_sonoff_d1.ino | 8 +- tasmota/xdrv_39_thermostat.ino | 56 ++--- tasmota/xdrv_40_telegram.ino | 16 +- tasmota/xdrv_41_tcp_bridge.ino | 6 +- tasmota/xdrv_42_i2s_audio.ino | 4 +- tasmota/xdrv_43_mlx90640.ino | 30 +-- tasmota/xdrv_44_miel_hvac.ino | 8 +- tasmota/xdrv_45_shelly_dimmer.ino | 56 ++--- tasmota/xdrv_46_ccloader.ino | 16 +- tasmota/xdrv_47_ftc532.ino | 12 +- tasmota/xdrv_48_timeprop.ino | 2 +- tasmota/xdrv_49_pid.ino | 2 +- tasmota/xdrv_50_filesystem.ino | 24 +- tasmota/xdrv_51_bs814a2.ino | 10 +- tasmota/xdrv_52_BLE_ESP32.ino | 258 ++++++++++---------- 66 files changed, 676 insertions(+), 676 deletions(-) diff --git a/tasmota/settings.ino b/tasmota/settings.ino index cd8733e0d..9656623a5 100644 --- a/tasmota/settings.ino +++ b/tasmota/settings.ino @@ -247,7 +247,7 @@ void SettingsBufferFree(void) { bool SettingsBufferAlloc(void) { SettingsBufferFree(); if (!(settings_buffer = (uint8_t *)malloc(sizeof(Settings)))) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_UPLOAD_ERR_2)); // Not enough (memory) space + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_UPLOAD_ERR_2)); // Not enough (memory) space return false; } return true; @@ -322,7 +322,7 @@ void UpdateQuickPowerCycle(bool update) { } else { qpc_buffer[0] = 0; ESP.flashWrite(qpc_location + (counter * 4), (uint32*)&qpc_buffer, 4); - AddLog_P(LOG_LEVEL_INFO, PSTR("QPC: Count %d"), counter); + AddLog(LOG_LEVEL_INFO, PSTR("QPC: Count %d"), counter); } } else if ((qpc_buffer[0] != QPC_SIGNATURE) || (0 == qpc_buffer[1])) { @@ -330,7 +330,7 @@ void UpdateQuickPowerCycle(bool update) { // Assume flash is default all ones and setting a bit to zero does not need an erase if (ESP.flashEraseSector(qpc_sector)) { ESP.flashWrite(qpc_location, (uint32*)&qpc_buffer, 4); - AddLog_P(LOG_LEVEL_INFO, PSTR("QPC: Reset")); + AddLog(LOG_LEVEL_INFO, PSTR("QPC: Reset")); } } #endif // ESP8266 @@ -347,13 +347,13 @@ void UpdateQuickPowerCycle(bool update) { } else { pc_register = 0xFFA55AF0 | counter; QPCWrite(&pc_register, sizeof(pc_register)); - AddLog_P(LOG_LEVEL_INFO, PSTR("QPC: Count %d"), counter); + AddLog(LOG_LEVEL_INFO, PSTR("QPC: Count %d"), counter); } } else if (pc_register != QPC_SIGNATURE) { pc_register = QPC_SIGNATURE; QPCWrite(&pc_register, sizeof(pc_register)); - AddLog_P(LOG_LEVEL_INFO, PSTR("QPC: Reset")); + AddLog(LOG_LEVEL_INFO, PSTR("QPC: Reset")); } #endif // ESP32 @@ -414,12 +414,12 @@ bool SettingsUpdateText(uint32_t index, const char* replace_me) { uint32_t current_len = end_pos - start_pos; int diff = replace_len - current_len; -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("TST: start %d, end %d, len %d, current %d, replace %d, diff %d"), +// AddLog(LOG_LEVEL_DEBUG, PSTR("TST: start %d, end %d, len %d, current %d, replace %d, diff %d"), // start_pos, end_pos, char_len, current_len, replace_len, diff); int too_long = (char_len + diff) - settings_text_size; if (too_long > 0) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_CONFIG "Text overflow by %d char(s)"), too_long); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_CONFIG "Text overflow by %d char(s)"), too_long); return false; // Replace text too long } @@ -441,9 +441,9 @@ bool SettingsUpdateText(uint32_t index, const char* replace_me) { } #ifdef DEBUG_FUNC_SETTINGSUPDATETEXT - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_CONFIG "CR %d/%d, Busy %d, Id %02d = \"%s\""), GetSettingsTextLen(), settings_text_size, settings_text_busy_count, index_save, replace); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_CONFIG "CR %d/%d, Busy %d, Id %02d = \"%s\""), GetSettingsTextLen(), settings_text_size, settings_text_busy_count, index_save, replace); #else - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_CONFIG "CR %d/%d, Busy %d"), GetSettingsTextLen(), settings_text_size, settings_text_busy_count); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_CONFIG "CR %d/%d, Busy %d"), GetSettingsTextLen(), settings_text_size, settings_text_busy_count); #endif return true; @@ -529,11 +529,11 @@ void SettingsSave(uint8_t rotate) { delay(1); } } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_CONFIG D_SAVED_TO_FLASH_AT " %X, " D_COUNT " %d, " D_BYTES " %d"), settings_location, Settings.save_flag, sizeof(Settings)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_CONFIG D_SAVED_TO_FLASH_AT " %X, " D_COUNT " %d, " D_BYTES " %d"), settings_location, Settings.save_flag, sizeof(Settings)); #endif // ESP8266 #ifdef ESP32 SettingsWrite(&Settings, sizeof(Settings)); - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_CONFIG "Saved, " D_COUNT " %d, " D_BYTES " %d"), Settings.save_flag, sizeof(Settings)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_CONFIG "Saved, " D_COUNT " %d, " D_BYTES " %d"), Settings.save_flag, sizeof(Settings)); #endif // ESP32 settings_crc32 = Settings.cfg_crc32; @@ -578,19 +578,19 @@ void SettingsLoad(void) { #ifdef USE_UFILESYS if (1 == settings_location) { TfsLoadFile(TASM_FILE_SETTINGS, (uint8_t*)&Settings, sizeof(Settings)); - AddLog_P(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG "Loaded from File, " D_COUNT " %lu"), Settings.save_flag); + AddLog(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG "Loaded from File, " D_COUNT " %lu"), Settings.save_flag); } else #endif // USE_UFILESYS { ESP.flashRead(settings_location * SPI_FLASH_SEC_SIZE, (uint32*)&Settings, sizeof(Settings)); - AddLog_P(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG D_LOADED_FROM_FLASH_AT " %X, " D_COUNT " %lu"), settings_location, Settings.save_flag); + AddLog(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG D_LOADED_FROM_FLASH_AT " %X, " D_COUNT " %lu"), settings_location, Settings.save_flag); } } #endif // ESP8266 #ifdef ESP32 uint32_t source = SettingsRead(&Settings, sizeof(Settings)); if (source) { settings_location = 1; } - AddLog_P(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG "Loaded from %s, " D_COUNT " %lu"), (source)?"File":"Nvm", Settings.save_flag); + AddLog(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG "Loaded from %s, " D_COUNT " %lu"), (source)?"File":"Nvm", Settings.save_flag); #endif // ESP32 #ifndef FIRMWARE_MINIMAL @@ -598,7 +598,7 @@ void SettingsLoad(void) { #ifdef USE_UFILESYS if (TfsLoadFile(TASM_FILE_SETTINGS_LKG, (uint8_t*)&Settings, sizeof(Settings)) && (Settings.cfg_crc32 == GetSettingsCrc32())) { settings_location = 1; - AddLog_P(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG "Loaded from LKG File, " D_COUNT " %lu"), Settings.save_flag); + AddLog(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG "Loaded from LKG File, " D_COUNT " %lu"), Settings.save_flag); } else #endif // USE_UFILESYS { @@ -679,7 +679,7 @@ void SettingsSdkErase(void) { /********************************************************************************************/ void SettingsDefault(void) { - AddLog_P(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG D_USE_DEFAULTS)); + AddLog(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG D_USE_DEFAULTS)); SettingsDefaultSet1(); SettingsDefaultSet2(); SettingsSave(2); diff --git a/tasmota/support.ino b/tasmota/support.ino index 984dc49bf..71ad33cb9 100644 --- a/tasmota/support.ino +++ b/tasmota/support.ino @@ -49,10 +49,10 @@ void OsWatchTicker(void) #ifdef DEBUG_THEO int32_t rssi = WiFi.RSSI(); - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_OSWATCH " FreeRam %d, rssi %d %% (%d dBm), last_run %d"), ESP_getFreeHeap(), WifiGetRssiAsQuality(rssi), rssi, last_run); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_OSWATCH " FreeRam %d, rssi %d %% (%d dBm), last_run %d"), ESP_getFreeHeap(), WifiGetRssiAsQuality(rssi), rssi, last_run); #endif // DEBUG_THEO if (last_run >= (OSWATCH_RESET_TIME * 1000)) { -// AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_OSWATCH " " D_BLOCKED_LOOP ". " D_RESTARTING)); // Save iram space +// AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_OSWATCH " " D_BLOCKED_LOOP ". " D_RESTARTING)); // Save iram space RtcSettings.oswatch_blocked_loop = 1; RtcSettingsSave(); @@ -1042,7 +1042,7 @@ uint32_t GetSerialBaudrate(void) { void SetSerialBegin(void) { TasmotaGlobal.baudrate = Settings.baudrate * 300; - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_SERIAL "Set to %s %d bit/s"), GetSerialConfig().c_str(), TasmotaGlobal.baudrate); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_SERIAL "Set to %s %d bit/s"), GetSerialConfig().c_str(), TasmotaGlobal.baudrate); Serial.flush(); #ifdef ESP8266 Serial.begin(TasmotaGlobal.baudrate, (SerialConfig)pgm_read_byte(kTasmotaSerialConfig + Settings.serial_config)); @@ -1085,7 +1085,7 @@ void SetSerial(uint32_t baudrate, uint32_t serial_config) { void ClaimSerial(void) { TasmotaGlobal.serial_local = true; - AddLog_P(LOG_LEVEL_INFO, PSTR("SNS: Hardware Serial")); + AddLog(LOG_LEVEL_INFO, PSTR("SNS: Hardware Serial")); SetSeriallog(LOG_LEVEL_NONE); TasmotaGlobal.baudrate = GetSerialBaudrate(); Settings.baudrate = TasmotaGlobal.baudrate / 300; @@ -1132,7 +1132,7 @@ void ShowSource(uint32_t source) { if ((source > 0) && (source < SRC_MAX)) { char stemp1[20]; - AddLog_P(LOG_LEVEL_DEBUG, PSTR("SRC: %s"), GetTextIndexed(stemp1, sizeof(stemp1), source, kCommandSource)); + AddLog(LOG_LEVEL_DEBUG, PSTR("SRC: %s"), GetTextIndexed(stemp1, sizeof(stemp1), source, kCommandSource)); } } @@ -1321,7 +1321,7 @@ void TemplateConvert(uint8_t template8[], uint16_t template16[]) { } template16[(sizeof(mytmplt) / 2) -2] = Adc0Convert(template8[sizeof(mytmplt8285) -1]); -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("FNC: TemplateConvert")); +// AddLog(LOG_LEVEL_DEBUG, PSTR("FNC: TemplateConvert")); // AddLogBuffer(LOG_LEVEL_DEBUG, template8, sizeof(mytmplt8285)); // AddLogBufferSize(LOG_LEVEL_DEBUG, (uint8_t*)template16, sizeof(mytmplt) / 2, 2); } @@ -1337,7 +1337,7 @@ void ConvertGpios(void) { Settings.my_gp.io[(sizeof(myio) / 2) -1] = Adc0Convert(Settings.ex_my_adc0); Settings.gpio16_converted = 0xF5A0; -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("FNC: ConvertGpios")); +// AddLog(LOG_LEVEL_DEBUG, PSTR("FNC: ConvertGpios")); // AddLogBuffer(LOG_LEVEL_DEBUG, (uint8_t *)&Settings.ex_my_gp8.io, sizeof(myio8)); // AddLogBufferSize(LOG_LEVEL_DEBUG, (uint8_t *)&Settings.my_gp.io, sizeof(myio) / 2, 2); } @@ -1488,7 +1488,7 @@ String ModuleName(void) void GetInternalTemplate(void* ptr, uint32_t module, uint32_t option) { uint8_t module_template = pgm_read_byte(kModuleTemplateList + module); -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("DBG: Template %d, Option %d"), module_template, option); +// AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: Template %d, Option %d"), module_template, option); // template8 = GPIO 0,1,2,3,4,5,9,10,12,13,14,15,16,Adc uint8_t template8[sizeof(mytmplt8285)] = { GPIO_NONE }; @@ -1520,7 +1520,7 @@ void GetInternalTemplate(void* ptr, uint32_t module, uint32_t option) { } memcpy(ptr, &template16[index], size); -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("FNC: GetInternalTemplate option %d"), option); +// AddLog(LOG_LEVEL_DEBUG, PSTR("FNC: GetInternalTemplate option %d"), option); // AddLogBufferSize(LOG_LEVEL_DEBUG, (uint8_t *)ptr, size / 2, 2); } #endif // ESP8266 @@ -1674,7 +1674,7 @@ bool JsonTemplate(char* dataBuf) } if (old_template) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TPL: Converting template ...")); + AddLog(LOG_LEVEL_DEBUG, PSTR("TPL: Converting template ...")); val = root[PSTR(D_JSON_FLAG)]; if (val) { @@ -1708,7 +1708,7 @@ bool JsonTemplate(char* dataBuf) Settings.user_template_base = base -1; // Default WEMOS } -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("TPL: Converted")); +// AddLog(LOG_LEVEL_DEBUG, PSTR("TPL: Converted")); // AddLogBufferSize(LOG_LEVEL_DEBUG, (uint8_t*)&Settings.user_template, sizeof(Settings.user_template) / 2, 2); return true; @@ -1716,7 +1716,7 @@ bool JsonTemplate(char* dataBuf) void TemplateJson(void) { -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("TPL: Show")); +// AddLog(LOG_LEVEL_DEBUG, PSTR("TPL: Show")); // AddLogBufferSize(LOG_LEVEL_DEBUG, (uint8_t*)&Settings.user_template, sizeof(Settings.user_template) / 2, 2); Response_P(PSTR("{\"" D_JSON_NAME "\":\"%s\",\"" D_JSON_GPIO "\":["), SettingsText(SET_TEMPLATE_NAME)); @@ -1989,7 +1989,7 @@ void I2cResetActive(uint32_t addr, uint32_t count = 1) i2c_active[addr / 32] &= ~(1 << (addr % 32)); addr++; } -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("I2C: Active %08X,%08X,%08X,%08X"), i2c_active[0], i2c_active[1], i2c_active[2], i2c_active[3]); +// AddLog(LOG_LEVEL_DEBUG, PSTR("I2C: Active %08X,%08X,%08X,%08X"), i2c_active[0], i2c_active[1], i2c_active[2], i2c_active[3]); } void I2cSetActive(uint32_t addr, uint32_t count = 1) @@ -2000,13 +2000,13 @@ void I2cSetActive(uint32_t addr, uint32_t count = 1) i2c_active[addr / 32] |= (1 << (addr % 32)); addr++; } -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("I2C: Active %08X,%08X,%08X,%08X"), i2c_active[0], i2c_active[1], i2c_active[2], i2c_active[3]); +// AddLog(LOG_LEVEL_DEBUG, PSTR("I2C: Active %08X,%08X,%08X,%08X"), i2c_active[0], i2c_active[1], i2c_active[2], i2c_active[3]); } void I2cSetActiveFound(uint32_t addr, const char *types) { I2cSetActive(addr); - AddLog_P(LOG_LEVEL_INFO, S_LOG_I2C_FOUND_AT, types, addr); + AddLog(LOG_LEVEL_INFO, S_LOG_I2C_FOUND_AT, types, addr); } bool I2cActive(uint32_t addr) @@ -2033,7 +2033,7 @@ bool I2cSetDevice(uint32_t addr) * Syslog * * Example: - * AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_LOG "Any value %d"), value); + * AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_LOG "Any value %d"), value); * \*********************************************************************************************/ @@ -2074,7 +2074,7 @@ void SyslogAsync(bool refresh) { if (!PortUdp.beginPacket(syslog_host_addr, Settings.syslog_port)) { TasmotaGlobal.syslog_level = 0; TasmotaGlobal.syslog_timer = SYSLOG_TIMER; - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_SYSLOG_HOST_NOT_FOUND ". " D_RETRY_IN " %d " D_UNIT_SECOND), SYSLOG_TIMER); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_SYSLOG_HOST_NOT_FOUND ". " D_RETRY_IN " %d " D_UNIT_SECOND), SYSLOG_TIMER); return; } char log_data[len +72]; // Hostname + Id + log data @@ -2263,7 +2263,7 @@ void AddLogSerial(uint32_t loglevel) void AddLogMissed(const char *sensor, uint32_t misses) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("SNS: %s missed %d"), sensor, SENSOR_MAX_MISS - misses); + AddLog(LOG_LEVEL_DEBUG, PSTR("SNS: %s missed %d"), sensor, SENSOR_MAX_MISS - misses); } void AddLogBufferSize(uint32_t loglevel, uint8_t *buffer, uint32_t count, uint32_t size) { @@ -2286,15 +2286,15 @@ void AddLogSpi(bool hardware, uint32_t clk, uint32_t mosi, uint32_t miso) { uint32_t enabled = (hardware) ? TasmotaGlobal.spi_enabled : TasmotaGlobal.soft_spi_enabled; switch(enabled) { case SPI_MOSI: - AddLog_P(LOG_LEVEL_INFO, PSTR("SPI: %s using GPIO%02d(CLK) and GPIO%02d(MOSI)"), + AddLog(LOG_LEVEL_INFO, PSTR("SPI: %s using GPIO%02d(CLK) and GPIO%02d(MOSI)"), (hardware) ? PSTR("Hardware") : PSTR("Software"), clk, mosi); break; case SPI_MISO: - AddLog_P(LOG_LEVEL_INFO, PSTR("SPI: %s using GPIO%02d(CLK) and GPIO%02d(MISO)"), + AddLog(LOG_LEVEL_INFO, PSTR("SPI: %s using GPIO%02d(CLK) and GPIO%02d(MISO)"), (hardware) ? PSTR("Hardware") : PSTR("Software"), clk, miso); break; case SPI_MOSI_MISO: - AddLog_P(LOG_LEVEL_INFO, PSTR("SPI: %s using GPIO%02d(CLK), GPIO%02d(MOSI) and GPIO%02d(MISO)"), + AddLog(LOG_LEVEL_INFO, PSTR("SPI: %s using GPIO%02d(CLK), GPIO%02d(MOSI) and GPIO%02d(MISO)"), (hardware) ? PSTR("Hardware") : PSTR("Software"), clk, mosi, miso); break; } diff --git a/tasmota/support_button.ino b/tasmota/support_button.ino index f1bd22c0f..d5262f517 100644 --- a/tasmota/support_button.ino +++ b/tasmota/support_button.ino @@ -146,7 +146,7 @@ void ButtonHandler(void) { if (!button_index && ((SONOFF_DUAL == TasmotaGlobal.module_type) || (CH4 == TasmotaGlobal.module_type))) { button_present = 1; if (Button.dual_code) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON " " D_CODE " %04X"), Button.dual_code); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON " " D_CODE " %04X"), Button.dual_code); button = PRESSED; if (0xF500 == Button.dual_code) { // Button hold Button.hold_timer[button_index] = (loops_per_second * Settings.param[P_HOLD_TIME] / 10) -1; // SetOption32 (40) @@ -176,7 +176,7 @@ void ButtonHandler(void) { Button.touch_hits[button_index] = 0; } if (bitRead(TOUCH_BUTTON.calibration, button_index+1)) { - AddLog_P(LOG_LEVEL_INFO, PSTR("PLOT: %u, %u, %u,"), button_index+1, _value, Button.touch_hits[button_index]); // Button number (1..4), value, continuous hits under threshold + AddLog(LOG_LEVEL_INFO, PSTR("PLOT: %u, %u, %u,"), button_index+1, _value, Button.touch_hits[button_index]); // Button number (1..4), value, continuous hits under threshold } } else #endif // ESP32 @@ -206,12 +206,12 @@ void ButtonHandler(void) { bool button_pressed = false; if ((PRESSED == button) && (NOT_PRESSED == Button.last_state[button_index])) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_LEVEL_10), button_index +1); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_LEVEL_10), button_index +1); Button.hold_timer[button_index] = loops_per_second; button_pressed = true; } if ((NOT_PRESSED == button) && (PRESSED == Button.last_state[button_index])) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_LEVEL_01), button_index +1); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_LEVEL_01), button_index +1); if (!Button.hold_timer[button_index]) { button_pressed = true; } // Do not allow within 1 second } if (button_pressed) { @@ -230,7 +230,7 @@ void ButtonHandler(void) { if (Settings.flag.button_single) { // SetOption13 (0) - Allow only single button press for immediate action, if (!Settings.flag3.mqtt_buttons) { // SetOption73 (0) - Decouple button from relay and send just mqtt topic - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_IMMEDIATE), button_index +1); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_IMMEDIATE), button_index +1); if (!SendKey(KEY_BUTTON, button_index +1, POWER_TOGGLE)) { // Execute Toggle command via MQTT if ButtonTopic is set ExecuteCommandPower(button_index +1, POWER_TOGGLE, SRC_BUTTON); // Execute Toggle command internally } @@ -239,7 +239,7 @@ void ButtonHandler(void) { } } else { Button.press_counter[button_index] = (Button.window_timer[button_index]) ? Button.press_counter[button_index] +1 : 1; - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_MULTI_PRESS " %d"), button_index +1, Button.press_counter[button_index]); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_MULTI_PRESS " %d"), button_index +1, Button.press_counter[button_index]); Button.window_timer[button_index] = loops_per_second / 2; // 0.5 second multi press window } TasmotaGlobal.blinks = 201; @@ -327,7 +327,7 @@ void ButtonHandler(void) { #endif // ESP8266 if ((Button.press_counter[button_index] > 1) && valid_relay && (Button.press_counter[button_index] <= MAX_RELAY_BUTTON1)) { ExecuteCommandPower(button_index + Button.press_counter[button_index], POWER_TOGGLE, SRC_BUTTON); // Execute Toggle command internally -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("DBG: Relay%d found on GPIO%d"), Button.press_counter[button_index], Pin(GPIO_REL1, Button.press_counter[button_index]-1)); +// AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: Relay%d found on GPIO%d"), Button.press_counter[button_index], Pin(GPIO_REL1, Button.press_counter[button_index]-1)); } } } diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index 5b3801538..57821ba70 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -227,7 +227,7 @@ void CommandHandler(char* topicBuf, char* dataBuf, uint32_t data_len) type[i] = '\0'; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR("CMD: " D_GROUP " %d, " D_INDEX " %d, " D_COMMAND " \"%s\", " D_DATA " \"%s\""), grpflg, index, type, dataBuf); + AddLog(LOG_LEVEL_DEBUG, PSTR("CMD: " D_GROUP " %d, " D_INDEX " %d, " D_COMMAND " \"%s\", " D_DATA " \"%s\""), grpflg, index, type, dataBuf); if (type != nullptr) { Response_P(PSTR("{\"" D_JSON_COMMAND "\":\"" D_JSON_ERROR "\"}")); @@ -744,7 +744,7 @@ void CmndRestart(void) CmndBlockedLoop(); break; case 99: - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_RESTARTING)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_RESTARTING)); EspRestart(); break; default: @@ -2117,7 +2117,7 @@ void CmndTouchCal(void) } Response_P(PSTR("{\"" D_CMND_TOUCH_CAL "\": %u"), TOUCH_BUTTON.calibration); ResponseJsonEnd(); - AddLog_P(LOG_LEVEL_INFO, PSTR("Button Touchvalue Hits,")); + AddLog(LOG_LEVEL_INFO, PSTR("Button Touchvalue Hits,")); } void CmndTouchThres(void) diff --git a/tasmota/support_device_groups.ino b/tasmota/support_device_groups.ino index ae4878e97..bfa954b50 100644 --- a/tasmota/support_device_groups.ino +++ b/tasmota/support_device_groups.ino @@ -129,7 +129,7 @@ void DeviceGroupsInit(void) // Initialize the device information for each device group. device_groups = (struct device_group *)calloc(device_group_count, sizeof(struct device_group)); if (!device_groups) { - AddLog_P(LOG_LEVEL_ERROR, PSTR("DGR: Error allocating %u-element array"), device_group_count); + AddLog(LOG_LEVEL_ERROR, PSTR("DGR: Error allocating %u-element array"), device_group_count); return; } @@ -169,7 +169,7 @@ void DeviceGroupsStart() // Subscribe to device groups multicasts. if (!device_groups_udp.beginMulticast(WiFi.localIP(), IPAddress(DEVICE_GROUPS_ADDRESS), DEVICE_GROUPS_PORT)) { - AddLog_P(LOG_LEVEL_ERROR, PSTR("DGR: Error subscribing")); + AddLog(LOG_LEVEL_ERROR, PSTR("DGR: Error subscribing")); return; } device_groups_up = true; @@ -185,7 +185,7 @@ void DeviceGroupsStart() device_group->initial_status_requests_remaining = 10; device_group->next_ack_check_time = next_check_time; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: (Re)discovering members")); + AddLog(LOG_LEVEL_DEBUG, PSTR("DGR: (Re)discovering members")); } } @@ -318,7 +318,7 @@ void SendReceiveDeviceGroupMessage(struct device_group * device_group, struct de case DGR_ITEM_LIGHT_CHANNELS: break; default: - AddLog_P(LOG_LEVEL_ERROR, PSTR("DGR: *** Invalid item=%u"), item); + AddLog(LOG_LEVEL_ERROR, PSTR("DGR: *** Invalid item=%u"), item); } #endif // DEVICE_GROUPS_DEBUG @@ -439,12 +439,12 @@ write_log: } delay(10); } - if (attempt > 5) AddLog_P(LOG_LEVEL_ERROR, PSTR("DGR: Error sending message")); + if (attempt > 5) AddLog(LOG_LEVEL_ERROR, PSTR("DGR: Error sending message")); } goto cleanup; badmsg: - AddLog_P(LOG_LEVEL_ERROR, PSTR("%s ** incorrect length"), log_buffer); + AddLog(LOG_LEVEL_ERROR, PSTR("%s ** incorrect length"), log_buffer); cleanup: if (received) { @@ -476,7 +476,7 @@ bool _SendDeviceGroupMessage(uint8_t device_group_index, DevGroupMessageType mes // Load the message header, sequence and flags. #ifdef DEVICE_GROUPS_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Building %s %spacket"), device_group->group_name, (message_type == DGR_MSGTYP_FULL_STATUS ? PSTR("full status ") : PSTR(""))); + AddLog(LOG_LEVEL_DEBUG, PSTR("DGR: Building %s %spacket"), device_group->group_name, (message_type == DGR_MSGTYP_FULL_STATUS ? PSTR("full status ") : PSTR(""))); #endif // DEVICE_GROUPS_DEBUG uint16_t original_sequence = device_group->outgoing_sequence; uint16_t flags = 0; @@ -652,7 +652,7 @@ bool _SendDeviceGroupMessage(uint8_t device_group_index, DevGroupMessageType mes previous_message_ptr += value; } #ifdef DEVICE_GROUPS_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: %u items carried over"), kept_item_count); + AddLog(LOG_LEVEL_DEBUG, PSTR("DGR: %u items carried over"), kept_item_count); #endif // DEVICE_GROUPS_DEBUG } @@ -770,12 +770,12 @@ void ProcessDeviceGroupMessage(uint8_t * message, int message_length) if (!device_group_member) { device_group_member = (struct device_group_member *)calloc(1, sizeof(struct device_group_member)); if (device_group_member == nullptr) { - AddLog_P(LOG_LEVEL_ERROR, PSTR("DGR: Error allocating member block")); + AddLog(LOG_LEVEL_ERROR, PSTR("DGR: Error allocating member block")); return; } device_group_member->ip_address = remote_ip; *flink = device_group_member; - AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Member %s added"), remote_ip.toString().c_str()); + AddLog(LOG_LEVEL_DEBUG, PSTR("DGR: Member %s added"), remote_ip.toString().c_str()); break; } else if (device_group_member->ip_address == remote_ip) { @@ -822,7 +822,7 @@ void DeviceGroupsLoop(void) // If it's time to check on things, iterate through the device groups. if ((long)(now - next_check_time) >= 0) { #ifdef DEVICE_GROUPS_DEBUG -AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Checking next_check_time=%u, now=%u"), next_check_time, now); +AddLog(LOG_LEVEL_DEBUG, PSTR("DGR: Checking next_check_time=%u, now=%u"), next_check_time, now); #endif // DEVICE_GROUPS_DEBUG next_check_time = now + DGR_ANNOUNCEMENT_INTERVAL * 2; @@ -839,7 +839,7 @@ AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Checking next_check_time=%u, now=%u"), next if (device_group->initial_status_requests_remaining) { if (--device_group->initial_status_requests_remaining) { #ifdef DEVICE_GROUPS_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Sending initial status request for group %s"), device_group->group_name); + AddLog(LOG_LEVEL_DEBUG, PSTR("DGR: Sending initial status request for group %s"), device_group->group_name); #endif // DEVICE_GROUPS_DEBUG SendReceiveDeviceGroupMessage(device_group, nullptr, device_group->message, device_group->message_length, false); device_group->message[device_group->message_header_length + 2] = DGR_FLAG_STATUS_REQUEST; // The reset flag is on only for the first packet - turn it off now @@ -857,7 +857,7 @@ AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Checking next_check_time=%u, now=%u"), next // If we're done initializing, iterate through the group memebers, ... else { #ifdef DEVICE_GROUPS_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Checking for ack's")); + AddLog(LOG_LEVEL_DEBUG, PSTR("DGR: Checking for ack's")); #endif // DEVICE_GROUPS_DEBUG bool acked = true; struct device_group_member ** flink = &device_group->device_group_members; @@ -872,7 +872,7 @@ AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Checking next_check_time=%u, now=%u"), next if ((long)(now - device_group->member_timeout_time) >= 0) { *flink = device_group_member->flink; free(device_group_member); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Member %s removed"), device_group_member->ip_address.toString().c_str()); + AddLog(LOG_LEVEL_DEBUG, PSTR("DGR: Member %s removed"), device_group_member->ip_address.toString().c_str()); continue; } @@ -910,7 +910,7 @@ AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Checking next_check_time=%u, now=%u"), next // announcement interval plus a random number of milliseconds so that even if all the devices // booted at the same time, they don't all multicast their announcements at the same time. #ifdef DEVICE_GROUPS_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: next_announcement_time=%u, now=%u"), device_group->next_announcement_time, now); + AddLog(LOG_LEVEL_DEBUG, PSTR("DGR: next_announcement_time=%u, now=%u"), device_group->next_announcement_time, now); #endif // DEVICE_GROUPS_DEBUG if ((long)(now - device_group->next_announcement_time) >= 0) { SendReceiveDeviceGroupMessage(device_group, nullptr, device_group->message, BeginDeviceGroupMessage(device_group, DGR_FLAG_ANNOUNCEMENT, true) - device_group->message, false); diff --git a/tasmota/support_esp32.ino b/tasmota/support_esp32.ino index 7bbad6468..8e6415bbd 100644 --- a/tasmota/support_esp32.ino +++ b/tasmota/support_esp32.ino @@ -150,13 +150,13 @@ void SettingsErase(uint8_t type) { r1 = NvmErase("qpc"); r2 = NvmErase("main"); r3 = TfsDeleteFile(TASM_FILE_SETTINGS); - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_ERASE " Tasmota data (%d,%d,%d)"), r1, r2, r3); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_ERASE " Tasmota data (%d,%d,%d)"), r1, r2, r3); break; case 1: // Reset 3 = SDK parameter area case 4: // WIFI_FORCE_RF_CAL_ERASE = SDK parameter area r1 = esp_phy_erase_cal_data_in_nvs(); // r1 = NvmErase("cal_data"); - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_ERASE " PHY data (%d)"), r1); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_ERASE " PHY data (%d)"), r1); break; case 3: // QPC Reached = QPC, Tasmota and SDK parameter area (0x0F3xxx - 0x0FFFFF) // nvs_flash_erase(); // Erase RTC, PHY, sta.mac, ap.sndchan, ap.mac, Tasmota etc. @@ -164,9 +164,9 @@ void SettingsErase(uint8_t type) { r2 = NvmErase("main"); // r3 = esp_phy_erase_cal_data_in_nvs(); // r3 = NvmErase("cal_data"); -// AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_ERASE " Tasmota (%d,%d) and PHY data (%d)"), r1, r2, r3); +// AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_ERASE " Tasmota (%d,%d) and PHY data (%d)"), r1, r2, r3); r3 = TfsDeleteFile(TASM_FILE_SETTINGS); - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_ERASE " Tasmota data (%d,%d,%d)"), r1, r2, r3); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_ERASE " Tasmota data (%d,%d,%d)"), r1, r2, r3); break; } } @@ -196,7 +196,7 @@ void QPCWrite(const void *pSettings, unsigned nSettingsLen) { void NvsInfo(void) { nvs_stats_t nvs_stats; nvs_get_stats(NULL, &nvs_stats); - AddLog_P(LOG_LEVEL_INFO, PSTR("NVS: Used %d/%d entries, NameSpaces %d"), + AddLog(LOG_LEVEL_INFO, PSTR("NVS: Used %d/%d entries, NameSpaces %d"), nvs_stats.used_entries, nvs_stats.total_entries, nvs_stats.namespace_count); } @@ -240,7 +240,7 @@ uint8_t* EspFlashMmap(uint32_t address) { int32_t err = spi_flash_mmap(address, 5 * SPI_FLASH_MMU_PAGE_SIZE, SPI_FLASH_MMAP_DATA, (const void **)&data, &handle); /* - AddLog_P(LOG_LEVEL_DEBUG, PSTR("DBG: Spi_flash_map %d"), err); + AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: Spi_flash_map %d"), err); spi_flash_mmap_dump(); */ @@ -258,7 +258,7 @@ int32_t EspPartitionMmap(uint32_t action) { if (!partition) { return 0; } err = esp_partition_mmap(partition, 0, 4 * SPI_FLASH_MMU_PAGE_SIZE, SPI_FLASH_MMAP_DATA, (const void **)&TasmotaGlobal_mmap_data, &handle); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("DBG: Partition start 0x%08X, Partition end 0x%08X, Mmap data 0x%08X"), partition->address, partition->size, TasmotaGlobal_mmap_data); + AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: Partition start 0x%08X, Partition end 0x%08X, Mmap data 0x%08X"), partition->address, partition->size, TasmotaGlobal_mmap_data); } else { spi_flash_munmap(handle); @@ -407,7 +407,7 @@ uint8_t* FlashDirectAccess(void) { uint32_t address = FlashWriteStartSector() * SPI_FLASH_SEC_SIZE; uint8_t* data = EspFlashMmap(address); /* - AddLog_P(LOG_LEVEL_DEBUG, PSTR("DBG: Flash start address 0x%08X, Mmap address 0x%08X"), address, data); + AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: Flash start address 0x%08X, Mmap address 0x%08X"), address, data); uint8_t buf[32]; memcpy(buf, data, sizeof(buf)); diff --git a/tasmota/support_esptool.ino b/tasmota/support_esptool.ino index a066838af..ebae51c75 100644 --- a/tasmota/support_esptool.ino +++ b/tasmota/support_esptool.ino @@ -95,7 +95,7 @@ bool EsptoolEraseSector(uint32_t sector) void EsptoolErase(uint32_t start_sector, uint32_t end_sector) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_ERASE " from 0x%08X to 0x%08X"), start_sector * SPI_FLASH_SEC_SIZE, (end_sector * SPI_FLASH_SEC_SIZE) -1); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_ERASE " from 0x%08X to 0x%08X"), start_sector * SPI_FLASH_SEC_SIZE, (end_sector * SPI_FLASH_SEC_SIZE) -1); int next_erase_sector = start_sector; int remaining_erase_sector = end_sector - start_sector; diff --git a/tasmota/support_float.ino b/tasmota/support_float.ino index 2bdf32ef2..e2877e5a3 100644 --- a/tasmota/support_float.ino +++ b/tasmota/support_float.ino @@ -136,7 +136,7 @@ double TaylorLog(double x) dtostrfd(log1, 8, log1s); char log2s[33]; dtostrfd(totalValue, 8, log2s); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("input %s, log %s, taylor %s"), logxs, log1s, log2s); + AddLog(LOG_LEVEL_DEBUG, PSTR("input %s, log %s, taylor %s"), logxs, log1s, log2s); */ return totalValue; } diff --git a/tasmota/support_network.ino b/tasmota/support_network.ino index e2b24d782..242c03121 100644 --- a/tasmota/support_network.ino +++ b/tasmota/support_network.ino @@ -32,13 +32,13 @@ void StartMdns(void) { if (Settings.flag3.mdns_enabled) { // SetOption55 - Control mDNS service if (!Mdns.begun) { // if (mdns_delayed_start) { -// AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS D_ATTEMPTING_CONNECTION)); +// AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS D_ATTEMPTING_CONNECTION)); // mdns_delayed_start--; // } else { // mdns_delayed_start = Settings.param[P_MDNS_DELAYED_START]; MDNS.end(); // close existing or MDNS.begin will fail Mdns.begun = (uint8_t)MDNS.begin(TasmotaGlobal.hostname); - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS "%s"), (Mdns.begun) ? PSTR(D_INITIALIZED) : PSTR(D_FAILED)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS "%s"), (Mdns.begun) ? PSTR(D_INITIALIZED) : PSTR(D_FAILED)); // } } } @@ -51,7 +51,7 @@ void MqttDiscoverServer(void) int n = MDNS.queryService("mqtt", "tcp"); // Search for mqtt service - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS D_QUERY_DONE " %d"), n); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS D_QUERY_DONE " %d"), n); if (n > 0) { uint32_t i = 0; // If the hostname isn't set, use the first record found. @@ -65,7 +65,7 @@ void MqttDiscoverServer(void) SettingsUpdateText(SET_MQTT_HOST, MDNS.hostname(i).c_str()); Settings.mqtt_port = MDNS.port(i); - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS D_MQTT_SERVICE_FOUND " %s," D_PORT " %d"), SettingsText(SET_MQTT_HOST), Settings.mqtt_port); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS D_MQTT_SERVICE_FOUND " %s," D_PORT " %d"), SettingsText(SET_MQTT_HOST), Settings.mqtt_port); } } #endif // MQTT_HOST_DISCOVERY @@ -84,7 +84,7 @@ void MdnsUpdate(void) { if (2 == Mdns.begun) { MDNS.update(); // this is basically passpacket like a webserver // being called in main loop so no logging - // AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_MDNS "MDNS.update")); + // AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_MDNS "MDNS.update")); } } #endif // ESP8266 diff --git a/tasmota/support_rotary.ino b/tasmota/support_rotary.ino index 7e32647cb..4f5eda5a6 100644 --- a/tasmota/support_rotary.ino +++ b/tasmota/support_rotary.ino @@ -209,7 +209,7 @@ void RotaryHandler(void) { bool button_pressed = (Button.hold_timer[index]); // Button is pressed: set color temperature if (button_pressed) { Encoder[index].changed = true; } -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("ROT: Button1 %d, Position %d"), button_pressed, rotary_position); +// AddLog(LOG_LEVEL_DEBUG, PSTR("ROT: Button1 %d, Position %d"), button_pressed, rotary_position); #ifdef USE_LIGHT if (!Settings.flag4.rotary_uses_rules) { // SetOption98 - Use rules instead of light control diff --git a/tasmota/support_rtc.ino b/tasmota/support_rtc.ino index 2f2403e7a..7a5670921 100644 --- a/tasmota/support_rtc.ino +++ b/tasmota/support_rtc.ino @@ -396,7 +396,7 @@ void RtcSecond(void) Rtc.standard_time = RuleToTime(Settings.tflag[0], RtcTime.year); // Do not use AddLog_P( here (interrupt routine) if syslog or mqttlog is enabled. UDP/TCP will force exception 9 - AddLog_P(LOG_LEVEL_DEBUG, PSTR("RTC: " D_UTC_TIME " %s, " D_DST_TIME " %s, " D_STD_TIME " %s"), + AddLog(LOG_LEVEL_DEBUG, PSTR("RTC: " D_UTC_TIME " %s, " D_DST_TIME " %s, " D_STD_TIME " %s"), GetDateAndTime(DT_UTC).c_str(), GetDateAndTime(DT_DST).c_str(), GetDateAndTime(DT_STD).c_str()); if (Rtc.local_time < START_VALID_TIME) { // 2016-01-01 @@ -411,7 +411,7 @@ void RtcSecond(void) if ((Rtc.utc_time > (2 * 60 * 60)) && (last_sync < Rtc.utc_time - (2 * 60 * 60))) { // Every two hours a warning // Do not use AddLog_P( here (interrupt routine) if syslog or mqttlog is enabled. UDP/TCP will force exception 9 - AddLog_P(LOG_LEVEL_DEBUG, PSTR("RTC: Not synced")); + AddLog(LOG_LEVEL_DEBUG, PSTR("RTC: Not synced")); last_sync = Rtc.utc_time; } @@ -476,7 +476,7 @@ void RtcSecond(void) void RtcSync(void) { Rtc.time_synced = true; RtcSecond(); -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("RTC: Synced")); +// AddLog(LOG_LEVEL_DEBUG, PSTR("RTC: Synced")); } void RtcSetTime(uint32_t epoch) { diff --git a/tasmota/support_tasmota.ino b/tasmota/support_tasmota.ino index 40d5836ad..0761e504d 100644 --- a/tasmota/support_tasmota.ino +++ b/tasmota/support_tasmota.ino @@ -815,7 +815,7 @@ void PerformEverySecond(void) if (!(DeepSleepEnabled() && !Settings.flag3.bootcount_update)) { #endif Settings.bootcount++; // Moved to here to stop flash writes during start-up - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BOOT_COUNT " %d"), Settings.bootcount); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BOOT_COUNT " %d"), Settings.bootcount); #ifdef USE_DEEPSLEEP } #endif @@ -832,7 +832,7 @@ void PerformEverySecond(void) TasmotaGlobal.seriallog_timer--; if (!TasmotaGlobal.seriallog_timer) { if (TasmotaGlobal.seriallog_level) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_SERIAL_LOGGING_DISABLED)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_SERIAL_LOGGING_DISABLED)); } TasmotaGlobal.seriallog_level = 0; } @@ -843,7 +843,7 @@ void PerformEverySecond(void) if (!TasmotaGlobal.syslog_timer) { TasmotaGlobal.syslog_level = Settings.syslog_level; if (Settings.syslog_level) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_SYSLOG_LOGGING_REENABLED)); // Might trigger disable again (on purpose) + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_SYSLOG_LOGGING_REENABLED)); // Might trigger disable again (on purpose) } } } @@ -1059,7 +1059,7 @@ void Every250mSeconds(void) char *ech = strchr(bch, '.'); // Find file type in filename (none, .ino.bin, .ino.bin.gz, .bin, .bin.gz or .gz) if (ech == nullptr) { ech = TasmotaGlobal.mqtt_data + strlen(TasmotaGlobal.mqtt_data); } // Point to '/0' at end of mqtt_data becoming an empty string -//AddLog_P(LOG_LEVEL_DEBUG, PSTR("OTA: File type [%s]"), ech); +//AddLog(LOG_LEVEL_DEBUG, PSTR("OTA: File type [%s]"), ech); char ota_url_type[strlen(ech) +1]; strncpy(ota_url_type, ech, sizeof(ota_url_type)); // Either empty, .ino.bin, .ino.bin.gz, .bin, .bin.gz or .gz @@ -1070,7 +1070,7 @@ void Every250mSeconds(void) snprintf_P(TasmotaGlobal.mqtt_data, sizeof(TasmotaGlobal.mqtt_data), PSTR("%s-" D_JSON_MINIMAL "%s"), TasmotaGlobal.mqtt_data, ota_url_type); // Minimal filename must be filename-minimal } #endif // FIRMWARE_MINIMAL - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "%s"), TasmotaGlobal.mqtt_data); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "%s"), TasmotaGlobal.mqtt_data); WiFiClient OTAclient; ota_result = (HTTP_UPDATE_FAILED != ESPhttpUpdate.update(OTAclient, TasmotaGlobal.mqtt_data)); if (!ota_result) { @@ -1189,7 +1189,7 @@ void Every250mSeconds(void) } TasmotaGlobal.restart_flag--; if (TasmotaGlobal.restart_flag <= 0) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION "%s"), (TasmotaGlobal.restart_halt) ? PSTR("Halted") : PSTR(D_RESTARTING)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION "%s"), (TasmotaGlobal.restart_halt) ? PSTR("Halted") : PSTR(D_RESTARTING)); EspRestart(); } } @@ -1300,7 +1300,7 @@ void ArduinoOTAInit(void) if (Settings.flag.mqtt_enabled) { MqttDisconnect(); // SetOption3 - Enable MQTT } - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA " D_UPLOAD_STARTED)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA " D_UPLOAD_STARTED)); arduino_ota_triggered = true; arduino_ota_progress_dot_count = 0; delay(100); // Allow time for message xfer @@ -1331,19 +1331,19 @@ void ArduinoOTAInit(void) default: snprintf_P(error_str, sizeof(error_str), PSTR(D_UPLOAD_ERROR_CODE " %d"), error); } - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA %s. " D_RESTARTING), error_str); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA %s. " D_RESTARTING), error_str); EspRestart(); }); ArduinoOTA.onEnd([]() { if ((LOG_LEVEL_DEBUG <= TasmotaGlobal.seriallog_level)) { Serial.println(); } - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA " D_SUCCESSFUL ". " D_RESTARTING)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA " D_SUCCESSFUL ". " D_RESTARTING)); EspRestart(); }); ArduinoOTA.begin(); - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA " D_ENABLED " " D_PORT " 8266")); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA " D_ENABLED " " D_PORT " 8266")); } void ArduinoOtaLoop(void) @@ -1451,7 +1451,7 @@ void SerialInput(void) TasmotaGlobal.serial_in_buffer[TasmotaGlobal.serial_in_byte_counter] = 0; // Serial data completed TasmotaGlobal.seriallog_level = (Settings.seriallog_level < LOG_LEVEL_INFO) ? (uint8_t)LOG_LEVEL_INFO : Settings.seriallog_level; if (serial_buffer_overrun) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_COMMAND "Serial buffer overrun")); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_COMMAND "Serial buffer overrun")); } else { AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_COMMAND "%s"), TasmotaGlobal.serial_in_buffer); ExecuteCommand(TasmotaGlobal.serial_in_buffer, SRC_SERIAL); @@ -1519,7 +1519,7 @@ void GpioInit(void) } SetModuleType(); -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("DBG: Used GPIOs %d"), GPIO_SENSOR_END); +// AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: Used GPIOs %d"), GPIO_SENSOR_END); #ifdef ESP8266 ConvertGpios(); @@ -1685,7 +1685,7 @@ void GpioInit(void) for (uint32_t i = 0; i < ARRAY_SIZE(TasmotaGlobal.my_module.io); i++) { uint32_t mpin = ValidPin(i, TasmotaGlobal.my_module.io[i]); -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("INI: gpio pin %d, mpin %d"), i, mpin); +// AddLog(LOG_LEVEL_DEBUG, PSTR("INI: gpio pin %d, mpin %d"), i, mpin); if (AGPIO(GPIO_OUTPUT_HI) == mpin) { pinMode(i, OUTPUT); digitalWrite(i, 1); diff --git a/tasmota/support_udp.ino b/tasmota/support_udp.ino index 07aa6736e..455b54b19 100644 --- a/tasmota/support_udp.ino +++ b/tasmota/support_udp.ino @@ -71,7 +71,7 @@ bool UdpDisconnect(void) // stop all WiFiUDP::stopAll(); #endif // !USE_DEVICE_GROUPS - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_MULTICAST_DISABLED)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_MULTICAST_DISABLED)); udp_connected = false; } return udp_connected; @@ -87,18 +87,18 @@ bool UdpConnect(void) ip_addr_t addr = IPADDR4_INIT(INADDR_ANY); if (UdpCtx.listen(&addr, 1900)) { // port 1900 // OK - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPNP D_MULTICAST_REJOINED)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_UPNP D_MULTICAST_REJOINED)); udp_connected = true; } #endif // ESP8266 #ifdef ESP32 if (PortUdp.beginMulticast(WiFi.localIP(), IPAddress(239,255,255,250), 1900)) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPNP D_MULTICAST_REJOINED)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_UPNP D_MULTICAST_REJOINED)); udp_connected = true; #endif // ESP32 } if (!udp_connected) { // if connection failed - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPNP D_MULTICAST_JOIN_FAILED)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_UPNP D_MULTICAST_JOIN_FAILED)); } } return udp_connected; @@ -120,7 +120,7 @@ void PollUdp(void) packet->buf[packet->len] = 0; // add NULL at the end of the packet char * packet_buffer = (char*) &packet->buf; int32_t len = packet->len; - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: Packet (%d)"), len); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: Packet (%d)"), len); #endif // ESP8266 #ifdef ESP32 while (uint32_t pack_len = PortUdp.parsePacket()) { @@ -129,7 +129,7 @@ void PollUdp(void) int32_t len = PortUdp.read(packet_buffer, UDP_BUFFER_SIZE -1); packet_buffer[len] = 0; PortUdp.flush(); - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: Packet (%d/%d)"), len, pack_len); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: Packet (%d/%d)"), len, pack_len); #endif // ESP32 // AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("\n%s"), packet_buffer); @@ -175,7 +175,7 @@ void PollUdp(void) #ifdef USE_EMULATION_HUE if (!udp_proccessed && (EMUL_HUE == Settings.flag2.emulation)) { - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: HUE")); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: HUE")); if ((strstr_P(packet_buffer, PSTR(":device:basic:1")) != nullptr) || (strstr_P(packet_buffer, UPNP_ROOTDEVICE) != nullptr) || (strstr_P(packet_buffer, SSDPSEARCH_ALL) != nullptr) || diff --git a/tasmota/support_wifi.ino b/tasmota/support_wifi.ino index 4c37b074a..1c6f1dbe6 100644 --- a/tasmota/support_wifi.ino +++ b/tasmota/support_wifi.ino @@ -102,11 +102,11 @@ void WifiConfig(uint8_t type) TasmotaGlobal.restart_flag = 2; } else if (WIFI_SERIAL == Wifi.config_type) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_WCFG_6_SERIAL " " D_ACTIVE_FOR_3_MINUTES)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_WCFG_6_SERIAL " " D_ACTIVE_FOR_3_MINUTES)); } #ifdef USE_WEBSERVER else if (WIFI_MANAGER == Wifi.config_type || WIFI_MANAGER_RESET_ONLY == Wifi.config_type) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_WCFG_2_WIFIMANAGER " " D_ACTIVE_FOR_3_MINUTES)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_WCFG_2_WIFIMANAGER " " D_ACTIVE_FOR_3_MINUTES)); WifiManagerBegin(WIFI_MANAGER_RESET_ONLY == Wifi.config_type); } #endif // USE_WEBSERVER @@ -125,7 +125,7 @@ void WifiSetMode(WiFiMode_t wifi_mode) uint32_t retry = 2; while (!WiFi.mode(wifi_mode) && retry--) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI "Retry set Mode...")); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI "Retry set Mode...")); delay(100); } @@ -217,7 +217,7 @@ void WifiBegin(uint8_t flag, uint8_t channel) } else { WiFi.begin(SettingsText(SET_STASSID1 + Settings.sta_active), SettingsText(SET_STAPWD1 + Settings.sta_active)); } - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECTING_TO_AP "%d %s%s " D_IN_MODE " 11%c " D_AS " %s..."), + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECTING_TO_AP "%d %s%s " D_IN_MODE " 11%c " D_AS " %s..."), Settings.sta_active +1, SettingsText(SET_STASSID1 + Settings.sta_active), stemp, pgm_read_byte(&kWifiPhyMode[WiFi.getPhyMode() & 0x3]), TasmotaGlobal.hostname); #if LWIP_IPV6 @@ -225,11 +225,11 @@ void WifiBegin(uint8_t flag, uint8_t channel) uint16_t cfgcnt = 0; for (auto addr : addrList) { if ((configured = !addr.isLocal() && addr.isV6()) || cfgcnt==30) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI "Got IPv6 global address %s"), addr.toString().c_str()); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI "Got IPv6 global address %s"), addr.toString().c_str()); break; // IPv6 is mandatory but stop after 15 seconds } delay(500); // Loop until real IPv6 address is aquired or too many tries failed - cfgcnt++; + cfgcnt++; } } #endif // LWIP_IPV6=1 @@ -260,7 +260,7 @@ void WifiBeginAfterScan(void) if (WiFi.scanComplete() != WIFI_SCAN_RUNNING) { WiFi.scanNetworks(true); // Start wifi scan async Wifi.scan_state++; - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI "Network (re)scan started...")); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI "Network (re)scan started...")); return; } } @@ -308,7 +308,7 @@ void WifiBeginAfterScan(void) } } char hex_char[18]; - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI "Network %d, AP%c, SSId %s, Channel %d, BSSId %s, RSSI %d, Encryption %d"), + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI "Network %d, AP%c, SSId %s, Channel %d, BSSId %s, RSSI %d, Encryption %d"), i, (known) ? (j) ? '2' : '1' : '-', ssid_scan.c_str(), @@ -373,11 +373,11 @@ String WifiGetIPv6(void) // Check to see if we have any routable IP address inline bool WifiCheck_hasIP(IPAddress const & ip_address) { -#ifdef LWIP2_IPV6 +#ifdef LWIP2_IPV6 return !a.isLocal(); #else return static_cast(ip_address) != 0; -#endif +#endif } void WifiCheckIp(void) @@ -387,8 +387,8 @@ void WifiCheckIp(void) Wifi.counter = WIFI_CHECK_SEC; Wifi.retry = Wifi.retry_init; if (Wifi.status != WL_CONNECTED) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECTED)); -// AddLog_P(LOG_LEVEL_INFO, PSTR("Wifi: Set IP addresses")); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECTED)); +// AddLog(LOG_LEVEL_INFO, PSTR("Wifi: Set IP addresses")); Settings.ipv4_address[1] = (uint32_t)WiFi.gatewayIP(); Settings.ipv4_address[2] = (uint32_t)WiFi.subnetMask(); Settings.ipv4_address[3] = (uint32_t)WiFi.dnsIP(); @@ -405,12 +405,12 @@ void WifiCheckIp(void) Wifi.status = WiFi.status(); switch (Wifi.status) { case WL_CONNECTED: - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECT_FAILED_NO_IP_ADDRESS)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECT_FAILED_NO_IP_ADDRESS)); Wifi.status = 0; Wifi.retry = Wifi.retry_init; break; case WL_NO_SSID_AVAIL: - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECT_FAILED_AP_NOT_REACHED)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECT_FAILED_AP_NOT_REACHED)); Settings.wifi_channel = 0; // Disable stored AP if (WIFI_WAIT == Settings.sta_config) { Wifi.retry = Wifi.retry_init; @@ -424,7 +424,7 @@ void WifiCheckIp(void) } break; case WL_CONNECT_FAILED: - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECT_FAILED_WRONG_PASSWORD)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECT_FAILED_WRONG_PASSWORD)); Settings.wifi_channel = 0; // Disable stored AP if (Wifi.retry > (Wifi.retry_init / 2)) { Wifi.retry = Wifi.retry_init / 2; @@ -435,7 +435,7 @@ void WifiCheckIp(void) break; default: // WL_IDLE_STATUS and WL_DISCONNECTED if (!Wifi.retry || ((Wifi.retry_init / 2) == Wifi.retry)) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECT_FAILED_AP_TIMEOUT)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECT_FAILED_AP_TIMEOUT)); Settings.wifi_channel = 0; // Disable stored AP } else { if (!strlen(SettingsText(SET_STASSID1)) && !strlen(SettingsText(SET_STASSID2))) { @@ -443,7 +443,7 @@ void WifiCheckIp(void) wifi_config_tool = WIFI_MANAGER; // Skip empty SSIDs and start Wifi config tool Wifi.retry = 0; } else { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_ATTEMPTING_CONNECTION)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_ATTEMPTING_CONNECTION)); } } } @@ -491,7 +491,7 @@ void WifiCheck(uint8_t param) SettingsUpdateText(SET_STAPWD1, WiFi.psk().c_str()); } Settings.sta_active = 0; - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_WCFG_2_WIFIMANAGER D_CMND_SSID "1 %s"), SettingsText(SET_STASSID1)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_WCFG_2_WIFIMANAGER D_CMND_SSID "1 %s"), SettingsText(SET_STASSID1)); } } if (!Wifi.config_counter) { @@ -502,7 +502,7 @@ void WifiCheck(uint8_t param) if (Wifi.scan_state) { WifiBeginAfterScan(); } if (Wifi.counter <= 0) { - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_WIFI D_CHECKING_CONNECTION)); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_WIFI D_CHECKING_CONNECTION)); Wifi.counter = WIFI_CHECK_SEC; WifiCheckIp(); } @@ -584,7 +584,7 @@ void WifiConnect(void) #ifdef WIFI_RF_PRE_INIT if (rf_pre_init_flag) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI "Pre-init done")); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI "Pre-init done")); } #endif // WIFI_RF_PRE_INIT } @@ -656,7 +656,7 @@ extern "C" { } void stationKeepAliveNow(void) { - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_WIFI "Sending Gratuitous ARP")); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_WIFI "Sending Gratuitous ARP")); for (netif* interface = netif_list; interface != nullptr; interface = interface->next) if ( (interface->flags & NETIF_FLAG_LINK_UP) @@ -744,11 +744,11 @@ uint32_t WifiGetNtp(void) { ntp_server_id++; } if (!resolved_ip) { -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("NTP: No server found")); +// AddLog(LOG_LEVEL_DEBUG, PSTR("NTP: No server found")); return 0; } -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("NTP: Name %s, IP %s"), ntp_server, time_server_ip.toString().c_str()); +// AddLog(LOG_LEVEL_DEBUG, PSTR("NTP: Name %s, IP %s"), ntp_server, time_server_ip.toString().c_str()); WiFiUDP udp; @@ -798,7 +798,7 @@ uint32_t WifiGetNtp(void) { if ((packet_buffer[0] & 0b11000000) == 0b11000000) { // Leap-Indicator: unknown (clock unsynchronized) // See: https://github.com/letscontrolit/ESPEasy/issues/2886#issuecomment-586656384 - AddLog_P(LOG_LEVEL_DEBUG, PSTR("NTP: IP %s unsynched"), time_server_ip.toString().c_str()); + AddLog(LOG_LEVEL_DEBUG, PSTR("NTP: IP %s unsynched"), time_server_ip.toString().c_str()); ntp_server_id++; // Next server next time return 0; } @@ -818,7 +818,7 @@ uint32_t WifiGetNtp(void) { delay(10); } // Timeout. - AddLog_P(LOG_LEVEL_DEBUG, PSTR("NTP: No reply")); + AddLog(LOG_LEVEL_DEBUG, PSTR("NTP: No reply")); udp.stop(); ntp_server_id++; // Next server next time return 0; diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index 9772b0fbe..f934a60a2 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -312,7 +312,7 @@ void setup(void) { Settings.module = Settings.fallback_module; // Reset module to fallback module // Settings.last_module = Settings.fallback_module; } - AddLog_P(LOG_LEVEL_INFO, PSTR("FRC: " D_LOG_SOME_SETTINGS_RESET " (%d)"), RtcReboot.fast_reboot_count); + AddLog(LOG_LEVEL_INFO, PSTR("FRC: " D_LOG_SOME_SETTINGS_RESET " (%d)"), RtcReboot.fast_reboot_count); } } @@ -339,10 +339,10 @@ void setup(void) { SetPowerOnState(); - AddLog_P(LOG_LEVEL_INFO, PSTR(D_PROJECT " %s %s " D_VERSION " %s%s-" ARDUINO_CORE_RELEASE "(%s)"), + AddLog(LOG_LEVEL_INFO, PSTR(D_PROJECT " %s %s " D_VERSION " %s%s-" ARDUINO_CORE_RELEASE "(%s)"), PSTR(PROJECT), SettingsText(SET_DEVICENAME), TasmotaGlobal.version, TasmotaGlobal.image_name, GetBuildDateAndTime().c_str()); #ifdef FIRMWARE_MINIMAL - AddLog_P(LOG_LEVEL_INFO, PSTR(D_WARNING_MINIMAL_VERSION)); + AddLog(LOG_LEVEL_INFO, PSTR(D_WARNING_MINIMAL_VERSION)); #endif // FIRMWARE_MINIMAL RtcInit(); diff --git a/tasmota/xdrv_01_webserver.ino b/tasmota/xdrv_01_webserver.ino index 62b4e30a5..68d1eb0dc 100644 --- a/tasmota/xdrv_01_webserver.ino +++ b/tasmota/xdrv_01_webserver.ino @@ -392,7 +392,7 @@ void ShowWebSource(uint32_t source) { if ((source > 0) && (source < SRC_MAX)) { char stemp1[20]; - AddLog_P(LOG_LEVEL_DEBUG, PSTR("SRC: %s from %s"), GetTextIndexed(stemp1, sizeof(stemp1), source, kCommandSource), Webserver->client().remoteIP().toString().c_str()); + AddLog(LOG_LEVEL_DEBUG, PSTR("SRC: %s from %s"), GetTextIndexed(stemp1, sizeof(stemp1), source, kCommandSource), Webserver->client().remoteIP().toString().c_str()); } } @@ -475,14 +475,14 @@ void StartWebserver(int type, IPAddress ipweb) #if LWIP_IPV6 String ipv6_addr = WifiGetIPv6(); if (ipv6_addr!="") { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_HTTP D_WEBSERVER_ACTIVE_ON " %s%s " D_WITH_IP_ADDRESS " %s and IPv6 global address %s "), + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_HTTP D_WEBSERVER_ACTIVE_ON " %s%s " D_WITH_IP_ADDRESS " %s and IPv6 global address %s "), NetworkHostname(), (Mdns.begun) ? PSTR(".local") : "", ipweb.toString().c_str(), ipv6_addr.c_str()); } else { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_HTTP D_WEBSERVER_ACTIVE_ON " %s%s " D_WITH_IP_ADDRESS " %s"), + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_HTTP D_WEBSERVER_ACTIVE_ON " %s%s " D_WITH_IP_ADDRESS " %s"), NetworkHostname(), (Mdns.begun) ? PSTR(".local") : "", ipweb.toString().c_str()); } #else - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_HTTP D_WEBSERVER_ACTIVE_ON " %s%s " D_WITH_IP_ADDRESS " %s"), + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_HTTP D_WEBSERVER_ACTIVE_ON " %s%s " D_WITH_IP_ADDRESS " %s"), NetworkHostname(), (Mdns.begun) ? PSTR(".local") : "", ipweb.toString().c_str()); #endif // LWIP_IPV6 = 1 TasmotaGlobal.rules_flag.http_init = 1; @@ -495,7 +495,7 @@ void StopWebserver(void) if (Web.state) { Webserver->close(); Web.state = HTTP_OFF; - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_HTTP D_WEBSERVER_STOPPED)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_HTTP D_WEBSERVER_STOPPED)); } } @@ -505,11 +505,11 @@ void WifiManagerBegin(bool reset_only) if (!TasmotaGlobal.global_state.wifi_down) { // WiFi.mode(WIFI_AP_STA); WifiSetMode(WIFI_AP_STA); - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_WIFIMANAGER_SET_ACCESSPOINT_AND_STATION)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_WIFIMANAGER_SET_ACCESSPOINT_AND_STATION)); } else { // WiFi.mode(WIFI_AP); WifiSetMode(WIFI_AP); - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_WIFIMANAGER_SET_ACCESSPOINT)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_WIFIMANAGER_SET_ACCESSPOINT)); } StopWebserver(); @@ -624,7 +624,7 @@ void _WSContentSendBuffer(void) return; } else if (len == sizeof(TasmotaGlobal.mqtt_data)) { - AddLog_P(LOG_LEVEL_INFO, PSTR("HTP: Content too large")); + AddLog(LOG_LEVEL_INFO, PSTR("HTP: Content too large")); } else if (len < CHUNKED_BUFFER_SIZE) { // Append chunk buffer with small content Web.chunk_buffer += TasmotaGlobal.mqtt_data; @@ -819,7 +819,7 @@ void WebRestart(uint32_t type) // type 0 = restart // type 1 = restart after config change // type 2 = restart after config change with possible ip address change too - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_RESTART)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_RESTART)); bool reset_only = (HTTP_MANAGER_RESET_ONLY == Web.state); @@ -905,7 +905,7 @@ void HandleRoot(void) return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_MAIN_MENU)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_MAIN_MENU)); char stemp[33]; @@ -1284,7 +1284,7 @@ void HandleConfiguration(void) { if (!HttpCheckPriviledgedAccess()) { return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURATION)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURATION)); WSContentStart_P(PSTR(D_CONFIGURATION)); WSContentSendStyle(); @@ -1403,7 +1403,7 @@ void HandleTemplateConfiguration(void) return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_TEMPLATE)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_TEMPLATE)); WSContentStart_P(PSTR(D_CONFIGURE_TEMPLATE)); WSContentSend_P(HTTP_SCRIPT_MODULE_TEMPLATE); @@ -1512,7 +1512,7 @@ void HandleModuleConfiguration(void) return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_MODULE)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_MODULE)); char stemp[30]; // Sensor name uint32_t midx; @@ -1592,7 +1592,7 @@ void ModuleSaveSettings(void) } } - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MODULE "%s " D_CMND_MODULE "%s"), ModuleName().c_str(), gpios.c_str()); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_MODULE "%s " D_CMND_MODULE "%s"), ModuleName().c_str(), gpios.c_str()); } /*-------------------------------------------------------------------------------------------*/ @@ -1623,7 +1623,7 @@ void HandleWifiConfiguration(void) { if (!HttpCheckPriviledgedAccess(!WifiIsInManagerMode())) { return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_WIFI)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_WIFI)); if (Webserver->hasArg(F("save")) && HTTP_MANAGER_RESET_ONLY != Web.state) { WifiSaveSettings(); @@ -1645,10 +1645,10 @@ void HandleWifiConfiguration(void) UdpDisconnect(); #endif // USE_EMULATION int n = WiFi.scanNetworks(); - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_SCAN_DONE)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_SCAN_DONE)); if (0 == n) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_NO_NETWORKS_FOUND)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_NO_NETWORKS_FOUND)); WSContentSend_P(PSTR(D_NO_NETWORKS_FOUND)); WSContentSend_P(PSTR(". " D_REFRESH_TO_SCAN_AGAIN ".")); } else { @@ -1802,7 +1802,7 @@ void HandleLoggingConfiguration(void) { if (!HttpCheckPriviledgedAccess()) { return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_LOGGING)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_LOGGING)); if (Webserver->hasArg("save")) { LoggingSaveSettings(); @@ -1867,7 +1867,7 @@ void HandleOtherConfiguration(void) { if (!HttpCheckPriviledgedAccess()) { return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_OTHER)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_OTHER)); if (Webserver->hasArg(F("save"))) { OtherSaveSettings(); @@ -1970,7 +1970,7 @@ void HandleBackupConfiguration(void) { if (!HttpCheckPriviledgedAccess()) { return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_BACKUP_CONFIGURATION)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_BACKUP_CONFIGURATION)); if (!SettingsBufferAlloc()) { return; } @@ -2012,7 +2012,7 @@ void HandleResetConfiguration(void) { if (!HttpCheckPriviledgedAccess(!WifiIsInManagerMode())) { return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_RESET_CONFIGURATION)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_RESET_CONFIGURATION)); WSContentStart_P(PSTR(D_RESET_CONFIGURATION), !WifiIsInManagerMode()); WSContentSendStyle(); @@ -2030,7 +2030,7 @@ void HandleRestoreConfiguration(void) { if (!HttpCheckPriviledgedAccess()) { return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_RESTORE_CONFIGURATION)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_RESTORE_CONFIGURATION)); WSContentStart_P(PSTR(D_RESTORE_CONFIGURATION)); WSContentSendStyle(); @@ -2052,7 +2052,7 @@ void HandleInformation(void) { if (!HttpCheckPriviledgedAccess()) { return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_INFORMATION)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_INFORMATION)); char stopic[TOPSZ]; @@ -2242,7 +2242,7 @@ uint32_t BUploadWriteBuffer(uint8_t *buf, size_t size) { void HandleUpgradeFirmware(void) { if (!HttpCheckPriviledgedAccess()) { return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_FIRMWARE_UPGRADE)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_FIRMWARE_UPGRADE)); WSContentStart_P(PSTR(D_FIRMWARE_UPGRADE)); WSContentSendStyle(); @@ -2259,7 +2259,7 @@ void HandleUpgradeFirmwareStart(void) { char command[TOPSZ + 10]; // OtaUrl - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_UPGRADE_STARTED)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_UPGRADE_STARTED)); WifiConfigCounter(); char otaurl[TOPSZ]; @@ -2294,7 +2294,7 @@ void HandleUploadDone(void) { } #endif // USE_ZIGBEE_EZSP - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_UPLOAD_DONE)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_UPLOAD_DONE)); WifiConfigCounter(); UploadServices(1); @@ -2339,7 +2339,7 @@ void UploadServices(uint32_t start_service) { Web.upload_services_stopped = !start_service; if (start_service) { -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("UPL: Services enabled")); +// AddLog(LOG_LEVEL_DEBUG, PSTR("UPL: Services enabled")); /* MqttRetryCounter(0); @@ -2355,7 +2355,7 @@ void UploadServices(uint32_t start_service) { #endif // USE_EMULATION } else { -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("UPL: Services disabled")); +// AddLog(LOG_LEVEL_DEBUG, PSTR("UPL: Services disabled")); #ifdef USE_BLE_ESP32 ExtStopBLE(); @@ -2390,7 +2390,7 @@ void HandleUploadLoop(void) { if (UPL_TASMOTA == Web.upload_file_type) { Update.end(); } UploadServices(1); -// AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "Upload error %d"), Web.upload_error); +// AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "Upload error %d"), Web.upload_error); upload_error_signalled = true; } @@ -2413,7 +2413,7 @@ void HandleUploadLoop(void) { } SettingsSave(1); // Free flash for upload - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD D_FILE " %s"), upload.filename.c_str()); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD D_FILE " %s"), upload.filename.c_str()); if (UPL_SETTINGS == Web.upload_file_type) { if (!SettingsBufferAlloc()) { @@ -2492,7 +2492,7 @@ void HandleUploadLoop(void) { return; } } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "File type %d"), Web.upload_file_type); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "File type %d"), Web.upload_file_type); } // First block received if (UPL_SETTINGS == Web.upload_file_type) { @@ -2514,7 +2514,7 @@ void HandleUploadLoop(void) { #ifdef USE_WEB_FW_UPGRADE else if (BUpload.active) { // Write a block -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("DBG: Size %d"), upload.currentSize); +// AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: Size %d"), upload.currentSize); // AddLogBuffer(LOG_LEVEL_DEBUG, upload.buf, 32); Web.upload_error = BUploadWriteBuffer(upload.buf, upload.currentSize); if (Web.upload_error != 0) { return; } @@ -2525,7 +2525,7 @@ void HandleUploadLoop(void) { return; } if (upload.totalSize && !(upload.totalSize % 102400)) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "Progress %d kB"), upload.totalSize / 1024); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "Progress %d kB"), upload.totalSize / 1024); } } @@ -2582,12 +2582,12 @@ void HandleUploadLoop(void) { // Done writing the data to SPI flash BUpload.active = false; - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Transfer %u bytes"), upload.totalSize); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Transfer %u bytes"), upload.totalSize); uint8_t* data = FlashDirectAccess(); // uint32_t* values = (uint32_t*)(data); // Only 4-byte access allowed -// AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "Head 0x%08X"), values[0]); +// AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "Head 0x%08X"), values[0]); uint32_t error = 0; #ifdef USE_RF_FLASH @@ -2616,7 +2616,7 @@ void HandleUploadLoop(void) { } #endif // USE_ZIGBEE_EZSP if (error != 0) { -// AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "Transfer error %d"), error); +// AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "Transfer error %d"), error); Web.upload_error = error + (100 * Web.upload_file_type); // Add offset to discriminate transfer errors return; } @@ -2626,7 +2626,7 @@ void HandleUploadLoop(void) { Web.upload_error = 6; // Upload failed. Enable logging 3 return; } - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD D_SUCCESSFUL " %u bytes"), upload.totalSize); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD D_SUCCESSFUL " %u bytes"), upload.totalSize); } // ***** Step4: Abort upload file @@ -2658,7 +2658,7 @@ void HandleHttpCommand(void) { if (!HttpCheckPriviledgedAccess(false)) { return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_COMMAND)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_COMMAND)); if (!WebAuthenticate()) { // Prefer authorization via HTTP header (Basic auth), if it fails, use legacy method via GET parameters @@ -2717,7 +2717,7 @@ void HandleConsole(void) return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONSOLE)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONSOLE)); WSContentStart_P(PSTR(D_CONSOLE)); WSContentSend_P(HTTP_SCRIPT_CONSOL, Settings.web_refresh); @@ -2764,7 +2764,7 @@ void HandleConsoleRefresh(void) void HandleNotFound(void) { -// AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP "Not found (%s)"), Webserver->uri().c_str()); +// AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP "Not found (%s)"), Webserver->uri().c_str()); if (CaptivePortal()) { return; } // If captive portal redirect instead of displaying the error page. @@ -2791,7 +2791,7 @@ bool CaptivePortal(void) { // Possible hostHeader: connectivitycheck.gstatic.com or 192.168.4.1 if ((WifiIsInManagerMode()) && !ValidIpAddress(Webserver->hostHeader().c_str())) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_REDIRECTED)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_REDIRECTED)); Webserver->sendHeader(F("Location"), String(F("http://")) + Webserver->client().localIP().toString(), true); WSSend(302, CT_PLAIN, ""); // Empty content inhibits Content-length header so we have to close the socket ourselves. diff --git a/tasmota/xdrv_02_mqtt.ino b/tasmota/xdrv_02_mqtt.ino index f14581128..0c9779744 100644 --- a/tasmota/xdrv_02_mqtt.ino +++ b/tasmota/xdrv_02_mqtt.ino @@ -273,12 +273,12 @@ void MqttRetryCounter(uint8_t value) { } void MqttSubscribe(const char *topic) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT D_SUBSCRIBE_TO " %s"), topic); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT D_SUBSCRIBE_TO " %s"), topic); MqttSubscribeLib(topic); } void MqttUnsubscribe(const char *topic) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT D_UNSUBSCRIBE_FROM " %s"), topic); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT D_UNSUBSCRIBE_FROM " %s"), topic); MqttUnsubscribeLib(topic); } @@ -381,7 +381,7 @@ void MqttPublishPrefixTopic_P(uint32_t prefix, const char* subtopic, bool retain free(mqtt_save); bool result = MqttClient.publish(romram, TasmotaGlobal.mqtt_data, false); - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT "Updated shadow: %s"), romram); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT "Updated shadow: %s"), romram); yield(); // #3313 } #endif // USE_MQTT_AWS_IOT @@ -475,7 +475,7 @@ void MqttDisconnected(int state) { MqttClient.disconnect(); - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT D_CONNECT_FAILED_TO " %s:%d, rc %d. " D_RETRY_IN " %d " D_UNIT_SECOND), SettingsText(SET_MQTT_HOST), Settings.mqtt_port, state, Mqtt.retry_counter); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT D_CONNECT_FAILED_TO " %s:%d, rc %d. " D_RETRY_IN " %d " D_UNIT_SECOND), SettingsText(SET_MQTT_HOST), Settings.mqtt_port, state, Mqtt.retry_counter); TasmotaGlobal.rules_flag.mqtt_disconnected = 1; } @@ -483,7 +483,7 @@ void MqttConnected(void) { char stopic[TOPSZ]; if (Mqtt.allowed) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT D_CONNECTED)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT D_CONNECTED)); Mqtt.connected = true; Mqtt.retry_counter = 0; Mqtt.retry_counter_delay = 1; @@ -604,7 +604,7 @@ void MqttReconnect(void) { #endif #endif - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT D_ATTEMPTING_CONNECTION)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT D_ATTEMPTING_CONNECTION)); char *mqtt_user = nullptr; char *mqtt_pwd = nullptr; @@ -680,21 +680,21 @@ void MqttReconnect(void) { #ifdef USE_MQTT_TLS if (Mqtt.mqtt_tls) { #ifdef ESP8266 - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT "TLS connected in %d ms, max ThunkStack used %d"), + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT "TLS connected in %d ms, max ThunkStack used %d"), millis() - mqtt_connect_time, tlsClient->getMaxThunkStackUse()); #elif defined(ESP32) - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT "TLS connected in %d ms, stack low mark %d"), + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT "TLS connected in %d ms, stack low mark %d"), millis() - mqtt_connect_time, uxTaskGetStackHighWaterMark(nullptr)); #endif if (!tlsClient->getMFLNStatus()) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT "MFLN not supported by TLS server")); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT "MFLN not supported by TLS server")); } #ifndef USE_MQTT_TLS_CA_CERT // don't bother with fingerprints if using CA validation const uint8_t *recv_fingerprint = tlsClient->getRecvPubKeyFingerprint(); // create a printable version of the fingerprint received char buf_fingerprint[64]; ToHex_P(recv_fingerprint, 20, buf_fingerprint, sizeof(buf_fingerprint), ' '); - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT "Server fingerprint: %s"), buf_fingerprint); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT "Server fingerprint: %s"), buf_fingerprint); bool learned = false; @@ -713,7 +713,7 @@ void MqttReconnect(void) { } if (learned) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT "Fingerprint learned: %s"), buf_fingerprint); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT "Fingerprint learned: %s"), buf_fingerprint); SettingsSaveAll(); // save settings } @@ -724,7 +724,7 @@ void MqttReconnect(void) { } else { #ifdef USE_MQTT_TLS if (Mqtt.mqtt_tls) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT "TLS connection error: %d"), tlsClient->getLastError()); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT "TLS connection error: %d"), tlsClient->getLastError()); } #endif MqttDisconnected(MqttClient.state()); // status codes are documented here http://pubsubclient.knolleary.net/api.html#state @@ -1128,7 +1128,7 @@ void CmndTlsKey(void) { // first copy SPI buffer into ram uint8_t *spi_buffer = (uint8_t*) malloc(tls_spi_len); if (!spi_buffer) { - AddLog_P(LOG_LEVEL_ERROR, ALLOCATE_ERROR); + AddLog(LOG_LEVEL_ERROR, ALLOCATE_ERROR); return; } memcpy_P(spi_buffer, tls_spi_start, tls_spi_len); @@ -1142,7 +1142,7 @@ void CmndTlsKey(void) { if (bin_len > 0) { bin_buf = (uint8_t*) malloc(bin_len + 4); if (!bin_buf) { - AddLog_P(LOG_LEVEL_ERROR, ALLOCATE_ERROR); + AddLog(LOG_LEVEL_ERROR, ALLOCATE_ERROR); free(spi_buffer); return; } @@ -1163,7 +1163,7 @@ void CmndTlsKey(void) { if (bin_len > 0) { if (bin_len != 32) { // no private key was previously stored, abort - AddLog_P(LOG_LEVEL_INFO, PSTR("TLSKey: Certificate must be 32 bytes: %d."), bin_len); + AddLog(LOG_LEVEL_INFO, PSTR("TLSKey: Certificate must be 32 bytes: %d."), bin_len); free(spi_buffer); free(bin_buf); return; @@ -1180,14 +1180,14 @@ void CmndTlsKey(void) { // Try to write Certificate if (TLS_NAME_SKEY != tls_dir.entry[0].name) { // no private key was previously stored, abort - AddLog_P(LOG_LEVEL_INFO, PSTR("TLSKey: cannot store Cert if no Key previously stored.")); + AddLog(LOG_LEVEL_INFO, PSTR("TLSKey: cannot store Cert if no Key previously stored.")); free(spi_buffer); free(bin_buf); return; } if (bin_len <= 256) { // Certificate lenght too short - AddLog_P(LOG_LEVEL_INFO, PSTR("TLSKey: Certificate length too short: %d."), bin_len); + AddLog(LOG_LEVEL_INFO, PSTR("TLSKey: Certificate length too short: %d."), bin_len); free(spi_buffer); free(bin_buf); return; @@ -1264,7 +1264,7 @@ void HandleMqttConfiguration(void) { if (!HttpCheckPriviledgedAccess()) { return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_MQTT)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_MQTT)); if (Webserver->hasArg(F("save"))) { MqttSaveSettings(); diff --git a/tasmota/xdrv_03_energy.ino b/tasmota/xdrv_03_energy.ino index f57431203..dd302ebf1 100644 --- a/tasmota/xdrv_03_energy.ino +++ b/tasmota/xdrv_03_energy.ino @@ -227,7 +227,7 @@ void EnergyUpdateTotal(float value, bool kwh) { // char energy_total_chr[FLOATSZ]; // dtostrfd(value, 4, energy_total_chr); -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("NRG: Energy Total %s %sWh"), energy_total_chr, (kwh) ? "k" : ""); +// AddLog(LOG_LEVEL_DEBUG, PSTR("NRG: Energy Total %s %sWh"), energy_total_chr, (kwh) ? "k" : ""); uint32_t multiplier = (kwh) ? 100000 : 100; // kWh or Wh to deca milli Wh @@ -244,7 +244,7 @@ void EnergyUpdateTotal(float value, bool kwh) Settings.energy_kWhtotal = RtcSettings.energy_kWhtotal; Energy.total = (float)(RtcSettings.energy_kWhtotal + Energy.kWhtoday_offset + Energy.kWhtoday) / 100000; Settings.energy_kWhtotal_time = (!Energy.kWhtoday_offset) ? LocalTime() : Midnight(); -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("NRG: Energy Total updated with hardware value")); +// AddLog(LOG_LEVEL_DEBUG, PSTR("NRG: Energy Total updated with hardware value")); } EnergyUpdateToday(); } @@ -338,7 +338,7 @@ void EnergyMarginCheck(void) for (uint32_t phase = 0; phase < Energy.phase_count; phase++) { uint16_t active_power = (uint16_t)(Energy.active_power[phase]); -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("NRG: APower %d, HPower0 %d, HPower1 %d, HPower2 %d"), active_power, Energy.power_history[phase][0], Energy.power_history[phase][1], Energy.power_history[phase][2]); +// AddLog(LOG_LEVEL_DEBUG, PSTR("NRG: APower %d, HPower0 %d, HPower1 %d, HPower2 %d"), active_power, Energy.power_history[phase][0], Energy.power_history[phase][1], Energy.power_history[phase][2]); if (Settings.energy_power_delta[phase]) { power_diff[phase] = active_power - Energy.power_history[phase][0]; @@ -509,7 +509,7 @@ void EnergyEverySecond(void) char temperature[33]; dtostrfd(TasmotaGlobal.temperature_celsius, 1, temperature); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("NRG: GlobTemp %s"), temperature); + AddLog(LOG_LEVEL_DEBUG, PSTR("NRG: GlobTemp %s"), temperature); SetAllPower(POWER_ALL_OFF, SRC_OVERTEMP); } @@ -537,7 +537,7 @@ void EnergyEverySecond(void) } if (!data_valid) { Energy.start_energy = 0; - AddLog_P(LOG_LEVEL_DEBUG, PSTR("NRG: Energy reset by " STR(ENERGY_WATCHDOG) " seconds invalid data")); + AddLog(LOG_LEVEL_DEBUG, PSTR("NRG: Energy reset by " STR(ENERGY_WATCHDOG) " seconds invalid data")); XnrgCall(FUNC_ENERGY_RESET); } diff --git a/tasmota/xdrv_04_light.ino b/tasmota/xdrv_04_light.ino index 7e0907dd1..dad57aef3 100644 --- a/tasmota/xdrv_04_light.ino +++ b/tasmota/xdrv_04_light.ino @@ -324,7 +324,7 @@ class LightStateClass { public: LightStateClass() { - //AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::Constructor RGB raw (%d %d %d) HS (%d %d) bri (%d)", _r, _g, _b, _hue, _sat, _bri); + //AddLog(LOG_LEVEL_DEBUG_MORE, "LightStateClass::Constructor RGB raw (%d %d %d) HS (%d %d) bri (%d)", _r, _g, _b, _hue, _sat, _bri); } void setSubType(uint8_t sub_type) { @@ -371,7 +371,7 @@ class LightStateClass { if (0 == _briCT) { _briCT = maxbri; } } #ifdef DEBUG_LIGHT - AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setColorMode prev_cm (%d) req_cm (%d) new_cm (%d)", prev_cm, cm, _color_mode); + AddLog(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setColorMode prev_cm (%d) req_cm (%d) new_cm (%d)", prev_cm, cm, _color_mode); #endif return prev_cm; } @@ -484,7 +484,7 @@ class LightStateClass { setBriRGB(_color_mode & LCM_RGB ? bri : 0); setBriCT(_color_mode & LCM_CT ? bri : 0); #ifdef DEBUG_LIGHT - AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setBri RGB raw (%d %d %d) HS (%d %d) bri (%d)", _r, _g, _b, _hue, _sat, _briRGB); + AddLog(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setBri RGB raw (%d %d %d) HS (%d %d) bri (%d)", _r, _g, _b, _hue, _sat, _briRGB); #endif } @@ -530,7 +530,7 @@ class LightStateClass { addCTMode(); } #ifdef DEBUG_LIGHT - AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setCT RGB raw (%d %d %d) HS (%d %d) briRGB (%d) briCT (%d) CT (%d)", _r, _g, _b, _hue, _sat, _briRGB, _briCT, _ct); + AddLog(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setCT RGB raw (%d %d %d) HS (%d %d) briRGB (%d) briCT (%d) CT (%d)", _r, _g, _b, _hue, _sat, _briRGB, _briCT, _ct); #endif } @@ -570,7 +570,7 @@ class LightStateClass { if (_color_mode & LCM_CT) { _briCT = free_range ? max : (sum > 255 ? 255 : sum); } } #ifdef DEBUG_LIGHT - AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setCW CW (%d %d) CT (%d) briCT (%d)", c, w, _ct, _briCT); + AddLog(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setCW CW (%d %d) CT (%d) briCT (%d)", c, w, _ct, _briCT); #endif } @@ -579,7 +579,7 @@ class LightStateClass { uint16_t hue; uint8_t sat; #ifdef DEBUG_LIGHT - AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setRGB RGB input (%d %d %d)", r, g, b); + AddLog(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setRGB RGB input (%d %d %d)", r, g, b); #endif uint32_t max = (r > g && r > b) ? r : (g > b) ? g : b; // 0..255 @@ -607,7 +607,7 @@ class LightStateClass { _hue = hue; _sat = sat; #ifdef DEBUG_LIGHT - AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setRGB RGB raw (%d %d %d) HS (%d %d) bri (%d)", _r, _g, _b, _hue, _sat, _briRGB); + AddLog(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setRGB RGB raw (%d %d %d) HS (%d %d) bri (%d)", _r, _g, _b, _hue, _sat, _briRGB); #endif return max; } @@ -622,8 +622,8 @@ class LightStateClass { _sat = sat; addRGBMode(); #ifdef DEBUG_LIGHT - AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setHS HS (%d %d) rgb (%d %d %d)", hue, sat, r, g, b); - AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setHS RGB raw (%d %d %d) HS (%d %d) bri (%d)", _r, _g, _b, _hue, _sat, _briRGB); + AddLog(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setHS HS (%d %d) rgb (%d %d %d)", hue, sat, r, g, b); + AddLog(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setHS RGB raw (%d %d %d) HS (%d %d) bri (%d)", _r, _g, _b, _hue, _sat, _briRGB); #endif } @@ -644,10 +644,10 @@ class LightStateClass { setRGB(channels[0], channels[1], channels[2]); setCW(channels[3], channels[4], true); // free range for WC and WW #ifdef DEBUG_LIGHT - AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setChannels (%d %d %d %d %d)", + AddLog(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setChannels (%d %d %d %d %d)", channels[0], channels[1], channels[2], channels[3], channels[4]); - AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setChannels CT (%d) briRGB (%d) briCT (%d)", _ct, _briRGB, _briCT); - AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setChannels Actuals (%d %d %d %d %d)", + AddLog(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setChannels CT (%d) briRGB (%d) briCT (%d)", _ct, _briRGB, _briCT); + AddLog(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setChannels Actuals (%d %d %d %d %d)", _r, _g, _b, _wc, _ww); #endif } @@ -704,9 +704,9 @@ public: void debugLogs() { uint8_t r,g,b,c,w; _state->getActualRGBCW(&r,&g,&b,&c,&w); - AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightControllerClass::debugLogs rgb (%d %d %d) cw (%d %d)", + AddLog(LOG_LEVEL_DEBUG_MORE, "LightControllerClass::debugLogs rgb (%d %d %d) cw (%d %d)", r, g, b, c, w); - AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightControllerClass::debugLogs lightCurrent (%d %d %d %d %d)", + AddLog(LOG_LEVEL_DEBUG_MORE, "LightControllerClass::debugLogs lightCurrent (%d %d %d %d %d)", Light.current_color[0], Light.current_color[1], Light.current_color[2], Light.current_color[3], Light.current_color[4]); } @@ -714,10 +714,10 @@ public: void loadSettings() { #ifdef DEBUG_LIGHT - AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightControllerClass::loadSettings Settings.light_color (%d %d %d %d %d - %d)", + AddLog(LOG_LEVEL_DEBUG_MORE, "LightControllerClass::loadSettings Settings.light_color (%d %d %d %d %d - %d)", Settings.light_color[0], Settings.light_color[1], Settings.light_color[2], Settings.light_color[3], Settings.light_color[4], Settings.light_dimmer); - AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightControllerClass::loadSettings light_type/sub (%d %d)", + AddLog(LOG_LEVEL_DEBUG_MORE, "LightControllerClass::loadSettings light_type/sub (%d %d)", TasmotaGlobal.light_type, Light.subtype); #endif if (_pwm_multi_channels) { @@ -892,7 +892,7 @@ public: } } #ifdef DEBUG_LIGHT - AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightControllerClass::saveSettings Settings.light_color (%d %d %d %d %d - %d)", + AddLog(LOG_LEVEL_DEBUG_MORE, "LightControllerClass::saveSettings Settings.light_color (%d %d %d %d %d - %d)", Settings.light_color[0], Settings.light_color[1], Settings.light_color[2], Settings.light_color[3], Settings.light_color[4], Settings.light_dimmer); #endif @@ -1074,7 +1074,7 @@ void LightCalcPWMRange(void) { Light.pwm_min = pwm_min; Light.pwm_max = pwm_max; - //AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("LightCalcPWMRange %d %d - %d %d"), Settings.dimmer_hw_min, Settings.dimmer_hw_max, Light.pwm_min, Light.pwm_max); + //AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("LightCalcPWMRange %d %d - %d %d"), Settings.dimmer_hw_min, Settings.dimmer_hw_max, Light.pwm_min, Light.pwm_max); } void LightInit(void) @@ -1189,7 +1189,7 @@ void LightUpdateColorMapping(void) Light.color_remap[4] = tmp[1-param]; Light.update = true; - //AddLog_P(LOG_LEVEL_DEBUG, PSTR("%d colors: %d %d %d %d %d") ,Settings.param[P_RGB_REMAP], Light.color_remap[0],Light.color_remap[1],Light.color_remap[2],Light.color_remap[3],Light.color_remap[4]); + //AddLog(LOG_LEVEL_DEBUG, PSTR("%d colors: %d %d %d %d %d") ,Settings.param[P_RGB_REMAP], Light.color_remap[0],Light.color_remap[1],Light.color_remap[2],Light.color_remap[3],Light.color_remap[4]); } uint8_t LightGetDimmer(uint8_t dimmer) { @@ -1306,7 +1306,7 @@ void LightSetSignal(uint16_t lo, uint16_t hi, uint16_t value) */ if (Settings.flag.light_signal) { // SetOption18 - Pair light signal with CO2 sensor uint16_t signal = changeUIntScale(value, lo, hi, 0, 255); // 0..255 -// AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "Light signal %d"), signal); +// AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "Light signal %d"), signal); light_controller.changeRGB(signal, 255 - signal, 0, true); // keep bri Settings.light_scheme = 0; if (0 == light_state.getBri()) { @@ -1423,7 +1423,7 @@ void ResponseLightState(uint8_t append) void LightPreparePower(power_t channels = 0xFFFFFFFF) { // 1 = only RGB, 2 = only CT, 3 = both RGB and CT #ifdef DEBUG_LIGHT - AddLog_P(LOG_LEVEL_DEBUG, "LightPreparePower power=%d Light.power=%d", TasmotaGlobal.power, Light.power); + AddLog(LOG_LEVEL_DEBUG, "LightPreparePower power=%d Light.power=%d", TasmotaGlobal.power, Light.power); #endif // If multi-channels, then we only switch off channels with a value of zero if (Light.pwm_multi_channels) { @@ -1486,7 +1486,7 @@ void LightPreparePower(power_t channels = 0xFFFFFFFF) { // 1 = only RGB, 2 = } #ifdef DEBUG_LIGHT - AddLog_P(LOG_LEVEL_DEBUG, "LightPreparePower End power=%d Light.power=%d", TasmotaGlobal.power, Light.power); + AddLog(LOG_LEVEL_DEBUG, "LightPreparePower End power=%d Light.power=%d", TasmotaGlobal.power, Light.power); #endif Light.power = TasmotaGlobal.power >> (Light.device - 1); // reset next state, works also with unlinked RGB/CT ResponseLightState(0); @@ -1543,7 +1543,7 @@ void LightCycleColor(int8_t direction) (Light.random > Light.wheel +128) ? 0 : 1; // Increment or Decrement and roll-over Light.random = (Light.random & 0xFE) | my_dir; -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("LGT: random %d"), Light.random); +// AddLog(LOG_LEVEL_DEBUG, PSTR("LGT: random %d"), Light.random); } // direction = (Light.random < Light.wheel) ? -1 : 1; direction = (Light.random &0x01) ? 1 : -1; @@ -1554,7 +1554,7 @@ void LightCycleColor(int8_t direction) Light.wheel += direction; uint16_t hue = changeUIntScale(Light.wheel, 0, 255, 0, 359); // Scale to hue to keep amount of steps low (max 255 instead of 359) -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("LGT: random %d, wheel %d, hue %d"), Light.random, Light.wheel, hue); +// AddLog(LOG_LEVEL_DEBUG, PSTR("LGT: random %d, wheel %d, hue %d"), Light.random, Light.wheel, hue); if (!Light.pwm_multi_channels) { uint8_t sat; diff --git a/tasmota/xdrv_04_light_utils.ino b/tasmota/xdrv_04_light_utils.ino index 8ab379d62..90c2f1dd3 100644 --- a/tasmota/xdrv_04_light_utils.ino +++ b/tasmota/xdrv_04_light_utils.ino @@ -132,7 +132,7 @@ void RgbToHsb(uint8_t ir, uint8_t ig, uint8_t ib, uint16_t *r_hue, uint8_t *r_sa if (r_hue) *r_hue = hue; if (r_sat) *r_sat = sat; if (r_bri) *r_bri = bri; - //AddLog_P(LOG_LEVEL_DEBUG_MORE, "RgbToHsb rgb (%d %d %d) hsb (%d %d %d)", r, g, b, hue, sat, bri); + //AddLog(LOG_LEVEL_DEBUG_MORE, "RgbToHsb rgb (%d %d %d) hsb (%d %d %d)", r, g, b, hue, sat, bri); } void HsToRgb(uint16_t hue, uint8_t sat, uint8_t *r_r, uint8_t *r_g, uint8_t *r_b) { diff --git a/tasmota/xdrv_05_irremote.ino b/tasmota/xdrv_05_irremote.ino index 44304c550..378405925 100644 --- a/tasmota/xdrv_05_irremote.ino +++ b/tasmota/xdrv_05_irremote.ino @@ -190,7 +190,7 @@ void IrReceiveCheck(void) Uint64toHex(results.value, hvalue, 32); // UNKNOWN is always 32 bits hash } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_IRR "RawLen %d, Overflow %d, Bits %d, Value 0x%s, Decode %d"), + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_IRR "RawLen %d, Overflow %d, Bits %d, Value 0x%s, Decode %d"), results.rawlen, results.overflow, results.bits, hvalue, results.decode_type); unsigned long now = millis(); diff --git a/tasmota/xdrv_07_domoticz.ino b/tasmota/xdrv_07_domoticz.ino index 749f2c194..96a6d4e3c 100644 --- a/tasmota/xdrv_07_domoticz.ino +++ b/tasmota/xdrv_07_domoticz.ino @@ -219,7 +219,7 @@ bool DomoticzMqttData(void) { uint32_t idx = domoticz.getUInt(PSTR("idx"), 0); int16_t nvalue = domoticz.getInt(PSTR("nvalue"), -1); - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_DOMOTICZ "idx %d, nvalue %d"), idx, nvalue); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_DOMOTICZ "idx %d, nvalue %d"), idx, nvalue); bool found = false; if ((idx > 0) && (nvalue >= 0) && (nvalue <= 15)) { @@ -544,7 +544,7 @@ const char HTTP_FORM_DOMOTICZ_TIMER[] PROGMEM = void HandleDomoticzConfiguration(void) { if (!HttpCheckPriviledgedAccess()) { return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_DOMOTICZ)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_DOMOTICZ)); if (Webserver->hasArg(F("save"))) { DomoticzSaveSettings(); diff --git a/tasmota/xdrv_09_timers.ino b/tasmota/xdrv_09_timers.ino index a33204906..81b454cf5 100644 --- a/tasmota/xdrv_09_timers.ino +++ b/tasmota/xdrv_09_timers.ino @@ -839,7 +839,7 @@ void HandleTimerConfiguration(void) { if (!HttpCheckPriviledgedAccess()) { return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_TIMER)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_TIMER)); if (Webserver->hasArg(F("save"))) { TimerSaveSettings(); diff --git a/tasmota/xdrv_10_rules.ino b/tasmota/xdrv_10_rules.ino index cff843d4a..59b5c7252 100644 --- a/tasmota/xdrv_10_rules.ino +++ b/tasmota/xdrv_10_rules.ino @@ -358,7 +358,7 @@ int32_t SetRule(uint32_t idx, const char *content, bool append = false) { len_uncompressed = strlen(Settings.rules[idx]); len_compressed = compressor.unishox_compress(Settings.rules[idx], len_uncompressed, nullptr /* dry-run */, MAX_RULE_SIZE + 8); - AddLog_P(LOG_LEVEL_INFO, PSTR("RUL: Stored uncompressed, would compress from %d to %d (-%d%%)"), len_uncompressed, len_compressed, 100 - changeUIntScale(len_compressed, 0, len_uncompressed, 0, 100)); + AddLog(LOG_LEVEL_INFO, PSTR("RUL: Stored uncompressed, would compress from %d to %d (-%d%%)"), len_uncompressed, len_compressed, 100 - changeUIntScale(len_compressed, 0, len_uncompressed, 0, 100)); } #endif // USE_UNISHOX_COMPRESSION @@ -387,7 +387,7 @@ int32_t SetRule(uint32_t idx, const char *content, bool append = false) { Settings.rules[idx][1] = (len_in + 7) / 8; // store original length in first bytes (4 bytes chuks) memcpy(&Settings.rules[idx][2], buf_out, len_compressed); Settings.rules[idx][len_compressed + 2] = 0; // add NULL termination - AddLog_P(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(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)); } else { @@ -2103,7 +2103,7 @@ void CmndRule(void) } int32_t res = SetRule(index - 1, ('"' == XdrvMailbox.data[0]) ? "" : XdrvMailbox.data, append); if (res < 0) { - AddLog_P(LOG_LEVEL_ERROR, PSTR("RUL: Not enough space")); + AddLog(LOG_LEVEL_ERROR, PSTR("RUL: Not enough space")); } } Rules.triggers[index -1] = 0; // Reset once flag diff --git a/tasmota/xdrv_12_home_assistant.ino b/tasmota/xdrv_12_home_assistant.ino index 0120615e0..918431071 100644 --- a/tasmota/xdrv_12_home_assistant.ino +++ b/tasmota/xdrv_12_home_assistant.ino @@ -1025,7 +1025,7 @@ void HAssAnnounceDeviceInfoAndStatusSensor(void) if (!Settings.flag.hass_discovery) { TasmotaGlobal.masterlog_level = 0; - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_LOG "Home Assistant MQTT Discovery disabled.")); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_LOG "Home Assistant MQTT Discovery disabled.")); } } diff --git a/tasmota/xdrv_13_display.ino b/tasmota/xdrv_13_display.ino index d2efd21c2..84a1d6058 100755 --- a/tasmota/xdrv_13_display.ino +++ b/tasmota/xdrv_13_display.ino @@ -1289,7 +1289,7 @@ void DisplayInitDriver(void) } -// AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "Display model %d"), Settings.display_model); +// AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "Display model %d"), Settings.display_model); if (Settings.display_model) { TasmotaGlobal.devices_present++; @@ -1312,7 +1312,7 @@ void DisplaySetPower(void) { disp_power = bitRead(XdrvMailbox.index, disp_device -1); -//AddLog_P(LOG_LEVEL_DEBUG, PSTR("DSP: Power %d"), disp_power); +//AddLog(LOG_LEVEL_DEBUG, PSTR("DSP: Power %d"), disp_power); if (Settings.display_model) { if (!renderer) { @@ -2176,7 +2176,7 @@ uint8_t vbutt=0; if (!(tbstate[tbut] & 1)) { // pressed tbstate[tbut] |= 1; - //AddLog_P(LOG_LEVEL_INFO, PSTR("tbut: %d pressed"), tbut); + //AddLog(LOG_LEVEL_INFO, PSTR("tbut: %d pressed"), tbut); Touch_MQTT(tbut, "BIB", tbstate[tbut] & 1); } } @@ -2186,7 +2186,7 @@ uint8_t vbutt=0; rotconvert(&pLoc.x, &pLoc.y); - //AddLog_P(LOG_LEVEL_INFO, PSTR("touch %d - %d"), pLoc.x, pLoc.y); + //AddLog(LOG_LEVEL_INFO, PSTR("touch %d - %d"), pLoc.x, pLoc.y); // now must compare with defined buttons for (uint8_t count=0; countvpower.disable) { @@ -2233,7 +2233,7 @@ uint8_t vbutt=0; // released tbstate[tbut] &= 0xfe; Touch_MQTT(tbut, "BIB", tbstate[tbut] & 1); - //AddLog_P(LOG_LEVEL_INFO, PSTR("tbut: %d released"), tbut); + //AddLog(LOG_LEVEL_INFO, PSTR("tbut: %d released"), tbut); } } #endif diff --git a/tasmota/xdrv_16_tuyamcu.ino b/tasmota/xdrv_16_tuyamcu.ino index 7535d29c5..8dcddb380 100644 --- a/tasmota/xdrv_16_tuyamcu.ino +++ b/tasmota/xdrv_16_tuyamcu.ino @@ -148,7 +148,7 @@ void CmndTuyaSend(void) { TuyaRequestState(8); } else if (XdrvMailbox.index == 9) { // TuyaSend Topic Toggle Settings.tuyamcu_topic = !Settings.tuyamcu_topic; - AddLog_P(LOG_LEVEL_INFO, PSTR("TYA: TuyaMCU Stat Topic %s"), (Settings.tuyamcu_topic ? PSTR("enabled") : PSTR("disabled"))); + AddLog(LOG_LEVEL_INFO, PSTR("TYA: TuyaMCU Stat Topic %s"), (Settings.tuyamcu_topic ? PSTR("enabled") : PSTR("disabled"))); } else { if (XdrvMailbox.data_len > 0) { @@ -207,7 +207,7 @@ void CmndTuyaMcu(void) { TuyaAddMcuFunc(parm[0], parm[1]); TasmotaGlobal.restart_flag = 2; } else { - AddLog_P(LOG_LEVEL_ERROR, PSTR("TYA: TuyaMcu Invalid function id=%d"), parm[0]); + AddLog(LOG_LEVEL_ERROR, PSTR("TYA: TuyaMcu Invalid function id=%d"), parm[0]); } } @@ -626,9 +626,9 @@ void LightSerialDuty(uint16_t duty, char *hex_char, uint8_t TuyaIdx) } else { duty = changeUIntScale(duty, 0, 100, 0, Settings.dimmer_hw_max); } - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Send dim skipped value %d for dpid %d"), duty, dpid); // due to 0 or already set + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: Send dim skipped value %d for dpid %d"), duty, dpid); // due to 0 or already set } else { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Cannot set dimmer. Dimmer Id unknown")); + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: Cannot set dimmer. Dimmer Id unknown")); } } @@ -638,7 +638,7 @@ void LightSerialDuty(uint16_t duty, char *hex_char, uint8_t TuyaIdx) TuyaSendEnum(TuyaGetDpId(TUYA_MCU_FUNC_MODESET), 1); } TuyaSendString(dpid, hex_char); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: TX RGB hex %s to dpId %d"), hex_char, dpid); + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: TX RGB hex %s to dpId %d"), hex_char, dpid); } } @@ -646,7 +646,7 @@ void TuyaRequestState(uint8_t state_type) { if (TuyaSerial) { // Get current status of MCU - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Read MCU state")); + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: Read MCU state")); Tuya.SuspendTopic = true; Tuya.ignore_topic_timeout = millis() + 1000; // suppress /STAT topic for 1000ms to limit data switch (state_type) { @@ -680,23 +680,23 @@ void TuyaProcessStatePacket(void) { dpDataLen = Tuya.buffer[dpidStart + 2] << 8 | Tuya.buffer[dpidStart + 3]; fnId = TuyaGetFuncId(Tuya.buffer[dpidStart]); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: fnId=%d is set for dpId=%d"), fnId, Tuya.buffer[dpidStart]); + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: fnId=%d is set for dpId=%d"), fnId, Tuya.buffer[dpidStart]); if (Tuya.buffer[dpidStart + 1] == 1) { // Data Type 1 if (fnId >= TUYA_MCU_FUNC_REL1 && fnId <= TUYA_MCU_FUNC_REL8) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: RX Relay-%d --> MCU State: %s Current State:%s"), fnId - TUYA_MCU_FUNC_REL1 + 1, Tuya.buffer[dpidStart + 4]?"On":"Off",bitRead(TasmotaGlobal.power, fnId - TUYA_MCU_FUNC_REL1)?"On":"Off"); + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: RX Relay-%d --> MCU State: %s Current State:%s"), fnId - TUYA_MCU_FUNC_REL1 + 1, Tuya.buffer[dpidStart + 4]?"On":"Off",bitRead(TasmotaGlobal.power, fnId - TUYA_MCU_FUNC_REL1)?"On":"Off"); if ((TasmotaGlobal.power || Settings.light_dimmer > 0) && (Tuya.buffer[dpidStart + 4] != bitRead(TasmotaGlobal.power, fnId - TUYA_MCU_FUNC_REL1))) { if (!Tuya.buffer[dpidStart + 4]) { PowerOff = true; } ExecuteCommandPower(fnId - TUYA_MCU_FUNC_REL1 + 1, Tuya.buffer[dpidStart + 4], SRC_SWITCH); // send SRC_SWITCH? to use as flag to prevent loop from inbound states from faceplate interaction } } else if (fnId >= TUYA_MCU_FUNC_REL1_INV && fnId <= TUYA_MCU_FUNC_REL8_INV) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: RX Relay-%d-Inverted --> MCU State: %s Current State:%s"), fnId - TUYA_MCU_FUNC_REL1_INV + 1, Tuya.buffer[dpidStart + 4]?"Off":"On",bitRead(TasmotaGlobal.power, fnId - TUYA_MCU_FUNC_REL1_INV) ^ 1?"Off":"On"); + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: RX Relay-%d-Inverted --> MCU State: %s Current State:%s"), fnId - TUYA_MCU_FUNC_REL1_INV + 1, Tuya.buffer[dpidStart + 4]?"Off":"On",bitRead(TasmotaGlobal.power, fnId - TUYA_MCU_FUNC_REL1_INV) ^ 1?"Off":"On"); if (Tuya.buffer[dpidStart + 4] != bitRead(TasmotaGlobal.power, fnId - TUYA_MCU_FUNC_REL1_INV) ^ 1) { ExecuteCommandPower(fnId - TUYA_MCU_FUNC_REL1_INV + 1, Tuya.buffer[dpidStart + 4] ^ 1, SRC_SWITCH); // send SRC_SWITCH? to use as flag to prevent loop from inbound states from faceplate interaction if (Tuya.buffer[dpidStart + 4]) { PowerOff = true; } } } else if (fnId >= TUYA_MCU_FUNC_SWT1 && fnId <= TUYA_MCU_FUNC_SWT4) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: RX Switch-%d --> MCU State: %d Current State:%d"),fnId - TUYA_MCU_FUNC_SWT1 + 1,Tuya.buffer[dpidStart + 4], SwitchGetVirtual(fnId - TUYA_MCU_FUNC_SWT1)); + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: RX Switch-%d --> MCU State: %d Current State:%d"),fnId - TUYA_MCU_FUNC_SWT1 + 1,Tuya.buffer[dpidStart + 4], SwitchGetVirtual(fnId - TUYA_MCU_FUNC_SWT1)); if (SwitchGetVirtual(fnId - TUYA_MCU_FUNC_SWT1) != Tuya.buffer[dpidStart + 4]) { SwitchSetVirtual(fnId - TUYA_MCU_FUNC_SWT1, Tuya.buffer[dpidStart + 4]); @@ -747,7 +747,7 @@ void TuyaProcessStatePacket(void) { Tuya.Levels[dimIndex] = changeUIntScale(packetValue, 0, Settings.dimmer_hw_max, 0, 100); } - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: RX value %d from dpId %d "), packetValue, Tuya.buffer[dpidStart]); + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: RX value %d from dpId %d "), packetValue, Tuya.buffer[dpidStart]); if ((fnId == TUYA_MCU_FUNC_DIMMER) || (fnId == TUYA_MCU_FUNC_REPORT1) || (fnId == TUYA_MCU_FUNC_DIMMER2) || (fnId == TUYA_MCU_FUNC_REPORT2) || @@ -787,13 +787,13 @@ void TuyaProcessStatePacket(void) { #ifdef USE_ENERGY_SENSOR else if (tuya_energy_enabled && fnId == TUYA_MCU_FUNC_VOLTAGE) { Energy.voltage[0] = (float)packetValue / 10; - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Rx ID=%d Voltage=%d"), Tuya.buffer[dpidStart], packetValue); + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: Rx ID=%d Voltage=%d"), Tuya.buffer[dpidStart], packetValue); } else if (tuya_energy_enabled && fnId == TUYA_MCU_FUNC_CURRENT) { Energy.current[0] = (float)packetValue / 1000; - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Rx ID=%d Current=%d"), Tuya.buffer[dpidStart], packetValue); + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: Rx ID=%d Current=%d"), Tuya.buffer[dpidStart], packetValue); } else if (tuya_energy_enabled && fnId == TUYA_MCU_FUNC_POWER) { Energy.active_power[0] = (float)packetValue / 10; - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Rx ID=%d Active_Power=%d"), Tuya.buffer[dpidStart], packetValue); + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: Rx ID=%d Active_Power=%d"), Tuya.buffer[dpidStart], packetValue); if (RtcTime.valid) { if (Tuya.lastPowerCheckTime != 0 && Energy.active_power[0] > 0) { @@ -882,7 +882,7 @@ void TuyaLowPowerModePacketProcess(void) { void TuyaHandleProductInfoPacket(void) { uint16_t dataLength = Tuya.buffer[4] << 8 | Tuya.buffer[5]; char *data = &Tuya.buffer[6]; - AddLog_P(LOG_LEVEL_INFO, PSTR("TYA: MCU Product ID: %.*s"), dataLength, data); + AddLog(LOG_LEVEL_INFO, PSTR("TYA: MCU Product ID: %.*s"), dataLength, data); } void TuyaSendLowPowerSuccessIfNeeded(void) { @@ -903,9 +903,9 @@ void TuyaNormalPowerModePacketProcess(void) break; case TUYA_CMD_HEARTBEAT: - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Heartbeat")); + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: Heartbeat")); if (Tuya.buffer[6] == 0) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Detected MCU restart")); + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: Detected MCU restart")); Tuya.wifi_state = -2; } break; @@ -916,17 +916,17 @@ void TuyaNormalPowerModePacketProcess(void) case TUYA_CMD_WIFI_RESET: case TUYA_CMD_WIFI_SELECT: - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: RX WiFi Reset")); + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: RX WiFi Reset")); TuyaResetWifi(); break; case TUYA_CMD_WIFI_STATE: - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: RX WiFi LED set ACK")); + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: RX WiFi LED set ACK")); Tuya.wifi_state = TuyaGetTuyaWifiState(); break; case TUYA_CMD_MCU_CONF: - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: RX MCU configuration Mode=%d"), Tuya.buffer[5]); + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: RX MCU configuration Mode=%d"), Tuya.buffer[5]); if (Tuya.buffer[5] == 2) { // Processing by ESP module mode uint8_t led1_gpio = Tuya.buffer[6]; @@ -954,7 +954,7 @@ void TuyaNormalPowerModePacketProcess(void) break; #endif default: - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: RX unknown command")); + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: RX unknown command")); } } @@ -1039,7 +1039,7 @@ void TuyaInit(void) // Get MCU Configuration Tuya.SuspendTopic = true; Tuya.ignore_topic_timeout = millis() + 1000; // suppress /STAT topic for 1000ms to avoid data overflow - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Request MCU configuration at %d bps"), baudrate); + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: Request MCU configuration at %d bps"), baudrate); } @@ -1175,7 +1175,7 @@ void TuyaSerialInput(void) bool TuyaButtonPressed(void) { if (!XdrvMailbox.index && ((PRESSED == XdrvMailbox.payload) && (NOT_PRESSED == Button.last_state[XdrvMailbox.index]))) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Reset GPIO triggered")); + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: Reset GPIO triggered")); TuyaResetWifi(); return true; // Reset GPIO served here } @@ -1204,7 +1204,7 @@ uint8_t TuyaGetTuyaWifiState(void) { void TuyaSetWifiLed(void) { Tuya.wifi_state = TuyaGetTuyaWifiState(); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Set WiFi LED %d (%d)"), Tuya.wifi_state, WifiState()); + AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: Set WiFi LED %d (%d)"), Tuya.wifi_state, WifiState()); if (Tuya.low_power_mode) { TuyaSendCmd(TUYA_LOW_POWER_CMD_WIFI_STATE, &Tuya.wifi_state, 1); diff --git a/tasmota/xdrv_17_rcswitch.ino b/tasmota/xdrv_17_rcswitch.ino index 8877544df..402929b19 100644 --- a/tasmota/xdrv_17_rcswitch.ino +++ b/tasmota/xdrv_17_rcswitch.ino @@ -56,7 +56,7 @@ void RfReceiveCheck(void) { int protocol = mySwitch.getReceivedProtocol(); int delay = mySwitch.getReceivedDelay(); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("RFR: Data 0x%lX (%u), Bits %d, Protocol %d, Delay %d"), data, data, bits, protocol, delay); + AddLog(LOG_LEVEL_DEBUG, PSTR("RFR: Data 0x%lX (%u), Bits %d, Protocol %d, Delay %d"), data, data, bits, protocol, delay); uint32_t now = millis(); if ((now - rf_lasttime > RF_TIME_AVOID_DUPLICATE) && (data > 0)) { @@ -130,7 +130,7 @@ void CmndRfProtocol(void) { } } mySwitch.setReceiveProtocolMask(Settings.rf_protocol_mask); -// AddLog_P(LOG_LEVEL_INFO, PSTR("RFR: CmndRfProtocol:: Start responce")); +// AddLog(LOG_LEVEL_INFO, PSTR("RFR: CmndRfProtocol:: Start responce")); Response_P(PSTR("{\"" D_CMND_RFPROTOCOL "\":\"")); bool gotone = false; thisdat = 1; diff --git a/tasmota/xdrv_18_armtronix_dimmers.ino b/tasmota/xdrv_18_armtronix_dimmers.ino index 14fba8c7b..185cb98c0 100644 --- a/tasmota/xdrv_18_armtronix_dimmers.ino +++ b/tasmota/xdrv_18_armtronix_dimmers.ino @@ -61,11 +61,11 @@ void LightSerial2Duty(uint8_t duty1, uint8_t duty2) ArmtronixSerial->print("\nDimmer2:"); ArmtronixSerial->println(duty2); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("ARM: Send Serial Packet Dim Values=%d,%d"), Armtronix.dim_state[0],Armtronix.dim_state[1]); + AddLog(LOG_LEVEL_DEBUG, PSTR("ARM: Send Serial Packet Dim Values=%d,%d"), Armtronix.dim_state[0],Armtronix.dim_state[1]); } else { Armtronix.ignore_dim = false; - AddLog_P(LOG_LEVEL_DEBUG, PSTR("ARM: Send Dim Level skipped due to already set. Value=%d,%d"), Armtronix.dim_state[0],Armtronix.dim_state[1]); + AddLog(LOG_LEVEL_DEBUG, PSTR("ARM: Send Dim Level skipped due to already set. Value=%d,%d"), Armtronix.dim_state[0],Armtronix.dim_state[1]); } } @@ -74,7 +74,7 @@ void ArmtronixRequestState(void) { if (ArmtronixSerial) { // Get current status of MCU - AddLog_P(LOG_LEVEL_DEBUG, PSTR("ARM: Request MCU state")); + AddLog(LOG_LEVEL_DEBUG, PSTR("ARM: Request MCU state")); ArmtronixSerial->println("Status"); } @@ -124,7 +124,7 @@ void ArmtronixSerialInput(void) Armtronix.ignore_dim = true; snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_CHANNEL "%d %d"),i+1, temp); ExecuteCommand(scmnd,SRC_SWITCH); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("ARM: Send CMND_CHANNEL=%s"), scmnd ); + AddLog(LOG_LEVEL_DEBUG, PSTR("ARM: Send CMND_CHANNEL=%s"), scmnd ); } commaIndex = answer.indexOf(',',commaIndex+1); } @@ -148,7 +148,7 @@ void ArmtronixSetWifiLed(void) break; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR("ARM: Set WiFi LED to state %d (%d)"), wifi_state, WifiState()); + AddLog(LOG_LEVEL_DEBUG, PSTR("ARM: Set WiFi LED to state %d (%d)"), wifi_state, WifiState()); char state = '0' + ((wifi_state & 1) > 0); ArmtronixSerial->print("Setled:"); diff --git a/tasmota/xdrv_20_hue.ino b/tasmota/xdrv_20_hue.ino index 013e22a98..e7395484c 100644 --- a/tasmota/xdrv_20_hue.ino +++ b/tasmota/xdrv_20_hue.ino @@ -223,7 +223,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 - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_HUE " %s " D_TO " %s:%d"), + 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); } @@ -427,7 +427,7 @@ String GetHueUserId(void) void HandleUpnpSetupHue(void) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_HUE_BRIDGE_SETUP)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_HUE_BRIDGE_SETUP)); String description_xml = Decompress(HUE_DESCRIPTION_XML_COMPRESSED,HUE_DESCRIPTION_XML_SIZE); description_xml.replace(F("{x1"), WiFi.localIP().toString()); description_xml.replace(F("{x2"), HueUuid()); @@ -437,7 +437,7 @@ void HandleUpnpSetupHue(void) void HueNotImplemented(String *path) { - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE_API_NOT_IMPLEMENTED " (%s)"), path->c_str()); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE_API_NOT_IMPLEMENTED " (%s)"), path->c_str()); WSSend(200, CT_JSON, PSTR("{}")); } @@ -690,7 +690,7 @@ void HueAuthentication(String *path) snprintf_P(response, sizeof(response), PSTR("[{\"success\":{\"username\":\"%s\"}}]"), GetHueUserId().c_str()); WSSend(200, CT_JSON, response); - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE " Authentication Result (%s)"), response); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE " Authentication Result (%s)"), response); } #ifdef USE_LIGHT @@ -805,7 +805,7 @@ void HueLightsCommand(uint8_t device, uint32_t device_id, String &response) { RgbToHsb(rr, gg, bb, &hue, &sat, nullptr); prev_hue = changeUIntScale(hue, 0, 360, 0, 65535); // calculate back prev_hue prev_sat = (sat > 254 ? 254 : sat); - //AddLog_P(LOG_LEVEL_DEBUG_MORE, "XY RGB (%d %d %d) HS (%d %d)", rr,gg,bb,hue,sat); + //AddLog(LOG_LEVEL_DEBUG_MORE, "XY RGB (%d %d %d) HS (%d %d)", rr,gg,bb,hue,sat); if (resp) { response += ","; } snprintf_P(buf, buf_size, msg[HUE_RESP_XY], @@ -874,7 +874,7 @@ void HueLightsCommand(uint8_t device, uint32_t device_id, String &response) { if (change) { #ifdef USE_SHUTTER if (ShutterState(device)) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Settings.shutter_invert: %d"), Settings.shutter_options[device-1] & 1); + AddLog(LOG_LEVEL_DEBUG, PSTR("Settings.shutter_invert: %d"), Settings.shutter_options[device-1] & 1); ShutterSetPosition(device, bri * 100.0f ); } else #endif @@ -962,7 +962,7 @@ void HueLights(String *path) } else if(path->indexOf(F("/lights/")) >= 0) { // Got /lights/ID - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("/lights path=%s"), path->c_str()); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("/lights path=%s"), path->c_str()); path->remove(0,8); // Remove /lights/ device_id = atoi(path->c_str()); device = DecodeLightId(device_id); @@ -996,7 +996,7 @@ void HueLights(String *path) code = 406; } exit: - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE " Result (%s)"), response.c_str()); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE " Result (%s)"), response.c_str()); WSSend(code, CT_JSON, response); } @@ -1029,7 +1029,7 @@ void HueGroups(String *path) response += F("}"); } - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE " HueGroups Result (%s)"), path->c_str()); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE " HueGroups Result (%s)"), path->c_str()); WSSend(200, CT_JSON, response); } @@ -1051,10 +1051,10 @@ void HandleHueApi(String *path) path->remove(0, 4); // remove /api uint16_t apilen = path->length(); - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE_API " (%s) from %s"), path->c_str(), Webserver->client().remoteIP().toString().c_str()); // HTP: Hue API (//lights/1/state) from 192.168.1.20 + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE_API " (%s) from %s"), path->c_str(), Webserver->client().remoteIP().toString().c_str()); // HTP: Hue API (//lights/1/state) from 192.168.1.20 for (args = 0; args < Webserver->args(); args++) { String json = Webserver->arg(args); - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE_POST_ARGS " (%s)"), json.c_str()); // HTP: Hue POST args ({"on":false}) + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE_POST_ARGS " (%s)"), json.c_str()); // HTP: Hue POST args ({"on":false}) } UnishoxStrings msg(HUE_API); diff --git a/tasmota/xdrv_21_wemo.ino b/tasmota/xdrv_21_wemo.ino index 18f793824..c6dbe75dd 100644 --- a/tasmota/xdrv_21_wemo.ino +++ b/tasmota/xdrv_21_wemo.ino @@ -74,7 +74,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 - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_WEMO " " D_JSON_TYPE " %d, %s " D_TO " %s:%d"), + 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); } @@ -265,7 +265,7 @@ const char WEMO_SETUP_XML[] PROGMEM = /********************************************************************************************/ void LogUpnpWithClient(const char *msg) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP "%s from %s"), msg, Webserver->client().remoteIP().toString().c_str()); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP "%s from %s"), msg, Webserver->client().remoteIP().toString().c_str()); } void HandleUpnpEvent(void) @@ -275,7 +275,7 @@ void HandleUpnpEvent(void) char event[500]; strlcpy(event, Webserver->arg(0).c_str(), sizeof(event)); -// AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("\n%s"), event); +// AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("\n%s"), event); //differentiate get and set state char state = 'G'; diff --git a/tasmota/xdrv_21_wemo_multi.ino b/tasmota/xdrv_21_wemo_multi.ino index 1a0b3ac6c..d6edfe5c0 100644 --- a/tasmota/xdrv_21_wemo_multi.ino +++ b/tasmota/xdrv_21_wemo_multi.ino @@ -256,7 +256,7 @@ public: _deviceId = deviceId; _webServer = webServer; #ifdef USE_EMULATION_WEMO_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR("WMO: Device #%d listening on port %d"), _deviceId, _localPort); + AddLog(LOG_LEVEL_DEBUG, PSTR("WMO: Device #%d listening on port %d"), _deviceId, _localPort); #endif } @@ -264,7 +264,7 @@ public: _deviceId = deviceId; _localPort = localPort; #ifdef USE_EMULATION_WEMO_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR("WMO: Device #%d listening on port %d"), _deviceId, _localPort); + AddLog(LOG_LEVEL_DEBUG, PSTR("WMO: Device #%d listening on port %d"), _deviceId, _localPort); #endif _webServer = new ESP8266WebServer(_localPort); @@ -278,7 +278,7 @@ public: } void WemoRespondToMSearch(int echo_type) { -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("WMO: WemoRespondToMSearch device #%d: %d"), _deviceId, echo_type); +// AddLog(LOG_LEVEL_DEBUG, PSTR("WMO: WemoRespondToMSearch device #%d: %d"), _deviceId, echo_type); char message[TOPSZ]; @@ -294,14 +294,14 @@ public: PortUdp.write(response); PortUdp.endPacket(); -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("WMO: Sending packet device %d: %s"), _deviceId, response); +// AddLog(LOG_LEVEL_DEBUG, PSTR("WMO: Sending packet device %d: %s"), _deviceId, response); snprintf_P(message, sizeof(message), PSTR(D_RESPONSE_SENT)); } 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_P(LOG_LEVEL_DEBUG, PSTR("WMO: WeMo Type %d, %s to %s:%d"), + AddLog(LOG_LEVEL_DEBUG, PSTR("WMO: WeMo Type %d, %s to %s:%d"), echo_type, message, udp_remote_ip.toString().c_str(), udp_remote_port); } @@ -319,7 +319,7 @@ private: } void LogUpnpWithClient(const char *msg) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP "%s from %s"), msg, _webServer->client().remoteIP().toString().c_str()); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP "%s from %s"), msg, _webServer->client().remoteIP().toString().c_str()); } void HandleUpnpEvent() { @@ -329,8 +329,8 @@ private: strlcpy(event, _webServer->arg(0).c_str(), sizeof(event)); #ifdef USE_EMULATION_WEMO_DEBUG - //AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("\n%s"), event); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("WMO: HandleUpnpEvent for deviceId %d: %s"), _deviceId, event); + //AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("\n%s"), event); + AddLog(LOG_LEVEL_DEBUG, PSTR("WMO: HandleUpnpEvent for deviceId %d: %s"), _deviceId, event); #endif //differentiate get and set state @@ -362,7 +362,7 @@ private: void HandleUpnpService(void) { #ifdef USE_EMULATION_WEMO_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR("WMO: HandleUpnpService")); + AddLog(LOG_LEVEL_DEBUG, PSTR("WMO: HandleUpnpService")); #endif LogUpnpWithClient(PSTR(D_WEMO_EVENT_SERVICE)); @@ -375,7 +375,7 @@ private: void HandleUpnpMetaService(void) { #ifdef USE_EMULATION_WEMO_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR("WMO: HandleUpnpMetaService")); + AddLog(LOG_LEVEL_DEBUG, PSTR("WMO: HandleUpnpMetaService")); #endif LogUpnpWithClient(PSTR(D_WEMO_META_SERVICE)); @@ -399,14 +399,14 @@ private: setup_xml.replace("{x3", WemoSerialnumber()); InternalWSSend(200, CT_XML, setup_xml); #ifdef USE_EMULATION_WEMO_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR("WMO: Sending device #%d: %s"), _deviceId, setup_xml.c_str()); + AddLog(LOG_LEVEL_DEBUG, PSTR("WMO: Sending device #%d: %s"), _deviceId, setup_xml.c_str()); #endif } public: void RegisterHandlers(void) { #ifdef USE_EMULATION_WEMO_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR("WMO: Register device #%d"), _deviceId); + AddLog(LOG_LEVEL_DEBUG, PSTR("WMO: Register device #%d"), _deviceId); #endif _webServer->on(F("/upnp/control/basicevent1"), [&]() { HandleUpnpEvent(); }); _webServer->on(F("/eventservice.xml"), [&]() { HandleUpnpService(); }); @@ -441,7 +441,7 @@ bool Xdrv21(uint8_t function) break; case FUNC_WEB_ADD_HANDLER: #ifdef USE_EMULATION_WEMO_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR("WMO: Adding handlers for %d devices"), TasmotaGlobal.devices_present); + AddLog(LOG_LEVEL_DEBUG, PSTR("WMO: Adding handlers for %d devices"), TasmotaGlobal.devices_present); #endif // For the first device use the current webserver, for the others.. create a new one listening on a different PortUdp wemoDevice[numOfWemoSwitch] = new WemoSwitch(1, Webserver); diff --git a/tasmota/xdrv_23_zigbee_2_devices.ino b/tasmota/xdrv_23_zigbee_2_devices.ino index 3f7f916e0..6a6b60655 100644 --- a/tasmota/xdrv_23_zigbee_2_devices.ino +++ b/tasmota/xdrv_23_zigbee_2_devices.ino @@ -637,7 +637,7 @@ Z_Data & Z_Data_Set::getByType(Z_Data_Type type, uint8_t ep) { // Byte 3: Power Z_Data & Z_Data_Set::createFromBuffer(const SBuffer & buf, uint32_t start, uint32_t len) { if (len < sizeof(Z_Data)) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Invalid len (<4) %d"), len); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Invalid len (<4) %d"), len); return *(Z_Data*)nullptr; } @@ -651,7 +651,7 @@ Z_Data & Z_Data_Set::createFromBuffer(const SBuffer & buf, uint32_t start, uint3 memcpy(&elt, buf.buf(start), len); } else { memcpy(&elt, buf.buf(start), sizeof(Z_Data)); - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "buffer len overflow %d > %d"), len, expected_len); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "buffer len overflow %d > %d"), len, expected_len); } return elt; } diff --git a/tasmota/xdrv_23_zigbee_3_hue.ino b/tasmota/xdrv_23_zigbee_3_hue.ino index d71a8c3a9..b8f678d9e 100644 --- a/tasmota/xdrv_23_zigbee_3_hue.ino +++ b/tasmota/xdrv_23_zigbee_3_hue.ino @@ -170,7 +170,7 @@ void ZigbeeHueDimmer(uint16_t shortaddr, uint8_t dimmer) { // CT void ZigbeeHueCT(uint16_t shortaddr, uint16_t ct) { if (ct > 0xFEFF) { ct = 0xFEFF; } - AddLog_P(LOG_LEVEL_INFO, PSTR("ZigbeeHueCT 0x%04X - %d"), shortaddr, ct); + AddLog(LOG_LEVEL_INFO, PSTR("ZigbeeHueCT 0x%04X - %d"), shortaddr, ct); char param[12]; snprintf_P(param, sizeof(param), PSTR("%02X%02X0A00"), ct & 0xFF, ct >> 8); uint8_t colormode = 2; // "ct" diff --git a/tasmota/xdrv_23_zigbee_4_persistence.ino b/tasmota/xdrv_23_zigbee_4_persistence.ino index dc7c385e3..c306cb184 100644 --- a/tasmota/xdrv_23_zigbee_4_persistence.ino +++ b/tasmota/xdrv_23_zigbee_4_persistence.ino @@ -301,7 +301,7 @@ void loadZigbeeDevices(bool dump_only = false) { // first copy SPI buffer into ram uint8_t *spi_buffer = (uint8_t*) malloc(z_spi_len); if (!spi_buffer) { - AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Cannot allocate 4KB buffer")); + AddLog(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Cannot allocate 4KB buffer")); return; } #ifdef USE_UFILESYS @@ -311,8 +311,8 @@ void loadZigbeeDevices(bool dump_only = false) { #endif // ESP32 Z_Flashentry flashdata; memcpy_P(&flashdata, z_dev_start, sizeof(Z_Flashentry)); -// AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "Memory %d"), ESP_getFreeHeap()); - // AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "Zigbee signature in Flash: %08X - %d"), flashdata.name, flashdata.len); +// AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "Memory %d"), ESP_getFreeHeap()); + // AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "Zigbee signature in Flash: %08X - %d"), flashdata.name, flashdata.len); // Check the signature if ( ((flashdata.name == ZIGB_NAME1) || (flashdata.name == ZIGB_NAME2)) @@ -322,7 +322,7 @@ void loadZigbeeDevices(bool dump_only = false) { // parse what seems to be a valid entry SBuffer buf(buf_len); buf.addBuffer(z_dev_start + sizeof(Z_Flashentry), buf_len); - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee device information in %s (%d bytes)"), PSTR("Flash"), buf_len); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee device information in %s (%d bytes)"), PSTR("Flash"), buf_len); if (dump_only) { size_t buf_len = buf.len(); @@ -336,7 +336,7 @@ void loadZigbeeDevices(bool dump_only = false) { zigbee_devices.clean(); // don't write back to Flash what we just loaded } } else { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "No Zigbee device information in %s"), PSTR("Flash")); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "No Zigbee device information in %s"), PSTR("Flash")); } #ifdef ESP32 free(spi_buffer); @@ -354,14 +354,14 @@ void saveZigbeeDevices(void) { SBuffer buf = hibernateDevices(); size_t buf_len = buf.len(); if (buf_len > 2040) { - AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Buffer too big to fit in Flash (%d bytes)"), buf_len); + AddLog(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Buffer too big to fit in Flash (%d bytes)"), buf_len); return; } // first copy SPI buffer into ram uint8_t *spi_buffer = (uint8_t*) malloc(z_spi_len); if (!spi_buffer) { - AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Cannot allocate 4KB buffer")); + AddLog(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Cannot allocate 4KB buffer")); return; } // copy the flash into RAM to make local change, and write back the whole buffer @@ -386,13 +386,13 @@ void saveZigbeeDevices(void) { if (ESP.flashEraseSector(z_spi_start_sector)) { ESP.flashWrite(z_spi_start_sector * SPI_FLASH_SEC_SIZE, (uint32_t*) spi_buffer, SPI_FLASH_SEC_SIZE); } - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data store in Flash (0x%08X - %d bytes)"), z_dev_start, buf_len); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data store in Flash (0x%08X - %d bytes)"), z_dev_start, buf_len); #endif // ESP8266 #ifdef ESP32 #ifdef USE_UFILESYS TfsSaveFile(TASM_FILE_ZIGBEE, spi_buffer, z_spi_len); #endif - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data saved in %s (%d bytes)"), PSTR("Flash"), buf_len); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data saved in %s (%d bytes)"), PSTR("Flash"), buf_len); #endif // ESP32 free(spi_buffer); } @@ -407,7 +407,7 @@ void eraseZigbeeDevices(void) { // first copy SPI buffer into ram uint8_t *spi_buffer = (uint8_t*) malloc(z_spi_len); if (!spi_buffer) { - AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Cannot allocate 4KB buffer")); + AddLog(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Cannot allocate 4KB buffer")); return; } // copy the flash into RAM to make local change, and write back the whole buffer @@ -422,13 +422,13 @@ void eraseZigbeeDevices(void) { } free(spi_buffer); - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data erased in %s"), PSTR("Flash")); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data erased in %s"), PSTR("Flash")); #endif // ESP8266 #ifdef ESP32 #ifdef USE_UFILESYS TfsInitFile(TASM_FILE_ZIGBEE, z_block_len, 0xFF); #endif - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data erased (%d bytes)"), z_block_len); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data erased (%d bytes)"), z_block_len); #endif // ESP32 } diff --git a/tasmota/xdrv_23_zigbee_4b_eeprom.ino b/tasmota/xdrv_23_zigbee_4b_eeprom.ino index 88fa1e391..6acada897 100644 --- a/tasmota/xdrv_23_zigbee_4b_eeprom.ino +++ b/tasmota/xdrv_23_zigbee_4b_eeprom.ino @@ -41,7 +41,7 @@ int32_t hydrateDeviceWideData(class Z_Device & device, const SBuffer & buf, size_t start, size_t len) { size_t segment_len = buf.get8(start); if ((segment_len < 6) || (segment_len > len)) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "invalid device wide data length=%d"), segment_len); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "invalid device wide data length=%d"), segment_len); return -1; } device.last_seen = buf.get32(start+1); @@ -77,13 +77,13 @@ bool hydrateDeviceData(class Z_Device & device, const SBuffer & buf, size_t star int32_t hydrateSingleDevice(const class SBuffer & buf, size_t start, size_t len) { uint8_t segment_len = buf.get8(start); if ((segment_len < 4) || (start + segment_len > len)) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "invalid segment_len=%d"), segment_len); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "invalid segment_len=%d"), segment_len); return -1; } // read shortaddr uint16_t shortaddr = buf.get16(start + 1); if (shortaddr >= 0xFFF0) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "invalid shortaddr=0x%04X"), shortaddr); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "invalid shortaddr=0x%04X"), shortaddr); return -1; } #ifdef Z_EEPROM_DEBUG @@ -118,9 +118,9 @@ bool hydrateDevicesDataFromEEPROM(void) { if (!zigbee.eeprom_ready) { return false; } int32_t file_length = ZFS::getLength(ZIGB_DATA2); if (file_length > 0) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee device data in EEPROM (%d bytes)"), file_length); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee device data in EEPROM (%d bytes)"), file_length); } else { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "No Zigbee device data in EEPROM")); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "No Zigbee device data in EEPROM")); return false; } @@ -222,7 +222,7 @@ void hibernateAllData(void) { } int32_t ret = write_data.close(); #ifdef Z_EEPROM_DEBUG - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "ZbData - %d bytes written to EEPROM"), ret); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "ZbData - %d bytes written to EEPROM"), ret); #endif #endif // USE_ZIGBEE_EZSP } @@ -270,10 +270,10 @@ bool hibernateDevicesInEEPROM(void) { int32_t ret = write_data.close(); if (ret < 0) { - AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Error writing Devices to EEPROM")); + AddLog(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Error writing Devices to EEPROM")); return false; } else { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data saved in %s (%d bytes)"), PSTR("EEPROM"), ret); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data saved in %s (%d bytes)"), PSTR("EEPROM"), ret); } return true; } @@ -288,10 +288,10 @@ bool loadZigbeeDevicesFromEEPROM(void) { ZFS::readBytes(ZIGB_NAME2, &num_devices, sizeof(num_devices), 0, sizeof(num_devices)); if ((file_len < 10) || (num_devices == 0x00) || (num_devices == 0xFF)) { // No data - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "No Zigbee device information in %s"), PSTR("EEPROM")); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "No Zigbee device information in %s"), PSTR("EEPROM")); return false; } - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee device information in %s (%d bytes)"), PSTR("EEPROM"), file_len); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee device information in %s (%d bytes)"), PSTR("EEPROM"), file_len); uint32_t k = 1; // byte index in global buffer for (uint32_t i = 0; (i < num_devices) && (k < file_len); i++) { @@ -301,7 +301,7 @@ bool loadZigbeeDevicesFromEEPROM(void) { buf.setLen(dev_record_len); ret = ZFS::readBytes(ZIGB_NAME2, buf.getBuffer(), dev_record_len, k, dev_record_len); if (ret != dev_record_len) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "File too short when reading EEPROM")); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "File too short when reading EEPROM")); return false; } @@ -318,7 +318,7 @@ bool loadZigbeeDevicesFromEEPROM(void) { void ZFS_Erase(void) { if (zigbee.eeprom_present) { ZFS::erase(); - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data erased in %s"), PSTR("EEPROM")); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data erased in %s"), PSTR("EEPROM")); } } diff --git a/tasmota/xdrv_23_zigbee_5_converters.ino b/tasmota/xdrv_23_zigbee_5_converters.ino index 67beaf9f1..3380d2fc0 100644 --- a/tasmota/xdrv_23_zigbee_5_converters.ino +++ b/tasmota/xdrv_23_zigbee_5_converters.ino @@ -1656,7 +1656,7 @@ void ZCLFrame::parseClusterSpecificCommand(Z_attribute_list& attr_list) { Z_Device & device = zigbee_devices.getShortAddr(_srcaddr); if ((device.debounce_endpoint != 0) && (device.debounce_endpoint == _srcendpoint) && (device.debounce_transact == _transact_seq)) { // this is a duplicate, drop the packet - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "Discarding duplicate command from 0x%04X, endpoint %d"), _srcaddr, _srcendpoint); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "Discarding duplicate command from 0x%04X, endpoint %d"), _srcaddr, _srcendpoint); } else { // reset the duplicate marker, parse the packet normally, and set a timer to reset the marker later (which will discard any existing timer for the same device/endpoint) device.debounce_endpoint = _srcendpoint; diff --git a/tasmota/xdrv_23_zigbee_7_0_statemachine.ino b/tasmota/xdrv_23_zigbee_7_0_statemachine.ino index b2a01b6eb..7c85bc015 100644 --- a/tasmota/xdrv_23_zigbee_7_0_statemachine.ino +++ b/tasmota/xdrv_23_zigbee_7_0_statemachine.ino @@ -932,12 +932,12 @@ void ZigbeeGotoLabel(uint8_t label) { } // no label found, abort - AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Goto label not found, label=%d pc=%d"), label, zigbee.pc); + AddLog(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Goto label not found, label=%d pc=%d"), label, zigbee.pc); if (ZIGBEE_LABEL_ABORT != label) { // if not already looking for ZIGBEE_LABEL_ABORT, goto ZIGBEE_LABEL_ABORT ZigbeeGotoLabel(ZIGBEE_LABEL_ABORT); } else { - AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Label Abort (%d) not present, aborting Zigbee"), ZIGBEE_LABEL_ABORT); + AddLog(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Label Abort (%d) not present, aborting Zigbee"), ZIGBEE_LABEL_ABORT); zigbee.state_machine = false; zigbee.active = false; } @@ -955,7 +955,7 @@ void ZigbeeStateMachine_Run(void) { // checking if timeout expired if ((zigbee.next_timeout) && (now > zigbee.next_timeout)) { // if next_timeout == 0 then wait forever if (!zigbee.state_no_timeout) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "timeout, goto label %d"), zigbee.on_timeout_goto); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "timeout, goto label %d"), zigbee.on_timeout_goto); ZigbeeGotoLabel(zigbee.on_timeout_goto); } else { zigbee.state_waiting = false; // simply stop waiting @@ -971,7 +971,7 @@ void ZigbeeStateMachine_Run(void) { zigbee.state_no_timeout = false; // reset the no_timeout for next instruction if (zigbee.pc > ARRAY_SIZE(zb_prog)) { - AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Invalid pc: %d, aborting"), zigbee.pc); + AddLog(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Invalid pc: %d, aborting"), zigbee.pc); zigbee.pc = -1; } if (zigbee.pc < 0) { @@ -1020,7 +1020,7 @@ void ZigbeeStateMachine_Run(void) { case ZGB_INSTR_STOP: zigbee.state_machine = false; if (cur_d8) { - AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Stopping (%d)"), cur_d8); + AddLog(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Stopping (%d)"), cur_d8); } break; case ZGB_INSTR_CALL: diff --git a/tasmota/xdrv_23_zigbee_8_parsers.ino b/tasmota/xdrv_23_zigbee_8_parsers.ino index c5034b805..1ac9adb23 100644 --- a/tasmota/xdrv_23_zigbee_8_parsers.ino +++ b/tasmota/xdrv_23_zigbee_8_parsers.ino @@ -195,7 +195,7 @@ int32_t EZ_MessageSent(int32_t res, const class SBuffer &buf) { uint16_t group_addr = buf.get16(13); if ((EMBER_OUTGOING_MULTICAST == message_type) && (0xFFFD == dst_addr)) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "Sniffing group 0x%04X"), group_addr); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "Sniffing group 0x%04X"), group_addr); } return -1; // ignore } @@ -229,7 +229,7 @@ void Z_Send_State_or_Map(uint16_t shortaddr, uint8_t index, uint16_t zdo_cmd) { // This callback is registered to send ZbMap(s) to each device one at a time void Z_Map(uint16_t shortaddr, uint16_t groupaddr, uint16_t cluster, uint8_t endpoint, uint32_t value) { if (BAD_SHORTADDR != shortaddr) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "sending `ZbMap 0x%04X`"), shortaddr); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "sending `ZbMap 0x%04X`"), shortaddr); #ifdef USE_ZIGBEE_ZNP Z_Send_State_or_Map(shortaddr, value, ZDO_MGMT_LQI_REQ); #endif // USE_ZIGBEE_ZNP @@ -237,7 +237,7 @@ void Z_Map(uint16_t shortaddr, uint16_t groupaddr, uint16_t cluster, uint8_t end Z_Send_State_or_Map(shortaddr, value, ZDO_Mgmt_Lqi_req); #endif // USE_ZIGBEE_EZSP } else { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "ZbMap done")); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "ZbMap done")); zigbee.mapping_in_progress = false; zigbee.mapping_ready = true; } @@ -1393,7 +1393,7 @@ void Z_WriteCIEAddress(uint16_t shortaddr, uint16_t groupaddr, uint16_t cluster, buf.add8(ZEUI64); buf.add64(localIEEEAddr); - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Writing CIE address")); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Writing CIE address")); ZigbeeZCLSend_Raw(ZigbeeZCLSendMessage({ shortaddr, 0x0000, /* group */ @@ -1417,7 +1417,7 @@ void Z_SendCIEZoneEnrollResponse(uint16_t shortaddr, uint16_t groupaddr, uint16_ uint8_t transacid = zigbee_devices.getNextSeqNumber(shortaddr); uint8_t EnrollRSP[2] = { 0x00 /* Sucess */, Z_B0(value) /* ZoneID */ }; - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Sending Enroll Zone %d"), Z_B0(value)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Sending Enroll Zone %d"), Z_B0(value)); ZigbeeZCLSend_Raw(ZigbeeZCLSendMessage({ shortaddr, 0x0000, /* group */ @@ -1549,7 +1549,7 @@ void Z_AutoConfigReportingForCluster(uint16_t shortaddr, uint16_t groupaddr, uin // encode value int32_t res = encodeSingleAttribute(buf, report_change, "", attr_type); if (res < 0) { - AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "internal error, unsupported attribute type")); + AddLog(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "internal error, unsupported attribute type")); } else { Z_attribute attr; attr.setKeyName(PSTR("ReportableChange"), true); // true because in PMEM @@ -1676,7 +1676,7 @@ void Z_IncomingMessage(class ZCLFrame &zcl_received) { // discard the message if it was sent by us (broadcast or group loopback) if (srcaddr == localShortAddr) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "loopback message, ignoring")); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "loopback message, ignoring")); return; // abort the rest of message management } diff --git a/tasmota/xdrv_23_zigbee_9_serial.ino b/tasmota/xdrv_23_zigbee_9_serial.ino index e2c5550a4..19592de94 100644 --- a/tasmota/xdrv_23_zigbee_9_serial.ino +++ b/tasmota/xdrv_23_zigbee_9_serial.ino @@ -101,14 +101,14 @@ void ZigbeeInputLoop(void) { // in this case the first bit (lsb) is missed and Tasmota receives 0xFF instead of 0xFE // We forgive this mistake, and next bytes are automatically resynchronized if (ZIGBEE_SOF_ALT == zigbee_in_byte) { - AddLog_P(LOG_LEVEL_INFO, PSTR("ZbInput forgiven first byte %02X (only for statistics)"), zigbee_in_byte); + AddLog(LOG_LEVEL_INFO, PSTR("ZbInput forgiven first byte %02X (only for statistics)"), zigbee_in_byte); zigbee_in_byte = ZIGBEE_SOF; } } if ((0 == zigbee_buffer->len()) && (ZIGBEE_SOF != zigbee_in_byte)) { // waiting for SOF (Start Of Frame) byte, discard anything else - AddLog_P(LOG_LEVEL_INFO, PSTR("ZbInput discarding byte %02X"), zigbee_in_byte); + AddLog(LOG_LEVEL_INFO, PSTR("ZbInput discarding byte %02X"), zigbee_in_byte); continue; // discard } diff --git a/tasmota/xdrv_23_zigbee_9a_upload.ino b/tasmota/xdrv_23_zigbee_9a_upload.ino index d8157c127..79131078a 100644 --- a/tasmota/xdrv_23_zigbee_9a_upload.ino +++ b/tasmota/xdrv_23_zigbee_9a_upload.ino @@ -84,7 +84,7 @@ char ZigbeeUploadFlashRead(void) { // static bool padding = true; // if (padding) { -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Start padding from %d"), ZbUpload.byte_counter); +// AddLog(LOG_LEVEL_DEBUG, PSTR("XMD: Start padding from %d"), ZbUpload.byte_counter); // padding = false; // } @@ -151,7 +151,7 @@ char XModemWaitACK(void) in_char = ZigbeeSerial->read(); // if (in_char != XM_ACK) { -// AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("XMD: Rcvd3 0x%02X"), in_char); +// AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("XMD: Rcvd3 0x%02X"), in_char); // } if (XM_CAN == in_char) { return XM_CAN; } @@ -266,7 +266,7 @@ bool ZigbeeUploadBootloaderPrompt(void) { if (buf_len) { char hex_char[256]; ToHex_P(serial_buffer, buf_len, hex_char, 256); - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("XMD: Rcvd %s"), hex_char); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("XMD: Rcvd %s"), hex_char); } return ((4 == ZbUpload.byte_counter) && (millis() > XModem.flush_delay)); @@ -279,7 +279,7 @@ bool ZigbeeUploadXmodem(void) { } #ifdef ZIGBEE_BOOTLOADER_SOFTWARE_RESET_FIRST case ZBU_INIT: { // *** Init ESF32 bootloader - AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Init bootloader")); + AddLog(LOG_LEVEL_DEBUG, PSTR("XMD: Init bootloader")); ZbUpload.ota_step = ZBU_SOFTWARE_RESET; return false; // Keep Zigbee serial active } @@ -294,7 +294,7 @@ bool ZigbeeUploadXmodem(void) { } case ZBU_SOFTWARE_SEND: { if (millis() > XModem.timeout) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Bootloader software reset send timeout")); + AddLog(LOG_LEVEL_DEBUG, PSTR("XMD: Bootloader software reset send timeout")); ZbUpload.ota_step = ZBU_HARDWARE_RESET; return true; } @@ -319,17 +319,17 @@ bool ZigbeeUploadXmodem(void) { case ZBU_PROMPT: { // *** Wait for prompt and select option upload ebl if (millis() > XModem.timeout) { if (ZBU_SOFTWARE_RESET == ZbUpload.bootloader) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Bootloader software reset timeout")); + AddLog(LOG_LEVEL_DEBUG, PSTR("XMD: Bootloader software reset timeout")); ZbUpload.ota_step = ZBU_HARDWARE_RESET; } else { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Bootloader hardware reset timeout")); + AddLog(LOG_LEVEL_DEBUG, PSTR("XMD: Bootloader hardware reset timeout")); ZbUpload.ota_step = ZBU_ERROR; } return true; } #else // No ZIGBEE_BOOTLOADER_SOFTWARE_RESET_FIRST case ZBU_INIT: { // *** Init ESF32 bootloader - AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Init bootloader")); + AddLog(LOG_LEVEL_DEBUG, PSTR("XMD: Init bootloader")); ZigbeeUploadSetBootloader(0); // Reboot MCU EFR32 which returns below text XModem.timeout = millis() + (30 * 1000); // Allow 30 seconds to receive EBL prompt XModem.delay = millis() + (2 * XMODEM_FLUSH_DELAY); @@ -339,7 +339,7 @@ bool ZigbeeUploadXmodem(void) { } case ZBU_PROMPT: { // *** Wait for prompt and select option upload ebl if (millis() > XModem.timeout) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Bootloader timeout")); + AddLog(LOG_LEVEL_DEBUG, PSTR("XMD: Bootloader timeout")); ZbUpload.ota_step = ZBU_ERROR; return true; } @@ -360,7 +360,7 @@ bool ZigbeeUploadXmodem(void) { // 3. ebl info[cr][lf] // BL > if (ZigbeeUploadBootloaderPrompt()) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Init sync")); + AddLog(LOG_LEVEL_DEBUG, PSTR("XMD: Init sync")); ZigbeeSerial->flush(); ZigbeeSerial->write('1'); // upload ebl if (TasmotaGlobal.sleep > 0) { @@ -374,7 +374,7 @@ bool ZigbeeUploadXmodem(void) { } case ZBU_SYNC: { // *** Handle file upload using XModem - sync if (millis() > XModem.timeout) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: SYNC timeout")); + AddLog(LOG_LEVEL_DEBUG, PSTR("XMD: SYNC timeout")); ZbUpload.ota_step = ZBU_ERROR; return true; } @@ -385,7 +385,7 @@ bool ZigbeeUploadXmodem(void) { // C char xmodem_sync = ZigbeeSerial->read(); -// AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("XMD: Rcvd2 0x%02X"), xmodem_sync); +// AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("XMD: Rcvd2 0x%02X"), xmodem_sync); if (('C' == xmodem_sync) || (XM_NAK == xmodem_sync)) { // Determine which checksum algorithm to use @@ -393,7 +393,7 @@ bool ZigbeeUploadXmodem(void) { XModem.packet_no = 1; ZbUpload.byte_counter = 0; ZbUpload.ota_step = ZBU_UPLOAD; - AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Init packet send")); + AddLog(LOG_LEVEL_DEBUG, PSTR("XMD: Init packet send")); } } break; @@ -401,10 +401,10 @@ bool ZigbeeUploadXmodem(void) { case ZBU_UPLOAD: { // *** Handle file upload using XModem - upload if (ZigbeeUploadAvailable()) { if (ZbUpload.byte_counter && !(ZbUpload.byte_counter % 10240)) { // Show progress every 10kB - AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Progress %d kB"), ZbUpload.byte_counter / 1024); + AddLog(LOG_LEVEL_DEBUG, PSTR("XMD: Progress %d kB"), ZbUpload.byte_counter / 1024); } if (!XModemSendPacket(XModem.packet_no)) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Packet %d send failed"), XModem.packet_no); + AddLog(LOG_LEVEL_DEBUG, PSTR("XMD: Packet %d send failed"), XModem.packet_no); ZbUpload.ota_step = ZBU_ERROR; return true; } @@ -416,7 +416,7 @@ bool ZigbeeUploadXmodem(void) { ZigbeeSerial->write(XM_EOT); XModem.timeout = millis() + (30 * 1000); // Allow 30 seconds to receive EOT ACK ZbUpload.ota_step = ZBU_EOT; - AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Transferred %d bytes"), ZbUpload.ota_size); + AddLog(LOG_LEVEL_DEBUG, PSTR("XMD: Transferred %d bytes"), ZbUpload.ota_size); } break; } @@ -427,19 +427,19 @@ bool ZigbeeUploadXmodem(void) { // its XModem state machine waits a sufficient amount of time to allow this checksum process // to occur without timing out on the response just before the EOT is sent. if (millis() > XModem.timeout) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: EOT ACK timeout")); + AddLog(LOG_LEVEL_DEBUG, PSTR("XMD: EOT ACK timeout")); ZbUpload.ota_step = ZBU_ERROR; return true; } if (ZigbeeSerial->available()) { char xmodem_ack = XModemWaitACK(); if (XM_CAN == xmodem_ack) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Transfer invalid")); + AddLog(LOG_LEVEL_DEBUG, PSTR("XMD: Transfer invalid")); ZbUpload.ota_step = ZBU_ERROR; return true; } else if (XM_ACK == xmodem_ack) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: " D_SUCCESSFUL)); + AddLog(LOG_LEVEL_DEBUG, PSTR("XMD: " D_SUCCESSFUL)); XModem.timeout = millis() + (30 * 1000); // Allow 30 seconds to receive EBL prompt ZbUpload.byte_counter = 0; ZbUpload.ota_step = ZBU_COMPLETE; @@ -449,7 +449,7 @@ bool ZigbeeUploadXmodem(void) { } case ZBU_COMPLETE: { // *** Wait for Serial upload complete EBL prompt if (millis() > XModem.timeout) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Bootloader timeout")); + AddLog(LOG_LEVEL_DEBUG, PSTR("XMD: Bootloader timeout")); ZbUpload.ota_step = ZBU_ERROR; return true; } else { @@ -467,14 +467,14 @@ bool ZigbeeUploadXmodem(void) { if (ZigbeeUploadBootloaderPrompt()) { ZbUpload.state = ZBU_COMPLETE; ZbUpload.ota_step = ZBU_DONE; - AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: " D_RESTARTING)); + AddLog(LOG_LEVEL_DEBUG, PSTR("XMD: " D_RESTARTING)); } } break; } case ZBU_ERROR: ZbUpload.state = ZBU_ERROR; - AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: " D_FAILED)); + AddLog(LOG_LEVEL_DEBUG, PSTR("XMD: " D_FAILED)); case ZBU_DONE: { // *** Clean up and restart to disable bootloader and use new firmware ZigbeeUploadSetBootloader(1); // Disable bootloader and reset MCU - should happen at restart if (1 == TasmotaGlobal.sleep) { @@ -547,7 +547,7 @@ void HandleZigbeeXfer(void) { return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_UPLOAD_TRANSFER)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_UPLOAD_TRANSFER)); WSContentStart_P(PSTR(D_INFORMATION)); WSContentSend_P(HTTP_SCRIPT_XFER_STATE); diff --git a/tasmota/xdrv_23_zigbee_A_impl.ino b/tasmota/xdrv_23_zigbee_A_impl.ino index 1e4683f28..af66a4972 100644 --- a/tasmota/xdrv_23_zigbee_A_impl.ino +++ b/tasmota/xdrv_23_zigbee_A_impl.ino @@ -67,7 +67,7 @@ void ZigbeeInit(void) // Check if settings in Flash are set if (PinUsed(GPIO_ZIGBEE_RX) && PinUsed(GPIO_ZIGBEE_TX)) { if (0 == Settings.zb_channel) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE D_ZIGBEE_RANDOMIZING_ZBCONFIG)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE D_ZIGBEE_RANDOMIZING_ZBCONFIG)); uint64_t mac64 = 0; // stuff mac address into 64 bits WiFi.macAddress((uint8_t*) &mac64); uint32_t esp_id = ESP_getChipId(); @@ -103,7 +103,7 @@ void ZigbeeInit(void) Wire.beginTransmission(USE_ZIGBEE_ZBBRIDGE_EEPROM); uint8_t error = Wire.endTransmission(); if (0 == error) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE D_ZIGBEE_EEPROM_FOUND_AT_ADDRESS " 0x%02X"), USE_ZIGBEE_ZBBRIDGE_EEPROM); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE D_ZIGBEE_EEPROM_FOUND_AT_ADDRESS " 0x%02X"), USE_ZIGBEE_ZBBRIDGE_EEPROM); zigbee.eeprom_present = true; } #endif diff --git a/tasmota/xdrv_24_buzzer.ino b/tasmota/xdrv_24_buzzer.ino index e6665e21f..868c1d84a 100644 --- a/tasmota/xdrv_24_buzzer.ino +++ b/tasmota/xdrv_24_buzzer.ino @@ -97,7 +97,7 @@ void BuzzerBeep(uint32_t count, uint32_t on, uint32_t off, uint32_t tune, uint32 Buzzer.freq_mode = 0; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR("BUZ: %d(%d),%d,%d,0x%08X(0x%08X),%d"), count, Buzzer.count, on, off, tune, Buzzer.tune, Buzzer.freq_mode); + AddLog(LOG_LEVEL_DEBUG, PSTR("BUZ: %d(%d),%d,%d,0x%08X(0x%08X),%d"), count, Buzzer.count, on, off, tune, Buzzer.tune, Buzzer.freq_mode); Buzzer.enable = (Buzzer.count > 0); if (Buzzer.enable) { diff --git a/tasmota/xdrv_26_ariluxrf.ino b/tasmota/xdrv_26_ariluxrf.ino index fca693c8d..0246e6a8f 100644 --- a/tasmota/xdrv_26_ariluxrf.ino +++ b/tasmota/xdrv_26_ariluxrf.ino @@ -98,7 +98,7 @@ void AriluxRfHandler(void) uint16_t stored_hostcode = Settings.rf_code[1][6] << 8 | Settings.rf_code[1][7]; // DEBUG_DRIVER_LOG(PSTR(D_LOG_RFR D_HOST D_CODE " 0x%04X, " D_RECEIVED " 0x%06X"), stored_hostcode, Arilux.rf_received_value); - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_RFR D_HOST D_CODE " 0x%04X, " D_RECEIVED " 0x%06X"), stored_hostcode, Arilux.rf_received_value); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_RFR D_HOST D_CODE " 0x%04X, " D_RECEIVED " 0x%06X"), stored_hostcode, Arilux.rf_received_value); if (hostcode == stored_hostcode) { char command[33]; diff --git a/tasmota/xdrv_27_shutter.ino b/tasmota/xdrv_27_shutter.ino index a774398ba..8ac9f2940 100644 --- a/tasmota/xdrv_27_shutter.ino +++ b/tasmota/xdrv_27_shutter.ino @@ -144,7 +144,7 @@ void ShutterRtc50mS(void) case SHT_COUNTER: if (Shutter[i].accelerator) { - //AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Accelerator i=%d -> %d"),i, Shutter[i].accelerator); + //AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Accelerator i=%d -> %d"),i, Shutter[i].accelerator); ShutterUpdateVelocity(i); analogWriteFreq(Shutter[i].pwm_velocity); analogWrite(Pin(GPIO_PWM1, i), 50); @@ -164,7 +164,7 @@ int32_t ShutterPercentToRealPosition(int16_t percent, uint32_t index) // check against DIV 0 for (uint32_t j = 0; j < 5; j++) { if (0 == Settings.shuttercoeff[j][index]) { - AddLog_P(LOG_LEVEL_ERROR, PSTR("SHT: RESET/INIT CALIBRATION MATRIX DIV 0")); + AddLog(LOG_LEVEL_ERROR, PSTR("SHT: RESET/INIT CALIBRATION MATRIX DIV 0")); for (uint32_t k = 0; k < 5; k++) { Settings.shuttercoeff[k][index] = SHT_DIV_ROUND(calibrate_pos[k+1] * 1000, calibrate_pos[5]); } @@ -251,7 +251,7 @@ void ShutterInit(void) if (Settings.shutter_mode == SHT_UNDEF) { bool relay_in_interlock = false; - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Mode undef.. calculate...")); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Mode undef.. calculate...")); for (uint32_t j = 0; j < MAX_INTERLOCKS * Settings.flag.interlock; j++) { // CMND_INTERLOCK - Enable/disable interlock //AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT: Interlock state i=%d %d, flag %d, Shuttermask %d, MaskedIL %d"),i, Settings.interlock[i], Settings.flag.interlock,ShutterGlobal.RelayShutterMask, Settings.interlock[i]&ShutterGlobal.RelayShutterMask); @@ -400,7 +400,7 @@ void ShutterDecellerateForStop(uint8_t i) int16_t missing_steps; Shutter[i].accelerator = -(ShutterGlobal.open_velocity_max / (Shutter[i].motordelay>4 ? (Shutter[i].motordelay*11)/10 : 4) ); while (Shutter[i].pwm_velocity > -2*Shutter[i].accelerator ) { - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Velocity %ld, Delta %d"), Shutter[i].pwm_velocity, Shutter[i].accelerator ); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Velocity %ld, Delta %d"), Shutter[i].pwm_velocity, Shutter[i].accelerator ); //Shutter[i].pwm_velocity = tmax(Shutter[i].pwm_velocity-Shutter[i].accelerator , 0); // Control will be done in RTC Ticker. delay(50); @@ -408,7 +408,7 @@ void ShutterDecellerateForStop(uint8_t i) if (ShutterGlobal.position_mode == SHT_COUNTER){ missing_steps = ((Shutter[i].target_position-Shutter[i].start_position)*Shutter[i].direction*ShutterGlobal.open_velocity_max/RESOLUTION/STEPS_PER_SECOND) - RtcSettings.pulse_counter[i]; //prepare for stop PWM - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Remain steps %d, Counter %d, Freq %d"), missing_steps, RtcSettings.pulse_counter[i] ,Shutter[i].pwm_velocity); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Remain steps %d, Counter %d, Freq %d"), missing_steps, RtcSettings.pulse_counter[i] ,Shutter[i].pwm_velocity); Shutter[i].accelerator = 0; Shutter[i].pwm_velocity = Shutter[i].pwm_velocity > 250 ? 250 : Shutter[i].pwm_velocity; analogWriteFreq(Shutter[i].pwm_velocity); @@ -419,7 +419,7 @@ void ShutterDecellerateForStop(uint8_t i) } analogWrite(Pin(GPIO_PWM1, i), 0); // removed with 8.3 because of reset caused by watchog Shutter[i].real_position = ShutterCalculatePosition(i); - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Real %d, Pulsecount %d, Start %d"), Shutter[i].real_position,RtcSettings.pulse_counter[i], Shutter[i].start_position); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Real %d, Pulsecount %d, Start %d"), Shutter[i].real_position,RtcSettings.pulse_counter[i], Shutter[i].start_position); } Shutter[i].direction = 0; @@ -429,7 +429,7 @@ void ShutterDecellerateForStop(uint8_t i) } void ShutterPowerOff(uint8_t i) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT: Stop Shutter %d. Switchmode %d"), i,Shutter[i].switch_mode); + AddLog(LOG_LEVEL_DEBUG, PSTR("SHT: Stop Shutter %d. Switchmode %d"), i,Shutter[i].switch_mode); ShutterDecellerateForStop(i); switch (Shutter[i].switch_mode) { case SHT_SWITCH: @@ -520,14 +520,14 @@ void ShutterAllowPreStartProcedure(uint8_t i) { #ifdef USE_RULES uint32_t uptime_Local=0; - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Delay Start. var%d <99>=<%s>, max10s?"),i+i, rules_vars[i]); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Delay Start. var%d <99>=<%s>, max10s?"),i+i, rules_vars[i]); TasmotaGlobal.rules_flag.shutter_moving = 1; XdrvRulesProcess(); uptime_Local = TasmotaGlobal.uptime; while (uptime_Local+10 > TasmotaGlobal.uptime && (String)rules_vars[i] == "99") { loop(); } - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Delay Start. Done")); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Delay Start. Done")); #endif // USE_RULES } @@ -657,7 +657,7 @@ void ShutterRelayChanged(void) switch (powerstate_local) { case 1: ShutterStartInit(i, Shutter[i].lastdirection*-1 , Shutter[i].lastdirection == 1 ? 0 : Shutter[i].open_max); - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shtr%d Garage. NewTarget %d"), i, Shutter[i].target_position); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shtr%d Garage. NewTarget %d"), i, Shutter[i].target_position); break; default: Shutter[i].target_position = Shutter[i].real_position; @@ -665,7 +665,7 @@ void ShutterRelayChanged(void) } // switch (ShutterGlobal.position_mode) - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shtr%d, Target %ld, Powerstatelocal %d"), i+1, Shutter[i].target_position, powerstate_local); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shtr%d, Target %ld, Powerstatelocal %d"), i+1, Shutter[i].target_position, powerstate_local); } // if (manual_relays_changed) } // for (uint32_t i = 0; i < TasmotaGlobal.shutters_present; i++) } @@ -760,12 +760,12 @@ void ShutterButtonHandler(void) Settings.shutter_button[i], shutter_index, Button.press_counter[i] , min_shutterbutton_press_counter, i); if ((button_index != i) && (Settings.shutter_button[i] & (1<<31)) && ((Settings.shutter_button[i] & 0x03) == shutter_index) && (i != button_index) && (Button.press_counter[i] < min_shutterbutton_press_counter)) { min_shutterbutton_press_counter = Button.press_counter[i]; - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: minShutterButtonPressCounter %d"), min_shutterbutton_press_counter); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: minShutterButtonPressCounter %d"), min_shutterbutton_press_counter); } } if (min_shutterbutton_press_counter == Button.press_counter[button_index]) { // simultaneous shutter button press detected - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Simultanous press detected")); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Simultanous press detected")); press_index = Button.press_counter[button_index]; for (uint32_t i = 0; i < MAX_KEYS; i++) if ((Settings.shutter_button[i] & (1<<31)) && ((Settings.shutter_button[i] & 0x03) != shutter_index)) @@ -871,7 +871,7 @@ void ShutterSetPosition(uint32_t device, uint32_t position) void ShutterToggle(bool dir) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT: Payload toggle: %d, i %d, dir %d"), XdrvMailbox.payload, XdrvMailbox.index, dir); + AddLog(LOG_LEVEL_DEBUG, PSTR("SHT: Payload toggle: %d, i %d, dir %d"), XdrvMailbox.payload, XdrvMailbox.index, dir); if ((1 == XdrvMailbox.index) && (XdrvMailbox.payload != -99)) { XdrvMailbox.index = XdrvMailbox.payload; } @@ -895,7 +895,7 @@ void ShutterToggle(bool dir) void CmndShutterOpen(void) { - //AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT: Payload open: %d, i %d"), XdrvMailbox.payload, XdrvMailbox.index); + //AddLog(LOG_LEVEL_DEBUG, PSTR("SHT: Payload open: %d, i %d"), XdrvMailbox.payload, XdrvMailbox.index); if ((1 == XdrvMailbox.index) && (XdrvMailbox.payload != -99)) { XdrvMailbox.index = XdrvMailbox.payload; } @@ -918,7 +918,7 @@ void CmndShutterStopOpen(void) void CmndShutterClose(void) { - //AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT: Payload close: %d, i %d"), XdrvMailbox.payload, XdrvMailbox.index); + //AddLog(LOG_LEVEL_DEBUG, PSTR("SHT: Payload close: %d, i %d"), XdrvMailbox.payload, XdrvMailbox.index); if ((1 == XdrvMailbox.index) && (XdrvMailbox.payload != -99)) { XdrvMailbox.index = XdrvMailbox.payload; } @@ -984,7 +984,7 @@ void CmndShutterStop(void) uint32_t i = XdrvMailbox.index -1; if (Shutter[i].direction != 0) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT: Stop moving %d: dir: %d"), XdrvMailbox.index, Shutter[i].direction); + AddLog(LOG_LEVEL_DEBUG, PSTR("SHT: Stop moving %d: dir: %d"), XdrvMailbox.index, Shutter[i].direction); Shutter[i].target_position = Shutter[i].real_position; } if (XdrvMailbox.command) @@ -1016,7 +1016,7 @@ void CmndShutterPosition(void) if (!(Settings.shutter_options[XdrvMailbox.index-1] & 2)) { uint32_t index = XdrvMailbox.index-1; //limit the payload - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Pos. in: payload %s (%d), payload %d, idx %d, src %d"), XdrvMailbox.data , XdrvMailbox.data_len, XdrvMailbox.payload , XdrvMailbox.index, TasmotaGlobal.last_source ); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Pos. in: payload %s (%d), payload %d, idx %d, src %d"), XdrvMailbox.data , XdrvMailbox.data_len, XdrvMailbox.payload , XdrvMailbox.index, TasmotaGlobal.last_source ); // value 0 with data_len > 0 can mean Open // special handling fo UP,DOWN,TOGGLE,STOP command comming with payload -99 @@ -1053,7 +1053,7 @@ void CmndShutterPosition(void) Shutter[index].target_position = ShutterPercentToRealPosition(target_pos_percent, index); //Shutter[i].accelerator[index] = ShutterGlobal.open_velocity_max / ((Shutter[i].motordelay[index] > 0) ? Shutter[i].motordelay[index] : 1); //Shutter[i].target_position[index] = XdrvMailbox.payload < 5 ? Settings.shuttercoeff[2][index] * XdrvMailbox.payload : Settings.shuttercoeff[1][index] * XdrvMailbox.payload + Settings.shuttercoeff[0,index]; - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: lastsource %d:, real %d, target %d, payload %d"), TasmotaGlobal.last_source, Shutter[index].real_position ,Shutter[index].target_position,target_pos_percent); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: lastsource %d:, real %d, target %d, payload %d"), TasmotaGlobal.last_source, Shutter[index].real_position ,Shutter[index].target_position,target_pos_percent); } if ( (target_pos_percent >= 0) && (target_pos_percent <= 100) && abs(Shutter[index].target_position - Shutter[index].real_position ) / Shutter[index].close_velocity > 2) { if (Settings.shutter_options[index] & 4) { @@ -1090,7 +1090,7 @@ void CmndShutterPosition(void) case SHT_TIME_GARAGE: if (!ShutterGlobal.skip_relay_change) { if (new_shutterdirection == Shutter[index].lastdirection) { - AddLog_P(LOG_LEVEL_INFO, PSTR("SHT: Garage not move in this direction: %d"), Shutter[index].switch_mode == SHT_PULSE); + AddLog(LOG_LEVEL_INFO, PSTR("SHT: Garage not move in this direction: %d"), Shutter[index].switch_mode == SHT_PULSE); for (uint8_t k=0 ; k <= (uint8_t)(Shutter[index].switch_mode == SHT_PULSE) ; k++) { ExecuteCommandPowerShutter(Settings.shutter_startrelay[index], 1, SRC_SHUTTER); delay(500); @@ -1400,7 +1400,7 @@ void CmndShutterPwmRange(void) } Settings.shutter_pwmrange[i][XdrvMailbox.index -1] = field; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT: Shtr%d Init1. pwmmin %d, pwmmax %d"), XdrvMailbox.index , Settings.shutter_pwmrange[0][XdrvMailbox.index -1], Settings.shutter_pwmrange[1][XdrvMailbox.index -1]); + AddLog(LOG_LEVEL_DEBUG, PSTR("SHT: Shtr%d Init1. pwmmin %d, pwmmax %d"), XdrvMailbox.index , Settings.shutter_pwmrange[0][XdrvMailbox.index -1], Settings.shutter_pwmrange[1][XdrvMailbox.index -1]); ShutterInit(); ResponseCmndIdxChar(XdrvMailbox.data); } else { @@ -1433,7 +1433,7 @@ void CmndShutterCalibration(void) Settings.shutter_set50percent[XdrvMailbox.index -1] = 50; for (i = 0; i < 5; i++) { Settings.shuttercoeff[i][XdrvMailbox.index -1] = SHT_DIV_ROUND((uint32_t)messwerte[i] * 1000, messwerte[4]); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT: Shuttercoeff %d, i %d, Value %d, MeasuredValue %d"), i,XdrvMailbox.index -1,Settings.shuttercoeff[i][XdrvMailbox.index -1], messwerte[i]); + AddLog(LOG_LEVEL_DEBUG, PSTR("SHT: Shuttercoeff %d, i %d, Value %d, MeasuredValue %d"), i,XdrvMailbox.index -1,Settings.shuttercoeff[i][XdrvMailbox.index -1], messwerte[i]); } ShutterInit(); ResponseCmndIdxChar(XdrvMailbox.data); @@ -1514,7 +1514,7 @@ bool Xdrv27(uint8_t function) char stemp1[10]; // extract the number of the relay that was switched and save for later in Update Position. ShutterGlobal.RelayCurrentMask = XdrvMailbox.index ^ ShutterGlobal.RelayOldMask; - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Switched relay %d by %s"), ShutterGlobal.RelayCurrentMask,GetTextIndexed(stemp1, sizeof(stemp1), TasmotaGlobal.last_source, kCommandSource)); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Switched relay %d by %s"), ShutterGlobal.RelayCurrentMask,GetTextIndexed(stemp1, sizeof(stemp1), TasmotaGlobal.last_source, kCommandSource)); ShutterRelayChanged(); ShutterGlobal.RelayOldMask = XdrvMailbox.index; break; @@ -1527,10 +1527,10 @@ bool Xdrv27(uint8_t function) } ShutterGlobal.RelayCurrentMask >>= 1; } - //AddLog_P(LOG_LEVEL_ERROR, PSTR("SHT: Skip relay change %d"), i+1); + //AddLog(LOG_LEVEL_ERROR, PSTR("SHT: Skip relay change %d"), i+1); result = true; ShutterGlobal.skip_relay_change = 0; - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Skipping switch off relay %d"), i); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Skipping switch off relay %d"), i); ExecuteCommandPowerShutter(i+1, 0, SRC_SHUTTER); } break; diff --git a/tasmota/xdrv_28_pcf8574.ino b/tasmota/xdrv_28_pcf8574.ino index b79f3caa6..231476ba2 100644 --- a/tasmota/xdrv_28_pcf8574.ino +++ b/tasmota/xdrv_28_pcf8574.ino @@ -48,14 +48,14 @@ void Pcf8574SwitchRelay(void) for (uint32_t i = 0; i < TasmotaGlobal.devices_present; i++) { uint8_t relay_state = bitRead(XdrvMailbox.index, i); - //AddLog_P(LOG_LEVEL_DEBUG, PSTR("PCF: Pcf8574.max_devices %d requested pin %d"), Pcf8574.max_devices,Pcf8574.pin[i]); + //AddLog(LOG_LEVEL_DEBUG, PSTR("PCF: Pcf8574.max_devices %d requested pin %d"), Pcf8574.max_devices,Pcf8574.pin[i]); if (Pcf8574.max_devices > 0 && Pcf8574.pin[i] < 99) { uint8_t board = Pcf8574.pin[i]>>3; uint8_t oldpinmask = Pcf8574.pin_mask[board]; uint8_t _val = bitRead(TasmotaGlobal.rel_inverted, i) ? !relay_state : relay_state; - //AddLog_P(LOG_LEVEL_DEBUG, PSTR("PCF: Pcf8574SwitchRelay %d on pin %d"), i,state); + //AddLog(LOG_LEVEL_DEBUG, PSTR("PCF: Pcf8574SwitchRelay %d on pin %d"), i,state); if (_val) { Pcf8574.pin_mask[board] |= _val << (Pcf8574.pin[i]&0x7); @@ -79,7 +79,7 @@ void Pcf8574Init(void) #ifdef USE_MCP230xx_ADDR if (USE_MCP230xx_ADDR == pcf8574_address) { - AddLog_P(LOG_LEVEL_INFO, PSTR("PCF: Address 0x%02x reserved for MCP320xx skipped"), pcf8574_address); + AddLog(LOG_LEVEL_INFO, PSTR("PCF: Address 0x%02x reserved for MCP320xx skipped"), pcf8574_address); pcf8574_address++; if ((PCF8574_ADDR1 +7) == pcf8574_address) { // Support I2C addresses 0x20 to 0x26 and 0x39 to 0x3F pcf8574_address = PCF8574_ADDR2 +1; @@ -87,7 +87,7 @@ void Pcf8574Init(void) } #endif - // AddLog_P(LOG_LEVEL_DEBUG, PSTR("PCF: Probing addr: 0x%x for PCF8574"), pcf8574_address); + // AddLog(LOG_LEVEL_DEBUG, PSTR("PCF: Probing addr: 0x%x for PCF8574"), pcf8574_address); if (I2cSetDevice(pcf8574_address)) { Pcf8574.type = true; @@ -115,7 +115,7 @@ void Pcf8574Init(void) Pcf8574.max_connected_ports = 0; // reset no of devices to avoid duplicate ports on duplicate init. for (uint32_t idx = 0; idx < Pcf8574.max_devices; idx++) { // suport up to 8 boards PCF8574 - AddLog_P(LOG_LEVEL_DEBUG, PSTR("PCF: Device %d config 0x%02x"), idx +1, Settings.pcf8574_config[idx]); + AddLog(LOG_LEVEL_DEBUG, PSTR("PCF: Device %d config 0x%02x"), idx +1, Settings.pcf8574_config[idx]); for (uint32_t i = 0; i < 8; i++) { uint8_t _result = Settings.pcf8574_config[idx] >> i &1; @@ -128,7 +128,7 @@ void Pcf8574Init(void) } } } - AddLog_P(LOG_LEVEL_INFO, PSTR("PCF: Total devices %d, PCF8574 output ports %d"), Pcf8574.max_devices, Pcf8574.max_connected_ports); + AddLog(LOG_LEVEL_INFO, PSTR("PCF: Total devices %d, PCF8574 output ports %d"), Pcf8574.max_devices, Pcf8574.max_connected_ports); } } @@ -158,7 +158,7 @@ void HandlePcf8574(void) { if (!HttpCheckPriviledgedAccess()) { return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_PCF8574)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_PCF8574)); if (Webserver->hasArg("save")) { Pcf8574SaveSettings(); @@ -193,7 +193,7 @@ void Pcf8574SaveSettings(void) char stemp[7]; char tmp[100]; - //AddLog_P(LOG_LEVEL_DEBUG, PSTR("PCF: Start working on Save arguements: inverted:%d")), Webserver->hasArg("b1"); + //AddLog(LOG_LEVEL_DEBUG, PSTR("PCF: Start working on Save arguements: inverted:%d")), Webserver->hasArg("b1"); Settings.flag3.pcf8574_ports_inverted = Webserver->hasArg("b1"); // SetOption81 - Invert all ports on PCF8574 devices for (byte idx = 0; idx < Pcf8574.max_devices; idx++) { @@ -219,7 +219,7 @@ void Pcf8574SaveSettings(void) } } //Settings.pcf8574_config[0] = (!strlen(webServer->arg("i2cs0").c_str())) ? 0 : atoi(webServer->arg("i2cs0").c_str()); - //AddLog_P(LOG_LEVEL_INFO, PSTR("PCF: I2C Board: %d, Config: %2x")), idx, Settings.pcf8574_config[idx]; + //AddLog(LOG_LEVEL_INFO, PSTR("PCF: I2C Board: %d, Config: %2x")), idx, Settings.pcf8574_config[idx]; } } diff --git a/tasmota/xdrv_29_deepsleep.ino b/tasmota/xdrv_29_deepsleep.ino index 3e28a9d31..45da79cb2 100644 --- a/tasmota/xdrv_29_deepsleep.ino +++ b/tasmota/xdrv_29_deepsleep.ino @@ -68,7 +68,7 @@ void DeepSleepReInit(void) if ((RtcSettings.ultradeepsleep > DEEPSLEEP_MAX_CYCLE) && (RtcSettings.ultradeepsleep < 1700000000)) { // Go back to sleep after 60 minutes if requested deepsleep has not been reached RtcSettings.ultradeepsleep = RtcSettings.ultradeepsleep - DEEPSLEEP_MAX_CYCLE; - AddLog_P(LOG_LEVEL_ERROR, PSTR("DSL: Remain DeepSleep %d"), RtcSettings.ultradeepsleep); + AddLog(LOG_LEVEL_ERROR, PSTR("DSL: Remain DeepSleep %d"), RtcSettings.ultradeepsleep); RtcSettingsSave(); RtcRebootReset(); #ifdef ESP8266 @@ -96,7 +96,7 @@ void DeepSleepPrepare(void) (RtcSettings.deepsleep_slip < 9000) || (RtcSettings.deepsleep_slip > 11000) || (RtcSettings.nextwakeup > (UtcTime() + Settings.deepsleep))) { - AddLog_P(LOG_LEVEL_ERROR, PSTR("DSL: Reset wrong settings wakeup: %ld, slip %ld"), RtcSettings.nextwakeup, RtcSettings.deepsleep_slip ); + AddLog(LOG_LEVEL_ERROR, PSTR("DSL: Reset wrong settings wakeup: %ld, slip %ld"), RtcSettings.nextwakeup, RtcSettings.deepsleep_slip ); RtcSettings.nextwakeup = 0; RtcSettings.deepsleep_slip = 10000; } @@ -137,7 +137,7 @@ void DeepSleepPrepare(void) void DeepSleepStart(void) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION "Sleeping")); // Won't show in GUI + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION "Sleeping")); // Won't show in GUI WifiShutdown(); RtcSettings.ultradeepsleep = RtcSettings.nextwakeup - UtcTime(); diff --git a/tasmota/xdrv_30_exs_dimmer.ino b/tasmota/xdrv_30_exs_dimmer.ino index b704d616d..ffab61d5d 100644 --- a/tasmota/xdrv_30_exs_dimmer.ino +++ b/tasmota/xdrv_30_exs_dimmer.ino @@ -124,7 +124,7 @@ void ExsSerialSend(const uint8_t data[] = nullptr, uint16_t len = 0) char rc; #ifdef EXS_DEBUG - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("EXS: Tx Packet:")); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("EXS: Tx Packet:")); AddLogBuffer(LOG_LEVEL_DEBUG_MORE, (uint8_t *)data, len); #endif @@ -145,7 +145,7 @@ void ExsSerialSend(const uint8_t data[] = nullptr, uint16_t len = 0) { // timeout #ifdef EXS_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR("ESX: serial send timeout")); + AddLog(LOG_LEVEL_DEBUG, PSTR("ESX: serial send timeout")); #endif continue; } @@ -215,9 +215,9 @@ void ExsSetBri(uint8_t device, uint8_t bri) void ExsSyncState(uint8_t device) { #ifdef EXS_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR("EXS: Channel %d Power Want %d, Is %d"), + AddLog(LOG_LEVEL_DEBUG, PSTR("EXS: Channel %d Power Want %d, Is %d"), device, bitRead(Exs.power, device), Exs.dimmer.channel[device].dimm); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("EXS: Set Channel %d Brightness Want %d, Is %d"), + AddLog(LOG_LEVEL_DEBUG, PSTR("EXS: Set Channel %d Brightness Want %d, Is %d"), device, Exs.dimm[device], Exs.dimmer.channel[device].bright_tbl); #endif @@ -236,7 +236,7 @@ void ExsSyncState(uint8_t device) bool ExsSyncState() { #ifdef EXS_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR("EXS: Serial %p, Cmd %d"), ExsSerial, Exs.cmd_status); + AddLog(LOG_LEVEL_DEBUG, PSTR("EXS: Serial %p, Cmd %d"), ExsSerial, Exs.cmd_status); #endif if (!ExsSerial || Exs.cmd_status != 0) @@ -363,7 +363,7 @@ bool ExsModuleSelected(void) bool ExsSetChannels(void) { #ifdef EXS_DEBUG - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("EXS: SetChannels:")); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("EXS: SetChannels:")); AddLogBuffer(LOG_LEVEL_DEBUG_MORE, (uint8_t *)XdrvMailbox.data, XdrvMailbox.data_len); #endif @@ -374,7 +374,7 @@ bool ExsSetChannels(void) bool ExsSetPower(void) { - AddLog_P(LOG_LEVEL_INFO, PSTR("EXS: Set Power, Device %d, Power 0x%02x"), + AddLog(LOG_LEVEL_INFO, PSTR("EXS: Set Power, Device %d, Power 0x%02x"), TasmotaGlobal.active_device, XdrvMailbox.index); Exs.power = XdrvMailbox.index; @@ -386,7 +386,7 @@ void EsxMcuStart(void) int retries = 3; #ifdef EXS_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR("EXS: Request MCU configuration, PIN %d to Low"), Pin(GPIO_EXS_ENABLE)); + AddLog(LOG_LEVEL_DEBUG, PSTR("EXS: Request MCU configuration, PIN %d to Low"), Pin(GPIO_EXS_ENABLE)); #endif pinMode(Pin(GPIO_EXS_ENABLE), OUTPUT); @@ -404,7 +404,7 @@ void EsxMcuStart(void) void ExsInit(void) { #ifdef EXS_DEBUG - AddLog_P(LOG_LEVEL_INFO, PSTR("EXS: Starting Tx %d Rx %d"), Pin(GPIO_TXD), Pin(GPIO_RXD)); + AddLog(LOG_LEVEL_INFO, PSTR("EXS: Starting Tx %d Rx %d"), Pin(GPIO_TXD), Pin(GPIO_RXD)); #endif Exs.buffer = (uint8_t *)malloc(EXS_BUFFER_SIZE); @@ -432,7 +432,7 @@ void ExsSerialInput(void) yield(); uint8_t serial_in_byte = ExsSerial->read(); - AddLog_P(LOG_LEVEL_INFO, PSTR("EXS: Serial In Byte 0x%02x"), serial_in_byte); + AddLog(LOG_LEVEL_INFO, PSTR("EXS: Serial In Byte 0x%02x"), serial_in_byte); if (Exs.cmd_status == 0 && serial_in_byte == 0x7B) @@ -456,7 +456,7 @@ void ExsSerialInput(void) Exs.cmd_status = 0; #ifdef EXS_DEBUG - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("EXS: CRC: 0x%02x, RX Packet:"), crc); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("EXS: CRC: 0x%02x, RX Packet:"), crc); AddLogBuffer(LOG_LEVEL_DEBUG_MORE, (uint8_t *)Exs.buffer, Exs.byte_counter); #endif diff --git a/tasmota/xdrv_31_tasmota_client.ino b/tasmota/xdrv_31_tasmota_client.ino index bf4426b61..54082d827 100644 --- a/tasmota/xdrv_31_tasmota_client.ino +++ b/tasmota/xdrv_31_tasmota_client.ino @@ -238,14 +238,14 @@ uint8_t TasmotaClient_receiveData(char* buffer, int size) { } if (255 == index) { index = 0; } -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("TCL: ReceiveData")); +// AddLog(LOG_LEVEL_DEBUG, PSTR("TCL: ReceiveData")); // AddLogBuffer(LOG_LEVEL_DEBUG, (uint8_t*)buffer, index); return index; } uint8_t TasmotaClient_sendBytes(uint8_t* bytes, int count) { -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("TCL: SendBytes")); +// AddLog(LOG_LEVEL_DEBUG, PSTR("TCL: SendBytes")); // AddLogBuffer(LOG_LEVEL_DEBUG, (uint8_t*)&bytes, count); TasmotaClient_Serial->write(bytes, count); @@ -298,7 +298,7 @@ uint32_t TasmotaClient_Flash(uint8_t* data, size_t size) { } if (timeout > 50) { return 1; } // Error: Bootloader could not be found - AddLog_P(LOG_LEVEL_INFO, PSTR("TCL: Found bootloader")); + AddLog(LOG_LEVEL_INFO, PSTR("TCL: Found bootloader")); uint8_t ProgParams[] = {0x86, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x03, 0xff, 0xff, 0xff, 0xff, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, 0x80, 0x00}; if (!TasmotaClient_execParam(CMND_STK_SET_DEVICE, ProgParams, sizeof(ProgParams))) { @@ -368,7 +368,7 @@ uint32_t TasmotaClient_Flash(uint8_t* data, size_t size) { } else if (0x0A != flash_buffer[ca]) { if (!isalnum(flash_buffer[ca])) { -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("DBG: Size %d, Processed %d"), size, processed); +// AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: Size %d, Processed %d"), size, processed); error = 7; // Error: Invalid data break; } @@ -408,7 +408,7 @@ void TasmotaClient_Init(void) { pinMode(Pin(GPIO_TASMOTACLIENT_RST), OUTPUT); TClient.SerialEnabled = true; TasmotaClient_Reset(); - AddLog_P(LOG_LEVEL_INFO, PSTR("TCL: Enabled")); + AddLog(LOG_LEVEL_INFO, PSTR("TCL: Enabled")); } } } @@ -421,10 +421,10 @@ void TasmotaClient_Init(void) { memcpy(&TClientSettings, &buffer, sizeof(TClientSettings)); if (TASMOTA_CLIENT_LIB_VERSION == TClientSettings.features_version) { TClient.type = true; - AddLog_P(LOG_LEVEL_INFO, PSTR("TCL: Version %u"), TClientSettings.features_version); + AddLog(LOG_LEVEL_INFO, PSTR("TCL: Version %u"), TClientSettings.features_version); } else { if ((!TClient.unsupported) && (TClientSettings.features_version > 0)) { - AddLog_P(LOG_LEVEL_INFO, PSTR("TCL: Version %u not supported!"), TClientSettings.features_version); + AddLog(LOG_LEVEL_INFO, PSTR("TCL: Version %u not supported!"), TClientSettings.features_version); TClient.unsupported = true; } } @@ -456,7 +456,7 @@ void TasmotaClient_sendCmnd(uint8_t cmnd, uint8_t param) { memcpy(&buffer[1], &TClientCommand, sizeof(TClientCommand)); buffer[sizeof(TClientCommand)+1] = CMND_END; -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("TCL: SendCmnd")); +// AddLog(LOG_LEVEL_DEBUG, PSTR("TCL: SendCmnd")); // AddLogBuffer(LOG_LEVEL_DEBUG, (uint8_t*)&buffer, sizeof(buffer)); for (uint32_t ca = 0; ca < sizeof(buffer); ca++) { diff --git a/tasmota/xdrv_33_nrf24l01.ino b/tasmota/xdrv_33_nrf24l01.ino index e992c398b..dfe690de2 100644 --- a/tasmota/xdrv_33_nrf24l01.ino +++ b/tasmota/xdrv_33_nrf24l01.ino @@ -67,10 +67,10 @@ void NRF24Detect(void) { if (PinUsed(GPIO_NRF24_CS) && PinUsed(GPIO_NRF24_DC) && TasmotaGlobal.spi_enabled) { if (NRF24initRadio()) { NRF24.chipType = 32; // SPACE - AddLog_P(LOG_LEVEL_INFO, PSTR("NRF: Model 24L01 initialized")); + AddLog(LOG_LEVEL_INFO, PSTR("NRF: Model 24L01 initialized")); if (NRF24radio.isPVariant()) { NRF24.chipType = 43; // + - AddLog_P(LOG_LEVEL_INFO, PSTR("NRF: Model 24L01+ detected")); + AddLog(LOG_LEVEL_INFO, PSTR("NRF: Model 24L01+ detected")); } } } diff --git a/tasmota/xdrv_36_keeloq.ino b/tasmota/xdrv_36_keeloq.ino index 4a0f33a83..0703190ca 100644 --- a/tasmota/xdrv_36_keeloq.ino +++ b/tasmota/xdrv_36_keeloq.ino @@ -97,7 +97,7 @@ void GenerateDeviceCryptKey() jaroliftDevice.device_key_msb = k.decrypt(jaroliftDevice.serial | 0x60000000L); jaroliftDevice.device_key_lsb = k.decrypt(jaroliftDevice.serial | 0x20000000L); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("generated device keys: %08x %08x"), jaroliftDevice.device_key_msb, jaroliftDevice.device_key_lsb); + AddLog(LOG_LEVEL_DEBUG, PSTR("generated device keys: %08x %08x"), jaroliftDevice.device_key_msb, jaroliftDevice.device_key_lsb); } void CmdSendButton(void) @@ -114,7 +114,7 @@ void CmdSendButton(void) DEBUG_DRIVER_LOG(LOG_LEVEL_DEBUG_MORE, PSTR("lsb: %08x"), jaroliftDevice.device_key_lsb); DEBUG_DRIVER_LOG(LOG_LEVEL_DEBUG_MORE, PSTR("serial: %08x"), jaroliftDevice.serial); DEBUG_DRIVER_LOG(LOG_LEVEL_DEBUG_MORE, PSTR("disc: %08x"), jaroliftDevice.disc); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("KLQ: count: %08x"), jaroliftDevice.count); + AddLog(LOG_LEVEL_DEBUG, PSTR("KLQ: count: %08x"), jaroliftDevice.count); CreateKeeloqPacket(); jaroliftDevice.count++; @@ -236,8 +236,8 @@ void CreateKeeloqPacket() jaroliftDevice.enc = k.encrypt(result); jaroliftDevice.pack |= jaroliftDevice.enc; - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("pack high: %08x"), jaroliftDevice.pack>>32); - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("pack low: %08x"), jaroliftDevice.pack); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("pack high: %08x"), jaroliftDevice.pack>>32); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("pack low: %08x"), jaroliftDevice.pack); } void KeeloqInit() @@ -248,7 +248,7 @@ void KeeloqInit() DEBUG_DRIVER_LOG(LOG_LEVEL_DEBUG_MORE, PSTR("cc1101.init()")); delay(100); cc1101.init(); - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("CC1101 done.")); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("CC1101 done.")); cc1101.setSyncWord(SYNC_WORD, false); cc1101.setCarrierFreq(CFREQ_433); cc1101.disableAddressCheck(); @@ -272,7 +272,7 @@ bool Xdrv36(uint8_t function) switch (function) { case FUNC_COMMAND: - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("calling command")); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("calling command")); result = DecodeCommand(kJaroliftCommands, jaroliftCommand); break; case FUNC_INIT: diff --git a/tasmota/xdrv_37_sonoff_d1.ino b/tasmota/xdrv_37_sonoff_d1.ino index 5abefd452..435bd28e5 100644 --- a/tasmota/xdrv_37_sonoff_d1.ino +++ b/tasmota/xdrv_37_sonoff_d1.ino @@ -50,7 +50,7 @@ void SonoffD1Received(void) if (action != SnfD1.power) { SnfD1.power = action; -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("SD1: Remote power (%d, %d)"), SnfD1.power, SnfD1.dimmer); +// AddLog(LOG_LEVEL_DEBUG, PSTR("SD1: Remote power (%d, %d)"), SnfD1.power, SnfD1.dimmer); ExecuteCommandPower(1, action, SRC_SWITCH); } @@ -59,7 +59,7 @@ void SonoffD1Received(void) if (dimmer != SnfD1.dimmer) { SnfD1.dimmer = dimmer; -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("SD1: Remote dimmer (%d, %d)"), SnfD1.power, SnfD1.dimmer); +// AddLog(LOG_LEVEL_DEBUG, PSTR("SD1: Remote dimmer (%d, %d)"), SnfD1.power, SnfD1.dimmer); char scmnd[20]; snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_DIMMER " %d"), SnfD1.dimmer); @@ -137,7 +137,7 @@ bool SonoffD1SendPower(void) if (action != SnfD1.power) { SnfD1.power = action; -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("SD1: Tasmota power (%d, %d)"), SnfD1.power, SnfD1.dimmer); +// AddLog(LOG_LEVEL_DEBUG, PSTR("SD1: Tasmota power (%d, %d)"), SnfD1.power, SnfD1.dimmer); SonoffD1Send(); } @@ -152,7 +152,7 @@ bool SonoffD1SendDimmer(void) if (dimmer != SnfD1.dimmer) { SnfD1.dimmer = dimmer; -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("SD1: Tasmota dimmer (%d, %d)"), SnfD1.power, SnfD1.dimmer); +// AddLog(LOG_LEVEL_DEBUG, PSTR("SD1: Tasmota dimmer (%d, %d)"), SnfD1.power, SnfD1.dimmer); SonoffD1Send(); } diff --git a/tasmota/xdrv_39_thermostat.ino b/tasmota/xdrv_39_thermostat.ino index 455e45f13..2078fd829 100644 --- a/tasmota/xdrv_39_thermostat.ino +++ b/tasmota/xdrv_39_thermostat.ino @@ -1272,58 +1272,58 @@ void ThermostatVirtualSwitchCtrState(uint8_t ctr_output) void ThermostatDebug(uint8_t ctr_output) { char result_chr[FLOATSZ]; - AddLog_P(LOG_LEVEL_DEBUG, PSTR("")); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("------ Thermostat Start ------")); + AddLog(LOG_LEVEL_DEBUG, PSTR("")); + AddLog(LOG_LEVEL_DEBUG, PSTR("------ Thermostat Start ------")); dtostrfd(Thermostat[ctr_output].status.counter_seconds, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.counter_seconds: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.counter_seconds: %s"), result_chr); dtostrfd(Thermostat[ctr_output].status.thermostat_mode, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.thermostat_mode: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.thermostat_mode: %s"), result_chr); dtostrfd(Thermostat[ctr_output].diag.state_emergency, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].diag.state_emergency: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].diag.state_emergency: %s"), result_chr); dtostrfd(Thermostat[ctr_output].diag.output_inconsist_ctr, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].diag.output_inconsist_ctr: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].diag.output_inconsist_ctr: %s"), result_chr); dtostrfd(Thermostat[ctr_output].status.controller_mode, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.controller_mode: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.controller_mode: %s"), result_chr); dtostrfd(Thermostat[ctr_output].status.command_output, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.command_output: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.command_output: %s"), result_chr); dtostrfd(Thermostat[ctr_output].status.status_output, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.status_output: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.status_output: %s"), result_chr); dtostrfd(Thermostat[ctr_output].status.status_input, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.status_input: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.status_input: %s"), result_chr); dtostrfd(Thermostat[ctr_output].status.phase_hybrid_ctr, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.phase_hybrid_ctr: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.phase_hybrid_ctr: %s"), result_chr); dtostrfd(Thermostat[ctr_output].status.sensor_alive, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.sensor_alive: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.sensor_alive: %s"), result_chr); dtostrfd(Thermostat[ctr_output].status.status_cycle_active, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.status_cycle_active: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.status_cycle_active: %s"), result_chr); dtostrfd(Thermostat[ctr_output].temp_pi_error, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].temp_pi_error: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].temp_pi_error: %s"), result_chr); dtostrfd(Thermostat[ctr_output].temp_pi_accum_error, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].temp_pi_accum_error: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].temp_pi_accum_error: %s"), result_chr); dtostrfd(Thermostat[ctr_output].time_proportional_pi, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_proportional_pi: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_proportional_pi: %s"), result_chr); dtostrfd(Thermostat[ctr_output].time_integral_pi, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_integral_pi: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_integral_pi: %s"), result_chr); dtostrfd(Thermostat[ctr_output].time_total_pi, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_total_pi: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_total_pi: %s"), result_chr); dtostrfd(Thermostat[ctr_output].temp_measured_gradient, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].temp_measured_gradient: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].temp_measured_gradient: %s"), result_chr); dtostrfd(Thermostat[ctr_output].time_rampup_deadtime, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_rampup_deadtime: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_rampup_deadtime: %s"), result_chr); dtostrfd(Thermostat[ctr_output].temp_rampup_meas_gradient, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].temp_rampup_meas_gradient: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].temp_rampup_meas_gradient: %s"), result_chr); dtostrfd(Thermostat[ctr_output].time_ctr_changepoint, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_ctr_changepoint: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_ctr_changepoint: %s"), result_chr); dtostrfd(Thermostat[ctr_output].temp_rampup_output_off, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].temp_rampup_output_off: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].temp_rampup_output_off: %s"), result_chr); dtostrfd(Thermostat[ctr_output].time_ctr_checkpoint, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_ctr_checkpoint: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_ctr_checkpoint: %s"), result_chr); dtostrfd(TasmotaGlobal.uptime, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("uptime: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("uptime: %s"), result_chr); dtostrfd(TasmotaGlobal.power, 0, result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("power: %s"), result_chr); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("------ Thermostat End ------")); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("")); + AddLog(LOG_LEVEL_DEBUG, PSTR("power: %s"), result_chr); + AddLog(LOG_LEVEL_DEBUG, PSTR("------ Thermostat End ------")); + AddLog(LOG_LEVEL_DEBUG, PSTR("")); } #endif // DEBUG_THERMOSTAT diff --git a/tasmota/xdrv_40_telegram.ino b/tasmota/xdrv_40_telegram.ino index 0ceefa3a7..3e4cc6f0a 100644 --- a/tasmota/xdrv_40_telegram.ino +++ b/tasmota/xdrv_40_telegram.ino @@ -99,7 +99,7 @@ bool TelegramInit(void) { Telegram.next_update_id = 0; // Code of last read Message Telegram.message[0].text = ""; - AddLog_P(LOG_LEVEL_INFO, PSTR("TGM: Started")); + AddLog(LOG_LEVEL_INFO, PSTR("TGM: Started")); } init_done = true; } @@ -115,7 +115,7 @@ String TelegramConnectToTelegram(String command) { uint32_t tls_connect_time = millis(); if (telegramClient->connect("api.telegram.org", 443)) { -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("TGM: Connected in %d ms, max ThunkStack used %d"), millis() - tls_connect_time, telegramClient->getMaxThunkStackUse()); +// AddLog(LOG_LEVEL_DEBUG, PSTR("TGM: Connected in %d ms, max ThunkStack used %d"), millis() - tls_connect_time, telegramClient->getMaxThunkStackUse()); telegramClient->println("GET /"+command); @@ -144,7 +144,7 @@ String TelegramConnectToTelegram(String command) { } void TelegramGetUpdates(uint32_t offset) { - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: getUpdates")); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: getUpdates")); if (!TelegramInit()) { return; } @@ -241,15 +241,15 @@ void TelegramGetUpdates(uint32_t offset) { AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: Parsed update_id %d, chat_id %d, text \"%s\""), Telegram.message[i].update_id, Telegram.message[i].chat_id, Telegram.message[i].text.c_str()); } } else { -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("TGM: No new messages")); +// AddLog(LOG_LEVEL_DEBUG, PSTR("TGM: No new messages")); } } else { -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("TGM: Failed to update")); +// AddLog(LOG_LEVEL_DEBUG, PSTR("TGM: Failed to update")); } } bool TelegramSendMessage(int32_t chat_id, String text) { - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: sendMessage")); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: sendMessage")); if (!TelegramInit()) { return false; } @@ -262,7 +262,7 @@ bool TelegramSendMessage(int32_t chat_id, String text) { // AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: Response %s"), response.c_str()); if (response.startsWith("{\"ok\":true")) { -// AddLog_P(LOG_LEVEL_DEBUG, PSTR("TGM: Message sent")); +// AddLog(LOG_LEVEL_DEBUG, PSTR("TGM: Message sent")); sent = true; } } @@ -272,7 +272,7 @@ bool TelegramSendMessage(int32_t chat_id, String text) { /* void TelegramSendGetMe(void) { - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: getMe")); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: getMe")); if (!TelegramInit()) { return; } diff --git a/tasmota/xdrv_41_tcp_bridge.ino b/tasmota/xdrv_41_tcp_bridge.ino index 7533e7d6d..9cc0b7942 100644 --- a/tasmota/xdrv_41_tcp_bridge.ino +++ b/tasmota/xdrv_41_tcp_bridge.ino @@ -127,7 +127,7 @@ void TCPLoop(void) void TCPInit(void) { if (PinUsed(GPIO_TCP_RX) && PinUsed(GPIO_TCP_TX)) { tcp_buf = (uint8_t*) malloc(TCP_BRIDGE_BUF_SIZE); - if (!tcp_buf) { AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_TCP "could not allocate buffer")); return; } + if (!tcp_buf) { AddLog(LOG_LEVEL_ERROR, PSTR(D_LOG_TCP "could not allocate buffer")); return; } if (!Settings.tcp_baudrate) { Settings.tcp_baudrate = 115200 / 1200; } TCPSerial = new TasmotaSerial(Pin(GPIO_TCP_RX), Pin(GPIO_TCP_TX), TasmotaGlobal.seriallog_level ? 1 : 2, 0, TCP_BRIDGE_BUF_SIZE); // set a receive buffer of 256 bytes @@ -151,7 +151,7 @@ void CmndTCPStart(void) { int32_t tcp_port = XdrvMailbox.payload; if (server_tcp) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_TCP "Stopping TCP server")); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_TCP "Stopping TCP server")); server_tcp->stop(); delete server_tcp; server_tcp = nullptr; @@ -162,7 +162,7 @@ void CmndTCPStart(void) { } } if (tcp_port > 0) { - AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_TCP "Starting TCP server on port %d"), tcp_port); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_TCP "Starting TCP server on port %d"), tcp_port); server_tcp = new WiFiServer(tcp_port); server_tcp->begin(); // start TCP server server_tcp->setNoDelay(true); diff --git a/tasmota/xdrv_42_i2s_audio.ino b/tasmota/xdrv_42_i2s_audio.ino index db19cf369..359308cba 100644 --- a/tasmota/xdrv_42_i2s_audio.ino +++ b/tasmota/xdrv_42_i2s_audio.ino @@ -379,7 +379,7 @@ uint32_t i2s_record(char *path, uint32_t secs) { if (data_offset >= mic_size-DATA_SIZE) break; delay(0); } - //AddLog_P(LOG_LEVEL_INFO, PSTR("rectime: %d ms"), millis()-stime); + //AddLog(LOG_LEVEL_INFO, PSTR("rectime: %d ms"), millis()-stime); SpeakerMic(MODE_SPK); // save to path SaveWav(path, mic_buff, mic_size); @@ -457,7 +457,7 @@ void MDCallback(void *cbData, const char *type, bool isUnicode, const char *str) if (strstr_P(type, PSTR("Title"))) { strncpy(wr_title, str, sizeof(wr_title)); wr_title[sizeof(wr_title)-1] = 0; - //AddLog_P(LOG_LEVEL_INFO,PSTR("WR-Title: %s"),wr_title); + //AddLog(LOG_LEVEL_INFO,PSTR("WR-Title: %s"),wr_title); } else { // Who knows what to do? Not me! } diff --git a/tasmota/xdrv_43_mlx90640.ino b/tasmota/xdrv_43_mlx90640.ino index 53cbcfe07..ea2b60f43 100644 --- a/tasmota/xdrv_43_mlx90640.ino +++ b/tasmota/xdrv_43_mlx90640.ino @@ -413,7 +413,7 @@ void MLX90640HandleWebGuiResponse(void){ WebGetArg("ul", tmp, sizeof(tmp)); // update line if (strlen(tmp)) { uint8_t _line = atoi(tmp); - // AddLog_P(LOG_LEVEL_DEBUG, "MLX90640: send line %u", _line); + // AddLog(LOG_LEVEL_DEBUG, "MLX90640: send line %u", _line); float _buf[65]; if(_line==0){_buf[0]=1000+MLX90640.Ta;} //ambient temperature modulation hack else{_buf[0]=(float)_line;} @@ -431,9 +431,9 @@ void MLX90640HandleWebGuiResponse(void){ uint32_t _poiNum = (_poi-(_poi%10000))/10000; MLX90640.pois[_poiNum*2] = (_poi%10000)/100; MLX90640.pois[(_poiNum*2)+1] = _poi%100; - // AddLog_P(LOG_LEVEL_DEBUG, PSTR("RAW: %u, POI-%u: x: %u, y: %u"),_poi,_poiNum,MLX90640.pois[_poiNum],MLX90640.pois[_poiNum+1]); + // AddLog(LOG_LEVEL_DEBUG, PSTR("RAW: %u, POI-%u: x: %u, y: %u"),_poi,_poiNum,MLX90640.pois[_poiNum],MLX90640.pois[_poiNum+1]); for(int i = 0;i23) MLX90640.pois[_idx+1]=23; } - AddLog_P(LOG_LEVEL_INFO, PSTR("POI-%u = x:%u,y:%u"),XdrvMailbox.index,MLX90640.pois[_idx],MLX90640.pois[_idx+1]); + AddLog(LOG_LEVEL_INFO, PSTR("POI-%u = x:%u,y:%u"),XdrvMailbox.index,MLX90640.pois[_idx],MLX90640.pois[_idx+1]); Response_P(S_JSON_MLX90640_COMMAND_NVALUE, command, XdrvMailbox.payload); break; default: @@ -494,10 +494,10 @@ void MLX90640init() if(!MLX90640.dumpedEE){ status = MLX90640_DumpEE(MLX90640_ADDRESS, MLX90640.Frame); if (status != 0){ - AddLog_P(LOG_LEVEL_INFO, PSTR("Failed to load system parameters")); + AddLog(LOG_LEVEL_INFO, PSTR("Failed to load system parameters")); } else { - AddLog_P(LOG_LEVEL_INFO, PSTR("MLX90640: started")); + AddLog(LOG_LEVEL_INFO, PSTR("MLX90640: started")); MLX90640.type = true; } MLX90640.params = new paramsMLX90640; @@ -514,11 +514,11 @@ void MLX90640every100msec(){ if(!MLX90640.extractedParams){ static uint32_t _chunk = 0; - AddLog_P(LOG_LEVEL_DEBUG, PSTR("MLX90640: will read chunk: %u"), _chunk); + AddLog(LOG_LEVEL_DEBUG, PSTR("MLX90640: will read chunk: %u"), _chunk); _time = millis(); status = MLX90640_ExtractParameters(MLX90640.Frame, MLX90640.params, _chunk); if (status == 0){ - AddLog_P(LOG_LEVEL_DEBUG, PSTR("MLX90640: parameter received after: %u msec, status: %u"), TimePassedSince(_time), status); + AddLog(LOG_LEVEL_DEBUG, PSTR("MLX90640: parameter received after: %u msec, status: %u"), TimePassedSince(_time), status); } if (_chunk == 5) MLX90640.extractedParams = true; _chunk++; @@ -529,12 +529,12 @@ void MLX90640every100msec(){ case 0: if(MLX90640_SynchFrame(MLX90640_ADDRESS)!=0){ _job=-1; - AddLog_P(LOG_LEVEL_DEBUG, PSTR("MLX90640: frame not ready")); + AddLog(LOG_LEVEL_DEBUG, PSTR("MLX90640: frame not ready")); break; } // _time = millis(); status = MLX90640_GetFrameData(MLX90640_ADDRESS, MLX90640.Frame); - // AddLog_P(LOG_LEVEL_DEBUG, PSTR("MLX90640: got frame 0 in %u msecs, status: %i"), TimePassedSince(_time), status); + // AddLog(LOG_LEVEL_DEBUG, PSTR("MLX90640: got frame 0 in %u msecs, status: %i"), TimePassedSince(_time), status); break; case 1: MLX90640.Ta = MLX90640_GetTa(MLX90640.Frame, MLX90640.params); @@ -542,7 +542,7 @@ void MLX90640every100msec(){ case 2: // _time = millis(); MLX90640_CalculateTo(MLX90640.Frame, MLX90640.params, 0.95f, MLX90640.Ta - 8, MLX90640.To, 0); - // AddLog_P(LOG_LEVEL_DEBUG, PSTR("MLX90640: calculated temperatures in %u msecs"), TimePassedSince(_time)); + // AddLog(LOG_LEVEL_DEBUG, PSTR("MLX90640: calculated temperatures in %u msecs"), TimePassedSince(_time)); break; case 5: if(MLX90640_SynchFrame(MLX90640_ADDRESS)!=0){ @@ -551,12 +551,12 @@ void MLX90640every100msec(){ } // _time = millis(); status = MLX90640_GetFrameData(MLX90640_ADDRESS, MLX90640.Frame); - // // AddLog_P(LOG_LEVEL_DEBUG, PSTR("MLX90640: got frame 1 in %u msecs, status: %i"), TimePassedSince(_time), status); + // // AddLog(LOG_LEVEL_DEBUG, PSTR("MLX90640: got frame 1 in %u msecs, status: %i"), TimePassedSince(_time), status); break; case 7: // _time = millis(); MLX90640_CalculateTo(MLX90640.Frame, MLX90640.params, 0.95f, MLX90640.Ta - 8, MLX90640.To, 1); - // AddLog_P(LOG_LEVEL_DEBUG, PSTR("MLX90640: calculated temperatures in %u msecs"), TimePassedSince(_time)); + // AddLog(LOG_LEVEL_DEBUG, PSTR("MLX90640: calculated temperatures in %u msecs"), TimePassedSince(_time)); break; default: break; @@ -580,8 +580,8 @@ void MLX90640Show(uint8_t json) char obj_tstr[FLOATSZ]; dtostrfd(MLX90640.To[MLX90640.pois[i*2]+(MLX90640.pois[(i*2)+1]*32)], Settings.flag2.temperature_resolution, obj_tstr); ResponseAppend_P(PSTR(",%s"),obj_tstr); - // AddLog_P(LOG_LEVEL_DEBUG, PSTR("Array pos: %u"),MLX90640.pois[i*2]+(MLX90640.pois[(i*2)+1]*32)); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("POI-%u: x: %u, y: %u"),i+1,MLX90640.pois[i*2],MLX90640.pois[(i*2)+1]); + // AddLog(LOG_LEVEL_DEBUG, PSTR("Array pos: %u"),MLX90640.pois[i*2]+(MLX90640.pois[(i*2)+1]*32)); + AddLog(LOG_LEVEL_DEBUG, PSTR("POI-%u: x: %u, y: %u"),i+1,MLX90640.pois[i*2],MLX90640.pois[(i*2)+1]); } ResponseAppend_P(PSTR("]}")); } diff --git a/tasmota/xdrv_44_miel_hvac.ino b/tasmota/xdrv_44_miel_hvac.ino index 680d9d72f..8bd6119de 100644 --- a/tasmota/xdrv_44_miel_hvac.ino +++ b/tasmota/xdrv_44_miel_hvac.ino @@ -845,7 +845,7 @@ static void miel_hvac_input_connected(struct miel_hvac_softc *sc, const void *buf, size_t len) { - AddLog_P(LOG_LEVEL_INFO, + AddLog(LOG_LEVEL_INFO, PSTR(MIEL_HVAC_LOGNAME ": connected to Mitsubishi Electric HVAC")); sc->sc_connected = 1; } @@ -973,7 +973,7 @@ miel_hvac_input_data(struct miel_hvac_softc *sc, miel_hvac_log_bytes(sc, "data", buf, len); if (len < sizeof(*d)) { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME + AddLog(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME ": short data response (%zu < %zu)"), len, sizeof(*d)); return; } @@ -1021,7 +1021,7 @@ miel_hvac_pre_init(void) sc = (struct miel_hvac_softc *)malloc(sizeof(*sc)); if (sc == NULL) { - AddLog_P(LOG_LEVEL_ERROR, + AddLog(LOG_LEVEL_ERROR, PSTR(MIEL_HVAC_LOGNAME ": unable to allocate state")); return; } @@ -1033,7 +1033,7 @@ miel_hvac_pre_init(void) Pin(GPIO_MIEL_HVAC_TX), 2); if (!sc->sc_serial->begin(baudrate, 2)) { - AddLog_P(LOG_LEVEL_ERROR, + AddLog(LOG_LEVEL_ERROR, PSTR(MIEL_HVAC_LOGNAME ": unable to begin serial " "(baudrate %d)"), baudrate); goto del; diff --git a/tasmota/xdrv_45_shelly_dimmer.ino b/tasmota/xdrv_45_shelly_dimmer.ino index 0b44cde96..8e6e00e5c 100644 --- a/tasmota/xdrv_45_shelly_dimmer.ino +++ b/tasmota/xdrv_45_shelly_dimmer.ino @@ -111,7 +111,7 @@ struct SHD void ShdResetToDFUMode() { #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Request co-processor reset in dfu mode")); + AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Request co-processor reset in dfu mode")); #endif // SHELLY_DIMMER_DEBUG pinMode(Pin(GPIO_SHELLY_DIMMER_RST_INV), OUTPUT); @@ -133,7 +133,7 @@ void ShdResetToDFUMode() bool ShdUpdateFirmware(uint8_t* data, uint32_t size) { #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Update firmware")); + AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Update firmware")); #endif // SHELLY_DIMMER_DEBUG bool ret = true; @@ -148,7 +148,7 @@ bool ShdUpdateFirmware(uint8_t* data, uint32_t size) stm32_err_t s_err; #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "STM32 erase memory")); + AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "STM32 erase memory")); #endif // SHELLY_DIMMER_DEBUG stm32_erase_memory(stm, 0, STM32_MASS_ERASE); @@ -190,7 +190,7 @@ bool ShdPresent(void) { uint32_t ShdFlash(uint8_t* data, size_t size) { #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_INFO, PSTR(SHD_LOGNAME "Updating firmware v%u.%u with %u bytes"), Shd.dimmer.version_major, Shd.dimmer.version_minor, size); + AddLog(LOG_LEVEL_INFO, PSTR(SHD_LOGNAME "Updating firmware v%u.%u with %u bytes"), Shd.dimmer.version_major, Shd.dimmer.version_minor, size); #endif // SHELLY_DIMMER_DEBUG Serial.end(); @@ -244,7 +244,7 @@ int check_byte() if (chksm != chksm_calc) { #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Checksum: %x calculated: %x"), chksm, chksm_calc); + AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Checksum: %x calculated: %x"), chksm, chksm_calc); #endif // SHELLY_DIMMER_DEBUG return 0; } @@ -267,7 +267,7 @@ bool ShdSerialSend(const uint8_t data[] = nullptr, uint16_t len = 0) int retries = 3; #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(SHD_LOGNAME "Tx Packet:")); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(SHD_LOGNAME "Tx Packet:")); AddLogBuffer(LOG_LEVEL_DEBUG_MORE, (uint8_t*)data, len); #endif // SHELLY_DIMMER_DEBUG @@ -287,7 +287,7 @@ bool ShdSerialSend(const uint8_t data[] = nullptr, uint16_t len = 0) } // timeout - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(SHD_LOGNAME "Serial send timeout")); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(SHD_LOGNAME "Serial send timeout")); } return false; } @@ -426,9 +426,9 @@ void ShdSendCalibration(uint16_t brightness, uint16_t func, uint16_t fade_rate) bool ShdSyncState() { #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Serial %p"), ShdSerial); - AddLog_P(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Set Brightness Want %d, Is %d"), Shd.req_brightness, Shd.dimmer.brightness); - AddLog_P(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Set Fade Want %d, Is %d"), Settings.light_speed, Shd.dimmer.fade_rate); + AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Serial %p"), ShdSerial); + AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Set Brightness Want %d, Is %d"), Shd.req_brightness, Shd.dimmer.brightness); + AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Set Fade Want %d, Is %d"), Settings.light_speed, Shd.dimmer.fade_rate); #endif // SHELLY_DIMMER_DEBUG if (!ShdSerial) @@ -456,7 +456,7 @@ bool ShdSyncState() void ShdDebugState() { #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "MCU v%d.%d, Brightness:%d(%d%%), Power:%d, Fade:%d"), + AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "MCU v%d.%d, Brightness:%d(%d%%), Power:%d, Fade:%d"), Shd.dimmer.version_major, Shd.dimmer.version_minor, Shd.dimmer.brightness, changeUIntScale(Shd.dimmer.brightness, 0, 1000, 0, 100), @@ -538,7 +538,7 @@ bool ShdPacketProcess(void) { float kWhused = (float)Energy.active_power[0] * (Rtc.utc_time - Shd.last_power_check) / 36; #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Adding %i mWh to todays usage from %lu to %lu"), (int)(kWhused * 10), Shd.last_power_check, Rtc.utc_time); + AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Adding %i mWh to todays usage from %lu to %lu"), (int)(kWhused * 10), Shd.last_power_check, Rtc.utc_time); #endif // USE_ENERGY_SENSOR Energy.kWhtoday += kWhused; EnergyUpdateToday(); @@ -547,7 +547,7 @@ bool ShdPacketProcess(void) #endif // USE_ENERGY_SENSOR #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "ShdPacketProcess: Brightness:%d Power:%lu Voltage:%lu Current:%lu Fade:%d"), brightness, wattage_raw, voltage_raw, current_raw, fade_rate); + AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "ShdPacketProcess: Brightness:%d Power:%lu Voltage:%lu Current:%lu Fade:%d"), brightness, wattage_raw, voltage_raw, current_raw, fade_rate); #endif // SHELLY_DIMMER_DEBUG Shd.dimmer.brightness = brightness; Shd.dimmer.power = wattage_raw; @@ -557,7 +557,7 @@ bool ShdPacketProcess(void) case SHD_VERSION_CMD: { #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "ShdPacketProcess: Version: %u.%u"), Shd.buffer[pos + 1], Shd.buffer[pos]); + AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "ShdPacketProcess: Version: %u.%u"), Shd.buffer[pos + 1], Shd.buffer[pos]); #endif // SHELLY_DIMMER_DEBUG Shd.dimmer.version_minor = Shd.buffer[pos]; Shd.dimmer.version_major = Shd.buffer[pos + 1]; @@ -581,7 +581,7 @@ bool ShdPacketProcess(void) void ShdResetToAppMode() { #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Request co-processor reset in app mode")); + AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Request co-processor reset in app mode")); #endif // SHELLY_DIMMER_DEBUG pinMode(Pin(GPIO_SHELLY_DIMMER_RST_INV), OUTPUT); @@ -603,7 +603,7 @@ void ShdResetToAppMode() void ShdPoll(void) { #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Poll")); + AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Poll")); #endif // SHELLY_DIMMER_DEBUG if (!ShdSerial) @@ -616,7 +616,7 @@ void ShdPoll(void) bool ShdSendVersion(void) { #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_INFO, PSTR(SHD_LOGNAME "Sending version command")); + AddLog(LOG_LEVEL_INFO, PSTR(SHD_LOGNAME "Sending version command")); #endif // SHELLY_DIMMER_DEBUG return ShdSendCmd(SHD_VERSION_CMD, 0, 0); } @@ -632,7 +632,7 @@ void ShdGetSettings(void) if (strstr(SettingsText(SET_SHD_PARAM), ",") != nullptr) { #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_INFO, PSTR(SHD_LOGNAME "Loading params: %s"), SettingsText(SET_SHD_PARAM)); + AddLog(LOG_LEVEL_INFO, PSTR(SHD_LOGNAME "Loading params: %s"), SettingsText(SET_SHD_PARAM)); #endif // SHELLY_DIMMER_DEBUG // Shd.req_brightness = atoi(subStr(parameters, SettingsText(SET_SHD_PARAM), ",", 1)); Shd.leading_edge = atoi(subStr(parameters, SettingsText(SET_SHD_PARAM), ",", 2)); @@ -653,7 +653,7 @@ void ShdSaveSettings(void) void ShdInit(void) { #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_INFO, PSTR(SHD_LOGNAME "Shelly Dimmer Driver Starting Tx %d Rx %d"), Pin(GPIO_TXD), Pin(GPIO_RXD)); + AddLog(LOG_LEVEL_INFO, PSTR(SHD_LOGNAME "Shelly Dimmer Driver Starting Tx %d Rx %d"), Pin(GPIO_TXD), Pin(GPIO_RXD)); #endif // SHELLY_DIMMER_DEBUG Shd.buffer = (uint8_t *)malloc(SHD_BUFFER_SIZE); @@ -669,7 +669,7 @@ void ShdInit(void) ShdResetToAppMode(); bool got_version = ShdSendVersion(); - AddLog_P(LOG_LEVEL_INFO, PSTR(SHD_LOGNAME "Shelly Dimmer Co-processor Version v%u.%u"), Shd.dimmer.version_major, Shd.dimmer.version_minor); + AddLog(LOG_LEVEL_INFO, PSTR(SHD_LOGNAME "Shelly Dimmer Co-processor Version v%u.%u"), Shd.dimmer.version_major, Shd.dimmer.version_minor); ShdGetSettings(); ShdSaveSettings(); @@ -694,7 +694,7 @@ bool ShdSerialInput(void) // finished #ifdef SHELLY_DIMMER_DEBUG Shd.byte_counter++; - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(SHD_LOGNAME "Rx Packet:")); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(SHD_LOGNAME "Rx Packet:")); AddLogBuffer(LOG_LEVEL_DEBUG_MORE, Shd.buffer, Shd.byte_counter); #endif // SHELLY_DIMMER_DEBUG Shd.byte_counter = 0; @@ -707,7 +707,7 @@ bool ShdSerialInput(void) { // wrong data #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Byte %i of received data frame is invalid. Rx Packet:"), Shd.byte_counter); + AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Byte %i of received data frame is invalid. Rx Packet:"), Shd.byte_counter); Shd.byte_counter++; AddLogBuffer(LOG_LEVEL_DEBUG_MORE, Shd.buffer, Shd.byte_counter); #endif // SHELLY_DIMMER_DEBUG @@ -739,7 +739,7 @@ bool ShdModuleSelected(void) { bool ShdSetChannels(void) { #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(SHD_LOGNAME "SetChannels:")); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(SHD_LOGNAME "SetChannels:")); AddLogBuffer(LOG_LEVEL_DEBUG_MORE, (uint8_t *)XdrvMailbox.data, XdrvMailbox.data_len); #endif // SHELLY_DIMMER_DEBUG @@ -757,7 +757,7 @@ bool ShdSetChannels(void) bool ShdSetPower(void) { #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_INFO, PSTR(SHD_LOGNAME "Set Power, Power 0x%02x"), XdrvMailbox.index); + AddLog(LOG_LEVEL_INFO, PSTR(SHD_LOGNAME "Set Power, Power 0x%02x"), XdrvMailbox.index); #endif // SHELLY_DIMMER_DEBUG Shd.req_on = (bool)XdrvMailbox.index; @@ -784,9 +784,9 @@ void CmndShdLeadingEdge(void) Settings.shd_leading_edge = XdrvMailbox.payload; #ifdef SHELLY_DIMMER_DEBUG if (Shd.leading_edge == 1) - AddLog_P(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Set to trailing edge")); + AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Set to trailing edge")); else - AddLog_P(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Set to leading edge")); + AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Set to leading edge")); #endif // SHELLY_DIMMER_DEBUG ShdSendSettings(); } @@ -801,7 +801,7 @@ void CmndShdWarmupBrightness(void) Shd.warmup_brightness = XdrvMailbox.payload * 10; Settings.shd_warmup_brightness = XdrvMailbox.payload; #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Set warmup brightness to %d%%"), XdrvMailbox.payload); + AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Set warmup brightness to %d%%"), XdrvMailbox.payload); #endif // SHELLY_DIMMER_DEBUG ShdSendSettings(); } @@ -816,7 +816,7 @@ void CmndShdWarmupTime(void) Shd.warmup_time = XdrvMailbox.payload; Settings.shd_warmup_time = XdrvMailbox.payload; #ifdef SHELLY_DIMMER_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Set warmup time to %dms"), XdrvMailbox.payload); + AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Set warmup time to %dms"), XdrvMailbox.payload); #endif // SHELLY_DIMMER_DEBUG ShdSendSettings(); } diff --git a/tasmota/xdrv_46_ccloader.ino b/tasmota/xdrv_46_ccloader.ino index 3675ca676..3b2afc84b 100644 --- a/tasmota/xdrv_46_ccloader.ino +++ b/tasmota/xdrv_46_ccloader.ino @@ -533,7 +533,7 @@ void CCLProgrammerInit(void) bool CCLoaderinit() { CCLProgrammerInit(); - AddLog_P(LOG_LEVEL_INFO,PSTR("CCL: programmer init")); + AddLog(LOG_LEVEL_INFO,PSTR("CCL: programmer init")); CCL.init = true; return true; } @@ -564,17 +564,17 @@ void CCLoaderLoop() { switch(step) { case 0: CCLdebug_init(); - AddLog_P(LOG_LEVEL_INFO,PSTR("CCL: debug init")); + AddLog(LOG_LEVEL_INFO,PSTR("CCL: debug init")); step++; break; case 1: CCLread_chip_id(); if((CCL.chip.ID!=0)) { - AddLog_P(LOG_LEVEL_INFO,PSTR("CCL: found chip with ID: %x, Rev: %x -> %s"), CCL.chip.ID, CCL.chip.rev, CCLChipName(CCL.chip.ID).c_str()); + AddLog(LOG_LEVEL_INFO,PSTR("CCL: found chip with ID: %x, Rev: %x -> %s"), CCL.chip.ID, CCL.chip.rev, CCLChipName(CCL.chip.ID).c_str()); step++; } else { - AddLog_P(LOG_LEVEL_INFO,PSTR("CCL: no chip found")); + AddLog(LOG_LEVEL_INFO,PSTR("CCL: no chip found")); return; } break; @@ -587,7 +587,7 @@ bool CLLFlashFirmware(uint8_t* data, uint32_t size) bool ret = true; unsigned char debug_config = 0; unsigned char Verify = 0; - AddLog_P(LOG_LEVEL_INFO,PSTR("CCL: .bin file downloaded with size: %u blocks"), size/512); + AddLog(LOG_LEVEL_INFO,PSTR("CCL: .bin file downloaded with size: %u blocks"), size/512); if (CCL.chip.ID!=0) { CCLRunDUP(); @@ -608,7 +608,7 @@ bool CLLFlashFirmware(uint8_t* data, uint32_t size) unsigned char rxBuf[512]; uint32_t block = 0; unsigned int addr = 0x0000; - AddLog_P(LOG_LEVEL_INFO,PSTR("CCL: will flash ....")); + AddLog(LOG_LEVEL_INFO,PSTR("CCL: will flash ....")); AddLogBuffer(LOG_LEVEL_DEBUG,data,16); // quick check to compare with a hex editor while((block*512)= FTC532_DEBOUNCE) { #endif // FTC532_DEBOUNCE > 1 #ifdef DEBUG_FTC532 - AddLog_P(LOG_LEVEL_DEBUG, PSTR("FTC: SAM=%04X KEY=%X OLD=%X INV=%u NOI=%u FRM=%u OK=%u TIME=%lu Pin=%u"), + AddLog(LOG_LEVEL_DEBUG, PSTR("FTC: SAM=%04X KEY=%X OLD=%X INV=%u NOI=%u FRM=%u OK=%u TIME=%lu Pin=%u"), Ftc532.sample, Ftc532.keys, Ftc532.old_keys, Ftc532.e_inv, Ftc532.e_noise, Ftc532.e_frame, Ftc532.valid, Ftc532.rxtime, Pin(GPIO_FTC532)); #endif // DEBUG_FTC532 @@ -197,7 +197,7 @@ void ftc532_update(void) { // Usually called every 50 m #ifdef DEBUG_FTC532 else { ++Ftc532.e_inv; - AddLog_P(LOG_LEVEL_DEBUG, PSTR("FTC: ILL SAM=%04X"), Ftc532.sample); + AddLog(LOG_LEVEL_DEBUG, PSTR("FTC: ILL SAM=%04X"), Ftc532.sample); } #endif // DEBUG_FTC532 } diff --git a/tasmota/xdrv_48_timeprop.ino b/tasmota/xdrv_48_timeprop.ino index 499a29c44..e2a699832 100644 --- a/tasmota/xdrv_48_timeprop.ino +++ b/tasmota/xdrv_48_timeprop.ino @@ -136,7 +136,7 @@ void TimepropSetPower(int index, float power) { } void TimepropInit(void) { - // AddLog_P(LOG_LEVEL_INFO, PSTR("TPR: Timeprop Init")); + // AddLog(LOG_LEVEL_INFO, PSTR("TPR: Timeprop Init")); int cycleTimes[TIMEPROP_NUM_OUTPUTS] = {TIMEPROP_CYCLETIMES}; int deadTimes[TIMEPROP_NUM_OUTPUTS] = {TIMEPROP_DEADTIMES}; int opInverts[TIMEPROP_NUM_OUTPUTS] = {TIMEPROP_OPINVERTS}; diff --git a/tasmota/xdrv_49_pid.ino b/tasmota/xdrv_49_pid.ino index 15097106b..5ba61b004 100644 --- a/tasmota/xdrv_49_pid.ino +++ b/tasmota/xdrv_49_pid.ino @@ -246,7 +246,7 @@ void PIDShowSensor() { Pid.run_pid_now = true; } } else { - AddLog_P(LOG_LEVEL_ERROR, PSTR("PID: No local temperature sensor found")); + AddLog(LOG_LEVEL_ERROR, PSTR("PID: No local temperature sensor found")); } } diff --git a/tasmota/xdrv_50_filesystem.ino b/tasmota/xdrv_50_filesystem.ino index d2729bd7c..f42dd2ff6 100644 --- a/tasmota/xdrv_50_filesystem.ino +++ b/tasmota/xdrv_50_filesystem.ino @@ -131,7 +131,7 @@ void UfsInitOnce(void) { void UfsInit(void) { UfsInitOnce(); if (ufs_type) { - AddLog_P(LOG_LEVEL_INFO, PSTR("UFS: FlashFS mounted with %d kB free"), UfsInfo(1, 0)); + AddLog(LOG_LEVEL_INFO, PSTR("UFS: FlashFS mounted with %d kB free"), UfsInfo(1, 0)); } } @@ -165,10 +165,10 @@ void UfsCheckSDCardInit(void) { // make sd card the global filesystem #ifdef ESP8266 // on esp8266 sdcard info takes several seconds !!!, so we ommit it here - AddLog_P(LOG_LEVEL_INFO, PSTR("UFS: SDCard mounted")); + AddLog(LOG_LEVEL_INFO, PSTR("UFS: SDCard mounted")); #endif // ESP8266 #ifdef ESP32 - AddLog_P(LOG_LEVEL_INFO, PSTR("UFS: SDCard mounted with %d kB free"), UfsInfo(1, 0)); + AddLog(LOG_LEVEL_INFO, PSTR("UFS: SDCard mounted with %d kB free"), UfsInfo(1, 0)); #endif // ESP32 } } @@ -276,7 +276,7 @@ bool TfsFileExists(const char *fname){ bool yes = ffsp->exists(fname); if (!yes) { - AddLog_P(LOG_LEVEL_INFO, PSTR("TFS: File not found")); + AddLog(LOG_LEVEL_INFO, PSTR("TFS: File not found")); } return yes; } @@ -286,7 +286,7 @@ bool TfsSaveFile(const char *fname, const uint8_t *buf, uint32_t len) { File file = ffsp->open(fname, "w"); if (!file) { - AddLog_P(LOG_LEVEL_INFO, PSTR("TFS: Save failed")); + AddLog(LOG_LEVEL_INFO, PSTR("TFS: Save failed")); return false; } @@ -300,7 +300,7 @@ bool TfsInitFile(const char *fname, uint32_t len, uint8_t init_value) { File file = ffsp->open(fname, "w"); if (!file) { - AddLog_P(LOG_LEVEL_INFO, PSTR("TFS: Erase failed")); + AddLog(LOG_LEVEL_INFO, PSTR("TFS: Erase failed")); return false; } @@ -317,7 +317,7 @@ bool TfsLoadFile(const char *fname, uint8_t *buf, uint32_t len) { File file = ffsp->open(fname, "r"); if (!file) { - AddLog_P(LOG_LEVEL_INFO, PSTR("TFS: File not found")); + AddLog(LOG_LEVEL_INFO, PSTR("TFS: File not found")); return false; } @@ -330,7 +330,7 @@ bool TfsDeleteFile(const char *fname) { if (!ffs_type) { return false; } if (!ffsp->remove(fname)) { - AddLog_P(LOG_LEVEL_INFO, PSTR("TFS: Delete failed")); + AddLog(LOG_LEVEL_INFO, PSTR("TFS: Delete failed")); return false; } return true; @@ -446,7 +446,7 @@ const char UFS_FORM_SDC_HREFdel[] PROGMEM = void UfsDirectory(void) { if (!HttpCheckPriviledgedAccess()) { return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_MANAGE_FILE_SYSTEM)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_MANAGE_FILE_SYSTEM)); uint8_t depth = 0; @@ -597,13 +597,13 @@ uint8_t UfsDownloadFile(char *file) { File download_file; if (!dfsp->exists(file)) { - AddLog_P(LOG_LEVEL_INFO, PSTR("UFS: File not found")); + AddLog(LOG_LEVEL_INFO, PSTR("UFS: File not found")); return 0; } download_file = dfsp->open(file, UFS_FILE_READ); if (!download_file) { - AddLog_P(LOG_LEVEL_INFO, PSTR("UFS: Could not open file")); + AddLog(LOG_LEVEL_INFO, PSTR("UFS: Could not open file")); return 0; } @@ -659,7 +659,7 @@ uint8_t UfsDownloadFile(char *file) { download_file.close(); if (download_busy == true) { - AddLog_P(LOG_LEVEL_INFO, PSTR("UFS: Download is busy")); + AddLog(LOG_LEVEL_INFO, PSTR("UFS: Download is busy")); return 0; } diff --git a/tasmota/xdrv_51_bs814a2.ino b/tasmota/xdrv_51_bs814a2.ino index 1a10eab9a..aa1abc4bb 100644 --- a/tasmota/xdrv_51_bs814a2.ino +++ b/tasmota/xdrv_51_bs814a2.ino @@ -34,7 +34,7 @@ THE PROTOCOL [tm]: ================== see Holtek-Semicon BS814A-2 datasheet for details - + ********************* * About this driver * ********************* @@ -100,7 +100,7 @@ void bs814_read(void) { // Poll touch keys uint8_t checksum = 0; uint8_t bitp; bool bitval; - + // generate clock signal & sample frame for (bitp = 0; bitp < 2 * BS814_KEYS_MAX; ++bitp) { digitalWrite(Pin(GPIO_BS814_CLK), LOW); @@ -123,8 +123,8 @@ void bs814_read(void) { // Poll touch keys // validate frame if (BS814_KEYS_MAX - checksum != ((frame >> 4) & 0x7)) { // checksum error #ifdef DEBUG_BS814_DRIVER - ++Bs814.e_cksum; - AddLog_P(LOG_LEVEL_DEBUG, PSTR("CKS=%02X CFR=%02X"), checksum, (frame >> 4) & 0x7); + ++Bs814.e_cksum; + AddLog(LOG_LEVEL_DEBUG, PSTR("CKS=%02X CFR=%02X"), checksum, (frame >> 4) & 0x7); #endif // DEBUG_BS814_DRIVER return; } @@ -144,7 +144,7 @@ void bs814_update(void) { // Usually called every 50 ms bs814_read(); if ((Bs814.keys & 0xF) != (Bs814.keys >> 4)) { #ifdef DEBUG_BS814_DRIVER - AddLog_P(LOG_LEVEL_DEBUG, PSTR("BS814: KEY=%0X OLD=%0X LVL=%u CKS=%u STP=%u OK=%u CLK=%u DAT=%u"), + AddLog(LOG_LEVEL_DEBUG, PSTR("BS814: KEY=%0X OLD=%0X LVL=%u CKS=%u STP=%u OK=%u CLK=%u DAT=%u"), Bs814.keys & 0xF, Bs814.keys >> 4, Bs814.e_level, Bs814.e_cksum, Bs814.e_stp, Bs814.valid, Pin(GPIO_BS814_CLK), Pin(GPIO_BS814_DAT)); #endif // DEBUG_BS814_DRIVER diff --git a/tasmota/xdrv_52_BLE_ESP32.ino b/tasmota/xdrv_52_BLE_ESP32.ino index cfd176a8d..e542ba427 100644 --- a/tasmota/xdrv_52_BLE_ESP32.ino +++ b/tasmota/xdrv_52_BLE_ESP32.ino @@ -599,7 +599,7 @@ int addSeenDevice(const uint8_t *mac, uint8_t addrtype, const char *name, int8_t int total = seenDevices.size(); if (total < MAX_BLE_DEVICES_LOGGED){ #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: New seendev slot %d"), total); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_INFO,PSTR("BLE: New seendev slot %d"), total); #endif BLE_ESP32::BLE_simple_device_t* dev = new BLE_ESP32::BLE_simple_device_t; freeDevices.push_back(dev); @@ -667,10 +667,10 @@ int deleteSeenDevices(int ageS = 0){ dump(addr, 20, dev->mac, 6); const char *alias = getAlias(dev->mac); if (!filter){ - AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: Delete device %s(%s) by age lastseen %u + maxage %u < now %u."), + AddLog(LOG_LEVEL_INFO,PSTR("BLE: Delete device %s(%s) by age lastseen %u + maxage %u < now %u."), addr, alias, lastseenS, ageS, nowS); } else { - AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: Delete device %s(%s) by addrtype filter %d > %d."), + AddLog(LOG_LEVEL_INFO,PSTR("BLE: Delete device %s(%s) by addrtype filter %d > %d."), addr, alias, dev->addrtype, BLEAddressFilter); } #endif @@ -682,7 +682,7 @@ int deleteSeenDevices(int ageS = 0){ } if (res){ #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: Deleted %d devices"), res); + AddLog(LOG_LEVEL_INFO,PSTR("BLE: Deleted %d devices"), res); #endif } return res; @@ -820,7 +820,7 @@ int getSeenDevicesToJson(char *dest, int maxlen){ } // deliberate test of SafeAddLog_P from main thread... - //AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: getSeen %d"), seenDevices.size()); + //AddLog(LOG_LEVEL_INFO,PSTR("BLE: getSeen %d"), seenDevices.size()); int len; @@ -1184,17 +1184,17 @@ void postAdvertismentDetails(){ class BLESensorCallback : public NimBLEClientCallbacks { void onConnect(NimBLEClient* pClient) { #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: onConnect %s"), ((std::string)pClient->getPeerAddress()).c_str()); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: onConnect %s"), ((std::string)pClient->getPeerAddress()).c_str()); #endif } void onDisconnect(NimBLEClient* pClient) { #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: onDisconnect %s"), ((std::string)pClient->getPeerAddress()).c_str()); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: onDisconnect %s"), ((std::string)pClient->getPeerAddress()).c_str()); #endif } bool onConnParamsUpdateRequest(NimBLEClient* pClient, const ble_gap_upd_params* params) { #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: onConnParamsUpdateRequest %s"), ((std::string)pClient->getPeerAddress()).c_str()); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: onConnParamsUpdateRequest %s"), ((std::string)pClient->getPeerAddress()).c_str()); #endif // if(params->itvl_min < 24) { /** 1.25ms units */ @@ -1315,7 +1315,7 @@ class BLEAdvCallbacks: public NimBLEAdvertisedDeviceCallbacks { } } catch(const std::exception& e){ #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: exception in advertismentCallbacks")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: exception in advertismentCallbacks")); #endif } } @@ -1334,18 +1334,18 @@ static BLESensorCallback BLESensorCB; static void BLEscanEndedCB(NimBLEScanResults results){ #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: Scan ended")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: Scan ended")); #endif for (int i = 0; i < scancompleteCallbacks.size(); i++){ try { SCANCOMPLETE_CALLBACK *pFn = scancompleteCallbacks[i]; int callbackres = pFn(results); #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: scancompleteCallbacks %d %d"), i, callbackres); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: scancompleteCallbacks %d %d"), i, callbackres); #endif } catch(const std::exception& e){ #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: exception in operationsCallbacks")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: exception in operationsCallbacks")); #endif } } @@ -1367,21 +1367,21 @@ static void BLEGenNotifyCB(NimBLERemoteCharacteristic* pRemoteCharacteristic, ui if (!pRemoteCharacteristic){ #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: Notify: no remote char!!??")); + AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: Notify: no remote char!!??")); #endif return; } #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: Notified length: %u"),length); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: Notified length: %u"),length); #endif // find the operation this is associated with NimBLERemoteService *pSvc = pRemoteCharacteristic->getRemoteService(); if (!pSvc){ #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Notify: no remote service found")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Notify: no remote service found")); #endif return; } @@ -1389,7 +1389,7 @@ static void BLEGenNotifyCB(NimBLERemoteCharacteristic* pRemoteCharacteristic, ui pRClient = pSvc->getClient(); if (!pRClient){ #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Notify: no remote client!!??")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Notify: no remote client!!??")); #endif return; } @@ -1404,7 +1404,7 @@ static void BLEGenNotifyCB(NimBLERemoteCharacteristic* pRemoteCharacteristic, ui generic_sensor_t *op = currentOperations[i]; if (!op){ #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Notify: null op in currentOperations!!??")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Notify: null op in currentOperations!!??")); #endif } else { if (devaddr == op->addr){ @@ -1420,7 +1420,7 @@ static void BLEGenNotifyCB(NimBLERemoteCharacteristic* pRemoteCharacteristic, ui if (!thisop){ #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: no op for notify")); + AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: no op for notify")); #endif return; } @@ -1452,21 +1452,21 @@ static void BLEGenNotifyCB(NimBLERemoteCharacteristic* pRemoteCharacteristic, ui void registerForAdvertismentCallbacks(const char *tag, BLE_ESP32::ADVERTISMENT_CALLBACK* pFn){ #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: registerForAdvertismentCallbacks %s:%x"), tag, (uint32_t) pFn); + AddLog(LOG_LEVEL_INFO,PSTR("BLE: registerForAdvertismentCallbacks %s:%x"), tag, (uint32_t) pFn); #endif advertismentCallbacks.push_back(pFn); } void registerForOpCallbacks(const char *tag, BLE_ESP32::OPCOMPLETE_CALLBACK* pFn){ #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: registerForOpCallbacks %s:%x"), tag, (uint32_t) pFn); + AddLog(LOG_LEVEL_INFO,PSTR("BLE: registerForOpCallbacks %s:%x"), tag, (uint32_t) pFn); #endif operationsCallbacks.push_back(pFn); } void registerForScanCallbacks(const char *tag, BLE_ESP32::SCANCOMPLETE_CALLBACK* pFn){ #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: registerForScnCallbacks %s:%x"), tag, (uint32_t) pFn); + AddLog(LOG_LEVEL_INFO,PSTR("BLE: registerForScnCallbacks %s:%x"), tag, (uint32_t) pFn); #endif scancompleteCallbacks.push_back(pFn); } @@ -1490,7 +1490,7 @@ static void BLEInit(void) { TasmotaGlobal.wifi_stay_asleep = true; if (WiFi.getSleep() == false) { - AddLog_P(LOG_LEVEL_DEBUG,PSTR("%s: Put WiFi modem in sleep mode"),"BLE"); + AddLog(LOG_LEVEL_DEBUG,PSTR("%s: Put WiFi modem in sleep mode"),"BLE"); WiFi.setSleep(true); // Sleep } @@ -1524,7 +1524,7 @@ static void BLEOperationTask(void *pvParameters); static void BLEStartOperationTask(){ if (BLERunning == false){ #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: %s: Start operations"),D_CMND_BLE); + AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: %s: Start operations"),D_CMND_BLE); #endif BLERunning = true; @@ -1547,25 +1547,25 @@ static void BLEStartOperationTask(){ static void BLETaskStopStartNimBLE(NimBLEClient **ppClient, bool start = true){ if (*ppClient){ - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Task:Stopping NimBLE")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Task:Stopping NimBLE")); (*ppClient)->setClientCallbacks(nullptr, false); try { if ((*ppClient)->isConnected()){ #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: disconnecting connected client")); + AddLog(LOG_LEVEL_INFO,PSTR("BLE: disconnecting connected client")); #endif (*ppClient)->disconnect(); } NimBLEDevice::deleteClient((*ppClient)); (*ppClient) = nullptr; #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: deleted client")); + AddLog(LOG_LEVEL_INFO,PSTR("BLE: deleted client")); #endif } catch(const std::exception& e){ #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Stopping NimBLE:exception in delete client")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Stopping NimBLE:exception in delete client")); #endif } @@ -1582,7 +1582,7 @@ static void BLETaskStopStartNimBLE(NimBLEClient **ppClient, bool start = true){ BLERunningScan = 0; if (start){ - AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: BLETask:Starting NimBLE")); + AddLog(LOG_LEVEL_INFO,PSTR("BLE: BLETask:Starting NimBLE")); NimBLEDevice::init("BLE_ESP32"); *ppClient = NimBLEDevice::createClient(); @@ -1623,7 +1623,7 @@ int BLETaskStartScan(int time){ } #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: BLETask: Startscan")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: BLETask: Startscan")); #endif //vTaskDelay(500/ portTICK_PERIOD_MS); ble32Scan->setActiveScan(BLEScanActiveMode ? 1: 0); @@ -1652,7 +1652,7 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe *pCurrentOperation = nextOperation(&queuedOperations); if (*pCurrentOperation){ #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: BLETask: new currentOperation")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: BLETask: new currentOperation")); #endif BLEOpCount++; generic_sensor_t* temp = *pCurrentOperation; @@ -1673,7 +1673,7 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe diff = diff/1000; if (diff > 20000){ // 20s #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: BLETask: notify timeout")); + AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: BLETask: notify timeout")); #endif (*pCurrentOperation)->state = GEN_STATE_FAILED_NOTIFYTIMEOUT; (*pCurrentOperation)->notifytimer = 0; @@ -1690,7 +1690,7 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe (*pCurrentOperation)->state = GEN_STATE_NOTIFIED; // just stay here until this is removed by the main thread #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: BLETask: notify operation complete")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: BLETask: notify operation complete")); #endif BLE_ESP32::BLETaskRunTaskDoneOperation(pCurrentOperation, ppClient); pClient = *ppClient; @@ -1701,7 +1701,7 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe case GEN_STATE_NOTIFIED: // - may have completed DURING our read/write to get here // just stay here until this is removed by the main thread #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: BLETask: operation complete")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: BLETask: operation complete")); #endif BLE_ESP32::BLETaskRunTaskDoneOperation(pCurrentOperation, ppClient); pClient = *ppClient; @@ -1721,7 +1721,7 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe if ((*pCurrentOperation)->state <= GEN_STATE_FAILED){ #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: BLETask: op failed %d"), (*pCurrentOperation)->state); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: BLETask: op failed %d"), (*pCurrentOperation)->state); #endif BLE_ESP32::BLETaskRunTaskDoneOperation(pCurrentOperation, ppClient); pClient = *ppClient; @@ -1735,7 +1735,7 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe if (pClient->isConnected()){ // don't do anything if we are still connected #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: BLETask: still connected")); + AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: BLETask: still connected")); #endif return; } @@ -1755,7 +1755,7 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe op->state = GEN_STATE_STARTED; #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: BLETask: attempt connect %s"), ((std::string)op->addr).c_str()); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: BLETask: attempt connect %s"), ((std::string)op->addr).c_str()); #endif if (!op->serviceUUID.bitSize()){ @@ -1766,7 +1766,7 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe if (pClient->connect(op->addr, true)) { #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: connected %s -> getservice"), ((std::string)op->addr).c_str()); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: connected %s -> getservice"), ((std::string)op->addr).c_str()); #endif NimBLERemoteService *pService = pClient->getService(op->serviceUUID); int waitNotify = false; @@ -1775,7 +1775,7 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe if (pService != nullptr) { #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: got service")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: got service")); #endif // pre-set to fail if no operations requested //newstate = GEN_STATE_FAILED_NOREADWRITE; @@ -1792,13 +1792,13 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe pService->getCharacteristic(op->notificationCharacteristicUUID); if (pNCharacteristic != nullptr) { #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: got notify characteristic")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: got notify characteristic")); #endif op->notifylen = 0; if(pNCharacteristic->canNotify()) { if(pNCharacteristic->subscribe(true, BLE_ESP32::BLEGenNotifyCB)) { #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: subscribe for notify")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: subscribe for notify")); #endif uint64_t now = esp_timer_get_time(); op->notifytimer = now; @@ -1808,7 +1808,7 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe waitNotify = true; } else { #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: failed subscribe for notify")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: failed subscribe for notify")); #endif newstate = GEN_STATE_FAILED_NOTIFY; } @@ -1816,7 +1816,7 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe if(pNCharacteristic->canIndicate()) { if(pNCharacteristic->subscribe(false, BLE_ESP32::BLEGenNotifyCB)) { #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: subscribe for indicate")); + AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: subscribe for indicate")); #endif notifystate = GEN_STATE_WAITINDICATE; uint64_t now = esp_timer_get_time(); @@ -1824,21 +1824,21 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe waitNotify = true; } else { #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: failed subscribe for indicate")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: failed subscribe for indicate")); #endif newstate = GEN_STATE_FAILED_INDICATE; } } else { newstate = GEN_STATE_FAILED_CANTNOTIFYORINDICATE; #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: characteristic can't notify")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: characteristic can't notify")); #endif } } } else { newstate = GEN_STATE_FAILED_NONOTIFYCHAR; #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: notify characteristic not found")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: notify characteristic not found")); #endif } @@ -1855,7 +1855,7 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe pCharacteristic = pService->getCharacteristic(op->characteristicUUID); if (pCharacteristic != nullptr) { #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: got read/write characteristic")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: got read/write characteristic")); #endif newstate = GEN_STATE_FAILED_NOREADWRITE; // overwritten on failure @@ -1875,12 +1875,12 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe if (op->readmodifywritecallback){ READ_CALLBACK *pFn = (READ_CALLBACK *)op->readmodifywritecallback; #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: read characteristic with readmodifywritecallback")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: read characteristic with readmodifywritecallback")); #endif pFn(op); } else { #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: read characteristic")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: read characteristic")); #endif } @@ -1896,12 +1896,12 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe if (!pCharacteristic->writeValue(op->dataToWrite, op->writelen, true)){ newstate = GEN_STATE_FAILED_WRITE; #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: characteristic write fail")); + AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: characteristic write fail")); #endif } else { if (!waitNotify) newstate = GEN_STATE_WRITEDONE; #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: write characteristic")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: write characteristic")); #endif } } else { @@ -1913,7 +1913,7 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe } else { newstate = GEN_STATE_FAILED_NO_RW_CHAR; #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: r/w characteristic not found")); + AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: r/w characteristic not found")); #endif } } @@ -1934,7 +1934,7 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe newstate = GEN_STATE_FAILED_NOSERVICE; // failed to get a service #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: failed - svc not on device?")); + AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: failed - svc not on device?")); #endif } @@ -1946,14 +1946,14 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe switch (rc){ case (0x0200+BLE_ERR_CONN_LIMIT ): #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Hit connection limit? - restarting NimBLE")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Hit connection limit? - restarting NimBLE")); #endif BLERestartNimBLE = 1; BLERestartBLEReason = BLE_RESTART_BLE_REASON_CONN_LIMIT; break; case (0x0200+BLE_ERR_ACL_CONN_EXISTS): #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Connection exists? - restarting NimBLE")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Connection exists? - restarting NimBLE")); #endif BLERestartNimBLE = 1; BLERestartBLEReason = BLE_RESTART_BLE_REASON_CONN_EXISTS; @@ -1963,7 +1963,7 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe // failed to connect #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: failed to connect to device %d"), rc); + AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: failed to connect to device %d"), rc); #endif } op->state = newstate; @@ -1979,7 +1979,7 @@ static void BLETaskRunTaskDoneOperation(BLE_ESP32::generic_sensor_t** op, NimBLE try { if ((*ppClient)->isConnected()){ #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: runTaskDoneOperation: disconnecting connected client")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: runTaskDoneOperation: disconnecting connected client")); #endif (*ppClient)->disconnect(); // wait for 1/2 second after disconnect @@ -1990,7 +1990,7 @@ static void BLETaskRunTaskDoneOperation(BLE_ESP32::generic_sensor_t** op, NimBLE //(*ppClient)->disconnect(); // we will stall here forever!!! - as testing #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: wait discon%d"), waits); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: wait discon%d"), waits); #endif vTaskDelay(500/ portTICK_PERIOD_MS); } @@ -1999,11 +1999,11 @@ static void BLETaskRunTaskDoneOperation(BLE_ESP32::generic_sensor_t** op, NimBLE int conn_id = (*ppClient)->getConnId(); ble_gap_conn_broken(conn_id, -1); #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: wait discon%d - kill connection"), waits); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: wait discon%d - kill connection"), waits); #endif } if (waits == 60){ - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: >60s waiting -> BLE Failed, restart Tasmota %d"), waits); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: >60s waiting -> BLE Failed, restart Tasmota %d"), waits); BLEStop = 1; BLEStopAt = esp_timer_get_time(); @@ -2015,7 +2015,7 @@ static void BLETaskRunTaskDoneOperation(BLE_ESP32::generic_sensor_t** op, NimBLE } } catch(const std::exception& e){ #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: runTaskDoneOperation: exception in disconnect")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: runTaskDoneOperation: exception in disconnect")); #endif } @@ -2035,7 +2035,7 @@ static void BLETaskRunTaskDoneOperation(BLE_ESP32::generic_sensor_t** op, NimBLE // by adding it to this list, this will cause it to be sent to MQTT #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: runTaskDoneOperation: add to completedOperations")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: runTaskDoneOperation: add to completedOperations")); #endif addOperation(&completedOperations, op); return; @@ -2096,7 +2096,7 @@ static void BLEOperationTask(void *pvParameters){ BLERestartNimBLE = 0; BLERestartTasmota = 10; BLERestartTasmotaReason = BLE_RESTART_TEAMOTA_REASON_RESTARTING_BLE_TIMEOUT; - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: BLETask: Restart NimBLE - restart Tasmota in 10 if not complt")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: BLETask: Restart NimBLE - restart Tasmota in 10 if not complt")); BLE_ESP32::BLETaskStopStartNimBLE(&pClient); BLERestartTasmotaReason = BLE_RESTART_TEAMOTA_REASON_UNKNOWN; BLERestartTasmota = 0; @@ -2110,7 +2110,7 @@ static void BLEOperationTask(void *pvParameters){ vTaskDelay(100/ portTICK_PERIOD_MS); #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: BLEOperationTask: Left task")); + AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: BLEOperationTask: Left task")); #endif deleteSeenDevices(); @@ -2159,7 +2159,7 @@ static void BLEEverySecond(bool restart){ BLEMasterEnable = Settings.flag5.mi32_enable; } } - AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: MasterEnable->%d"), BLEMasterEnable); + AddLog(LOG_LEVEL_INFO,PSTR("BLE: MasterEnable->%d"), BLEMasterEnable); } @@ -2192,11 +2192,11 @@ static void BLEEverySecond(bool restart){ if (!BLERestartTasmotaReason) BLERestartTasmotaReason = BLE_RESTART_TEAMOTA_REASON_UNKNOWN; snprintf_P(TasmotaGlobal.mqtt_data, sizeof(TasmotaGlobal.mqtt_data), PSTR("{\"reboot\":\"%s\"}"), BLERestartTasmotaReason); MqttPublishPrefixTopic_P(TELE, PSTR("BLE"), Settings.flag.mqtt_sensor_retain); - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Failure! Restarting Tasmota in %d seconds because %s"), BLERestartTasmota, BLERestartTasmotaReason); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Failure! Restarting Tasmota in %d seconds because %s"), BLERestartTasmota, BLERestartTasmotaReason); } if (!BLERestartTasmota){ - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Failure! Restarting Tasmota because %s"), BLERestartTasmotaReason); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Failure! Restarting Tasmota because %s"), BLERestartTasmotaReason); // just a normal restart TasmotaGlobal.restart_flag = 1; } @@ -2205,7 +2205,7 @@ static void BLEEverySecond(bool restart){ if (BLERestartBLEReason){ // just use the ptr as the trigger to send MQTT snprintf_P(TasmotaGlobal.mqtt_data, sizeof(TasmotaGlobal.mqtt_data), PSTR("{\"blerestart\":\"%s\"}"), BLERestartBLEReason); MqttPublishPrefixTopic_P(TELE, PSTR("BLE"), Settings.flag.mqtt_sensor_retain); - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Failure! Restarting BLE Stack because %s"), BLERestartBLEReason); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Failure! Restarting BLE Stack because %s"), BLERestartBLEReason); BLERestartBLEReason = nullptr; } @@ -2250,9 +2250,9 @@ int addOperation(std::deque *ops, generic_sensor_t** op){ } } if (res){ - //AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: added operation")); + //AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: added operation")); } else { - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: op - no room")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: op - no room")); } return res; } @@ -2260,7 +2260,7 @@ int addOperation(std::deque *ops, generic_sensor_t** op){ int newOperation(BLE_ESP32::generic_sensor_t** op){ if (!op) { - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: op inv in newOperation")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: op inv in newOperation")); return 0; } @@ -2299,7 +2299,7 @@ int freeOperation(BLE_ESP32::generic_sensor_t** op){ int extQueueOperation(BLE_ESP32::generic_sensor_t** op){ if (!op || !(*op)) { - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: op invalid")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: op invalid")); return 0; } (*op)->state = GEN_STATE_START; // trigger request later @@ -2307,7 +2307,7 @@ int extQueueOperation(BLE_ESP32::generic_sensor_t** op){ int res = addOperation(&queuedOperations, op); if (!res){ - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: extQueueOperation: op added id %d failed"), (lastopid-1)); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: extQueueOperation: op added id %d failed"), (lastopid-1)); } return res; } @@ -2427,7 +2427,7 @@ static int StartBLE(void) { BLE_ESP32::BLEStartOperationTask(); return 1; } - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: StartBLE - wait as BLEStop==1")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: StartBLE - wait as BLEStop==1")); return 0; } @@ -2436,16 +2436,16 @@ static int StopBLE(void){ if (BLERunning){ if (BLEStop != 1){ BLEStop = 1; - AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: StopBLE - BLEStop->1")); + AddLog(LOG_LEVEL_INFO,PSTR("BLE: StopBLE - BLEStop->1")); BLEStopAt = esp_timer_get_time(); // give a little time for it to stop. vTaskDelay(1000/ portTICK_PERIOD_MS); return 1; } - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: StopBLE - wait as BLEStop==1")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: StopBLE - wait as BLEStop==1")); return 0; } else { - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: StopBLE - was not running")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: StopBLE - was not running")); return 1; } } @@ -2686,7 +2686,7 @@ void CmndBLEDetails(void){ void CmndBLEAlias(void){ #ifdef BLE_ESP32_ALIASES int op = XdrvMailbox.index; - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: Alias %d %s"), op, XdrvMailbox.data); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: Alias %d %s"), op, XdrvMailbox.data); int res = -1; switch(op){ @@ -2705,7 +2705,7 @@ void CmndBLEAlias(void){ char *mac = p; int len = fromHex(addr, p, sizeof(addr)); if (len != 6){ - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Alias invalid mac %s"), p); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Alias invalid mac %s"), p); ResponseCmndChar("invalidmac"); return; } @@ -2726,7 +2726,7 @@ void CmndBLEAlias(void){ return; } - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Add Alias mac %s = name %s"), mac, p); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Add Alias mac %s = name %s"), mac, p); if (addAlias( addr, name )){ added++; } @@ -2734,7 +2734,7 @@ void CmndBLEAlias(void){ } while (p); if (added){ - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: Added %d Aliases"), added); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: Added %d Aliases"), added); BLEAliasListResp(); } else { BLEAliasListResp(); @@ -2742,7 +2742,7 @@ void CmndBLEAlias(void){ return; } break; case 2:{ // clear - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: Alias clearing %d"), aliases.size()); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: Alias clearing %d"), aliases.size()); for (int i = aliases.size()-1; i >= 0; i--){ BLE_ESP32::ble_alias_t *alias = aliases[i]; aliases.pop_back(); @@ -2773,14 +2773,14 @@ void CmndBLEName(void) { if (addrres){ if (addrres == 2){ - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: addr used alias: %s"), p); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: addr used alias: %s"), p); } //#ifdef EQ3_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: cmd addr: %s -> %s"), p, addr.toString().c_str()); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_INFO,PSTR("BLE: cmd addr: %s -> %s"), p, addr.toString().c_str()); //#endif } else { - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: addr invalid: %s"), p); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: addr invalid: %s"), p); ResponseCmndIdxChar(PSTR("invalidaddr")); return; } @@ -2789,11 +2789,11 @@ void CmndBLEName(void) { // ALWAYS use this function to create a new one. int res = BLE_ESP32::newOperation(&op); if (!res){ - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Can't get a newOperation")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Can't get a newOperation")); ResponseCmndChar(PSTR("FAIL")); return; } else { - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: got a newOperation from BLE")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: got a newOperation from BLE")); } op->addr = addr; @@ -2804,29 +2804,29 @@ void CmndBLEName(void) { char *name = strtok(nullptr, " "); bool write = false; if (name && *name){ - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: write name %s"), name); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: write name %s"), name); op->writelen = strlen(name); memcpy(op->dataToWrite, name, op->writelen); write = true; } else { - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: read name")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: read name")); op->readlen = 1; } res = BLE_ESP32::extQueueOperation(&op); - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: queue res %d"), res); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: queue res %d"), res); if (!res){ // if it fails to add to the queue, do please delete it BLE_ESP32::freeOperation(&op); - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Failed to queue new operation - deleted")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Failed to queue new operation - deleted")); ResponseCmndChar(PSTR("QUEUEFAIL")); return; } if (write){ - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG, PSTR("BLE: will write name")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG, PSTR("BLE: will write name")); } else { - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG, PSTR("BLE: will read name")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG, PSTR("BLE: will read name")); } ResponseCmndDone(); return; @@ -2856,7 +2856,7 @@ void CmndBLEOperation(void){ int op = XdrvMailbox.index; - //AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: op %d"), op); + //AddLog(LOG_LEVEL_INFO,PSTR("BLE: op %d"), op); int res = -1; @@ -2864,7 +2864,7 @@ void CmndBLEOperation(void){ switch(op) { case 0: #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: preview")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_INFO,PSTR("BLE: preview")); #endif BLEPostMQTTTrigger = 1; break; @@ -2875,7 +2875,7 @@ void CmndBLEOperation(void){ int opres = BLE_ESP32::newOperation(&prepOperation); if (!opres){ #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Could not create new operation")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Could not create new operation")); #endif ResponseCmndChar("FailCreate"); return; @@ -2933,14 +2933,14 @@ void CmndBLEOperation(void){ // this means you could retry with another BLEOp10. // it WOULD be deleted if you sent another BELOP1 #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Could not queue new operation")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Could not queue new operation")); #endif ResponseCmndChar("FailQueue"); return; } else { // NOTE: prepOperation has been set to null if we queued sucessfully. #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: Operations queued:%d"), queuedOperations.size()); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_INFO,PSTR("BLE: Operations queued:%d"), queuedOperations.size()); #endif char temp[40]; sprintf(temp, "{\"opid\":%d,\"u\":%d}", lastopid-1, u); @@ -2969,13 +2969,13 @@ void CmndBLEOperation(void){ // this means you could retry with another BLEOp10. // it WOULD be deleted if you sent another BELOP1 #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Could not queue new operation")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Could not queue new operation")); #endif ResponseCmndChar("FailQueue"); } else { // NOTE: prepOperation has been set to null if we queued sucessfully. #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: Operations queued:%d"), queuedOperations.size()); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_INFO,PSTR("BLE: Operations queued:%d"), queuedOperations.size()); #endif char temp[40]; sprintf(temp, "{\"opid\":%d,\"u\":%d}", lastopid-1, u); @@ -3026,20 +3026,20 @@ static void BLEPostMQTT(bool onlycompleted) { if (prepOperation || completedOperations.size() || queuedOperations.size() || currentOperations.size()){ #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: some to show")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_INFO,PSTR("BLE: some to show")); #endif if (prepOperation && !onlycompleted){ std::string out = BLETriggerResponse(prepOperation); snprintf_P(TasmotaGlobal.mqtt_data, sizeof(TasmotaGlobal.mqtt_data), PSTR("%s"), out.c_str()); MqttPublishPrefixTopic_P(TELE, PSTR("BLE"), Settings.flag.mqtt_sensor_retain); #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: prep sent %s"), out.c_str()); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_INFO,PSTR("BLE: prep sent %s"), out.c_str()); #endif } if (queuedOperations.size() && !onlycompleted){ #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: queued %d"), queuedOperations.size()); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_INFO,PSTR("BLE: queued %d"), queuedOperations.size()); #endif for (int i = 0; i < queuedOperations.size(); i++){ TasAutoMutex localmutex(&BLEOperationsRecursiveMutex, "BLEPost1"); @@ -3053,7 +3053,7 @@ static void BLEPostMQTT(bool onlycompleted) { snprintf_P(TasmotaGlobal.mqtt_data, sizeof(TasmotaGlobal.mqtt_data), PSTR("%s"), out.c_str()); MqttPublishPrefixTopic_P(TELE, PSTR("BLE"), Settings.flag.mqtt_sensor_retain); #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: queued %d sent %s"), i, out.c_str()); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_INFO,PSTR("BLE: queued %d sent %s"), i, out.c_str()); #endif //break; } @@ -3062,7 +3062,7 @@ static void BLEPostMQTT(bool onlycompleted) { if (currentOperations.size() && !onlycompleted){ #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: current %d"), currentOperations.size()); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_INFO,PSTR("BLE: current %d"), currentOperations.size()); #endif for (int i = 0; i < currentOperations.size(); i++){ TasAutoMutex localmutex(&BLEOperationsRecursiveMutex, "BLEPost2"); @@ -3075,7 +3075,7 @@ static void BLEPostMQTT(bool onlycompleted) { snprintf_P(TasmotaGlobal.mqtt_data, sizeof(TasmotaGlobal.mqtt_data), PSTR("%s"), out.c_str()); MqttPublishPrefixTopic_P(TELE, PSTR("BLE"), Settings.flag.mqtt_sensor_retain); #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: curr %d sent %s"), i, out.c_str()); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_INFO,PSTR("BLE: curr %d sent %s"), i, out.c_str()); #endif //break; } @@ -3084,7 +3084,7 @@ static void BLEPostMQTT(bool onlycompleted) { if (completedOperations.size()){ #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: completed %d"), completedOperations.size()); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_INFO,PSTR("BLE: completed %d"), completedOperations.size()); #endif do { generic_sensor_t *toSend = nextOperation(&completedOperations); @@ -3092,7 +3092,7 @@ static void BLEPostMQTT(bool onlycompleted) { break; // break from while loop } else { #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: completedOperation removed")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: completedOperation removed")); #endif std::string out = BLETriggerResponse(toSend); snprintf_P(TasmotaGlobal.mqtt_data, sizeof(TasmotaGlobal.mqtt_data), PSTR("%s"), out.c_str()); @@ -3121,11 +3121,11 @@ static void mainThreadBLETimeouts() { if (BLEStop == 1){ if (BLEStopAt + 30L*1000L*1000L < now){ // if asked to stop > 30s ago... - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Stop Timeout - restart Tasmota")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Stop Timeout - restart Tasmota")); BLERestartTasmota = 2; BLEStopAt = now; } - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Awaiting BLEStop")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Awaiting BLEStop")); return; } @@ -3135,7 +3135,7 @@ static void mainThreadBLETimeouts() { if (BLEScanLastAdvertismentAt + adTimeout < now){ BLEScanLastAdvertismentAt = now; // initialise the time of the last advertisment BLERestartNimBLE = 1; - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: scan stall? no adverts > 120s, restart BLE")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: scan stall? no adverts > 120s, restart BLE")); BLERestartBLEReason = BLE_RESTART_BLE_REASON_ADVERT_BLE_TIMEOUT; } @@ -3146,7 +3146,7 @@ static void mainThreadBLETimeouts() { if (BLELastLoopTime + bleLoopTimeout < now){ BLELastLoopTime = now; // initialise the time of the last advertisment BLERestartTasmota = 10; - AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: BLETask stall > 120s, restart Tasmota in 10s")); + AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: BLETask stall > 120s, restart Tasmota in 10s")); BLERestartTasmotaReason = BLE_RESTART_TEAMOTA_REASON_BLE_LOOP_STALLED; } } @@ -3154,7 +3154,7 @@ static void mainThreadBLETimeouts() { static void mainThreadOpCallbacks() { if (completedOperations.size()){ - //AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: completed %d"), completedOperations.size()); + //AddLog(LOG_LEVEL_INFO,PSTR("BLE: completed %d"), completedOperations.size()); TasAutoMutex localmutex(&BLEOperationsRecursiveMutex, "BLEMainCB"); // find this operation in currentOperations, and remove it. @@ -3169,11 +3169,11 @@ static void mainThreadOpCallbacks() { OPCOMPLETE_CALLBACK *pFn = (OPCOMPLETE_CALLBACK *)(op->completecallback); callbackres = pFn(op); #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: op->completecallback %d"), callbackres); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: op->completecallback %d"), callbackres); #endif } catch(const std::exception& e){ #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: exception in op->completecallback")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: exception in op->completecallback")); #endif } } @@ -3184,14 +3184,14 @@ static void mainThreadOpCallbacks() { OPCOMPLETE_CALLBACK *pFn = operationsCallbacks[i]; callbackres = pFn(op); #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: operationsCallbacks %d %d"), i, callbackres); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: operationsCallbacks %d %d"), i, callbackres); #endif if (callbackres){ break; // this callback ate the op. } } catch(const std::exception& e){ #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: exception in operationsCallbacks")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: exception in operationsCallbacks")); #endif } } @@ -3200,7 +3200,7 @@ static void mainThreadOpCallbacks() { // if some callback told us not to send on MQTT, then remove from completed and delete the data if (callbackres){ #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG,PSTR("BLE: callbackres true -> delete op")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: callbackres true -> delete op")); #endif completedOperations.erase(completedOperations.begin() + i); delete op; @@ -3214,7 +3214,7 @@ static void BLEShow(bool json) { if (json){ #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: show json %d"),json); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_INFO,PSTR("BLE: show json %d"),json); #endif uint32_t totalCount = BLEAdvertisment.totalCount; uint32_t deviceCount = seenDevices.size(); @@ -3372,30 +3372,30 @@ void HandleBleConfiguration(void) { #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR("BLE: HandleBleConfiguration")); + AddLog(LOG_LEVEL_DEBUG, PSTR("BLE: HandleBleConfiguration")); #endif if (!HttpCheckPriviledgedAccess()) { #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR("BLE: !HttpCheckPriviledgedAccess()")); + AddLog(LOG_LEVEL_DEBUG, PSTR("BLE: !HttpCheckPriviledgedAccess()")); #endif return; } #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_BLE)); + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_BLE)); #endif char tmp[20]; WebGetArg("en", tmp, sizeof(tmp)); #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog_P(LOG_LEVEL_DEBUG, PSTR("BLE: arg en is %s"), tmp); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG, PSTR("BLE: arg en is %s"), tmp); #endif if (Webserver->hasArg("save")) { #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR("BLE: SETTINGS SAVE")); + AddLog(LOG_LEVEL_DEBUG, PSTR("BLE: SETTINGS SAVE")); #endif Settings.flag5.mi32_enable = Webserver->hasArg("e0"); // BLEScanActiveMode = (Webserver->hasArg("e1")?1:0); // @@ -3405,7 +3405,7 @@ void HandleBleConfiguration(void) return; } #ifdef BLE_ESP32_DEBUG - AddLog_P(LOG_LEVEL_DEBUG, PSTR("BLE: !SAVE")); + AddLog(LOG_LEVEL_DEBUG, PSTR("BLE: !SAVE")); #endif char str[TOPSZ]; @@ -3460,7 +3460,7 @@ void HandleBleConfiguration(void) \*********************************************************************************************/ int ExtStopBLE(){ - AddLog_P(LOG_LEVEL_INFO, PSTR("BLE: Stopping if active")); + AddLog(LOG_LEVEL_INFO, PSTR("BLE: Stopping if active")); BLE_ESP32::BLEMode = BLE_ESP32::BLEModeDisabled; BLE_ESP32::StopBLE(); return 0; @@ -3548,13 +3548,13 @@ int myAdvertCallback(BLE_ESP32::ble_advertisment_t *pStruct) { // this one is used to demonstrate processing ALL operations int myOpCallback(BLE_ESP32::generic_sensor_t *pStruct){ - AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: myOpCallback")); + AddLog(LOG_LEVEL_INFO,PSTR("BLE: myOpCallback")); return 0; // return true to block MQTT broadcast } // this one is used to demonstrate processing of ONE specific operation int myOpCallback2(BLE_ESP32::generic_sensor_t *pStruct){ - AddLog_P(LOG_LEVEL_INFO,PSTR("BLE: myOpCallback2")); + AddLog(LOG_LEVEL_INFO,PSTR("BLE: myOpCallback2")); return 1; // return true to block MQTT broadcast } #endif @@ -3577,7 +3577,7 @@ void sendExample(){ BLE_ESP32::generic_sensor_t *op = nullptr; int res = BLE_ESP32::newOperation(&op); if (!res){ - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Could not create new operation")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Could not create new operation")); return; } strncpy(op->MAC, "001A22092EE0", sizeof(op->MAC)); @@ -3592,7 +3592,7 @@ void sendExample(){ if (!res){ // if it fails to add to the queue, do please delete it BLE_ESP32::freeOperation(&op); - AddLog_P(LOG_LEVEL_ERROR,PSTR("BLE: Failed to queue new operation - deleted")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: Failed to queue new operation - deleted")); return; }