From 60fabf65a7b2f69399547ec194ce853c77631755 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Mon, 5 Jul 2021 17:11:03 +0200 Subject: [PATCH] Fix regression ESP8266 setting hostname --- CHANGELOG.md | 2 +- RELEASENOTES.md | 2 +- tasmota/support_wifi.ino | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40b11fc2a..e58d2322d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,10 +14,10 @@ All notable changes to this project will be documented in this file. - ESP32 Ethernet Phy Type information to IDF v3+ - Allow buttons to work in AP normal mode (#12518) - Enable Ping and rule features for any device compiled with more than 1M flash size (#12539) -- Setting hostname to fixing ArduinoESP32 core 2.0.0 ### Fixed - ESP32-C3 settings layout for configuration backup and restore +- ESP32 core v2.0.0 setting hostname - Berry button handlers and error messages (#12521) - Scripter and Display MQTT errors due to MQTT_DATA move to String (#12525) - Scripter moving average and sml input validation (#12541) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 5e8c77495..955fe79df 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -109,13 +109,13 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo - ESP32 Ethernet Phy Type information to IDF v3+ - Speed up initial GUI console refresh - Enable UFILESYS, GUI_TRASH_FILE and GUI_EDIT_FILE for any device compiled with more than 1M flash size -- Setting hostname to fixing ArduinoESP32 core 2.0.0 - Simplified configuration for ir-full and removal of tasmota-ircustom [#12428](https://github.com/arendst/Tasmota/issues/12428) - Refactor platformio [#12442](https://github.com/arendst/Tasmota/issues/12442) - Allow buttons to work in AP normal mode [#12518](https://github.com/arendst/Tasmota/issues/12518) - Enable Ping and rule features for any device compiled with more than 1M flash size [#12539](https://github.com/arendst/Tasmota/issues/12539) ### Fixed +- ESP32 core v2.0.0 setting hostname - ESP32-C3 settings layout for configuration backup and restore - DDS238-2 wrong reactive power value [#12283](https://github.com/arendst/Tasmota/issues/12283) - ESP32 Webcam add boundary marker before sending mjpeg image [#12376](https://github.com/arendst/Tasmota/issues/12376) diff --git a/tasmota/support_wifi.ino b/tasmota/support_wifi.ino index 8c4fc945b..6f61f41ab 100644 --- a/tasmota/support_wifi.ino +++ b/tasmota/support_wifi.ino @@ -116,7 +116,7 @@ void WifiSetMode(WiFiMode_t wifi_mode) { if (WiFi.getMode() == wifi_mode) { return; } if (wifi_mode != WIFI_OFF) { - WiFi.hostname(TasmotaGlobal.hostname); // Set hostname before WiFi.mode as needed for ESP32 core 2.0.0 + WiFi.hostname(TasmotaGlobal.hostname); // ESP32 needs this here (before WiFi.mode) for core 2.0.0 // See: https://github.com/esp8266/Arduino/issues/6172#issuecomment-500457407 WiFi.forceSleepWake(); // Make sure WiFi is really active. @@ -187,6 +187,7 @@ void WifiBegin(uint8_t flag, uint8_t channel) WiFi.persistent(false); // Solve possible wifi init errors (re-add at 6.2.1.16 #4044, #4083) WiFi.disconnect(true); // Delete SDK wifi config delay(200); + WifiSetMode(WIFI_STA); // Disable AP mode WiFiSetSleepMode(); // if (WiFi.getPhyMode() != WIFI_PHY_MODE_11N) { WiFi.setPhyMode(WIFI_PHY_MODE_11N); } // B/G/N @@ -207,6 +208,7 @@ void WifiBegin(uint8_t flag, uint8_t channel) if (Settings->ipv4_address[0]) { WiFi.config(Settings->ipv4_address[0], Settings->ipv4_address[1], Settings->ipv4_address[2], Settings->ipv4_address[3]); // Set static IP } + WiFi.hostname(TasmotaGlobal.hostname); // ESP8266 needs this here (after WiFi.mode) char stemp[40] = { 0 }; if (channel) {