Change setting hostname to fixing ArduinoESP32 core 2.0.0

This commit is contained in:
Theo Arends 2021-07-05 14:50:33 +02:00
parent c08b6db1e3
commit 512d912b77
6 changed files with 11 additions and 10 deletions

View File

@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file.
- ESP32 Ethernet Phy Type information to IDF v3+ - ESP32 Ethernet Phy Type information to IDF v3+
- Allow buttons to work in AP normal mode (#12518) - 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) - 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 ### Fixed
- ESP32-C3 settings layout for configuration backup and restore - ESP32-C3 settings layout for configuration backup and restore

View File

@ -97,6 +97,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
## Changelog v9.5.0.2 ## Changelog v9.5.0.2
### Added ### Added
- Command ``SetOption127 1`` to force Wifi in no-sleep mode even if ``Sleep 0`` is not enabled
- Initial support for Tasmota Mesh (TasMesh) providing node/broker communication using ESP-NOW [#11939](https://github.com/arendst/Tasmota/issues/11939) - Initial support for Tasmota Mesh (TasMesh) providing node/broker communication using ESP-NOW [#11939](https://github.com/arendst/Tasmota/issues/11939)
- Berry ESP32 partition manager [#12465](https://github.com/arendst/Tasmota/issues/12465) - Berry ESP32 partition manager [#12465](https://github.com/arendst/Tasmota/issues/12465)
- Support for AM2320 Temperature and Humidity Sensor by Lars Wessels [#12485](https://github.com/arendst/Tasmota/issues/12485) - Support for AM2320 Temperature and Humidity Sensor by Lars Wessels [#12485](https://github.com/arendst/Tasmota/issues/12485)
@ -108,6 +109,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
- ESP32 Ethernet Phy Type information to IDF v3+ - ESP32 Ethernet Phy Type information to IDF v3+
- Speed up initial GUI console refresh - 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 - 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) - 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) - 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) - Allow buttons to work in AP normal mode [#12518](https://github.com/arendst/Tasmota/issues/12518)

View File

@ -156,7 +156,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
uint32_t wiegand_keypad_to_tag : 1; // bit 10 (v9.3.1.1) - SetOption124 - (Wiegand) send key pad stroke as single char (0) or one tag (ending char #) (1) uint32_t wiegand_keypad_to_tag : 1; // bit 10 (v9.3.1.1) - SetOption124 - (Wiegand) send key pad stroke as single char (0) or one tag (ending char #) (1)
uint32_t zigbee_hide_bridge_topic : 1; // bit 11 (v9.3.1.1) - SetOption125 - (Zigbee) Hide bridge topic from zigbee topic (use with SetOption89) (1) uint32_t zigbee_hide_bridge_topic : 1; // bit 11 (v9.3.1.1) - SetOption125 - (Zigbee) Hide bridge topic from zigbee topic (use with SetOption89) (1)
uint32_t ds18x20_mean : 1; // bit 12 (v9.3.1.2) - SetOption126 - (DS18x20) Enable arithmetic mean over teleperiod for JSON temperature (1) uint32_t ds18x20_mean : 1; // bit 12 (v9.3.1.2) - SetOption126 - (DS18x20) Enable arithmetic mean over teleperiod for JSON temperature (1)
uint32_t wifi_no_sleep : 1; // bit 13 (v9.5.0.2) - SetOption127 - (Wifi) keep wifi in no-sleep mode, prevents some occasional unresponsiveness uint32_t wifi_no_sleep : 1; // bit 13 (v9.5.0.2) - SetOption127 - (Wifi) Keep wifi in no-sleep mode, prevents some occasional unresponsiveness
uint32_t spare14 : 1; // bit 14 uint32_t spare14 : 1; // bit 14
uint32_t spare15 : 1; // bit 15 uint32_t spare15 : 1; // bit 15
uint32_t spare16 : 1; // bit 16 uint32_t spare16 : 1; // bit 16

View File

@ -112,11 +112,12 @@ void WifiConfig(uint8_t type)
} }
} }
void WifiSetMode(WiFiMode_t wifi_mode) void WifiSetMode(WiFiMode_t wifi_mode) {
{
if (WiFi.getMode() == wifi_mode) { return; } if (WiFi.getMode() == wifi_mode) { return; }
if (wifi_mode != WIFI_OFF) { if (wifi_mode != WIFI_OFF) {
WiFi.hostname(TasmotaGlobal.hostname); // Set hostname before WiFi.mode as needed for ESP32 core 2.0.0
// See: https://github.com/esp8266/Arduino/issues/6172#issuecomment-500457407 // See: https://github.com/esp8266/Arduino/issues/6172#issuecomment-500457407
WiFi.forceSleepWake(); // Make sure WiFi is really active. WiFi.forceSleepWake(); // Make sure WiFi is really active.
delay(100); delay(100);
@ -161,7 +162,7 @@ void WiFiSetSleepMode(void)
*/ */
bool wifi_no_sleep = Settings->flag5.wifi_no_sleep; bool wifi_no_sleep = Settings->flag5.wifi_no_sleep;
#ifdef CONFIG_IDF_TARGET_ESP32C3 #ifdef CONFIG_IDF_TARGET_ESP32C3
wifi_no_sleep = true; // temporary patch for IDF4.4, wifi sleeping may cause wifi drops wifi_no_sleep = true; // Temporary patch for IDF4.4, wifi sleeping may cause wifi drops
#endif #endif
if (0 == TasmotaGlobal.sleep || wifi_no_sleep) { if (0 == TasmotaGlobal.sleep || wifi_no_sleep) {
if (!TasmotaGlobal.wifi_stay_asleep) { if (!TasmotaGlobal.wifi_stay_asleep) {
@ -186,8 +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.persistent(false); // Solve possible wifi init errors (re-add at 6.2.1.16 #4044, #4083)
WiFi.disconnect(true); // Delete SDK wifi config WiFi.disconnect(true); // Delete SDK wifi config
delay(200); delay(200);
// WiFi.mode(WIFI_STA); // Disable AP mode WifiSetMode(WIFI_STA); // Disable AP mode
WifiSetMode(WIFI_STA);
WiFiSetSleepMode(); WiFiSetSleepMode();
// if (WiFi.getPhyMode() != WIFI_PHY_MODE_11N) { WiFi.setPhyMode(WIFI_PHY_MODE_11N); } // B/G/N // if (WiFi.getPhyMode() != WIFI_PHY_MODE_11N) { WiFi.setPhyMode(WIFI_PHY_MODE_11N); } // B/G/N
// if (WiFi.getPhyMode() != WIFI_PHY_MODE_11G) { WiFi.setPhyMode(WIFI_PHY_MODE_11G); } // B/G // if (WiFi.getPhyMode() != WIFI_PHY_MODE_11G) { WiFi.setPhyMode(WIFI_PHY_MODE_11G); } // B/G
@ -207,7 +207,6 @@ void WifiBegin(uint8_t flag, uint8_t channel)
if (Settings->ipv4_address[0]) { 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.config(Settings->ipv4_address[0], Settings->ipv4_address[1], Settings->ipv4_address[2], Settings->ipv4_address[3]); // Set static IP
} }
WiFi.hostname(TasmotaGlobal.hostname);
char stemp[40] = { 0 }; char stemp[40] = { 0 };
if (channel) { if (channel) {

View File

@ -594,11 +594,9 @@ void WifiManagerBegin(bool reset_only)
// setup AP // setup AP
if (!Web.initial_config) { AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_WCFG_2_WIFIMANAGER " " D_ACTIVE_FOR_3_MINUTES)); } if (!Web.initial_config) { AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_WCFG_2_WIFIMANAGER " " D_ACTIVE_FOR_3_MINUTES)); }
if (!TasmotaGlobal.global_state.wifi_down) { if (!TasmotaGlobal.global_state.wifi_down) {
// WiFi.mode(WIFI_AP_STA);
WifiSetMode(WIFI_AP_STA); WifiSetMode(WIFI_AP_STA);
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_WIFIMANAGER_SET_ACCESSPOINT_AND_STATION)); AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_WIFIMANAGER_SET_ACCESSPOINT_AND_STATION));
} else { } else {
// WiFi.mode(WIFI_AP);
WifiSetMode(WIFI_AP); WifiSetMode(WIFI_AP);
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_WIFIMANAGER_SET_ACCESSPOINT)); AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_WIFIMANAGER_SET_ACCESSPOINT));
} }

View File

@ -181,7 +181,8 @@ a_setoption = [[
"(Wiegand) send key pad stroke as single char (0) or one tag (ending char #) (1)", "(Wiegand) send key pad stroke as single char (0) or one tag (ending char #) (1)",
"(Zigbee) Hide bridge topic from zigbee topic (use with SetOption89) (1)", "(Zigbee) Hide bridge topic from zigbee topic (use with SetOption89) (1)",
"(DS18x20) Enable arithmetic mean over teleperiod for JSON temperature (1)", "(DS18x20) Enable arithmetic mean over teleperiod for JSON temperature (1)",
"","","", "(Wifi) Keep wifi in no-sleep mode, prevents some occasional unresponsiveness",
"","",
"","","","", "","","","",
"","","","", "","","","",
"","","","", "","","","",