Change Wifi 5 to Wifi 6

This commit is contained in:
Theo Arends 2024-04-04 14:59:32 +02:00
parent ad3782bed1
commit db92a843fc
3 changed files with 34 additions and 24 deletions

View File

@ -6,7 +6,7 @@ All notable changes to this project will be documented in this file.
## [13.4.0.4] ## [13.4.0.4]
### Added ### Added
- Command ``PowerLock`` to disable power control of selected outputs (#21081) - Command ``PowerLock`` to disable power control of selected outputs (#21081)
- Command ``Wifi 5`` to enable 11ax on ESP32 Core3 - Command ``Wifi 6`` to enable 11ax on ESP32 Core3
### Breaking Changed ### Breaking Changed

View File

@ -118,7 +118,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
## Changelog v13.4.0.4 ## Changelog v13.4.0.4
### Added ### Added
- Command ``Wifi 5`` to enable 11ax on ESP32 Core3 - Command ``Wifi 6`` to enable 11ax on ESP32 Core3
- Command ``PowerLock`` to disable power control of selected outputs [#21081](https://github.com/arendst/Tasmota/issues/21081) - Command ``PowerLock`` to disable power control of selected outputs [#21081](https://github.com/arendst/Tasmota/issues/21081)
- Support for calculated heat index if temperature and humidity is available with ``#define USE_HEAT_INDEX`` [#4771](https://github.com/arendst/Tasmota/issues/4771) - Support for calculated heat index if temperature and humidity is available with ``#define USE_HEAT_INDEX`` [#4771](https://github.com/arendst/Tasmota/issues/4771)
- Support for LoRa and single channel EU863-870 LoRaWanBridge [#17790](https://github.com/arendst/Tasmota/issues/17790) - Support for LoRa and single channel EU863-870 LoRaWanBridge [#17790](https://github.com/arendst/Tasmota/issues/17790)

View File

@ -2692,34 +2692,44 @@ void CmndWifiPower(void) {
} }
void CmndWifi(void) { void CmndWifi(void) {
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 1)) { // Wifi - Show current state
Settings->flag4.network_wifi = XdrvMailbox.payload; // Wifi 0 - Off
if (Settings->flag4.network_wifi) { // Wifi 1 - On
// Wifi 2 - B
// Wifi 3 - BG
// Wifi 4 - BGN
// Wifi 6 - BGNAX
uint32_t option = XdrvMailbox.payload -1;
switch (XdrvMailbox.payload) {
case 0: // Wifi 0 = Off
case 1: // Wifi 1 = On
{
Settings->flag4.network_wifi = XdrvMailbox.payload;
if (Settings->flag4.network_wifi) {
#ifdef ESP32 #ifdef ESP32
WifiConnect(); WifiConnect();
#else #else // ESP8266
WifiEnable(); WifiEnable();
#endif #endif // ESP32
} }
} else if ((XdrvMailbox.payload >= 2) && break;
}
#ifdef ESP32 #ifdef ESP32
#if ESP_IDF_VERSION_MAJOR >= 5 #if ESP_IDF_VERSION_MAJOR >= 5
(XdrvMailbox.payload <= 5) case 6: // Wifi 6 = BGNAX
#else // ESP_IDF_VERSION_MAJOR < 5 option = 4;
(XdrvMailbox.payload <= 4)
#endif // ESP_IDF_VERSION_MAJOR #endif // ESP_IDF_VERSION_MAJOR
#else // ESP8266
(XdrvMailbox.payload <= 4)
#endif // ESP32/ESP8266 #endif // ESP32/ESP8266
) { case 4: // Wifi 4 = BGN
// Wifi 2 = B case 3: // Wifi 3 = BG
// Wifi 3 = BG case 2: // Wifi 2 = B
// Wifi 4 = BGN {
// Wifi 5 = BGNAX
#ifdef ESP32 #ifdef ESP32
Wifi.phy_mode = XdrvMailbox.payload - 1; Wifi.phy_mode = option;
#endif #endif // ESP32
WiFi.setPhyMode(WiFiPhyMode_t(XdrvMailbox.payload - 1)); // 1-B/2-BG/3-BGN/4-BGNAX WiFi.setPhyMode(WiFiPhyMode_t(option)); // 1=B/2=BG/3=BGN/4=BGNAX
break;
}
} }
Response_P(PSTR("{\"" D_JSON_WIFI "\":\"%s\",\"" D_JSON_WIFI_MODE "\":\"%s\"}"), Response_P(PSTR("{\"" D_JSON_WIFI "\":\"%s\",\"" D_JSON_WIFI_MODE "\":\"%s\"}"),
GetStateText(Settings->flag4.network_wifi), WifiGetPhyMode().c_str()); GetStateText(Settings->flag4.network_wifi), WifiGetPhyMode().c_str());