From 7b10bec8fe63bcfa464bd221c5eeb4fae0d03a98 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 14 Nov 2019 15:57:52 +0100 Subject: [PATCH 01/25] Refactor SDK erase Add device hardware type to status 2 --- tasmota/settings.ino | 35 ++++++++++++++--------------------- tasmota/support.ino | 14 ++++++++++++++ tasmota/support_command.ino | 5 +++-- tasmota/support_wifi.ino | 3 --- 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/tasmota/settings.ino b/tasmota/settings.ino index 205cc92c0..3c664bd34 100644 --- a/tasmota/settings.ino +++ b/tasmota/settings.ino @@ -536,17 +536,24 @@ void SettingsLoad(void) void SettingsErase(uint8_t type) { /* - 0 = Erase from program end until end of physical flash - 1 = Erase SDK parameter area at end of linker memory model (0x0FDxxx - 0x0FFFFF) solving possible wifi errors - 2 = Erase Tasmota settings + Erase only works from flash start address to SDK recognized flash end address (flashchip->chip_size = ESP.getFlashChipSize). + Addresses above SDK recognized size (up to ESP.getFlashChipRealSize) are not accessable. + The only way to erase whole flash is esptool which uses direct SPI writes to flash. + + 0 = Erase from program end until end of flash as seen by SDK + 1 = Erase 16k SDK parameter area near end of flash as seen by SDK (0x0xFCxxx - 0x0xFFFFF) solving possible wifi errors + 2 = Erase Tasmota settings (0x0xF4xxx - 0x0xFBFFF) */ #ifndef FIRMWARE_MINIMAL +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SDK: Flash size 0x%08X"), flashchip->chip_size); + uint32_t _sectorStart = (ESP.getSketchSize() / SPI_FLASH_SEC_SIZE) + 1; - uint32_t _sectorEnd = ESP.getFlashChipRealSize() / SPI_FLASH_SEC_SIZE; +// uint32_t _sectorEnd = ESP.getFlashChipRealSize() / SPI_FLASH_SEC_SIZE; + uint32_t _sectorEnd = ESP.getFlashChipSize() / SPI_FLASH_SEC_SIZE; if (1 == type) { - _sectorStart = SETTINGS_LOCATION +2; // SDK parameter area above EEPROM area (0x0FDxxx - 0x0FFFFF) - _sectorEnd = SETTINGS_LOCATION +5; + // source Esp.cpp and core_esp8266_phy.cpp + _sectorStart = (ESP.getFlashChipSize() / SPI_FLASH_SEC_SIZE) - 4; } else if (2 == type) { _sectorStart = SETTINGS_LOCATION - CFG_ROTATES; // Tasmota parameter area (0x0F4xxx - 0x0FBFFF) @@ -565,7 +572,7 @@ void SettingsErase(uint8_t type) if (result) { Serial.println(F(" " D_OK)); } else { - Serial.println(F(" " D_ERROR)); + Serial.println(F(" " D_ERROR)); // } delay(10); } @@ -574,24 +581,10 @@ void SettingsErase(uint8_t type) #endif // FIRMWARE_MINIMAL } -// Copied from 2.4.0 as 2.3.0 is incomplete -bool SettingsEraseConfig(void) { - const size_t cfgSize = 0x4000; - size_t cfgAddr = ESP.getFlashChipSize() - cfgSize; - - for (size_t offset = 0; offset < cfgSize; offset += SPI_FLASH_SEC_SIZE) { - if (!ESP.flashEraseSector((cfgAddr + offset) / SPI_FLASH_SEC_SIZE)) { - return false; - } - } - return true; -} - void SettingsSdkErase(void) { WiFi.disconnect(true); // Delete SDK wifi config SettingsErase(1); - SettingsEraseConfig(); delay(1000); } diff --git a/tasmota/support.ino b/tasmota/support.ino index 0a07edf07..77202427d 100644 --- a/tasmota/support.ino +++ b/tasmota/support.ino @@ -612,6 +612,20 @@ char* GetPowerDevice(char* dest, uint32_t idx, size_t size) return GetPowerDevice(dest, idx, size, 0); } +String GetDeviceHardware(void) +{ + // esptool.py get_efuses + uint32_t efuse1 = *(uint32_t*)(0x3FF00050); + uint32_t efuse2 = *(uint32_t*)(0x3FF00054); +// uint32_t efuse3 = *(uint32_t*)(0x3FF00058); +// uint32_t efuse4 = *(uint32_t*)(0x3FF0005C); + +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("FUS: efuses 0x%08X 0x%08X, name %s"), efuse1, efuse2); + + bool is_8285 = ( (efuse1 & (1 << 4)) || (efuse2 & (1 << 16)) ); + return String((is_8285) ? F("ESP8285") : F("ESP8266EX")); +} + float ConvertTemp(float c) { float result = c; diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index 877ff7547..939189938 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -369,9 +369,10 @@ void CmndStatus(void) if ((0 == payload) || (2 == payload)) { Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS2_FIRMWARE "\":{\"" D_JSON_VERSION "\":\"%s%s\",\"" D_JSON_BUILDDATETIME "\":\"%s\",\"" - D_JSON_BOOTVERSION "\":%d,\"" D_JSON_COREVERSION "\":\"" ARDUINO_ESP8266_RELEASE "\",\"" D_JSON_SDKVERSION "\":\"%s\"}}"), + D_JSON_BOOTVERSION "\":%d,\"" D_JSON_COREVERSION "\":\"" ARDUINO_ESP8266_RELEASE "\",\"" D_JSON_SDKVERSION "\":\"%s\"," + "\"Hardware\":\"%s\"}}"), my_version, my_image, GetBuildDateAndTime().c_str(), - ESP.getBootVersion(), ESP.getSdkVersion()); + ESP.getBootVersion(), ESP.getSdkVersion(), GetDeviceHardware().c_str()); MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "2")); } diff --git a/tasmota/support_wifi.ino b/tasmota/support_wifi.ino index 162fbc2a9..f90d7cff1 100644 --- a/tasmota/support_wifi.ino +++ b/tasmota/support_wifi.ino @@ -618,6 +618,3 @@ void EspRestart(void) // ESP.restart(); // This results in exception 3 on restarts on core 2.3.0 ESP.reset(); } - - - From c64743e2ca345b3856e063e561536fc8bc3ce936 Mon Sep 17 00:00:00 2001 From: Jason2866 Date: Thu, 14 Nov 2019 17:25:53 +0100 Subject: [PATCH 02/25] Support for Arduino Core 2.6.1.... and deleted all old outdated cores --- platformio.ini | 158 +++++++++++++++++++++++-------------------------- 1 file changed, 74 insertions(+), 84 deletions(-) diff --git a/platformio.ini b/platformio.ini index eb925b680..f28d59e9f 100755 --- a/platformio.ini +++ b/platformio.ini @@ -15,7 +15,7 @@ build_cache_dir = .cache ; *** Build/upload environment default_envs = ; *** Uncomment by deleting ";" in the line(s) below to select version(s) -; tasmota + tasmota ; tasmota-ircustom ; alternative to 'tasmota' with full IR protocols activated, you will need to disable some features to keep code not too big ; tasmota-minimal ; tasmota-basic @@ -99,18 +99,14 @@ extra_scripts = pio/strip-floats.py [core_active] ; Select one core set for platform and build_flags -;platform = ${core_2_3_0.platform} -;build_flags = ${core_2_3_0.build_flags} -;platform = ${core_2_4_2.platform} -;build_flags = ${core_2_4_2.build_flags} -platform = ${core_2_6_0.platform} -build_flags = ${core_2_6_0.build_flags} -;platform = ${core_pre.platform} -;build_flags = ${core_pre.build_flags} -;platform = ${core_pre_ipv6.platform} -;build_flags = ${core_pre_ipv6.build_flags} +;platform = ${core_2_6_0.platform} +;build_flags = ${core_2_6_0.build_flags} +platform = ${core_2_6_1.platform} +build_flags = ${core_2_6_1.build_flags} ;platform = ${core_stage.platform} ;build_flags = ${core_stage.build_flags} +;platform = ${core_cstage.platform} +;build_flags = ${core_cstage.build_flags} ; ********************************************************************* @@ -118,29 +114,7 @@ build_flags = ${core_2_6_0.build_flags} build_flags = -D NDEBUG -mtarget-align -Wl,-Map,firmware.map - -[core_2_3_0] -; *** Esp8266 core for Arduino version 2.3.0 -; *** W A R N I N G ! *** old outdated Arduino Esp8266 core with many security issues! NOT recommended to use. NO SUPPORT! -platform = espressif8266@1.5.0 -build_flags = ${esp82xx_defaults.build_flags} - -Wl,-Tesp8266.flash.1m0.ld - -[core_2_4_2] -; *** Esp8266 core for Arduino version 2.4.2 -; *** W A R N I N G ! *** old outdated Arduino Esp8266 core with security issues. NOT recommended to use. NO SUPPORT! -platform = espressif8266@1.8.0 -build_flags = ${esp82xx_defaults.build_flags} - -Wl,-Teagle.flash.1m0.ld - -lstdc++ -lsupc++ -; lwIP 1.4 -; -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH -; lwIP 2 - Low Memory -; -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY -; lwIP 2 - Higher Bandwidth (Tasmota default) - -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH - -DVTABLES_IN_FLASH - + [core_2_6_0] ; *** Esp8266 core for Arduino version 2.6.0 (for Windows, most Linux variants and Mac) ; *** custom setup until the core 2.6.0 version is official released from PlatformIO crew @@ -171,6 +145,8 @@ build_flags = ${esp82xx_defaults.build_flags} ; -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY_LOW_FLASH ; lwIP 2 - Higher Bandwidth no Features (Tasmota default) -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH +; lwIP 2 - Higher Bandwidth IPv6 (use ONLY if you need IPv6, experimental!) +; -DPIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_HIGHER_BANDWIDTH ; VTABLES in Flash (Tasmota default) -DVTABLES_IN_FLASH ; VTABLES in Heap @@ -185,18 +161,25 @@ build_flags = ${esp82xx_defaults.build_flags} ; -fexceptions ; -lstdc++-exc -[core_pre] -; *** Arduino Esp8266 core pre 2.6.x for Tasmota (recommended version, no known issues) -platform = https://github.com/Jason2866/platform-espressif8266.git#Tasmota +[core_2_6_1] +; *** Esp8266 core for Arduino version 2.6.0 (for Windows, most Linux variants and Mac) +; *** custom setup until the core 2.6.0 version is official released from PlatformIO crew +platform = https://github.com/Jason2866/platform-espressif8266.git#core_2_6_1 build_flags = ${esp82xx_defaults.build_flags} - -Wl,-Tesp8266.flash.1m.ld + -Wl,-Teagle.flash.1m.ld -O2 -DBEARSSL_SSL_BASIC -; nonos-sdk 22y - -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22y -; nonos-sdk 22x -; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x -; nonos-sdk-pre-v3 +; NONOSDK221 +; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK221 +; NONOSDK22x_190313 +; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190313 +; NONOSDK22x_190703 +; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703 +; NONOSDK22x_191024 +; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_191024 +; NONOSDK22x_191105 (Tasmota default) + -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_191105 +; NONOSDK3V0 (known issues) ; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK3 ; lwIP 1.4 ; -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH @@ -208,7 +191,9 @@ build_flags = ${esp82xx_defaults.build_flags} ; -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY_LOW_FLASH ; lwIP 2 - Higher Bandwidth no Features (Tasmota default) -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH -; VTABLES in Flash (default) +; lwIP 2 - Higher Bandwidth IPv6 (use ONLY if you need IPv6, experimental!) +; -DPIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_HIGHER_BANDWIDTH +; VTABLES in Flash (Tasmota default) -DVTABLES_IN_FLASH ; VTABLES in Heap ; -DVTABLES_IN_DRAM @@ -218,49 +203,11 @@ build_flags = ${esp82xx_defaults.build_flags} ; No exception code in firmware -fno-exceptions -lstdc++ -; Exception code in firmware /needs much space! -; -fexceptions -; -lstdc++-exc - -[core_pre_ipv6] -; *** Arduino Esp8266 core pre 2.6.x IPv6 for Tasmota (use ONLY if you need IPv6, experimental!) -platform = https://github.com/Jason2866/platform-espressif8266.git#Tasmota -build_flags = ${esp82xx_defaults.build_flags} - -Wl,-Tesp8266.flash.1m.ld - -O2 - -DBEARSSL_SSL_BASIC -; nonos-sdk 22y - -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22y -; nonos-sdk 22x -; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x -; nonos-sdk-pre-v3 -; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK3 -; lwIP 1.4 -; -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH -; lwIP 2 - Low Memory -; -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY -; lwIP 2 - Higher Bandwidth -; -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH -; lwIP 2 - Higher Bandwidth Low Memory no Features -; -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY_LOW_FLASH -; lwIP 2 - Higher Bandwidth no Features -; -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH -; lwIP 2 - Higher Bandwidth IPv6 - -DPIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_HIGHER_BANDWIDTH -; VTABLES in Flash (default) - -DVTABLES_IN_FLASH -; VTABLES in Heap -; -DVTABLES_IN_DRAM -; VTABLES in IRAM -; -DVTABLES_IN_IRAM -; enable one option set -> No exception recommended -; No exception code in firmware - -fno-exceptions - -lstdc++ -; Exception code in firmware /needs much space! +; Exception code in firmware /needs much space! 90k ; -fexceptions ; -lstdc++-exc +[core_stage] [core_stage] ; *** Esp8266 core for Arduino version latest beta platform = https://github.com/platformio/platform-espressif8266.git#feature/stage @@ -305,6 +252,49 @@ build_flags = ${esp82xx_defaults.build_flags} ; -fexceptions ; -lstdc++-exc +[core_cstage] +; *** Arduino Esp8266 -> Stage with Xtensa build chain 2.5.0.4 and Esptoolpy 2.8 +platform = https://github.com/Jason2866/platform-espressif8266.git#feature/stage +build_flags = ${esp82xx_defaults.build_flags} + -Wl,-Tesp8266.flash.1m.ld + -O2 + -DBEARSSL_SSL_BASIC +; NONOSDK221 +; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK221 +; NONOSDK22x_190313 +; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190313 +; NONOSDK22x_190703 +; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703 +; NONOSDK22x_191024 +; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_191024 +; NONOSDK22x_191105 + -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_191105 +; NONOSDK3V0 (known issues) +; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK3 +; lwIP 1.4 +; -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH +; lwIP 2 - Low Memory +; -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY +; lwIP 2 - Higher Bandwidth +; -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH +; lwIP 2 - Higher Bandwidth Low Memory no Features +; -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY_LOW_FLASH +; lwIP 2 - Higher Bandwidth no Features + -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH +; VTABLES in Flash (default) + -DVTABLES_IN_FLASH +; VTABLES in Heap +; -DVTABLES_IN_DRAM +; VTABLES in IRAM +; -DVTABLES_IN_IRAM +; enable one option set -> No exception recommended +; No exception code in firmware + -fno-exceptions + -lstdc++ +; Exception code in firmware /needs much space! 90k +; -fexceptions +; -lstdc++-exc + [env:tasmota] platform = ${common.platform} framework = ${common.framework} From 7e6409d167adb913e4c69d6bd061c7de63ed19e2 Mon Sep 17 00:00:00 2001 From: Jason2866 Date: Thu, 14 Nov 2019 17:30:03 +0100 Subject: [PATCH 03/25] unselect env --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index f28d59e9f..c2121c6f9 100755 --- a/platformio.ini +++ b/platformio.ini @@ -15,7 +15,7 @@ build_cache_dir = .cache ; *** Build/upload environment default_envs = ; *** Uncomment by deleting ";" in the line(s) below to select version(s) - tasmota +; tasmota ; tasmota-ircustom ; alternative to 'tasmota' with full IR protocols activated, you will need to disable some features to keep code not too big ; tasmota-minimal ; tasmota-basic From 084a725e314ab6cd6725744d776c794333732815 Mon Sep 17 00:00:00 2001 From: Jason2866 Date: Thu, 14 Nov 2019 17:37:46 +0100 Subject: [PATCH 04/25] Update platformio.ini --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index c2121c6f9..7ea41dd85 100755 --- a/platformio.ini +++ b/platformio.ini @@ -162,7 +162,7 @@ build_flags = ${esp82xx_defaults.build_flags} ; -lstdc++-exc [core_2_6_1] -; *** Esp8266 core for Arduino version 2.6.0 (for Windows, most Linux variants and Mac) +; *** Esp8266 core for Arduino version 2.6.1 (for Windows, most Linux variants and Mac) ; *** custom setup until the core 2.6.0 version is official released from PlatformIO crew platform = https://github.com/Jason2866/platform-espressif8266.git#core_2_6_1 build_flags = ${esp82xx_defaults.build_flags} From 2ccf9c199bddd526aa7dceef3b81430bdf9d91fa Mon Sep 17 00:00:00 2001 From: Jason2866 Date: Thu, 14 Nov 2019 17:39:43 +0100 Subject: [PATCH 05/25] Update platformio.ini --- platformio.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 7ea41dd85..3c6228274 100755 --- a/platformio.ini +++ b/platformio.ini @@ -207,7 +207,6 @@ build_flags = ${esp82xx_defaults.build_flags} ; -fexceptions ; -lstdc++-exc -[core_stage] [core_stage] ; *** Esp8266 core for Arduino version latest beta platform = https://github.com/platformio/platform-espressif8266.git#feature/stage From b3bcb0e8a70f14b509e024fb2eb722355fe04bff Mon Sep 17 00:00:00 2001 From: Federico Leoni Date: Thu, 14 Nov 2019 22:37:30 -0300 Subject: [PATCH 06/25] Update xdrv_12_home_assistant.ino --- tasmota/xdrv_12_home_assistant.ino | 37 +++++++++++++++++++----------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/tasmota/xdrv_12_home_assistant.ino b/tasmota/xdrv_12_home_assistant.ino index e2e23a355..38c36ead1 100644 --- a/tasmota/xdrv_12_home_assistant.ino +++ b/tasmota/xdrv_12_home_assistant.ino @@ -34,18 +34,23 @@ const char HASS_DISCOVER_RELAY[] PROGMEM = const char HASS_DISCOVER_BUTTON_SWITCH[] PROGMEM = "{\"name\":\"%s\"," // dualr2 1 BTN - "\"stat_t\":\"%s\"," // stat/RESULT/ (implies "\"optimistic\":\"false\",") - "\"value_template\":\"{{value_json.%s}}\"," // BUTTON1 - "\"pl_on\":\"%s\"," // ON + "\"stat_t\":\"%s\"," // dualr2/stat/BUTTON1/ (implies "\"optimistic\":\"false\",") "\"avty_t\":\"%s\"," // tele/dualr2/LWT "\"pl_avail\":\"" D_ONLINE "\"," // Online "\"pl_not_avail\":\"" D_OFFLINE "\""; // Offline -const char HASS_DISCOVER_BUTTON_SWITCH_TOGGLE[] PROGMEM = - ",\"off_delay\":1"; // Hass has no support for TOGGLE, fake it by resetting to OFF after 1s +const char HASS_DISCOVER_BUTTON_TOGGLE[] PROGMEM = + ",\"value_template\":\"{{value_json.%s}}\"," // STATE + "\"pl_on\":\"%s\"," // TOGGLE + "\"off_delay\":1"; // Hass has no support for TOGGLE, fake it by resetting to OFF after 1s +const char HASS_DISCOVER_SWITCH_TOGGLE[] PROGMEM = + ",\"value_template\":\"{%%if is_state(entity_id,\\\"on\\\")-%%}OFF{%%-else-%%}ON{%%-endif%%}\""; // A switch must maintain his state until the next update + const char HASS_DISCOVER_BUTTON_SWITCH_ONOFF[] PROGMEM = - ",\"frc_upd\":true," // In ON/OFF case, enable force_update to make automations work + ",\"value_template\":\"{{value_json.%s}}\"," // STATE + "\"frc_upd\":true," // In ON/OFF case, enable force_update to make automations work + "\"pl_on\":\"%s\"," // ON "\"pl_off\":\"%s\""; // OFF const char HASS_DISCOVER_LIGHT_DIMMER[] PROGMEM = @@ -319,21 +324,25 @@ void HAssAnnounceButtonSwitch(uint8_t device, char* topic, uint8_t present, uint char jsoname[8]; snprintf_P(name, sizeof(name), PSTR("%s %s%d"), Settings.friendlyname[0], key?"Switch":"Button", device+1); + snprintf_P(jsoname, sizeof(jsoname), PSTR("%s%d"), key?"SWITCH":"BUTTON", device+1); GetPowerDevice(value_template, device+1, sizeof(value_template), key + Settings.flag.device_index_enable); // Force index for Switch 1, Index on Button1 is controlled by SetOption26 - Switch between POWER or POWER1 //GetTopic_P(state_topic, CMND, topic, value_template); // State of button is sent as CMND TOGGLE, state of switch is sent as ON/OFF - GetTopic_P(state_topic, STAT, mqtt_topic, PSTR(D_RSLT_RESULT)); + GetTopic_P(state_topic, STAT, mqtt_topic, (PSTR("/'%s'"), jsoname)); GetTopic_P(availability_topic, TELE, mqtt_topic, S_LWT); FindPrefix(state_topic, availability_topic, prefix); Shorten(&state_topic, prefix); Shorten(&availability_topic, prefix); - snprintf_P(jsoname, sizeof(jsoname), PSTR("%s%d"), key?"SWITCH":"BUTTON", device+1); - Response_P(HASS_DISCOVER_BUTTON_SWITCH, name, state_topic, jsoname, Settings.state_text[toggle?2:1], availability_topic); + Response_P(HASS_DISCOVER_BUTTON_SWITCH, name, state_topic, availability_topic); TryResponseAppend_P(HASS_DISCOVER_DEVICE_INFO_SHORT, unique_id, ESP.getChipId(), WiFi.macAddress().c_str()); if (strlen(prefix) > 0 ) TryResponseAppend_P(HASS_DISCOVER_TOPIC_PREFIX, prefix); - if (toggle) TryResponseAppend_P(HASS_DISCOVER_BUTTON_SWITCH_TOGGLE); - else TryResponseAppend_P(HASS_DISCOVER_BUTTON_SWITCH_ONOFF, Settings.state_text[0]); + if (toggle) { + if (!key) { + TryResponseAppend_P(HASS_DISCOVER_BUTTON_TOGGLE, PSTR(D_RSLT_STATE), Settings.state_text[toggle?2:1]); + } else {TryResponseAppend_P(HASS_DISCOVER_SWITCH_TOGGLE);} + } + else TryResponseAppend_P(HASS_DISCOVER_BUTTON_SWITCH_ONOFF, PSTR(D_RSLT_STATE), Settings.state_text[toggle?2:1], Settings.state_text[0]); TryResponseAppend_P(PSTR("}")); } @@ -620,8 +629,10 @@ void HAssAnyKey(void) char scommand[CMDSZ]; snprintf_P(scommand, sizeof(scommand), PSTR("%s%d"), (key) ? "SWITCH" : "BUTTON", device); char stopic[TOPSZ]; - GetTopic_P(stopic, STAT, mqtt_topic, (Settings.flag.mqtt_response) ? scommand : S_RSLT_RESULT); // SetOption4 - Switch between MQTT RESULT or COMMAND - Response_P(S_JSON_COMMAND_SVALUE, scommand, GetStateText(state)); + //GetTopic_P(stopic, STAT, mqtt_topic, (Settings.flag.mqtt_response) ? scommand : S_RSLT_RESULT); // SetOption4 - Switch between MQTT RESULT or COMMAND + //Response_P(S_JSON_COMMAND_SVALUE, scommand, GetStateText(state)); + GetTopic_P(stopic, STAT, mqtt_topic, scommand); + Response_P(S_JSON_COMMAND_SVALUE, PSTR(D_RSLT_STATE), GetStateText(state)); MqttPublish(stopic); } From 5c324357e67e0cd74ab172355209bb5f5ff61190 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 15 Nov 2019 11:50:41 +0100 Subject: [PATCH 07/25] Add command SetOption76 0/1 Add command SetOption76 0/1 to enable incrementing bootcount when deepsleep is enabled (#6930) --- tasmota/_changelog.ino | 1 + tasmota/settings.h | 2 +- tasmota/tasmota.ino | 10 ++++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tasmota/_changelog.ino b/tasmota/_changelog.ino index e075af947..137bcf1d3 100644 --- a/tasmota/_changelog.ino +++ b/tasmota/_changelog.ino @@ -7,6 +7,7 @@ * Add Keep last channels values when Color command end with '=' (#6799) * Add support for I2C sensor TLS2591 Light Intensity sensor (#6873) * Change Kept only NEC/RC5/RC6/HASH IR protocols in standard Tasmota, all other protocols require Tasmota-IR, saving 4K + * Add command SetOption76 0/1 to enable incrementing bootcount when deepsleep is enabled (#6930) * * 7.0.0.3 20191103 * Add command I2cDriver for I2C driver runtime control using document I2CDEVICES.md diff --git a/tasmota/settings.h b/tasmota/settings.h index d7a06c778..f88f33c52 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -89,7 +89,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t cors_enabled : 1; // bit 23 (v7.0.0.1) - SetOption73 - Enable HTTP CORS uint32_t ds18x20_internal_pullup : 1; // bit 24 (v7.0.0.1) - SetOption74 - Enable internal pullup for single DS18x20 sensor uint32_t grouptopic_mode : 1; // bit 25 (v7.0.0.1) - SetOption75 - GroupTopic replaces %topic% (0) or fixed topic cmnd/grouptopic (1) - uint32_t spare26 : 1; + uint32_t bootcount_update : 1; // bit 26 (v7.0.0.4) - SetOption76 - Enable incrementing bootcount when deepsleep is enabled uint32_t spare27 : 1; uint32_t spare28 : 1; uint32_t spare29 : 1; diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index 568fff407..2f7979ccb 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -819,8 +819,14 @@ void PerformEverySecond(void) RtcReboot.fast_reboot_count = 0; RtcRebootSave(); - Settings.bootcount++; // Moved to here to stop flash writes during start-up - AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BOOT_COUNT " %d"), Settings.bootcount); +#ifdef USE_DEEPSLEEP + if (!(DeepSleepEnabled() && !Settings.flag3.bootcount_update)) { +#endif + Settings.bootcount++; // Moved to here to stop flash writes during start-up + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BOOT_COUNT " %d"), Settings.bootcount); +#ifdef USE_DEEPSLEEP + } +#endif } if (seriallog_timer) { From f64264da95368589ba41babef75058d5cf18add9 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 15 Nov 2019 12:19:47 +0100 Subject: [PATCH 08/25] Fix core 2.3.0 compile error Fix core 2.3.0 compile error (#6856) --- tasmota/support.ino | 118 +----------------------- tasmota/support_legacy_cores.ino | 153 +++++++++++++++++++++++++++++++ 2 files changed, 154 insertions(+), 117 deletions(-) create mode 100644 tasmota/support_legacy_cores.ino diff --git a/tasmota/support.ino b/tasmota/support.ino index 77202427d..0520a04d2 100644 --- a/tasmota/support.ino +++ b/tasmota/support.ino @@ -87,127 +87,11 @@ bool OsWatchBlockedLoop(void) { return oswatch_blocked_loop; } + /*********************************************************************************************\ * Miscellaneous \*********************************************************************************************/ -#ifdef ARDUINO_ESP8266_RELEASE_2_3_0 -// Functions not available in 2.3.0 - -// http://clc-wiki.net/wiki/C_standard_library:string.h:memchr -void* memchr(const void* ptr, int value, size_t num) -{ - unsigned char *p = (unsigned char*)ptr; - while (num--) { - if (*p != (unsigned char)value) { - p++; - } else { - return p; - } - } - return 0; -} - -// http://clc-wiki.net/wiki/C_standard_library:string.h:strcspn -// Get span until any character in string -size_t strcspn(const char *str1, const char *str2) -{ - size_t ret = 0; - while (*str1) { - if (strchr(str2, *str1)) { // Slow - return ret; - } else { - str1++; - ret++; - } - } - return ret; -} - -// https://clc-wiki.net/wiki/C_standard_library:string.h:strpbrk -// Locate the first occurrence in the string pointed to by s1 of any character from the string pointed to by s2 -char* strpbrk(const char *s1, const char *s2) -{ - while(*s1) { - if (strchr(s2, *s1++)) { - return (char*)--s1; - } - } - return 0; -} - -// https://opensource.apple.com/source/Libc/Libc-583/stdlib/FreeBSD/strtoull.c -// Convert a string to an unsigned long long integer -#ifndef __LONG_LONG_MAX__ -#define __LONG_LONG_MAX__ 9223372036854775807LL -#endif -#ifndef ULLONG_MAX -#define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1) -#endif - -unsigned long long strtoull(const char *__restrict nptr, char **__restrict endptr, int base) -{ - const char *s = nptr; - char c; - do { c = *s++; } while (isspace((unsigned char)c)); // Trim leading spaces - - int neg = 0; - if (c == '-') { // Set minus flag and/or skip sign - neg = 1; - c = *s++; - } else { - if (c == '+') { - c = *s++; - } - } - - if ((base == 0 || base == 16) && (c == '0') && (*s == 'x' || *s == 'X')) { // Set Hexadecimal - c = s[1]; - s += 2; - base = 16; - } - if (base == 0) { base = (c == '0') ? 8 : 10; } // Set Octal or Decimal - - unsigned long long acc = 0; - int any = 0; - if (base > 1 && base < 37) { - unsigned long long cutoff = ULLONG_MAX / base; - int cutlim = ULLONG_MAX % base; - for ( ; ; c = *s++) { - if (c >= '0' && c <= '9') - c -= '0'; - else if (c >= 'A' && c <= 'Z') - c -= 'A' - 10; - else if (c >= 'a' && c <= 'z') - c -= 'a' - 10; - else - break; - - if (c >= base) - break; - - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) - any = -1; - else { - any = 1; - acc *= base; - acc += c; - } - } - if (any < 0) { - acc = ULLONG_MAX; // Range error - } - else if (any && neg) { - acc = -acc; - } - } - - if (endptr != nullptr) { *endptr = (char *)(any ? s - 1 : nptr); } - - return acc; -} -#endif // ARDUINO_ESP8266_RELEASE_2_3_0 - // Get span until single character in string size_t strchrspn(const char *str1, int character) { diff --git a/tasmota/support_legacy_cores.ino b/tasmota/support_legacy_cores.ino new file mode 100644 index 000000000..9a5cee2ae --- /dev/null +++ b/tasmota/support_legacy_cores.ino @@ -0,0 +1,153 @@ +/* + support_legacy_cores.ino - Legacy arduino core support for Tasmota + + Copyright (C) 2019 Theo Arends + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifdef ARDUINO_ESP8266_RELEASE_2_3_0 +/*********************************************************************************************\ + * Functions not available in core 2.3.0 +\*********************************************************************************************/ + +// Functions not available in 2.3.0 + +// http://clc-wiki.net/wiki/C_standard_library:string.h:memchr +void* memchr(const void* ptr, int value, size_t num) +{ + unsigned char *p = (unsigned char*)ptr; + while (num--) { + if (*p != (unsigned char)value) { + p++; + } else { + return p; + } + } + return 0; +} + +// http://clc-wiki.net/wiki/C_standard_library:string.h:strcspn +// Get span until any character in string +size_t strcspn(const char *str1, const char *str2) +{ + size_t ret = 0; + while (*str1) { + if (strchr(str2, *str1)) { // Slow + return ret; + } else { + str1++; + ret++; + } + } + return ret; +} + +// https://clc-wiki.net/wiki/C_standard_library:string.h:strpbrk +// Locate the first occurrence in the string pointed to by s1 of any character from the string pointed to by s2 +char* strpbrk(const char *s1, const char *s2) +{ + while(*s1) { + if (strchr(s2, *s1++)) { + return (char*)--s1; + } + } + return 0; +} + +// https://opensource.apple.com/source/Libc/Libc-583/stdlib/FreeBSD/strtoull.c +// Convert a string to an unsigned long long integer +#ifndef __LONG_LONG_MAX__ +#define __LONG_LONG_MAX__ 9223372036854775807LL +#endif +#ifndef ULLONG_MAX +#define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1) +#endif + +unsigned long long strtoull(const char *__restrict nptr, char **__restrict endptr, int base) +{ + const char *s = nptr; + char c; + do { c = *s++; } while (isspace((unsigned char)c)); // Trim leading spaces + + int neg = 0; + if (c == '-') { // Set minus flag and/or skip sign + neg = 1; + c = *s++; + } else { + if (c == '+') { + c = *s++; + } + } + + if ((base == 0 || base == 16) && (c == '0') && (*s == 'x' || *s == 'X')) { // Set Hexadecimal + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) { base = (c == '0') ? 8 : 10; } // Set Octal or Decimal + + unsigned long long acc = 0; + int any = 0; + if (base > 1 && base < 37) { + unsigned long long cutoff = ULLONG_MAX / base; + int cutlim = ULLONG_MAX % base; + for ( ; ; c = *s++) { + if (c >= '0' && c <= '9') + c -= '0'; + else if (c >= 'A' && c <= 'Z') + c -= 'A' - 10; + else if (c >= 'a' && c <= 'z') + c -= 'a' - 10; + else + break; + + if (c >= base) + break; + + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) + any = -1; + else { + any = 1; + acc *= base; + acc += c; + } + } + if (any < 0) { + acc = ULLONG_MAX; // Range error + } + else if (any && neg) { + acc = -acc; + } + } + + if (endptr != nullptr) { *endptr = (char *)(any ? s - 1 : nptr); } + + return acc; +} + +// https://github.com/arendst/Tasmota/issues/6856#issuecomment-554258914 +void* memmove_P(void *dest, const void *src, size_t n) +{ + if (src > (void*)0x40000000) { + return memcpy_P(dest, src, n); + } else { + return memmove(dest, src, n); + } +} + +#endif // ARDUINO_ESP8266_RELEASE_2_3_0 +/*********************************************************************************************\ + * +\*********************************************************************************************/ From 822b719a5dcdd76fdf6dfd5d3087bb9286b576c8 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 15 Nov 2019 15:42:10 +0100 Subject: [PATCH 09/25] Change Reset erase Change Reset erase end address from as seen by SDK (getFlashChipSize) to full flash size (getFlashChipRealSize) --- tasmota/_changelog.ino | 1 + tasmota/settings.ino | 22 ++++++--- tasmota/support_esptool.ino | 91 +++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+), 6 deletions(-) create mode 100644 tasmota/support_esptool.ino diff --git a/tasmota/_changelog.ino b/tasmota/_changelog.ino index 137bcf1d3..f7c53a1f9 100644 --- a/tasmota/_changelog.ino +++ b/tasmota/_changelog.ino @@ -8,6 +8,7 @@ * Add support for I2C sensor TLS2591 Light Intensity sensor (#6873) * Change Kept only NEC/RC5/RC6/HASH IR protocols in standard Tasmota, all other protocols require Tasmota-IR, saving 4K * Add command SetOption76 0/1 to enable incrementing bootcount when deepsleep is enabled (#6930) + * Change Reset erase end address from as seen by SDK (getFlashChipSize) to full flash size (getFlashChipRealSize) * * 7.0.0.3 20191103 * Add command I2cDriver for I2C driver runtime control using document I2CDEVICES.md diff --git a/tasmota/settings.ino b/tasmota/settings.ino index 3c664bd34..753e8602b 100644 --- a/tasmota/settings.ino +++ b/tasmota/settings.ino @@ -536,27 +536,31 @@ void SettingsLoad(void) void SettingsErase(uint8_t type) { /* + For Arduino core and SDK: Erase only works from flash start address to SDK recognized flash end address (flashchip->chip_size = ESP.getFlashChipSize). Addresses above SDK recognized size (up to ESP.getFlashChipRealSize) are not accessable. + For Esptool: The only way to erase whole flash is esptool which uses direct SPI writes to flash. + The default erase function is EspTool (EsptoolEraseSector) + 0 = Erase from program end until end of flash as seen by SDK 1 = Erase 16k SDK parameter area near end of flash as seen by SDK (0x0xFCxxx - 0x0xFFFFF) solving possible wifi errors - 2 = Erase Tasmota settings (0x0xF4xxx - 0x0xFBFFF) + 2 = Erase Tasmota settings (0x0xF3xxx - 0x0xFBFFF) */ #ifndef FIRMWARE_MINIMAL // AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SDK: Flash size 0x%08X"), flashchip->chip_size); uint32_t _sectorStart = (ESP.getSketchSize() / SPI_FLASH_SEC_SIZE) + 1; -// uint32_t _sectorEnd = ESP.getFlashChipRealSize() / SPI_FLASH_SEC_SIZE; - uint32_t _sectorEnd = ESP.getFlashChipSize() / SPI_FLASH_SEC_SIZE; + uint32_t _sectorEnd = ESP.getFlashChipRealSize() / SPI_FLASH_SEC_SIZE; +// uint32_t _sectorEnd = ESP.getFlashChipSize() / SPI_FLASH_SEC_SIZE; if (1 == type) { // source Esp.cpp and core_esp8266_phy.cpp _sectorStart = (ESP.getFlashChipSize() / SPI_FLASH_SEC_SIZE) - 4; } else if (2 == type) { - _sectorStart = SETTINGS_LOCATION - CFG_ROTATES; // Tasmota parameter area (0x0F4xxx - 0x0FBFFF) + _sectorStart = SETTINGS_LOCATION - CFG_ROTATES; // Tasmota parameter area (0x0F3xxx - 0x0FBFFF) _sectorEnd = SETTINGS_LOCATION +1; } @@ -565,16 +569,22 @@ void SettingsErase(uint8_t type) AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_ERASE " %d " D_UNIT_SECTORS), _sectorEnd - _sectorStart); for (uint32_t _sector = _sectorStart; _sector < _sectorEnd; _sector++) { - bool result = ESP.flashEraseSector(_sector); + +// bool result = ESP.flashEraseSector(_sector); // Arduino core - erases flash as seen by SDK +// bool result = !SPIEraseSector(_sector); // SDK - erases flash as seen by SDK + bool result = EsptoolEraseSector(_sector); // Esptool - erases flash completely + if (_serialoutput) { Serial.print(F(D_LOG_APPLICATION D_ERASED_SECTOR " ")); Serial.print(_sector); if (result) { Serial.println(F(" " D_OK)); } else { - Serial.println(F(" " D_ERROR)); // + Serial.println(F(" " D_ERROR)); } delay(10); + } else { + yield(); } OsWatchLoop(); } diff --git a/tasmota/support_esptool.ino b/tasmota/support_esptool.ino new file mode 100644 index 000000000..45e5245bf --- /dev/null +++ b/tasmota/support_esptool.ino @@ -0,0 +1,91 @@ +/* + support_esptool.ino - esptool support for Tasmota + + Copyright (C) 2019 Theo Arends + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#define USE_ESPTOOL +#ifdef USE_ESPTOOL +/*********************************************************************************************\ + * EspTool Erase function based on Version 2.8 + * + * Source: https://github.com/espressif/esptool/blob/master/flasher_stub +\*********************************************************************************************/ + +// *** flasher_stub/include/soc_support.h +#define READ_REG(REG) (*((volatile uint32_t *)(REG))) +#define WRITE_REG(REG, VAL) *((volatile uint32_t *)(REG)) = (VAL) +#define REG_SET_MASK(reg, mask) WRITE_REG((reg), (READ_REG(reg)|(mask))) + +#define SPI_BASE_REG 0x60000200 // SPI peripheral 0 + +#define SPI_CMD_REG (SPI_BASE_REG + 0x00) +#define SPI_FLASH_RDSR (1<<27) +#define SPI_FLASH_SE (1<<24) +#define SPI_FLASH_BE (1<<23) +#define SPI_FLASH_WREN (1<<30) + +#define SPI_ADDR_REG (SPI_BASE_REG + 0x04) +#define SPI_CTRL_REG (SPI_BASE_REG + 0x08) +#define SPI_RD_STATUS_REG (SPI_BASE_REG + 0x10) +#define SPI_W0_REG (SPI_BASE_REG + 0x40) +#define SPI_EXT2_REG (SPI_BASE_REG + 0xF8) + +#define SPI_ST 0x7 // Done state value + +// *** flasher_stub/stub_write_flash.c +static const uint32_t STATUS_WIP_BIT = (1 << 0); // SPI status bits + +// Wait for the SPI state machine to be ready, ie no command in progress in the internal host. +inline static void spi_wait_ready(void) +{ + // Wait for SPI state machine ready + while((READ_REG(SPI_EXT2_REG) & SPI_ST)) { } +} + +// Returns true if the spiflash is ready for its next write operation. +// Doesn't block, except for the SPI state machine to finish any previous SPI host operation. +static bool spiflash_is_ready(void) +{ + spi_wait_ready(); + WRITE_REG(SPI_RD_STATUS_REG, 0); + WRITE_REG(SPI_CMD_REG, SPI_FLASH_RDSR); // Issue read status command + while(READ_REG(SPI_CMD_REG) != 0) { } + uint32_t status_value = READ_REG(SPI_RD_STATUS_REG); + return (status_value & STATUS_WIP_BIT) == 0; +} + +static void spi_write_enable(void) +{ + while(!spiflash_is_ready()) { } + WRITE_REG(SPI_CMD_REG, SPI_FLASH_WREN); + while(READ_REG(SPI_CMD_REG) != 0) { } +} + +bool EsptoolEraseSector(uint32_t sector) +{ + spi_write_enable(); + spi_wait_ready(); + + WRITE_REG(SPI_ADDR_REG, (sector * SPI_FLASH_SEC_SIZE) & 0xffffff); + WRITE_REG(SPI_CMD_REG, SPI_FLASH_SE); // Sector erase, 4KB + while(READ_REG(SPI_CMD_REG) != 0) { } + while(!spiflash_is_ready()) { } + + return true; +} + +#endif // USE_ESPTOOL From 4c2ad6405659dc4f5b0bad19aef3787c33acc725 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 15 Nov 2019 16:58:22 +0100 Subject: [PATCH 10/25] Speedup flash erase using block erase --- tasmota/settings.ino | 14 +++++++++----- tasmota/support_esptool.ino | 38 +++++++++++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/tasmota/settings.ino b/tasmota/settings.ino index 753e8602b..ae442069b 100644 --- a/tasmota/settings.ino +++ b/tasmota/settings.ino @@ -542,7 +542,7 @@ void SettingsErase(uint8_t type) For Esptool: The only way to erase whole flash is esptool which uses direct SPI writes to flash. - The default erase function is EspTool (EsptoolEraseSector) + The default erase function is EspTool (EsptoolErase) 0 = Erase from program end until end of flash as seen by SDK 1 = Erase 16k SDK parameter area near end of flash as seen by SDK (0x0xFCxxx - 0x0xFFFFF) solving possible wifi errors @@ -564,15 +564,16 @@ void SettingsErase(uint8_t type) _sectorEnd = SETTINGS_LOCATION +1; } - bool _serialoutput = (LOG_LEVEL_DEBUG_MORE <= seriallog_level); - AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_ERASE " %d " D_UNIT_SECTORS), _sectorEnd - _sectorStart); +/* + bool _serialoutput = (LOG_LEVEL_DEBUG_MORE <= seriallog_level); + for (uint32_t _sector = _sectorStart; _sector < _sectorEnd; _sector++) { -// bool result = ESP.flashEraseSector(_sector); // Arduino core - erases flash as seen by SDK + bool result = ESP.flashEraseSector(_sector); // Arduino core - erases flash as seen by SDK // bool result = !SPIEraseSector(_sector); // SDK - erases flash as seen by SDK - bool result = EsptoolEraseSector(_sector); // Esptool - erases flash completely +// bool result = EsptoolEraseSector(_sector); // Esptool - erases flash completely (slow) if (_serialoutput) { Serial.print(F(D_LOG_APPLICATION D_ERASED_SECTOR " ")); @@ -588,6 +589,9 @@ void SettingsErase(uint8_t type) } OsWatchLoop(); } +*/ + EsptoolErase(_sectorStart, _sectorEnd); // Esptool - erases flash completely (fast) + #endif // FIRMWARE_MINIMAL } diff --git a/tasmota/support_esptool.ino b/tasmota/support_esptool.ino index 45e5245bf..f030e113d 100644 --- a/tasmota/support_esptool.ino +++ b/tasmota/support_esptool.ino @@ -46,14 +46,16 @@ #define SPI_ST 0x7 // Done state value +// *** flasher_stub/include/stub_flasher.h +#define SECTORS_PER_BLOCK (FLASH_BLOCK_SIZE / SPI_FLASH_SEC_SIZE) + // *** flasher_stub/stub_write_flash.c static const uint32_t STATUS_WIP_BIT = (1 << 0); // SPI status bits // Wait for the SPI state machine to be ready, ie no command in progress in the internal host. inline static void spi_wait_ready(void) { - // Wait for SPI state machine ready - while((READ_REG(SPI_EXT2_REG) & SPI_ST)) { } + while((READ_REG(SPI_EXT2_REG) & SPI_ST)) { } // Wait for SPI state machine ready } // Returns true if the spiflash is ready for its next write operation. @@ -75,6 +77,7 @@ static void spi_write_enable(void) while(READ_REG(SPI_CMD_REG) != 0) { } } +/* bool EsptoolEraseSector(uint32_t sector) { spi_write_enable(); @@ -87,5 +90,36 @@ bool EsptoolEraseSector(uint32_t sector) return true; } +*/ + +void EsptoolErase(uint32_t start_sector, uint32_t end_sector) +{ + int next_erase_sector = start_sector; + int remaining_erase_sector = end_sector - start_sector; + + while (remaining_erase_sector > 0) { + spi_write_enable(); + + uint32_t command = SPI_FLASH_SE; // Sector erase, 4KB + uint32_t sectors_to_erase = 1; + if (remaining_erase_sector >= SECTORS_PER_BLOCK && + next_erase_sector % SECTORS_PER_BLOCK == 0) { + command = SPI_FLASH_BE; // Block erase 64KB if we have space for it + sectors_to_erase = SECTORS_PER_BLOCK; + } + uint32_t addr = next_erase_sector * SPI_FLASH_SEC_SIZE; + + spi_wait_ready(); + WRITE_REG(SPI_ADDR_REG, addr & 0xffffff); + WRITE_REG(SPI_CMD_REG, command); // Sector erase, 4KB + while(READ_REG(SPI_CMD_REG) != 0) { } + remaining_erase_sector -= sectors_to_erase; + next_erase_sector += sectors_to_erase; + + while (!spiflash_is_ready()) { } + yield(); + OsWatchLoop(); + } +} #endif // USE_ESPTOOL From edcc17c41bf107f73914664a26981310c8c53872 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 15 Nov 2019 18:10:46 +0100 Subject: [PATCH 11/25] Version bump 7.0.0.5 Add one time flash sdk reset on initial execution solving possible SDK wifi releated issues --- tasmota/_changelog.ino | 3 +++ tasmota/settings.ino | 10 ++++++++++ tasmota/support_wifi.ino | 1 + tasmota/tasmota.ino | 3 +-- tasmota/tasmota_version.h | 2 +- tasmota/xdrv_29_deepsleep.ino | 3 +-- 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/tasmota/_changelog.ino b/tasmota/_changelog.ino index f7c53a1f9..bd00958ef 100644 --- a/tasmota/_changelog.ino +++ b/tasmota/_changelog.ino @@ -1,4 +1,7 @@ /*********************************************************************************************\ + * 7.0.0.5 20191115 + * Add one time flash sdk reset on initial execution solving possible SDK wifi releated issues + * * 7.0.0.4 20191108 * Add command WifiPower 0 .. 20.5 to set Wifi Output Power which will be default set to 17dBm * Change supported PCF8574 I2C address range to 0x20 - 0x26 allowing other I2C devices with address 0x27 to be used at the same time diff --git a/tasmota/settings.ino b/tasmota/settings.ino index ae442069b..2e4796b29 100644 --- a/tasmota/settings.ino +++ b/tasmota/settings.ino @@ -231,6 +231,12 @@ void RtcRebootSave(void) } } +void RtcRebootReset(void) +{ + RtcReboot.fast_reboot_count = 0; + RtcRebootSave(); +} + void RtcRebootLoad(void) { ESP.rtcUserMemoryRead(100 - sizeof(RTCRBT), (uint32_t*)&RtcReboot, sizeof(RTCRBT)); // 0x280 @@ -1148,6 +1154,10 @@ void SettingsDelta(void) if (Settings.version < 0x07000004) { Settings.wifi_output_power = 170; } + if (Settings.version < 0x07000005) { + restart_flag = 213; // Perform a sdk wifi parameter reset and restart + } + Settings.version = VERSION; SettingsSave(1); } diff --git a/tasmota/support_wifi.ino b/tasmota/support_wifi.ino index f90d7cff1..4451047bd 100644 --- a/tasmota/support_wifi.ino +++ b/tasmota/support_wifi.ino @@ -615,6 +615,7 @@ void WifiShutdown(void) void EspRestart(void) { WifiShutdown(); + RtcRebootReset(); // ESP.restart(); // This results in exception 3 on restarts on core 2.3.0 ESP.reset(); } diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index 2f7979ccb..4d50d9cf7 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -816,8 +816,7 @@ void PerformEverySecond(void) } if (BOOT_LOOP_TIME == uptime) { - RtcReboot.fast_reboot_count = 0; - RtcRebootSave(); + RtcRebootReset(); #ifdef USE_DEEPSLEEP if (!(DeepSleepEnabled() && !Settings.flag3.bootcount_update)) { diff --git a/tasmota/tasmota_version.h b/tasmota/tasmota_version.h index 9cd601086..50a0ac045 100644 --- a/tasmota/tasmota_version.h +++ b/tasmota/tasmota_version.h @@ -20,6 +20,6 @@ #ifndef _TASMOTA_VERSION_H_ #define _TASMOTA_VERSION_H_ -const uint32_t VERSION = 0x07000004; +const uint32_t VERSION = 0x07000005; #endif // _TASMOTA_VERSION_H_ diff --git a/tasmota/xdrv_29_deepsleep.ino b/tasmota/xdrv_29_deepsleep.ino index 6afc247ff..11987518c 100644 --- a/tasmota/xdrv_29_deepsleep.ino +++ b/tasmota/xdrv_29_deepsleep.ino @@ -62,8 +62,7 @@ bool DeepSleepEnabled(void) void DeepSleepInit(void) { if (DeepSleepEnabled()) { - RtcReboot.fast_reboot_count = 0; - RtcRebootSave(); + RtcRebootReset(); if ((RtcSettings.ultradeepsleep > MAX_DEEPSLEEP_CYCLE) && (RtcSettings.ultradeepsleep < 1700000000)) { // Go back to sleep after 60 minutes if requested deepsleep has not been reached RtcSettings.ultradeepsleep = RtcSettings.ultradeepsleep - MAX_DEEPSLEEP_CYCLE; From 4f1b4ca8e44b7167cccc15f1769ca1081a970d02 Mon Sep 17 00:00:00 2001 From: blakadder Date: Fri, 15 Nov 2019 18:58:03 +0100 Subject: [PATCH 12/25] remove outdated docker container --- build-container/Dockerfile | 24 ------------- build-container/README.md | 26 -------------- build-container/entrypoint.sh | 35 ------------------- .../init_pio_tasmota/platformio.ini | 30 ---------------- build-container/init_pio_tasmota/src/main.cpp | 3 -- 5 files changed, 118 deletions(-) delete mode 100644 build-container/Dockerfile delete mode 100644 build-container/README.md delete mode 100644 build-container/entrypoint.sh delete mode 100755 build-container/init_pio_tasmota/platformio.ini delete mode 100644 build-container/init_pio_tasmota/src/main.cpp diff --git a/build-container/Dockerfile b/build-container/Dockerfile deleted file mode 100644 index a5852d41c..000000000 --- a/build-container/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM python:2 - -LABEL author="Eduard Angold" - -# Install platformio. To be able to build tasmota <=v6.6.0 (and later) -# we have to use version 3.6.7 of platformio. -RUN pip install --upgrade pip &&\ - pip install -U platformio==3.6.7 - -# Init project -COPY init_pio_tasmota /init_pio_tasmota - -# Install project dependencies using a init project. -RUN cd /init_pio_tasmota &&\ - pio run &&\ - cd ../ &&\ - rm -fr init_pio_tasmota &&\ - cp -r /root/.platformio / &&\ - chmod -R 777 /.platformio - -COPY entrypoint.sh /entrypoint.sh - -ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] - diff --git a/build-container/README.md b/build-container/README.md deleted file mode 100644 index 64754f4f1..000000000 --- a/build-container/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# Docker container for tasmota builds -This Container will setup a proper build environment for [Tasmota](https://github.com/arendst/Tasmota) - -## Create container -`docker build -t mytasmota:latest .` - -## Use a ready container from docker hub -Use instead of the container `mytasmota:latest` the published container `eddyhub/docker-tasmota:latest` from docker hub. - -## Build all development binaries -`git clone https://github.com/arendst/Tasmota.git` -`docker run -ti --rm -v $(pwd)/Tasmota:/tasmota -u $UID:$GID mytasmota:latest` - -## Build a specific binary with custom options -Checkout Tasmota: `git clone https://github.com/arendst/Tasmota.git` -Mount the source as volume in `/tasmota`. **Prefix** any parameter available in `Tasmota/sonoff/my_user_config.h` with `TASMOTA_` as a environment variable for the container. **Also don't forget to escape what needs to be escaped in your shell.** **Strings** should be in **double quotes**. My config example: -`docker run -ti --rm -v $(pwd)/Tasmota:/tasmota -e TASMOTA_STA_SSID1='"my-wifi"' -e TASMOTA_STA_PASS1='"my-wifi-password"' -e TASMOTA_MQTT_HOST='my-mqtt-host' -e TASMOTA_MQTT_USER='"my-mqtt-user"' -e TASMOTA_MQTT_PASS='"my-mqtt-password"' -e TASMOTA_WEB_PASSWORD='"my-web-password"' -u $UID:$GID mytasmota:latest --environment sonoff-DE` - -Now you should have the file Tasmota/.pioenvs/sonoff-DE/firmware.bin which can be flashed on your device. - -## Build a specific version of tasmota -Checkout out the needed version before using the build instructions above: -- `git clone https://github.com/arendst/Tasmota.git` -- `git -C Tasmota checkout v6.6.0` -Build it: -- `docker run -ti --rm -v $(pwd)/Tasmota:/tasmota -u $UID:$GID mytasmota:latest` diff --git a/build-container/entrypoint.sh b/build-container/entrypoint.sh deleted file mode 100644 index 8be6c11be..000000000 --- a/build-container/entrypoint.sh +++ /dev/null @@ -1,35 +0,0 @@ -# configure build via environment -#!/bin/bash - -TASMOTA_VOLUME='/tasmota' -USER_CONFIG_OVERRIDE="${TASMOTA_VOLUME}/tasmota/user_config_override.h" - -if [ -d $TASMOTA_VOLUME ]; then - cd $TASMOTA_VOLUME - if [ -n "$(env | grep ^TASMOTA_)" ]; then - echo "Removing $USER_CONFIG_OVERRIDE and creating a new one." - rm "$USER_CONFIG_OVERRIDE" - #export PLATFORMIO_BUILD_FLAGS='-DUSE_CONFIG_OVERRIDE' - sed -i 's/^; *-DUSE_CONFIG_OVERRIDE/ -DUSE_CONFIG_OVERRIDE/' platformio.ini - echo '#ifndef _USER_CONFIG_OVERRIDE_H_' >> $USER_CONFIG_OVERRIDE - echo '#define _USER_CONFIG_OVERRIDE_H_' >> $USER_CONFIG_OVERRIDE - echo '#warning **** user_config_override.h: Using Settings from this File ****' >> $USER_CONFIG_OVERRIDE - echo '#undef CFG_HOLDER' >> $USER_CONFIG_OVERRIDE - echo '#define CFG_HOLDER 1' >> $USER_CONFIG_OVERRIDE - for i in $(env | grep ^TASMOTA_); do - config=${i#TASMOTA_} - key=$(echo $config | cut -d '=' -f 1) - value=$(echo $config | cut -d '=' -f 2) - echo "#undef ${key}" >> $USER_CONFIG_OVERRIDE - echo "#define ${key} ${value}" >> $USER_CONFIG_OVERRIDE - done - echo '#endif' >> $USER_CONFIG_OVERRIDE - fi - echo "Compiling..." - #pio run -t clean - pio run $@ - echo "Everything done you find your builds in .pioenvs//firmware.bin" -else - echo ">>> NO TASMOTA VOLUME MOUNTED --> EXITING" - exit 0; -fi diff --git a/build-container/init_pio_tasmota/platformio.ini b/build-container/init_pio_tasmota/platformio.ini deleted file mode 100755 index 058e9064f..000000000 --- a/build-container/init_pio_tasmota/platformio.ini +++ /dev/null @@ -1,30 +0,0 @@ -[env:core_2_3_0] -; *** Esp8266 core for Arduino version 2.3.0 -platform = espressif8266@1.5.0 -framework = arduino -board = esp01_1m - -[env:core_2_4_2] -; *** Esp8266 core for Arduino version 2.4.2 -platform = espressif8266@1.8.0 -framework = arduino -board = esp01_1m - -[env:core_2_5_2] -; *** Esp8266 core for Arduino version 2.5.2 -platform = espressif8266@~2.2.2 -framework = arduino -board = esp01_1m - -[env:core_stage] -; *** Esp8266 core for Arduino version latest beta -platform = https://github.com/platformio/platform-espressif8266.git#feature/stage -framework = arduino -board = esp01_1m - -[env:core_pre] -; *** Arduino Esp8266 core pre 2.6.x for Tasmota (mqtt reconnects fixed) -platform = https://github.com/Jason2866/platform-espressif8266.git#Tasmota -framework = arduino -board = esp01_1m - diff --git a/build-container/init_pio_tasmota/src/main.cpp b/build-container/init_pio_tasmota/src/main.cpp deleted file mode 100644 index 27f3768b7..000000000 --- a/build-container/init_pio_tasmota/src/main.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include -void setup() {} -void loop() {} From 45830eda5aa05178a16982a449b5de8c81789e8a Mon Sep 17 00:00:00 2001 From: Adrian Scillato <35405447+ascillato@users.noreply.github.com> Date: Fri, 15 Nov 2019 15:57:28 -0300 Subject: [PATCH 13/25] Make optional some scripts while compiling --- platformio.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio.ini b/platformio.ini index 3c6228274..77053d7e2 100755 --- a/platformio.ini +++ b/platformio.ini @@ -86,8 +86,8 @@ upload_resetmethod = nodemcu ; *** Upload Serial reset method for Wemos and NodeMCU upload_port = COM5 extra_scripts = pio/strip-floats.py - pio/rename-firmware.py - pio/obj-dump.py +; pio/rename-firmware.py +; pio/obj-dump.py ; *** Upload file to OTA server using SCP ;upload_port = user@host:/path From 063611314777d4dd9dc8c25905f19f8b25f510aa Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 15 Nov 2019 21:30:59 +0100 Subject: [PATCH 14/25] Revert "Version bump 7.0.0.5" This reverts commit edcc17c41bf107f73914664a26981310c8c53872. --- tasmota/_changelog.ino | 3 --- tasmota/settings.ino | 10 ---------- tasmota/support_wifi.ino | 1 - tasmota/tasmota.ino | 3 ++- tasmota/tasmota_version.h | 2 +- tasmota/xdrv_29_deepsleep.ino | 3 ++- 6 files changed, 5 insertions(+), 17 deletions(-) diff --git a/tasmota/_changelog.ino b/tasmota/_changelog.ino index bd00958ef..f7c53a1f9 100644 --- a/tasmota/_changelog.ino +++ b/tasmota/_changelog.ino @@ -1,7 +1,4 @@ /*********************************************************************************************\ - * 7.0.0.5 20191115 - * Add one time flash sdk reset on initial execution solving possible SDK wifi releated issues - * * 7.0.0.4 20191108 * Add command WifiPower 0 .. 20.5 to set Wifi Output Power which will be default set to 17dBm * Change supported PCF8574 I2C address range to 0x20 - 0x26 allowing other I2C devices with address 0x27 to be used at the same time diff --git a/tasmota/settings.ino b/tasmota/settings.ino index 2e4796b29..ae442069b 100644 --- a/tasmota/settings.ino +++ b/tasmota/settings.ino @@ -231,12 +231,6 @@ void RtcRebootSave(void) } } -void RtcRebootReset(void) -{ - RtcReboot.fast_reboot_count = 0; - RtcRebootSave(); -} - void RtcRebootLoad(void) { ESP.rtcUserMemoryRead(100 - sizeof(RTCRBT), (uint32_t*)&RtcReboot, sizeof(RTCRBT)); // 0x280 @@ -1154,10 +1148,6 @@ void SettingsDelta(void) if (Settings.version < 0x07000004) { Settings.wifi_output_power = 170; } - if (Settings.version < 0x07000005) { - restart_flag = 213; // Perform a sdk wifi parameter reset and restart - } - Settings.version = VERSION; SettingsSave(1); } diff --git a/tasmota/support_wifi.ino b/tasmota/support_wifi.ino index 4451047bd..f90d7cff1 100644 --- a/tasmota/support_wifi.ino +++ b/tasmota/support_wifi.ino @@ -615,7 +615,6 @@ void WifiShutdown(void) void EspRestart(void) { WifiShutdown(); - RtcRebootReset(); // ESP.restart(); // This results in exception 3 on restarts on core 2.3.0 ESP.reset(); } diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index 4d50d9cf7..2f7979ccb 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -816,7 +816,8 @@ void PerformEverySecond(void) } if (BOOT_LOOP_TIME == uptime) { - RtcRebootReset(); + RtcReboot.fast_reboot_count = 0; + RtcRebootSave(); #ifdef USE_DEEPSLEEP if (!(DeepSleepEnabled() && !Settings.flag3.bootcount_update)) { diff --git a/tasmota/tasmota_version.h b/tasmota/tasmota_version.h index 50a0ac045..9cd601086 100644 --- a/tasmota/tasmota_version.h +++ b/tasmota/tasmota_version.h @@ -20,6 +20,6 @@ #ifndef _TASMOTA_VERSION_H_ #define _TASMOTA_VERSION_H_ -const uint32_t VERSION = 0x07000005; +const uint32_t VERSION = 0x07000004; #endif // _TASMOTA_VERSION_H_ diff --git a/tasmota/xdrv_29_deepsleep.ino b/tasmota/xdrv_29_deepsleep.ino index 11987518c..6afc247ff 100644 --- a/tasmota/xdrv_29_deepsleep.ino +++ b/tasmota/xdrv_29_deepsleep.ino @@ -62,7 +62,8 @@ bool DeepSleepEnabled(void) void DeepSleepInit(void) { if (DeepSleepEnabled()) { - RtcRebootReset(); + RtcReboot.fast_reboot_count = 0; + RtcRebootSave(); if ((RtcSettings.ultradeepsleep > MAX_DEEPSLEEP_CYCLE) && (RtcSettings.ultradeepsleep < 1700000000)) { // Go back to sleep after 60 minutes if requested deepsleep has not been reached RtcSettings.ultradeepsleep = RtcSettings.ultradeepsleep - MAX_DEEPSLEEP_CYCLE; From b0a5479c3b8775e058ec62cc3261a97f02fef101 Mon Sep 17 00:00:00 2001 From: kristi5 Date: Fri, 15 Nov 2019 23:10:07 +0100 Subject: [PATCH 15/25] JSN-SR04T add Mode 2 and Mode 3 --- tasmota/language/bg-BG.h | 4 +- tasmota/language/cs-CZ.h | 4 +- tasmota/language/de-DE.h | 4 +- tasmota/language/el-GR.h | 4 +- tasmota/language/en-GB.h | 4 +- tasmota/language/es-ES.h | 4 +- tasmota/language/fr-FR.h | 4 +- tasmota/language/he-HE.h | 4 +- tasmota/language/hu-HU.h | 4 +- tasmota/language/it-IT.h | 4 +- tasmota/language/ko-KO.h | 4 +- tasmota/language/nl-NL.h | 4 +- tasmota/language/pl-PL.h | 4 +- tasmota/language/pt-BR.h | 4 +- tasmota/language/pt-PT.h | 4 +- tasmota/language/ru-RU.h | 4 +- tasmota/language/sk-SK.h | 4 +- tasmota/language/sv-SE.h | 4 +- tasmota/language/tr-TR.h | 4 +- tasmota/language/uk-UK.h | 4 +- tasmota/language/zh-CN.h | 4 +- tasmota/language/zh-TW.h | 4 +- tasmota/tasmota_template.h | 8 +-- tasmota/xsns_22_sr04.ino | 136 ++++++++++++++++++++++++++++++++++--- 24 files changed, 174 insertions(+), 58 deletions(-) diff --git a/tasmota/language/bg-BG.h b/tasmota/language/bg-BG.h index 1ac26a0ea..c1daf8b21 100644 --- a/tasmota/language/bg-BG.h +++ b/tasmota/language/bg-BG.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/cs-CZ.h b/tasmota/language/cs-CZ.h index 0417eb67b..c40cdb2b0 100644 --- a/tasmota/language/cs-CZ.h +++ b/tasmota/language/cs-CZ.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/de-DE.h b/tasmota/language/de-DE.h index e5900b056..55c2eb8d0 100644 --- a/tasmota/language/de-DE.h +++ b/tasmota/language/de-DE.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/el-GR.h b/tasmota/language/el-GR.h index 785d4d486..c9a57c635 100644 --- a/tasmota/language/el-GR.h +++ b/tasmota/language/el-GR.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/en-GB.h b/tasmota/language/en-GB.h index 5e1ff19c1..6ff230746 100644 --- a/tasmota/language/en-GB.h +++ b/tasmota/language/en-GB.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/es-ES.h b/tasmota/language/es-ES.h index 186635a66..a403369b7 100644 --- a/tasmota/language/es-ES.h +++ b/tasmota/language/es-ES.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/fr-FR.h b/tasmota/language/fr-FR.h index 2a8835159..302dc41c1 100644 --- a/tasmota/language/fr-FR.h +++ b/tasmota/language/fr-FR.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/he-HE.h b/tasmota/language/he-HE.h index ea8487d6d..f50128447 100644 --- a/tasmota/language/he-HE.h +++ b/tasmota/language/he-HE.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/hu-HU.h b/tasmota/language/hu-HU.h index 6f978e7bb..d33b465d8 100644 --- a/tasmota/language/hu-HU.h +++ b/tasmota/language/hu-HU.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/it-IT.h b/tasmota/language/it-IT.h index ad28b0d94..5d2d3e10f 100644 --- a/tasmota/language/it-IT.h +++ b/tasmota/language/it-IT.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/ko-KO.h b/tasmota/language/ko-KO.h index 346db3154..28bb44b6d 100644 --- a/tasmota/language/ko-KO.h +++ b/tasmota/language/ko-KO.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/nl-NL.h b/tasmota/language/nl-NL.h index 9a752a963..75a990387 100644 --- a/tasmota/language/nl-NL.h +++ b/tasmota/language/nl-NL.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/pl-PL.h b/tasmota/language/pl-PL.h index 19e8552ca..76415e599 100644 --- a/tasmota/language/pl-PL.h +++ b/tasmota/language/pl-PL.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/pt-BR.h b/tasmota/language/pt-BR.h index 7e5b117a4..111ce5359 100644 --- a/tasmota/language/pt-BR.h +++ b/tasmota/language/pt-BR.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/pt-PT.h b/tasmota/language/pt-PT.h index 2b36e9a09..af85629dc 100644 --- a/tasmota/language/pt-PT.h +++ b/tasmota/language/pt-PT.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/ru-RU.h b/tasmota/language/ru-RU.h index e287c3b89..72a68753d 100644 --- a/tasmota/language/ru-RU.h +++ b/tasmota/language/ru-RU.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/sk-SK.h b/tasmota/language/sk-SK.h index 9eb0e33dc..9042cf59e 100644 --- a/tasmota/language/sk-SK.h +++ b/tasmota/language/sk-SK.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/sv-SE.h b/tasmota/language/sv-SE.h index 87559bee6..83078f9d0 100644 --- a/tasmota/language/sv-SE.h +++ b/tasmota/language/sv-SE.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/tr-TR.h b/tasmota/language/tr-TR.h index c5f200c78..3999d9093 100644 --- a/tasmota/language/tr-TR.h +++ b/tasmota/language/tr-TR.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/uk-UK.h b/tasmota/language/uk-UK.h index 85483781d..64c806dfb 100644 --- a/tasmota/language/uk-UK.h +++ b/tasmota/language/uk-UK.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/zh-CN.h b/tasmota/language/zh-CN.h index 915c42fc2..5c5c37379 100644 --- a/tasmota/language/zh-CN.h +++ b/tasmota/language/zh-CN.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/language/zh-TW.h b/tasmota/language/zh-TW.h index 04fff0a37..9a40f2470 100644 --- a/tasmota/language/zh-TW.h +++ b/tasmota/language/zh-TW.h @@ -552,8 +552,8 @@ #define D_SENSOR_HPMA_TX "HPMA Tx" #define D_SENSOR_SBR_RX "SerBr Rx" #define D_SENSOR_SBR_TX "SerBr Tx" -#define D_SENSOR_SR04_TRIG "SR04 Tri" -#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SR04_TRIG "SR04 Tri/TX" +#define D_SENSOR_SR04_ECHO "SR04 Ech/RX" #define D_SENSOR_SDM120_TX "SDMx20 Tx" #define D_SENSOR_SDM120_RX "SDMx20 Rx" #define D_SENSOR_SDM630_TX "SDM630 Tx" diff --git a/tasmota/tasmota_template.h b/tasmota/tasmota_template.h index e73e60aad..3f59c2dae 100644 --- a/tasmota/tasmota_template.h +++ b/tasmota/tasmota_template.h @@ -97,8 +97,8 @@ enum UserSelectablePins { GPIO_SDS0X1_RX, // Nova Fitness SDS011 Serial interface GPIO_SBR_TX, // Serial Bridge Serial interface GPIO_SBR_RX, // Serial Bridge Serial interface - GPIO_SR04_TRIG, // SR04 Trigger pin - GPIO_SR04_ECHO, // SR04 Echo pin + GPIO_SR04_TRIG, // SR04 Trigger/TX pin + GPIO_SR04_ECHO, // SR04 Echo/RX pin GPIO_SDM120_TX, // SDM120 Serial interface GPIO_SDM120_RX, // SDM120 Serial interface GPIO_SDM630_TX, // SDM630 Serial interface @@ -603,8 +603,8 @@ const uint8_t kGpioNiceList[] PROGMEM = { GPIO_RF_SENSOR, // Rf receiver with sensor decoding #endif #ifdef USE_SR04 - GPIO_SR04_TRIG, // SR04 Trigger pin - GPIO_SR04_ECHO, // SR04 Echo pin + GPIO_SR04_TRIG, // SR04 Tri/TXgger pin + GPIO_SR04_ECHO, // SR04 Ech/RXo pin #endif #ifdef USE_TM1638 GPIO_TM16CLK, // TM1638 Clock diff --git a/tasmota/xsns_22_sr04.ino b/tasmota/xsns_22_sr04.ino index e70fea52f..c3d27872e 100644 --- a/tasmota/xsns_22_sr04.ino +++ b/tasmota/xsns_22_sr04.ino @@ -20,6 +20,7 @@ #ifdef USE_SR04 #include +#include /*********************************************************************************************\ * HC-SR04, HC-SR04+, JSN-SR04T - Ultrasonic distance sensor * @@ -30,17 +31,129 @@ #define XSNS_22 22 -uint8_t sr04_echo_pin = 0; -uint8_t sr04_trig_pin = 0; +uint8_t sr04_type = 1; +int sr04_echo_pin = 0; +int sr04_trig_pin = 0; real64_t distance; NewPing* sonar = nullptr; +TasmotaSerial* sonar_serial = nullptr; + + + +uint8_t Sr04TModeDetect(void) +{ + sr04_type = 0; + if (pin[GPIO_SR04_ECHO]>=99) return sr04_type; -void Sr04Init(void) -{ sr04_echo_pin = pin[GPIO_SR04_ECHO]; - sr04_trig_pin = pin[GPIO_SR04_TRIG]; - sonar = new NewPing(sr04_trig_pin, sr04_echo_pin, 300); + sr04_trig_pin = (pin[GPIO_SR04_TRIG] < 99) ? pin[GPIO_SR04_TRIG] : -1; + sonar_serial = new TasmotaSerial(sr04_echo_pin, sr04_trig_pin, 1); + + if (sonar_serial->begin(9600,1)) { + DEBUG_SENSOR_LOG(PSTR("SR04: Detect mode")); + + if (sr04_trig_pin!=-1) { + sr04_type = (Sr04TMiddleValue(Sr04TMode3Distance(),Sr04TMode3Distance(),Sr04TMode3Distance())!=NO_ECHO)?3:1; + } else { + sr04_type = 2; + } + } else { + sr04_type = 1; + } + + if (sr04_type < 2) { + delete sonar_serial; + sonar_serial = nullptr; + sonar = new NewPing(sr04_trig_pin, sr04_echo_pin, 300); + } else { + if (sonar_serial->hardwareSerial()) { + ClaimSerial(); + } + } + + AddLog_P2(LOG_LEVEL_INFO,PSTR("SR04: Mode %d"), sr04_type); + return sr04_type; +} + +uint16_t Sr04TMiddleValue(uint16_t first, uint16_t second, uint16_t third) +{ + uint16_t ret = first; + if (first > second) { + first = second; + second = ret; + } + + if (third < first) { + return first; + } else if (third > second) { + return second; + } else { + return third; + } +} + +uint16_t Sr04TMode3Distance() { + + sonar_serial->write(0x55); + sonar_serial->flush(); + + return Sr04TMode2Distance(); +} + +uint16_t Sr04TMode2Distance(void) +{ + sonar_serial->setTimeout(300); + const char startByte = 0xff; + + if (!sonar_serial->find(startByte)) { + //DEBUG_SENSOR_LOG(PSTR("SR04: No start byte")); + return NO_ECHO; + } + + delay(5); + + uint8_t crc = sonar_serial->read(); + //read high byte + uint16_t distance = ((uint16_t)crc) << 8; + + //read low byte + distance += sonar_serial->read(); + crc += distance & 0x00ff; + crc += 0x00FF; + + //check crc sum + if (crc != sonar_serial->read()) { + AddLog_P2(LOG_LEVEL_ERROR,PSTR("SR04: Reading CRC error.")); + return NO_ECHO; + } + //DEBUG_SENSOR_LOG(PSTR("SR04: Distance: %d"), distance); + return distance; +} + +void Sr04TReading(void) { + + if (sonar_serial==nullptr && sonar==nullptr) { + Sr04TModeDetect(); + } + + switch (sr04_type) { + case 3: + distance = (real64_t)(Sr04TMiddleValue(Sr04TMode3Distance(),Sr04TMode3Distance(),Sr04TMode3Distance()))/ 10; //convert to cm + break; + case 2: + //empty input buffer first + while(sonar_serial->available()) sonar_serial->read(); + distance = (real64_t)(Sr04TMiddleValue(Sr04TMode2Distance(),Sr04TMode2Distance(),Sr04TMode2Distance()))/10; + break; + case 1: + distance = (real64_t)(sonar->ping_median(5))/ US_ROUNDTRIP_CM; + break; + default: + distance = NO_ECHO; + } + + return; } #ifdef USE_WEBSERVER @@ -49,8 +162,7 @@ const char HTTP_SNS_DISTANCE[] PROGMEM = #endif // USE_WEBSERVER void Sr04Show(bool json) -{ - distance = (real64_t)(sonar->ping_median(5))/ US_ROUNDTRIP_CM; +{ if (distance != 0) { // Check if read failed char distance_chr[33]; @@ -79,10 +191,14 @@ bool Xsns22(uint8_t function) { bool result = false; - if ((pin[GPIO_SR04_ECHO] < 99) && (pin[GPIO_SR04_TRIG] < 99)) { + if (sr04_type) { switch (function) { case FUNC_INIT: - Sr04Init(); + result = (pin[GPIO_SR04_ECHO]<99); + break; + case FUNC_EVERY_SECOND: + Sr04TReading(); + result = true; break; case FUNC_JSON_APPEND: Sr04Show(1); From f6a7722a3c761879641c27c379d82ef083618b9e Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 16 Nov 2019 10:42:28 +0100 Subject: [PATCH 16/25] Refactor RtcReboot counter --- tasmota/settings.ino | 7 +++++++ tasmota/support_wifi.ino | 1 + tasmota/tasmota.ino | 3 +-- tasmota/xdrv_29_deepsleep.ino | 3 +-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tasmota/settings.ino b/tasmota/settings.ino index ae442069b..fe362179b 100644 --- a/tasmota/settings.ino +++ b/tasmota/settings.ino @@ -231,6 +231,12 @@ void RtcRebootSave(void) } } +void RtcRebootReset(void) +{ + RtcReboot.fast_reboot_count = 0; + RtcRebootSave(); +} + void RtcRebootLoad(void) { ESP.rtcUserMemoryRead(100 - sizeof(RTCRBT), (uint32_t*)&RtcReboot, sizeof(RTCRBT)); // 0x280 @@ -1148,6 +1154,7 @@ void SettingsDelta(void) if (Settings.version < 0x07000004) { Settings.wifi_output_power = 170; } + Settings.version = VERSION; SettingsSave(1); } diff --git a/tasmota/support_wifi.ino b/tasmota/support_wifi.ino index f90d7cff1..4451047bd 100644 --- a/tasmota/support_wifi.ino +++ b/tasmota/support_wifi.ino @@ -615,6 +615,7 @@ void WifiShutdown(void) void EspRestart(void) { WifiShutdown(); + RtcRebootReset(); // ESP.restart(); // This results in exception 3 on restarts on core 2.3.0 ESP.reset(); } diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index 2f7979ccb..4d50d9cf7 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -816,8 +816,7 @@ void PerformEverySecond(void) } if (BOOT_LOOP_TIME == uptime) { - RtcReboot.fast_reboot_count = 0; - RtcRebootSave(); + RtcRebootReset(); #ifdef USE_DEEPSLEEP if (!(DeepSleepEnabled() && !Settings.flag3.bootcount_update)) { diff --git a/tasmota/xdrv_29_deepsleep.ino b/tasmota/xdrv_29_deepsleep.ino index 6afc247ff..11987518c 100644 --- a/tasmota/xdrv_29_deepsleep.ino +++ b/tasmota/xdrv_29_deepsleep.ino @@ -62,8 +62,7 @@ bool DeepSleepEnabled(void) void DeepSleepInit(void) { if (DeepSleepEnabled()) { - RtcReboot.fast_reboot_count = 0; - RtcRebootSave(); + RtcRebootReset(); if ((RtcSettings.ultradeepsleep > MAX_DEEPSLEEP_CYCLE) && (RtcSettings.ultradeepsleep < 1700000000)) { // Go back to sleep after 60 minutes if requested deepsleep has not been reached RtcSettings.ultradeepsleep = RtcSettings.ultradeepsleep - MAX_DEEPSLEEP_CYCLE; From fd4e1995bcbbc514e0f20ca4346b1a5486c64ff5 Mon Sep 17 00:00:00 2001 From: David Hunt Date: Sat, 16 Nov 2019 10:36:19 +0000 Subject: [PATCH 17/25] extend Honeywell HPMA driver for compact devices The HPMA115C0-xxx is a new series of devices than has a slightly different (longer) response than the HPMA115S0-xxx THis patch keeps the same API as the original library and picks out the PM2.5 and PM10 reading from the new response format. The patch also changes a const change to be more in line with the upstream library for future rebases. This change has also been merge-requested into the upstream library. Signed-off-by: David Hunt --- lib/HPMA115S0/example/example.ino | 2 +- lib/HPMA115S0/src/hpma115S0.cpp | 32 ++++++++++++++++++++----------- lib/HPMA115S0/src/hpma115S0.h | 9 +++++---- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/lib/HPMA115S0/example/example.ino b/lib/HPMA115S0/example/example.ino index 165055d00..7bb45f771 100644 --- a/lib/HPMA115S0/example/example.ino +++ b/lib/HPMA115S0/example/example.ino @@ -6,7 +6,7 @@ * @license MIT */ -#include +#include #include //Create an instance of software serial diff --git a/lib/HPMA115S0/src/hpma115S0.cpp b/lib/HPMA115S0/src/hpma115S0.cpp index 7e5cfc67b..d07cdc9ec 100644 --- a/lib/HPMA115S0/src/hpma115S0.cpp +++ b/lib/HPMA115S0/src/hpma115S0.cpp @@ -45,7 +45,7 @@ void HPMA115S0::Init() { * @param size of buffer * @return void */ -void HPMA115S0::SendCmd(unsigned char * cmdBuf, unsigned int cmdSize) { +void HPMA115S0::SendCmd(const char * cmdBuf, unsigned int cmdSize) { //Clear RX while (_serial.available()) _serial.read(); @@ -114,18 +114,28 @@ int HPMA115S0::ReadCmdResp(unsigned char * dataBuf, unsigned int dataBufSize, un * @return returns true if valid measurements were read from sensor */ boolean HPMA115S0::ReadParticleMeasurement(unsigned int * pm2_5, unsigned int * pm10) { - unsigned char cmdBuf[] = {0x68, 0x01, 0x04, 0x93}; - static unsigned char dataBuf[HPM_READ_PARTICLE_MEASURMENT_LEN - 1]; + const char cmdBuf[] = {0x68, 0x01, 0x04, 0x93}; + static unsigned char dataBuf[HPM_READ_PARTICLE_MEASURMENT_LEN_C - 1]; + int len; - //Serial.println("PS- Reading Particle Measurements..." ); + // Serial.println("PS- Reading Particle Measurements..." ); //Send command SendCmd(cmdBuf, 4); //Read response - if (ReadCmdResp(dataBuf, sizeof(dataBuf), READ_PARTICLE_MEASURMENT) == (HPM_READ_PARTICLE_MEASURMENT_LEN - 1)) { - _pm2_5 = dataBuf[0] * 256 + dataBuf[1]; - _pm10 = dataBuf[2] * 256 + dataBuf[3]; + len = ReadCmdResp(dataBuf, sizeof(dataBuf), READ_PARTICLE_MEASURMENT); + if ((len == (HPM_READ_PARTICLE_MEASURMENT_LEN - 1)) || (len == (HPM_READ_PARTICLE_MEASURMENT_LEN_C - 1))) { + + if (len == (HPM_READ_PARTICLE_MEASURMENT_LEN - 1)) { + // HPMA115S0 Standard devices + _pm2_5 = dataBuf[0] * 256 + dataBuf[1]; + _pm10 = dataBuf[2] * 256 + dataBuf[3]; + } else { + // HPMA115C0 Compact devices + _pm2_5 = dataBuf[2] * 256 + dataBuf[3]; + _pm10 = dataBuf[6] * 256 + dataBuf[7]; + } *pm2_5 = _pm2_5; *pm10 = _pm10; // Serial.println("PS- PM 2.5: " + String(_pm2_5) + " ug/m3" ); @@ -140,7 +150,7 @@ boolean HPMA115S0::ReadParticleMeasurement(unsigned int * pm2_5, unsigned int * * @return void */ void HPMA115S0::StartParticleMeasurement() { - unsigned char cmd[] = {0x68, 0x01, 0x01, 0x96}; + const char cmd[] = {0x68, 0x01, 0x01, 0x96}; SendCmd(cmd, 4); } @@ -149,7 +159,7 @@ void HPMA115S0::StartParticleMeasurement() { * @return void */ void HPMA115S0::StopParticleMeasurement() { - unsigned char cmd[] = {0x68, 0x01, 0x02, 0x95}; + const char cmd[] = {0x68, 0x01, 0x02, 0x95}; SendCmd(cmd, 4); } @@ -158,7 +168,7 @@ void HPMA115S0::StopParticleMeasurement() { * @return void */ void HPMA115S0::EnableAutoSend() { - unsigned char cmd[] = {0x68, 0x01, 0x40, 0x57}; + const char cmd[] = {0x68, 0x01, 0x40, 0x57}; SendCmd(cmd, 4); } @@ -167,7 +177,7 @@ void HPMA115S0::EnableAutoSend() { * @return void */ void HPMA115S0::DisableAutoSend() { - unsigned char cmd[] = {0x68, 0x01, 0x20, 0x77}; + const char cmd[] = {0x68, 0x01, 0x20, 0x77}; SendCmd(cmd, 4); } diff --git a/lib/HPMA115S0/src/hpma115S0.h b/lib/HPMA115S0/src/hpma115S0.h index 995b86a73..e3500d92f 100644 --- a/lib/HPMA115S0/src/hpma115S0.h +++ b/lib/HPMA115S0/src/hpma115S0.h @@ -13,8 +13,9 @@ #include "Arduino.h" #define HPM_CMD_RESP_HEAD 0x40 -#define HPM_MAX_RESP_SIZE 8 // max command response size is 8 bytes +#define HPM_MAX_RESP_SIZE 16 // max command response size is 16 bytes #define HPM_READ_PARTICLE_MEASURMENT_LEN 5 +#define HPM_READ_PARTICLE_MEASURMENT_LEN_C 13 enum CMD_TYPE_T { READ_PARTICLE_MEASURMENT = 0x04, @@ -53,8 +54,8 @@ public: /** * @brief Function that sends a read command to sensor * @return returns true if valid measurements were read from sensor - */boolean ReadParticleMeasurement(unsigned int * pm2_5, unsigned int * pm10) - ; + */ + boolean ReadParticleMeasurement(unsigned int * pm2_5, unsigned int * pm10); /** * @brief Function that starts sensor measurement @@ -108,7 +109,7 @@ private: * @param size of buffer * @return void */ - void SendCmd(unsigned char * command, unsigned int size); + void SendCmd(const char * command, unsigned int size); /** * @brief Function that reads command response from sensor From 6287eb5b27efabc20acb107ddbbcceaa9d8b7d58 Mon Sep 17 00:00:00 2001 From: Jason2866 Date: Sat, 16 Nov 2019 13:55:18 +0100 Subject: [PATCH 18/25] Change rename firmware script to name firmware Since the old script did a rename Platformio flash function failed. Change script to `copy` firmware.bin to tasmota variant name. So the firmware.bin is still there and flash is working in Plaformio With this change script can be activated and every function will work --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 77053d7e2..22e0998ee 100755 --- a/platformio.ini +++ b/platformio.ini @@ -86,7 +86,7 @@ upload_resetmethod = nodemcu ; *** Upload Serial reset method for Wemos and NodeMCU upload_port = COM5 extra_scripts = pio/strip-floats.py -; pio/rename-firmware.py +; pio/name-firmware.py ; pio/obj-dump.py ; *** Upload file to OTA server using SCP From 72f901a2f765ccbe29941fcda8c194d56d8e1944 Mon Sep 17 00:00:00 2001 From: Jason2866 Date: Sat, 16 Nov 2019 13:56:24 +0100 Subject: [PATCH 19/25] Delete rename-firmware.py --- pio/rename-firmware.py | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 pio/rename-firmware.py diff --git a/pio/rename-firmware.py b/pio/rename-firmware.py deleted file mode 100644 index 49f86d79e..000000000 --- a/pio/rename-firmware.py +++ /dev/null @@ -1,12 +0,0 @@ -Import('env') -import os - -def obj_ren_after_bin(source, target, env): - # print("Rename firmware.bin") - base_dir = os.path.dirname(str(target[0])) - new_file = "{}{}{}.bin".format(base_dir, os.path.sep, str(target[0]).split(os.path.sep)[1]) - if os.path.isfile(new_file): - os.remove(new_file) - os.rename(str(target[0]), new_file) - -env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [obj_ren_after_bin]) From 94bd75681ef4743af0870cdd9f228c973349cf02 Mon Sep 17 00:00:00 2001 From: Jason2866 Date: Sat, 16 Nov 2019 13:57:07 +0100 Subject: [PATCH 20/25] Add files via upload --- pio/name-firmware.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 pio/name-firmware.py diff --git a/pio/name-firmware.py b/pio/name-firmware.py new file mode 100644 index 000000000..1a65ad4fc --- /dev/null +++ b/pio/name-firmware.py @@ -0,0 +1,12 @@ +Import('env') +import os +import shutil + +def name_firmware(source, target, env): + base_dir = os.path.dirname(str(target[0])) + new_file = "{}{}{}.bin".format(base_dir, os.path.sep, str(target[0]).split(os.path.sep)[1]) + if os.path.isfile(new_file): + os.remove(new_file) + shutil.copyfile(str(target[0]), new_file) + +env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [name_firmware]) From 87b42c4c4e343c2050144424af04f146b86ed77a Mon Sep 17 00:00:00 2001 From: Jason2866 Date: Sat, 16 Nov 2019 20:16:39 +0100 Subject: [PATCH 21/25] Copy compiled firmware(s) in folder `build_output/firmware`... easier to find and firmware is named after the `envs`. A second folder is generated in `build_output` -> `map` where the generated map files to the bin(s) are stored. --- pio/name-firmware.py | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/pio/name-firmware.py b/pio/name-firmware.py index 1a65ad4fc..dfb9b7f85 100644 --- a/pio/name-firmware.py +++ b/pio/name-firmware.py @@ -2,11 +2,32 @@ Import('env') import os import shutil -def name_firmware(source, target, env): - base_dir = os.path.dirname(str(target[0])) - new_file = "{}{}{}.bin".format(base_dir, os.path.sep, str(target[0]).split(os.path.sep)[1]) - if os.path.isfile(new_file): - os.remove(new_file) - shutil.copyfile(str(target[0]), new_file) +OUTPUT_DIR = "build_output{}".format(os.path.sep) -env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [name_firmware]) +def bin_map_copy(source, target, env): + variant = str(target[0]).split(os.path.sep)[1] + + # check if output directories exist and create if necessary + if not os.path.isdir(OUTPUT_DIR): + os.mkdir(OUTPUT_DIR) + + for d in ['firmware', 'map']: + if not os.path.isdir("{}{}".format(OUTPUT_DIR, d)): + os.mkdir("{}{}".format(OUTPUT_DIR, d)) + + # create string with location and file names based on variant + map_file = "{}map{}{}.map".format(OUTPUT_DIR, os.path.sep, variant) + bin_file = "{}firmware{}{}.bin".format(OUTPUT_DIR, os.path.sep, variant) + + # check if new target files exist and remove if necessary + for f in [map_file, bin_file]: + if os.path.isfile(f): + os.remove(f) + + # copy firmware.bin to firmware/.bin + shutil.copy(str(target[0]), bin_file) + + # copy firmware.map to map/.map + shutil.copy("firmware.map", map_file) + +env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [bin_map_copy]) From 61e3dea5b7820a835532e7f17ec1695a98a69289 Mon Sep 17 00:00:00 2001 From: Jason2866 Date: Sat, 16 Nov 2019 20:18:17 +0100 Subject: [PATCH 22/25] Activate firmware copy and naming --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 22e0998ee..dd871a365 100755 --- a/platformio.ini +++ b/platformio.ini @@ -86,7 +86,7 @@ upload_resetmethod = nodemcu ; *** Upload Serial reset method for Wemos and NodeMCU upload_port = COM5 extra_scripts = pio/strip-floats.py -; pio/name-firmware.py + pio/name-firmware.py ; pio/obj-dump.py ; *** Upload file to OTA server using SCP From 232ba1284d22363b77f87304b8d36e1eab547d2f Mon Sep 17 00:00:00 2001 From: Hadinger Date: Sun, 17 Nov 2019 12:51:27 +0100 Subject: [PATCH 23/25] Change Zigbee log verbosity reduction --- tasmota/_changelog.ino | 1 + tasmota/language/bg-BG.h | 1 + tasmota/language/cs-CZ.h | 1 + tasmota/language/de-DE.h | 1 + tasmota/language/el-GR.h | 1 + tasmota/language/en-GB.h | 1 + tasmota/language/es-ES.h | 1 + tasmota/language/fr-FR.h | 1 + tasmota/language/he-HE.h | 1 + tasmota/language/hu-HU.h | 1 + tasmota/language/it-IT.h | 1 + tasmota/language/ko-KO.h | 1 + tasmota/language/nl-NL.h | 1 + tasmota/language/pl-PL.h | 1 + tasmota/language/pt-BR.h | 1 + tasmota/language/pt-PT.h | 1 + tasmota/language/ru-RU.h | 1 + tasmota/language/sk-SK.h | 1 + tasmota/language/sv-SE.h | 1 + tasmota/language/tr-TR.h | 1 + tasmota/language/uk-UK.h | 1 + tasmota/language/zh-CN.h | 1 + tasmota/language/zh-TW.h | 1 + tasmota/xdrv_23_zigbee_5_converters.ino | 2 +- tasmota/xdrv_23_zigbee_7_statemachine.ino | 32 +++++++++++------------ tasmota/xdrv_23_zigbee_8_parsers.ino | 1 - tasmota/xdrv_23_zigbee_9_impl.ino | 22 ++++++++-------- 27 files changed, 51 insertions(+), 29 deletions(-) diff --git a/tasmota/_changelog.ino b/tasmota/_changelog.ino index f7c53a1f9..cbc56312c 100644 --- a/tasmota/_changelog.ino +++ b/tasmota/_changelog.ino @@ -9,6 +9,7 @@ * Change Kept only NEC/RC5/RC6/HASH IR protocols in standard Tasmota, all other protocols require Tasmota-IR, saving 4K * Add command SetOption76 0/1 to enable incrementing bootcount when deepsleep is enabled (#6930) * Change Reset erase end address from as seen by SDK (getFlashChipSize) to full flash size (getFlashChipRealSize) + * Change Zigbee log verbosity reduction * * 7.0.0.3 20191103 * Add command I2cDriver for I2C driver runtime control using document I2CDEVICES.md diff --git a/tasmota/language/bg-BG.h b/tasmota/language/bg-BG.h index c1daf8b21..cfc7998b2 100644 --- a/tasmota/language/bg-BG.h +++ b/tasmota/language/bg-BG.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Фазов ъгъл" diff --git a/tasmota/language/cs-CZ.h b/tasmota/language/cs-CZ.h index c40cdb2b0..e3d18ab41 100644 --- a/tasmota/language/cs-CZ.h +++ b/tasmota/language/cs-CZ.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Phase Angle" diff --git a/tasmota/language/de-DE.h b/tasmota/language/de-DE.h index 55c2eb8d0..82b8f7020 100644 --- a/tasmota/language/de-DE.h +++ b/tasmota/language/de-DE.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Phasenwinkel" diff --git a/tasmota/language/el-GR.h b/tasmota/language/el-GR.h index c9a57c635..161b838eb 100644 --- a/tasmota/language/el-GR.h +++ b/tasmota/language/el-GR.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Phase Angle" diff --git a/tasmota/language/en-GB.h b/tasmota/language/en-GB.h index 6ff230746..ed9bbba27 100644 --- a/tasmota/language/en-GB.h +++ b/tasmota/language/en-GB.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Phase Angle" diff --git a/tasmota/language/es-ES.h b/tasmota/language/es-ES.h index a403369b7..ebd637f22 100644 --- a/tasmota/language/es-ES.h +++ b/tasmota/language/es-ES.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Ángulo de Fase" diff --git a/tasmota/language/fr-FR.h b/tasmota/language/fr-FR.h index 302dc41c1..9297ed78d 100644 --- a/tasmota/language/fr-FR.h +++ b/tasmota/language/fr-FR.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Angle de phase" diff --git a/tasmota/language/he-HE.h b/tasmota/language/he-HE.h index f50128447..01364aa3d 100644 --- a/tasmota/language/he-HE.h +++ b/tasmota/language/he-HE.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Phase Angle" diff --git a/tasmota/language/hu-HU.h b/tasmota/language/hu-HU.h index d33b465d8..5587add24 100644 --- a/tasmota/language/hu-HU.h +++ b/tasmota/language/hu-HU.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Fázisszög" diff --git a/tasmota/language/it-IT.h b/tasmota/language/it-IT.h index 5d2d3e10f..b6ed56de4 100644 --- a/tasmota/language/it-IT.h +++ b/tasmota/language/it-IT.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Angolo Fase" diff --git a/tasmota/language/ko-KO.h b/tasmota/language/ko-KO.h index 28bb44b6d..41c2edb32 100644 --- a/tasmota/language/ko-KO.h +++ b/tasmota/language/ko-KO.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Phase Angle" diff --git a/tasmota/language/nl-NL.h b/tasmota/language/nl-NL.h index 75a990387..b17f17a71 100644 --- a/tasmota/language/nl-NL.h +++ b/tasmota/language/nl-NL.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Fase hoek" diff --git a/tasmota/language/pl-PL.h b/tasmota/language/pl-PL.h index 76415e599..3bda5ec01 100644 --- a/tasmota/language/pl-PL.h +++ b/tasmota/language/pl-PL.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Phase Angle" diff --git a/tasmota/language/pt-BR.h b/tasmota/language/pt-BR.h index 111ce5359..e997a1e81 100644 --- a/tasmota/language/pt-BR.h +++ b/tasmota/language/pt-BR.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Ângulo de Fase" diff --git a/tasmota/language/pt-PT.h b/tasmota/language/pt-PT.h index af85629dc..ab95be031 100644 --- a/tasmota/language/pt-PT.h +++ b/tasmota/language/pt-PT.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Ângulo de fase" diff --git a/tasmota/language/ru-RU.h b/tasmota/language/ru-RU.h index 72a68753d..0476cc584 100644 --- a/tasmota/language/ru-RU.h +++ b/tasmota/language/ru-RU.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Угол фазы" diff --git a/tasmota/language/sk-SK.h b/tasmota/language/sk-SK.h index 9042cf59e..b9565f9df 100644 --- a/tasmota/language/sk-SK.h +++ b/tasmota/language/sk-SK.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Phase Angle" diff --git a/tasmota/language/sv-SE.h b/tasmota/language/sv-SE.h index 83078f9d0..d8f2c2931 100644 --- a/tasmota/language/sv-SE.h +++ b/tasmota/language/sv-SE.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Fasvinkel" diff --git a/tasmota/language/tr-TR.h b/tasmota/language/tr-TR.h index 3999d9093..20aec50dc 100644 --- a/tasmota/language/tr-TR.h +++ b/tasmota/language/tr-TR.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Phase Angle" diff --git a/tasmota/language/uk-UK.h b/tasmota/language/uk-UK.h index 64c806dfb..e71b499b8 100644 --- a/tasmota/language/uk-UK.h +++ b/tasmota/language/uk-UK.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Кут фази" diff --git a/tasmota/language/zh-CN.h b/tasmota/language/zh-CN.h index 5c5c37379..93832fc07 100644 --- a/tasmota/language/zh-CN.h +++ b/tasmota/language/zh-CN.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "相位角" diff --git a/tasmota/language/zh-TW.h b/tasmota/language/zh-TW.h index 9a40f2470..f16077925 100644 --- a/tasmota/language/zh-TW.h +++ b/tasmota/language/zh-TW.h @@ -691,6 +691,7 @@ #define D_LOG_UPLOAD "UPL: " // Upload #define D_LOG_UPNP "UPP: " // UPnP #define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee //SDM220 #define D_PHASE_ANGLE "Phase Angle" diff --git a/tasmota/xdrv_23_zigbee_5_converters.ino b/tasmota/xdrv_23_zigbee_5_converters.ino index 57d4e3624..bf58a80b9 100644 --- a/tasmota/xdrv_23_zigbee_5_converters.ino +++ b/tasmota/xdrv_23_zigbee_5_converters.ino @@ -388,7 +388,7 @@ uint32_t parseSingleAttribute(JsonObject& json, char *attrid_str, class SBuffer // String pp; // pretty print // json[attrid_str].prettyPrintTo(pp); // // now store the attribute - // AddLog_P2(LOG_LEVEL_INFO, PSTR("ZIG: ZCL attribute decoded, id %s, type 0x%02X, val=%s"), + // AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "ZCL attribute decoded, id %s, type 0x%02X, val=%s"), // attrid_str, attrtype, pp.c_str()); return i - offset; // how much have we increased the index } diff --git a/tasmota/xdrv_23_zigbee_7_statemachine.ino b/tasmota/xdrv_23_zigbee_7_statemachine.ino index 26d30d032..d4f3e459f 100644 --- a/tasmota/xdrv_23_zigbee_7_statemachine.ino +++ b/tasmota/xdrv_23_zigbee_7_statemachine.ino @@ -323,11 +323,11 @@ static const Zigbee_Instruction zb_prog[] PROGMEM = { ZI_ON_ERROR_GOTO(50) //ZI_MQTT_STATE(ZIGBEE_STATUS_BOOT, "Booting") - //ZI_LOG(LOG_LEVEL_INFO, "ZIG: rebooting device") + //ZI_LOG(LOG_LEVEL_INFO, D_LOG_ZIGBEE "rebooting device") ZI_SEND(ZBS_RESET) // reboot cc2530 just in case we rebooted ESP8266 but not cc2530 ZI_WAIT_RECV_FUNC(5000, ZBR_RESET, &Z_Reboot) // timeout 5s ZI_WAIT(100) - ZI_LOG(LOG_LEVEL_INFO, "ZIG: checking device configuration") + ZI_LOG(LOG_LEVEL_DEBUG, D_LOG_ZIGBEE "checking device configuration") ZI_SEND(ZBS_ZNPHC) // check value of ZNP Has Configured ZI_WAIT_RECV(2000, ZBR_ZNPHC) ZI_SEND(ZBS_VERSION) // check ZNP software version @@ -342,7 +342,7 @@ static const Zigbee_Instruction zb_prog[] PROGMEM = { ZI_WAIT_RECV(1000, ZBR_PFGK) ZI_SEND(ZBS_PFGKEN) // check PFGKEN ZI_WAIT_RECV(1000, ZBR_PFGKEN) - //ZI_LOG(LOG_LEVEL_INFO, "ZIG: zigbee configuration ok") + //ZI_LOG(LOG_LEVEL_INFO, D_LOG_ZIGBEE "zigbee configuration ok") // all is good, we can start ZI_LABEL(ZIGBEE_LABEL_START) // START ZNP App @@ -350,7 +350,7 @@ static const Zigbee_Instruction zb_prog[] PROGMEM = { //ZI_CALL(&Z_State_Ready, 1) // Now accept incoming messages ZI_ON_ERROR_GOTO(ZIGBEE_LABEL_ABORT) // Z_ZDO:startupFromApp - //ZI_LOG(LOG_LEVEL_INFO, "ZIG: starting zigbee coordinator") + //ZI_LOG(LOG_LEVEL_INFO, D_LOG_ZIGBEE "starting zigbee coordinator") ZI_SEND(ZBS_STARTUPFROMAPP) // start coordinator ZI_WAIT_RECV(2000, ZBR_STARTUPFROMAPP) // wait for sync ack of command ZI_WAIT_UNTIL(5000, AREQ_STARTUPFROMAPP) // wait for async message that coordinator started @@ -383,7 +383,7 @@ ZI_SEND(ZBS_STARTUPFROMAPP) // start coordinator ZI_LABEL(ZIGBEE_LABEL_READY) ZI_MQTT_STATE(ZIGBEE_STATUS_OK, "Started") - ZI_LOG(LOG_LEVEL_INFO, "ZIG: zigbee device ready, listening...") + ZI_LOG(LOG_LEVEL_INFO, D_LOG_ZIGBEE "Zigbee started") ZI_CALL(&Z_State_Ready, 1) // Now accept incoming messages ZI_LABEL(ZIGBEE_LABEL_MAIN_LOOP) ZI_WAIT_FOREVER() @@ -415,7 +415,7 @@ ZI_SEND(ZBS_STARTUPFROMAPP) // start coordinator ZI_LABEL(50) // reformat device ZI_MQTT_STATE(ZIGBEE_STATUS_RESET_CONF, "Reseting configuration") - //ZI_LOG(LOG_LEVEL_INFO, "ZIG: zigbee bad configuration of device, doing a factory reset") + //ZI_LOG(LOG_LEVEL_INFO, D_LOG_ZIGBEE "zigbee bad configuration of device, doing a factory reset") ZI_ON_ERROR_GOTO(ZIGBEE_LABEL_ABORT) ZI_SEND(ZBS_FACTRES) // factory reset ZI_WAIT_RECV(1000, ZBR_W_OK) @@ -443,7 +443,7 @@ ZI_SEND(ZBS_STARTUPFROMAPP) // start coordinator ZI_SEND(ZBS_WNV_ZNPHC) // Write NV ZNP Has Configured ZI_WAIT_RECV(1000, ZBR_WNV_OK) - //ZI_LOG(LOG_LEVEL_INFO, "ZIG: zigbee device reconfigured") + //ZI_LOG(LOG_LEVEL_INFO, D_LOG_ZIGBEE "zigbee device reconfigured") ZI_GOTO(ZIGBEE_LABEL_START) ZI_LABEL(ZIGBEE_LABEL_UNSUPPORTED_VERSION) @@ -452,7 +452,7 @@ ZI_SEND(ZBS_STARTUPFROMAPP) // start coordinator ZI_LABEL(ZIGBEE_LABEL_ABORT) // Label 99: abort ZI_MQTT_STATE(ZIGBEE_STATUS_ABORT, "Abort") - ZI_LOG(LOG_LEVEL_ERROR, "ZIG: Abort") + ZI_LOG(LOG_LEVEL_ERROR, D_LOG_ZIGBEE "Abort") ZI_STOP(ZIGBEE_LABEL_ABORT) }; @@ -480,7 +480,7 @@ void ZigbeeGotoLabel(uint8_t label) { //AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("ZGB GOTO: pc %d instr %d"), i, cur_instr); if (ZGB_INSTR_LABEL == cur_instr) { - //AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("ZIG: found label %d at pc %d"), cur_d8, i); + //AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE "found label %d at pc %d"), cur_d8, i); if (label == cur_d8) { // label found, goto to this pc zigbee.pc = i; @@ -494,12 +494,12 @@ void ZigbeeGotoLabel(uint8_t label) { } // no label found, abort - AddLog_P2(LOG_LEVEL_ERROR, PSTR("ZIG: Goto label not found, label=%d pc=%d"), label, zigbee.pc); + AddLog_P2(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_P2(LOG_LEVEL_ERROR, PSTR("ZIG: Label Abort (%d) not present, aborting Zigbee"), ZIGBEE_LABEL_ABORT); + AddLog_P2(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Label Abort (%d) not present, aborting Zigbee"), ZIGBEE_LABEL_ABORT); zigbee.state_machine = false; zigbee.active = false; } @@ -516,9 +516,9 @@ void ZigbeeStateMachine_Run(void) { if (zigbee.state_waiting) { // state machine is waiting for external event or timeout // checking if timeout expired if ((zigbee.next_timeout) && (now > zigbee.next_timeout)) { // if next_timeout == 0 then wait forever - //AddLog_P2(LOG_LEVEL_INFO, PSTR("ZIG: timeout occured pc=%d"), zigbee.pc); + //AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "timeout occured pc=%d"), zigbee.pc); if (!zigbee.state_no_timeout) { - AddLog_P2(LOG_LEVEL_INFO, PSTR("ZIG: timeout, goto label %d"), zigbee.on_timeout_goto); + AddLog_P2(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 @@ -534,7 +534,7 @@ void ZigbeeStateMachine_Run(void) { zigbee.state_no_timeout = false; // reset the no_timeout for next instruction if (zigbee.pc > (sizeof(zb_prog)/sizeof(zb_prog[0]))) { - AddLog_P2(LOG_LEVEL_ERROR, PSTR("ZIG: Invalid pc: %d, aborting"), zigbee.pc); + AddLog_P2(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Invalid pc: %d, aborting"), zigbee.pc); zigbee.pc = -1; } if (zigbee.pc < 0) { @@ -543,7 +543,7 @@ void ZigbeeStateMachine_Run(void) { } // load current instruction details - AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("ZIG: Executing instruction pc=%d"), zigbee.pc); + AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE "Executing instruction pc=%d"), zigbee.pc); const Zigbee_Instruction *cur_instr_line = &zb_prog[zigbee.pc]; cur_instr = pgm_read_byte(&cur_instr_line->i.i); cur_d8 = pgm_read_byte(&cur_instr_line->i.d8); @@ -585,7 +585,7 @@ void ZigbeeStateMachine_Run(void) { case ZGB_INSTR_STOP: zigbee.state_machine = false; if (cur_d8) { - AddLog_P2(LOG_LEVEL_ERROR, PSTR("ZIG: Stopping (%d)"), cur_d8); + AddLog_P2(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 22cebd21c..a610bb882 100644 --- a/tasmota/xdrv_23_zigbee_8_parsers.ino +++ b/tasmota/xdrv_23_zigbee_8_parsers.ino @@ -435,7 +435,6 @@ const Z_Dispatcher Z_DispatchTable[] PROGMEM = { int32_t Z_Recv_Default(int32_t res, const class SBuffer &buf) { // Default message handler for new messages - AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ZIG: Z_Recv_Default")); if (zigbee.init_phase) { // if still during initialization phase, ignore any unexpected message return -1; // ignore message diff --git a/tasmota/xdrv_23_zigbee_9_impl.ino b/tasmota/xdrv_23_zigbee_9_impl.ino index a8736003c..41a73b415 100644 --- a/tasmota/xdrv_23_zigbee_9_impl.ino +++ b/tasmota/xdrv_23_zigbee_9_impl.ino @@ -66,7 +66,7 @@ int32_t ZigbeeProcessInput(class SBuffer &buf) { } } - AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ZIG: ZigbeeProcessInput: recv_prefix_match = %d, recv_filter_match = %d"), recv_prefix_match, recv_filter_match); + AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE "ZigbeeProcessInput: recv_prefix_match = %d, recv_filter_match = %d"), recv_prefix_match, recv_filter_match); } // if there is a recv_callback, call it now @@ -105,7 +105,7 @@ int32_t ZigbeeProcessInput(class SBuffer &buf) { res = (*zigbee.recv_unexpected)(res, buf); } } - AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ZIG: ZigbeeProcessInput: res = %d"), res); + AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE "ZigbeeProcessInput: res = %d"), res); // change state accordingly if (0 == res) { @@ -184,7 +184,7 @@ void ZigbeeInput(void) ToHex_P((unsigned char*)zigbee_buffer->getBuffer(), zigbee_buffer->len(), hex_char, sizeof(hex_char)); #ifndef Z_USE_SOFTWARE_SERIAL - AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ZIG: Bytes follor_read_metric = %0d"), ZigbeeSerial->getLoopReadMetric()); + AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE "Bytes follow_read_metric = %0d"), ZigbeeSerial->getLoopReadMetric()); #endif // buffer received, now check integrity if (zigbee_buffer->len() != zigbee_frame_len) { @@ -195,15 +195,17 @@ void ZigbeeInput(void) AddLog_P2(LOG_LEVEL_INFO, PSTR(D_JSON_ZIGBEEZNPRECEIVED ": received bad FCS frame %s, %d"), hex_char, fcs); } else { // frame is correct - AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_JSON_ZIGBEEZNPRECEIVED ": received correct frame %s"), hex_char); + //AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_JSON_ZIGBEEZNPRECEIVED ": received correct frame %s"), hex_char); SBuffer znp_buffer = zigbee_buffer->subBuffer(2, zigbee_frame_len - 3); // remove SOF, LEN and FCS #ifdef ZIGBEE_VERBOSE ToHex_P((unsigned char*)znp_buffer.getBuffer(), znp_buffer.len(), hex_char, sizeof(hex_char)); - Response_P(PSTR("{\"" D_JSON_ZIGBEEZNPRECEIVED "\":\"%s\"}"), hex_char); - MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEEZNPRECEIVED)); - XdrvRulesProcess(); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE D_JSON_ZIGBEEZNPRECEIVED " %s"), + hex_char); + // Response_P(PSTR("{\"" D_JSON_ZIGBEEZNPRECEIVED "\":\"%s\"}"), hex_char); + // MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEEZNPRECEIVED)); + // XdrvRulesProcess(); #endif // now process the message @@ -333,10 +335,8 @@ void ZigbeeZNPSend(const uint8_t *msg, size_t len) { #ifdef ZIGBEE_VERBOSE // Now send a MQTT message to report the sent message char hex_char[(len * 2) + 2]; - Response_P(PSTR("{\"" D_JSON_ZIGBEEZNPSENT "\":\"%s\"}"), - ToHex_P(msg, len, hex_char, sizeof(hex_char))); - MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEEZNPSENT)); - XdrvRulesProcess(); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE D_JSON_ZIGBEEZNPSENT " %s"), + ToHex_P(msg, len, hex_char, sizeof(hex_char))); #endif } From 6f421694328f68d17711d1a12d5f2d6219b1ce2d Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sun, 17 Nov 2019 14:29:33 +0100 Subject: [PATCH 24/25] Refactor Erase code --- tasmota/settings.ino | 46 +++++++++++++++++-------------------- tasmota/support_esptool.ino | 8 +++---- 2 files changed, 24 insertions(+), 30 deletions(-) diff --git a/tasmota/settings.ino b/tasmota/settings.ino index fe362179b..552f04937 100644 --- a/tasmota/settings.ino +++ b/tasmota/settings.ino @@ -539,6 +539,25 @@ void SettingsLoad(void) RtcSettingsLoad(); } +void EspErase(uint32_t start_sector, uint32_t end_sector) +{ + bool serial_output = (LOG_LEVEL_DEBUG_MORE <= seriallog_level); + for (uint32_t sector = start_sector; sector < end_sector; sector++) { + + bool result = ESP.flashEraseSector(sector); // Arduino core - erases flash as seen by SDK +// bool result = !SPIEraseSector(sector); // SDK - erases flash as seen by SDK +// bool result = EsptoolEraseSector(sector); // Esptool - erases flash completely (slow) + + if (serial_output) { + Serial.printf_P(PSTR(D_LOG_APPLICATION D_ERASED_SECTOR " %d %s\n"), sector, (result) ? D_OK : D_ERROR); + delay(10); + } else { + yield(); + } + OsWatchLoop(); + } +} + void SettingsErase(uint8_t type) { /* @@ -572,31 +591,8 @@ void SettingsErase(uint8_t type) AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_ERASE " %d " D_UNIT_SECTORS), _sectorEnd - _sectorStart); -/* - bool _serialoutput = (LOG_LEVEL_DEBUG_MORE <= seriallog_level); - - for (uint32_t _sector = _sectorStart; _sector < _sectorEnd; _sector++) { - - bool result = ESP.flashEraseSector(_sector); // Arduino core - erases flash as seen by SDK -// bool result = !SPIEraseSector(_sector); // SDK - erases flash as seen by SDK -// bool result = EsptoolEraseSector(_sector); // Esptool - erases flash completely (slow) - - if (_serialoutput) { - Serial.print(F(D_LOG_APPLICATION D_ERASED_SECTOR " ")); - Serial.print(_sector); - if (result) { - Serial.println(F(" " D_OK)); - } else { - Serial.println(F(" " D_ERROR)); - } - delay(10); - } else { - yield(); - } - OsWatchLoop(); - } -*/ - EsptoolErase(_sectorStart, _sectorEnd); // Esptool - erases flash completely (fast) +// EspErase(_sectorStart, _sectorEnd); // Arduino core and SDK - erases flash as seen by SDK + EsptoolErase(_sectorStart, _sectorEnd); // Esptool - erases flash completely #endif // FIRMWARE_MINIMAL } diff --git a/tasmota/support_esptool.ino b/tasmota/support_esptool.ino index f030e113d..bf62a8da1 100644 --- a/tasmota/support_esptool.ino +++ b/tasmota/support_esptool.ino @@ -77,7 +77,6 @@ static void spi_write_enable(void) while(READ_REG(SPI_CMD_REG) != 0) { } } -/* bool EsptoolEraseSector(uint32_t sector) { spi_write_enable(); @@ -90,7 +89,6 @@ bool EsptoolEraseSector(uint32_t sector) return true; } -*/ void EsptoolErase(uint32_t start_sector, uint32_t end_sector) { @@ -100,18 +98,18 @@ void EsptoolErase(uint32_t start_sector, uint32_t end_sector) while (remaining_erase_sector > 0) { spi_write_enable(); - uint32_t command = SPI_FLASH_SE; // Sector erase, 4KB + uint32_t command = SPI_FLASH_SE; // Sector erase, 4kB uint32_t sectors_to_erase = 1; if (remaining_erase_sector >= SECTORS_PER_BLOCK && next_erase_sector % SECTORS_PER_BLOCK == 0) { - command = SPI_FLASH_BE; // Block erase 64KB if we have space for it + command = SPI_FLASH_BE; // Block erase 64kB if we have space for it sectors_to_erase = SECTORS_PER_BLOCK; } uint32_t addr = next_erase_sector * SPI_FLASH_SEC_SIZE; spi_wait_ready(); WRITE_REG(SPI_ADDR_REG, addr & 0xffffff); - WRITE_REG(SPI_CMD_REG, command); // Sector erase, 4KB + WRITE_REG(SPI_CMD_REG, command); // Perform erase, 4kB or 65kB while(READ_REG(SPI_CMD_REG) != 0) { } remaining_erase_sector -= sectors_to_erase; next_erase_sector += sectors_to_erase; From 9f7c9cd12f75fae2a7d73f9cd3dd2b9e20f06f39 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sun, 17 Nov 2019 15:07:03 +0100 Subject: [PATCH 25/25] Consolidate LOG prefixes --- tasmota/i18n.h | 30 ++++++++++++++++++++++++++++++ tasmota/language/bg-BG.h | 30 ------------------------------ tasmota/language/cs-CZ.h | 30 ------------------------------ tasmota/language/de-DE.h | 30 ------------------------------ tasmota/language/el-GR.h | 30 ------------------------------ tasmota/language/en-GB.h | 30 ------------------------------ tasmota/language/es-ES.h | 30 ------------------------------ tasmota/language/fr-FR.h | 30 ------------------------------ tasmota/language/he-HE.h | 30 ------------------------------ tasmota/language/hu-HU.h | 30 ------------------------------ tasmota/language/it-IT.h | 30 ------------------------------ tasmota/language/ko-KO.h | 30 ------------------------------ tasmota/language/nl-NL.h | 30 ------------------------------ tasmota/language/pl-PL.h | 30 ------------------------------ tasmota/language/pt-BR.h | 30 ------------------------------ tasmota/language/pt-PT.h | 30 ------------------------------ tasmota/language/ru-RU.h | 30 ------------------------------ tasmota/language/sk-SK.h | 30 ------------------------------ tasmota/language/sv-SE.h | 30 ------------------------------ tasmota/language/tr-TR.h | 30 ------------------------------ tasmota/language/uk-UK.h | 30 ------------------------------ tasmota/language/zh-CN.h | 30 ------------------------------ tasmota/language/zh-TW.h | 30 ------------------------------ 23 files changed, 30 insertions(+), 660 deletions(-) diff --git a/tasmota/i18n.h b/tasmota/i18n.h index 323203f0c..d1e85c1de 100644 --- a/tasmota/i18n.h +++ b/tasmota/i18n.h @@ -491,6 +491,36 @@ /********************************************************************************************/ +// Log message prefix +#define D_LOG_APPLICATION "APP: " // Application +#define D_LOG_BRIDGE "BRG: " // Bridge +#define D_LOG_CONFIG "CFG: " // Settings +#define D_LOG_COMMAND "CMD: " // Command +#define D_LOG_DEBUG "DBG: " // Debug +#define D_LOG_DHT "DHT: " // DHT sensor +#define D_LOG_DOMOTICZ "DOM: " // Domoticz +#define D_LOG_DSB "DSB: " // DS18xB20 sensor +#define D_LOG_HTTP "HTP: " // HTTP webserver +#define D_LOG_HRE "HRE: " +#define D_LOG_I2C "I2C: " // I2C +#define D_LOG_IRR "IRR: " // Infra Red Received +#define D_LOG_KNX "KNX: " +#define D_LOG_LOG "LOG: " // Logging +#define D_LOG_MODULE "MOD: " // Module +#define D_LOG_MDNS "DNS: " // mDNS +#define D_LOG_MQTT "MQT: " // MQTT +#define D_LOG_OTHER "OTH: " // Other +#define D_LOG_RESULT "RSL: " // Result +#define D_LOG_RFR "RFR: " // RF Received +#define D_LOG_SERIAL "SER: " // Serial +#define D_LOG_SHT1 "SHT: " // SHT1x sensor +#define D_LOG_UPLOAD "UPL: " // Upload +#define D_LOG_UPNP "UPP: " // UPnP +#define D_LOG_WIFI "WIF: " // Wifi +#define D_LOG_ZIGBEE "ZIG: " // Zigbee + +/********************************************************************************************/ + #define D_ASTERISK_PWD "****" #ifndef MY_LANGUAGE diff --git a/tasmota/language/bg-BG.h b/tasmota/language/bg-BG.h index cfc7998b2..4bc5feebd 100644 --- a/tasmota/language/bg-BG.h +++ b/tasmota/language/bg-BG.h @@ -427,7 +427,6 @@ #define D_DELETE "Изтриване" #define D_REPLY "Отговор" #define D_KNX_GROUP_ADDRESS_TO_READ "Групови адреси за получаване на данни" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "Получен от" #define D_KNX_COMMAND_WRITE "Писане" #define D_KNX_COMMAND_READ "Четене" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "Ю" #define D_TX20_WEST "З" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Няма" #define D_SENSOR_USER "Потребит." @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "Wh" #define D_UNIT_WATT_METER_QUADRAT "W/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Фазов ъгъл" #define D_IMPORT_ACTIVE "Входна активна мощност" diff --git a/tasmota/language/cs-CZ.h b/tasmota/language/cs-CZ.h index e3d18ab41..8800368a3 100644 --- a/tasmota/language/cs-CZ.h +++ b/tasmota/language/cs-CZ.h @@ -427,7 +427,6 @@ #define D_DELETE "Smaž" #define D_REPLY "Odpověď" #define D_KNX_GROUP_ADDRESS_TO_READ "Skupinové adresy pro příjem dat z" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "Přijato z" #define D_KNX_COMMAND_WRITE "Zapiš" #define D_KNX_COMMAND_READ "Čti" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "J" #define D_TX20_WEST "Z" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Není" #define D_SENSOR_USER "User" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "Wh" #define D_UNIT_WATT_METER_QUADRAT "W/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Phase Angle" #define D_IMPORT_ACTIVE "Import Active" diff --git a/tasmota/language/de-DE.h b/tasmota/language/de-DE.h index 82b8f7020..c50de823f 100644 --- a/tasmota/language/de-DE.h +++ b/tasmota/language/de-DE.h @@ -427,7 +427,6 @@ #define D_DELETE "Löschen" #define D_REPLY "Antworten" #define D_KNX_GROUP_ADDRESS_TO_READ "Gruppenadresse zum Emfang von Daten" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "Empfangen von" #define D_KNX_COMMAND_WRITE "Schreiben" #define D_KNX_COMMAND_READ "Lesen" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "None" #define D_SENSOR_USER "User" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "Wh" #define D_UNIT_WATT_METER_QUADRAT "W/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Phasenwinkel" #define D_IMPORT_ACTIVE "Importiere Wirk" diff --git a/tasmota/language/el-GR.h b/tasmota/language/el-GR.h index 161b838eb..4fe47ae6d 100644 --- a/tasmota/language/el-GR.h +++ b/tasmota/language/el-GR.h @@ -427,7 +427,6 @@ #define D_DELETE "Διαγραφή" #define D_REPLY "Επανάληψη" #define D_KNX_GROUP_ADDRESS_TO_READ "Ομάδα Διευθύνσεων που θα λάβει τα Δεδομένα" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "Στάλθηκε από" #define D_KNX_COMMAND_WRITE "Εγγραφή" #define D_KNX_COMMAND_READ "Ανάγνωση" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "Ν" #define D_TX20_WEST "Δ" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Κανένα" #define D_SENSOR_USER "User" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "Wh" #define D_UNIT_WATT_METER_QUADRAT "W/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Phase Angle" #define D_IMPORT_ACTIVE "Import Active" diff --git a/tasmota/language/en-GB.h b/tasmota/language/en-GB.h index ed9bbba27..a98087a18 100644 --- a/tasmota/language/en-GB.h +++ b/tasmota/language/en-GB.h @@ -427,7 +427,6 @@ #define D_DELETE "Delete" #define D_REPLY "Reply" #define D_KNX_GROUP_ADDRESS_TO_READ "Group Addresses to Receive Data from" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "Received from" #define D_KNX_COMMAND_WRITE "Write" #define D_KNX_COMMAND_READ "Read" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "None" #define D_SENSOR_USER "User" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "Wh" #define D_UNIT_WATT_METER_QUADRAT "W/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Phase Angle" #define D_IMPORT_ACTIVE "Import Active" diff --git a/tasmota/language/es-ES.h b/tasmota/language/es-ES.h index ebd637f22..086c6a2be 100644 --- a/tasmota/language/es-ES.h +++ b/tasmota/language/es-ES.h @@ -427,7 +427,6 @@ #define D_DELETE "Eliminar" #define D_REPLY "Responder" #define D_KNX_GROUP_ADDRESS_TO_READ "Direcciones de Grupo para Recibir Datos" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "Recibido desde" #define D_KNX_COMMAND_WRITE "Escribir" #define D_KNX_COMMAND_READ "Leer" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "O" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Ninguno" #define D_SENSOR_USER "User" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "Wh" #define D_UNIT_WATT_METER_QUADRAT "W/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Ángulo de Fase" #define D_IMPORT_ACTIVE "P. Activa Entrante" diff --git a/tasmota/language/fr-FR.h b/tasmota/language/fr-FR.h index 9297ed78d..4704c49e7 100644 --- a/tasmota/language/fr-FR.h +++ b/tasmota/language/fr-FR.h @@ -427,7 +427,6 @@ #define D_DELETE "Supprimer" #define D_REPLY "Répondre" #define D_KNX_GROUP_ADDRESS_TO_READ "Données à recevoir des Adresses de Groupe" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "Reçu de" #define D_KNX_COMMAND_WRITE "Écrire" #define D_KNX_COMMAND_READ "Lire" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "O" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Aucun" #define D_SENSOR_USER "Utilisateur" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "Wh" #define D_UNIT_WATT_METER_QUADRAT "W/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Angle de phase" #define D_IMPORT_ACTIVE "Énergie act conso" diff --git a/tasmota/language/he-HE.h b/tasmota/language/he-HE.h index 01364aa3d..69387ceca 100644 --- a/tasmota/language/he-HE.h +++ b/tasmota/language/he-HE.h @@ -427,7 +427,6 @@ #define D_DELETE "מחק" #define D_REPLY "השב" #define D_KNX_GROUP_ADDRESS_TO_READ "כתובות קבוצתיות לקבלת נתונים מ" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "התקבל מאת" #define D_KNX_COMMAND_WRITE "כתיבה" #define D_KNX_COMMAND_READ "קריאה" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "None" #define D_SENSOR_USER "משתמש" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "Wh" #define D_UNIT_WATT_METER_QUADRAT "W/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Phase Angle" #define D_IMPORT_ACTIVE "Import Active" diff --git a/tasmota/language/hu-HU.h b/tasmota/language/hu-HU.h index 5587add24..58f85eb22 100644 --- a/tasmota/language/hu-HU.h +++ b/tasmota/language/hu-HU.h @@ -427,7 +427,6 @@ #define D_DELETE "Törlés" #define D_REPLY "Válasz" #define D_KNX_GROUP_ADDRESS_TO_READ "Fogadáshoz használt csoportcímek" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "Fogadva tőle:" #define D_KNX_COMMAND_WRITE "Írás" #define D_KNX_COMMAND_READ "Olvasás" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "D" #define D_TX20_WEST "NY" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Nincs" #define D_SENSOR_USER "User" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "Wh" #define D_UNIT_WATT_METER_QUADRAT "W/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Fázisszög" #define D_IMPORT_ACTIVE "Bejövő aktív" diff --git a/tasmota/language/it-IT.h b/tasmota/language/it-IT.h index b6ed56de4..3029f37da 100644 --- a/tasmota/language/it-IT.h +++ b/tasmota/language/it-IT.h @@ -427,7 +427,6 @@ #define D_DELETE "Elimina" #define D_REPLY "Rispondi" #define D_KNX_GROUP_ADDRESS_TO_READ "Gruppo di Indirizzi da cui Ricevere Dati" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "Ricevuto Da" #define D_KNX_COMMAND_WRITE "Scrivi" #define D_KNX_COMMAND_READ "Leggi" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "O" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Nessuno" #define D_SENSOR_USER "User" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "Wh" #define D_UNIT_WATT_METER_QUADRAT "W/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Angolo Fase" #define D_IMPORT_ACTIVE "Potenza Attiva Importata" diff --git a/tasmota/language/ko-KO.h b/tasmota/language/ko-KO.h index 41c2edb32..51c24912d 100644 --- a/tasmota/language/ko-KO.h +++ b/tasmota/language/ko-KO.h @@ -427,7 +427,6 @@ #define D_DELETE "삭제" #define D_REPLY "응답" #define D_KNX_GROUP_ADDRESS_TO_READ "받은 데이터의 그룹 주소" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "다음에서 받음" #define D_KNX_COMMAND_WRITE "쓰기" #define D_KNX_COMMAND_READ "읽기" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "없음" #define D_SENSOR_USER "User" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "Wh" #define D_UNIT_WATT_METER_QUADRAT "W/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Phase Angle" #define D_IMPORT_ACTIVE "Import Active" diff --git a/tasmota/language/nl-NL.h b/tasmota/language/nl-NL.h index b17f17a71..da20ff1d7 100644 --- a/tasmota/language/nl-NL.h +++ b/tasmota/language/nl-NL.h @@ -427,7 +427,6 @@ #define D_DELETE "Verwijder" #define D_REPLY "Antwoord" #define D_KNX_GROUP_ADDRESS_TO_READ "Ontvang gegevens van groep adressen" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "Ontvangen van" #define D_KNX_COMMAND_WRITE "Schrijven" #define D_KNX_COMMAND_READ "Lezen" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Geen" #define D_SENSOR_USER "Gebruiker" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "Wh" #define D_UNIT_WATT_METER_QUADRAT "W/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Fase hoek" #define D_IMPORT_ACTIVE "Import werkelijk" diff --git a/tasmota/language/pl-PL.h b/tasmota/language/pl-PL.h index 3bda5ec01..7e75276db 100644 --- a/tasmota/language/pl-PL.h +++ b/tasmota/language/pl-PL.h @@ -427,7 +427,6 @@ #define D_DELETE "Usuń" #define D_REPLY "Odpowiedz" #define D_KNX_GROUP_ADDRESS_TO_READ "Adresy grupowe do odbioru danych z" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "Otrzymane od" #define D_KNX_COMMAND_WRITE "Zapisz" #define D_KNX_COMMAND_READ "Czytaj" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Brak" #define D_SENSOR_USER "User" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "Wh" #define D_UNIT_WATT_METER_QUADRAT "W/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Phase Angle" #define D_IMPORT_ACTIVE "Import Active" diff --git a/tasmota/language/pt-BR.h b/tasmota/language/pt-BR.h index e997a1e81..2eb81f294 100644 --- a/tasmota/language/pt-BR.h +++ b/tasmota/language/pt-BR.h @@ -427,7 +427,6 @@ #define D_DELETE "Remover" #define D_REPLY "Responder" #define D_KNX_GROUP_ADDRESS_TO_READ "Endereço do grupo para receber" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "Recebido de" #define D_KNX_COMMAND_WRITE "Escrever" #define D_KNX_COMMAND_READ "Ler" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "O" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Nenhum" #define D_SENSOR_USER "User" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "W/h" #define D_UNIT_WATT_METER_QUADRAT "W/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Ângulo de Fase" #define D_IMPORT_ACTIVE "Importar Ativo" diff --git a/tasmota/language/pt-PT.h b/tasmota/language/pt-PT.h index ab95be031..46bafdef6 100644 --- a/tasmota/language/pt-PT.h +++ b/tasmota/language/pt-PT.h @@ -427,7 +427,6 @@ #define D_DELETE "Remover" #define D_REPLY "Responder" #define D_KNX_GROUP_ADDRESS_TO_READ "Endereços de Grupo de onde receber dados" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "Recebido de" #define D_KNX_COMMAND_WRITE "Escrever" #define D_KNX_COMMAND_READ "Ler" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "O" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Nenhum" #define D_SENSOR_USER "User" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "Wh" #define D_UNIT_WATT_METER_QUADRAT "W/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Ângulo de fase" #define D_IMPORT_ACTIVE "Ativo importado" diff --git a/tasmota/language/ru-RU.h b/tasmota/language/ru-RU.h index 0476cc584..5ff9bff50 100644 --- a/tasmota/language/ru-RU.h +++ b/tasmota/language/ru-RU.h @@ -427,7 +427,6 @@ #define D_DELETE "Delete" #define D_REPLY "Reply" #define D_KNX_GROUP_ADDRESS_TO_READ "Group Addresses to Receive Data from" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "Received from" #define D_KNX_COMMAND_WRITE "Write" #define D_KNX_COMMAND_READ "Read" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "-нет-" #define D_SENSOR_USER "User" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "ВтЧ" #define D_UNIT_WATT_METER_QUADRAT "W/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Угол фазы" #define D_IMPORT_ACTIVE "Импорт активной мощности" diff --git a/tasmota/language/sk-SK.h b/tasmota/language/sk-SK.h index b9565f9df..57ec74f8a 100644 --- a/tasmota/language/sk-SK.h +++ b/tasmota/language/sk-SK.h @@ -427,7 +427,6 @@ #define D_DELETE "Zmazať" #define D_REPLY "Odpoveď" #define D_KNX_GROUP_ADDRESS_TO_READ "Skupinové adresy pre príjem dát z" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "Prijaté z" #define D_KNX_COMMAND_WRITE "Zapíš" #define D_KNX_COMMAND_READ "Čítaj" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "J" #define D_TX20_WEST "Z" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Žiaden" #define D_SENSOR_USER "User" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "Wh" #define D_UNIT_WATT_METER_QUADRAT "W/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Phase Angle" #define D_IMPORT_ACTIVE "Import Active" diff --git a/tasmota/language/sv-SE.h b/tasmota/language/sv-SE.h index d8f2c2931..aee8fd25d 100644 --- a/tasmota/language/sv-SE.h +++ b/tasmota/language/sv-SE.h @@ -427,7 +427,6 @@ #define D_DELETE "Ta bort" #define D_REPLY "Svara" #define D_KNX_GROUP_ADDRESS_TO_READ "Gruppadresser att ta emot data från" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "Mottagen från" #define D_KNX_COMMAND_WRITE "Skriv" #define D_KNX_COMMAND_READ "Läs" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "V" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Ingen" #define D_SENSOR_USER "User" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "Wh" #define D_UNIT_WATT_METER_QUADRAT "W/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Fasvinkel" #define D_IMPORT_ACTIVE "Import aktiv" diff --git a/tasmota/language/tr-TR.h b/tasmota/language/tr-TR.h index 20aec50dc..78612dace 100644 --- a/tasmota/language/tr-TR.h +++ b/tasmota/language/tr-TR.h @@ -427,7 +427,6 @@ #define D_DELETE "Sil" #define D_REPLY "Cevapla" #define D_KNX_GROUP_ADDRESS_TO_READ "Group Addresses to Receive Data from" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "Received from" #define D_KNX_COMMAND_WRITE "Yaz" #define D_KNX_COMMAND_READ "Oku" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "None" #define D_SENSOR_USER "User" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "Wh" #define D_UNIT_WATT_METER_QUADRAT "W/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Phase Angle" #define D_IMPORT_ACTIVE "Import Active" diff --git a/tasmota/language/uk-UK.h b/tasmota/language/uk-UK.h index e71b499b8..f16d66648 100644 --- a/tasmota/language/uk-UK.h +++ b/tasmota/language/uk-UK.h @@ -427,7 +427,6 @@ #define D_DELETE "Видалити" #define D_REPLY "Повторити" #define D_KNX_GROUP_ADDRESS_TO_READ "Дані для читання групових адрес" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "Отримати з" #define D_KNX_COMMAND_WRITE "Записати" #define D_KNX_COMMAND_READ "Читати" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "Пд" #define D_TX20_WEST "Зх" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Немає" #define D_SENSOR_USER "Користувач" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "Вт/Год" #define D_UNIT_WATT_METER_QUADRAT "Вт/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Кут фази" #define D_IMPORT_ACTIVE "Активна вхід" diff --git a/tasmota/language/zh-CN.h b/tasmota/language/zh-CN.h index 93832fc07..2c8610400 100644 --- a/tasmota/language/zh-CN.h +++ b/tasmota/language/zh-CN.h @@ -427,7 +427,6 @@ #define D_DELETE "删除" #define D_REPLY "回复" #define D_KNX_GROUP_ADDRESS_TO_READ "用来接收数据的组地址" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "接收自" #define D_KNX_COMMAND_WRITE "写" #define D_KNX_COMMAND_READ "读" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "南" #define D_TX20_WEST "西" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "无" #define D_SENSOR_USER "User" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "瓦时" #define D_UNIT_WATT_METER_QUADRAT "瓦/平米" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "相位角" #define D_IMPORT_ACTIVE "有功输入" diff --git a/tasmota/language/zh-TW.h b/tasmota/language/zh-TW.h index f16077925..e5ef8926a 100644 --- a/tasmota/language/zh-TW.h +++ b/tasmota/language/zh-TW.h @@ -427,7 +427,6 @@ #define D_DELETE "Delete" #define D_REPLY "Reply" #define D_KNX_GROUP_ADDRESS_TO_READ "Group Addresses to Receive Data from" -#define D_LOG_KNX "KNX: " #define D_RECEIVED_FROM "Received from" #define D_KNX_COMMAND_WRITE "Write" #define D_KNX_COMMAND_READ "Read" @@ -508,9 +507,6 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" -//xsns_43_hre.ino -#define D_LOG_HRE "HRE: " - // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "None" #define D_SENSOR_USER "User" @@ -667,32 +663,6 @@ #define D_UNIT_WATTHOUR "瓦時" #define D_UNIT_WATT_METER_QUADRAT "W/m²" -// Log message prefix -#define D_LOG_APPLICATION "APP: " // Application -#define D_LOG_BRIDGE "BRG: " // Bridge -#define D_LOG_CONFIG "CFG: " // Settings -#define D_LOG_COMMAND "CMD: " // Command -#define D_LOG_DEBUG "DBG: " // Debug -#define D_LOG_DHT "DHT: " // DHT sensor -#define D_LOG_DOMOTICZ "DOM: " // Domoticz -#define D_LOG_DSB "DSB: " // DS18xB20 sensor -#define D_LOG_HTTP "HTP: " // HTTP webserver -#define D_LOG_I2C "I2C: " // I2C -#define D_LOG_IRR "IRR: " // Infra Red Received -#define D_LOG_LOG "LOG: " // Logging -#define D_LOG_MODULE "MOD: " // Module -#define D_LOG_MDNS "DNS: " // mDNS -#define D_LOG_MQTT "MQT: " // MQTT -#define D_LOG_OTHER "OTH: " // Other -#define D_LOG_RESULT "RSL: " // Result -#define D_LOG_RFR "RFR: " // RF Received -#define D_LOG_SERIAL "SER: " // Serial -#define D_LOG_SHT1 "SHT: " // SHT1x sensor -#define D_LOG_UPLOAD "UPL: " // Upload -#define D_LOG_UPNP "UPP: " // UPnP -#define D_LOG_WIFI "WIF: " // Wifi -#define D_LOG_ZIGBEE "ZIG: " // Zigbee - //SDM220 #define D_PHASE_ANGLE "Phase Angle" #define D_IMPORT_ACTIVE "Import Active"