diff --git a/CHANGELOG.md b/CHANGELOG.md index e9b6c414a..50fb5596a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ All notable changes to this project will be documented in this file. - Support for Lithuanian language translations by zzdovydas (#22971) - `MqttTLS` field in `Status 6` to indicate if the MQTT connection is encrypted (#22995) - Support for WiZ Smart Remote using `#define USE_WIZMOTE` and command `SetOption164 1` -- Berry add `bytes().appendb64()` (#22767) +- Berry `bytes().appendb64()` (#22767) ### Breaking Changed diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 9559a210f..b7a143e77 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -153,6 +153,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm - Berry unicode encoding to string parsing [#22713](https://github.com/arendst/Tasmota/issues/22713) - Berry light_pixels values to `tasmota.settings` [#22762](https://github.com/arendst/Tasmota/issues/22762) - Berry `tasmota.defer()` [#22976](https://github.com/arendst/Tasmota/issues/22976) +- Berry `bytes().appendb64()` [#22767](https://github.com/arendst/Tasmota/issues/22767) - LVLG/HASPmota add color names from OpenHASP [#22879](https://github.com/arendst/Tasmota/issues/22879) - LVGL `lv.set_paint_cb()` to register a callback when screen is refreshed [#22909](https://github.com/arendst/Tasmota/issues/22909) - HASPmota support for `buttonmatrix` events [#22898](https://github.com/arendst/Tasmota/issues/22898) diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index ef6d61c25..2b7855972 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -420,6 +420,7 @@ // #define USE_TASMESH_HEARTBEAT // If enabled, the broker will detect when nodes come online and offline and send Birth and LWT messages over MQTT correspondingly // #define TASMESH_OFFLINE_DELAY 3 // Maximum number of seconds since the last heartbeat before the broker considers a node to be offline //#define USE_WIZMOTE // [SetOption164 1] Add support for WiZ Smart Remote (uses ESP-NOW) (+4k2 code) +// #define WIZMOTE_CHANNEL 1 // WiZ Smart Remote ESP-NOW channel if WiFi is disabled // -- OTA ----------------------------------------- //#define USE_ARDUINO_OTA // Add optional support for Arduino OTA with ESP8266 (+13k code) diff --git a/tasmota/tasmota_support/support_command.ino b/tasmota/tasmota_support/support_command.ino index f8ce1070e..cf6ba7c7b 100644 --- a/tasmota/tasmota_support/support_command.ino +++ b/tasmota/tasmota_support/support_command.ino @@ -2750,6 +2750,8 @@ void CmndWifi(void) { { Settings->flag4.network_wifi = XdrvMailbox.payload; if (Settings->flag4.network_wifi) { +// TasmotaGlobal.wifi_state_flag = WIFI_RESTART; +// WifiConnect(); #ifdef ESP32 WifiConnect(); #else // ESP8266 diff --git a/tasmota/tasmota_xdrv_driver/xdrv_77_wizmote.ino b/tasmota/tasmota_xdrv_driver/xdrv_77_wizmote.ino index 29b8fdd7f..13194e7ae 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_77_wizmote.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_77_wizmote.ino @@ -22,6 +22,10 @@ #define XDRV_77 77 +#ifndef WIZMOTE_CHANNEL +#define WIZMOTE_CHANNEL 1 // WiZ Smart Remote ESP-NOW channel if WiFi is disabled +#endif + #include struct WizMote { @@ -138,7 +142,7 @@ void EspNowDataReceived(uint8_t* mac, uint8_t* data, uint8_t len, signed int rss char _destMAC[18]; ToHex_P(mac, 6, _destMAC, 18, ':'); - AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("NOW: ESP-NOW Rcvd %*_H, RSSI %d dBm, From %s, %s"), + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("NOW: Rcvd %*_H, RSSI %d, MAC %s, %s"), len, data, rssi, _destMAC, broadcast ? "Broadcast" : "Unicast"); if (data[0] == 0x91 || data[0] == 0x81 || data[0] == 0x80) { @@ -147,21 +151,32 @@ void EspNowDataReceived(uint8_t* mac, uint8_t* data, uint8_t len, signed int rss } void EspNowInit(void) { - if (0 == Settings->flag4.network_wifi) { // WiFi Off + if (0 == Settings->flag4.network_wifi) { // WiFi Off .. + if (!TasmotaGlobal.global_state.wifi_down) { return; } // .. and processed by WifiDisable() + if (1 == WizMote.active) { + WizMote.active--; // Add a second delay + return; + } if (WizMote.active != 2) { - uint32_t channel = 1; + +// AddLog(LOG_LEVEL_DEBUG, PSTR("NOW: Status %d, SSID '%s', Ch %d, IP %s, MAC %s"), +// WiFi.status(), WiFi.SSID().c_str(), WiFi.channel(), WiFi.localIP().toString().c_str(), WiFi.macAddress().c_str()); + + WiFi.mode(WIFI_STA); +#ifdef ESP32 + WiFi.disconnect(false, true); +#else + WiFi.disconnect(false); +#endif // ESP32 + +// AddLog(LOG_LEVEL_DEBUG, PSTR("NOW: Status %d, SSID '%s', Ch %d, IP %s, MAC %s"), +// WiFi.status(), WiFi.SSID().c_str(), WiFi.channel(), WiFi.localIP().toString().c_str(), WiFi.macAddress().c_str()); quickEspNow.stop(); - delay(500); // Allow time to finish stopped WiFi by WifiDisable() - WiFi.mode(WIFI_STA); -#if defined ESP32 - WiFi.disconnect(false, true); -#elif defined ESP8266 - WiFi.disconnect(false); -#endif //ESP32 - quickEspNow.onDataRcvd(EspNowDataReceived); - if (quickEspNow.begin(channel)) { // Specify channel if no connected WiFi - AddLog(LOG_LEVEL_INFO, PSTR("NOW: ESP-NOW started on channel %d"), channel); + if (quickEspNow.begin(WIZMOTE_CHANNEL)) { // Specify channel if no connected WiFi + quickEspNow.onDataRcvd(EspNowDataReceived); + Settings->flag.global_state = 1; // SetOption31 - (Wifi, MQTT) Control link led blinking (1) + AddLog(LOG_LEVEL_INFO, PSTR("NOW: Started on channel " STR(WIZMOTE_CHANNEL))); WizMote.active = 2; } } @@ -171,9 +186,9 @@ void EspNowInit(void) { } else if (WizMote.active != 1) { quickEspNow.stop(); - quickEspNow.onDataRcvd(EspNowDataReceived); if (quickEspNow.begin()) { - AddLog(LOG_LEVEL_INFO, PSTR("NOW: ESP-NOW started")); + quickEspNow.onDataRcvd(EspNowDataReceived); + AddLog(LOG_LEVEL_INFO, PSTR("NOW: Started")); WizMote.active = 1; } } @@ -185,7 +200,14 @@ void EspNowInit(void) { \*********************************************************************************************/ bool Xdrv77(uint32_t function) { - if (!Settings->flag6.wizmote_enabled) { return false; } // SetOption164 - (WizMote) Enable WiZ Smart Remote support (1) + if (!Settings->flag6.wizmote_enabled) { // SetOption164 - (WizMote) Enable WiZ Smart Remote support (1) + if (WizMote.active) { + quickEspNow.stop(); + AddLog(LOG_LEVEL_INFO, PSTR("NOW: Stopped")); + WizMote.active = 0; + } + return false; + } bool result = false;