mirror of https://github.com/arendst/Tasmota.git
Add command ``Wifi 5`` to enable 11ax on ESP32 Core3
This commit is contained in:
parent
fe89774fe0
commit
7c36029ec2
|
@ -6,6 +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
|
||||||
|
|
||||||
### Breaking Changed
|
### Breaking Changed
|
||||||
|
|
||||||
|
|
|
@ -118,6 +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 ``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)
|
||||||
|
|
|
@ -147,10 +147,13 @@ int WiFiClass32::getPhyMode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WiFiClass32::setPhyMode(WiFiPhyMode_t mode) {
|
bool WiFiClass32::setPhyMode(WiFiPhyMode_t mode) {
|
||||||
uint8_t protocol_bitmap = WIFI_PROTOCOL_11B; // 1
|
uint8_t protocol_bitmap = WIFI_PROTOCOL_11B; // 1
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 3: protocol_bitmap |= WIFI_PROTOCOL_11N; // 4
|
#if ESP_IDF_VERSION_MAJOR >= 5
|
||||||
case 2: protocol_bitmap |= WIFI_PROTOCOL_11G; // 2
|
case 4: protocol_bitmap |= WIFI_PROTOCOL_11AX; // 16
|
||||||
|
#endif
|
||||||
|
case 3: protocol_bitmap |= WIFI_PROTOCOL_11N; // 4
|
||||||
|
case 2: protocol_bitmap |= WIFI_PROTOCOL_11G; // 2
|
||||||
}
|
}
|
||||||
return (ESP_OK == esp_wifi_set_protocol(WIFI_IF_STA, protocol_bitmap));
|
return (ESP_OK == esp_wifi_set_protocol(WIFI_IF_STA, protocol_bitmap));
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,9 @@
|
||||||
typedef enum WiFiPhyMode
|
typedef enum WiFiPhyMode
|
||||||
{
|
{
|
||||||
TAS_WIFI_PHY_MODE_LR = 0, TAS_WIFI_PHY_MODE_11B = 1, TAS_WIFI_PHY_MODE_11G = 2, TAS_WIFI_PHY_MODE_11N = 3
|
TAS_WIFI_PHY_MODE_LR = 0, TAS_WIFI_PHY_MODE_11B = 1, TAS_WIFI_PHY_MODE_11G = 2, TAS_WIFI_PHY_MODE_11N = 3
|
||||||
|
#if ESP_IDF_VERSION_MAJOR >= 5
|
||||||
|
, TAS_WIFI_PHY_MODE_11AX = 4
|
||||||
|
#endif
|
||||||
} WiFiPhyMode_t;
|
} WiFiPhyMode_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -2686,8 +2686,7 @@ void CmndWifiPower(void) {
|
||||||
ResponseCmndFloat(WifiGetOutputPower(), 1);
|
ResponseCmndFloat(WifiGetOutputPower(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CmndWifi(void)
|
void CmndWifi(void) {
|
||||||
{
|
|
||||||
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 1)) {
|
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 1)) {
|
||||||
Settings->flag4.network_wifi = XdrvMailbox.payload;
|
Settings->flag4.network_wifi = XdrvMailbox.payload;
|
||||||
if (Settings->flag4.network_wifi) {
|
if (Settings->flag4.network_wifi) {
|
||||||
|
@ -2697,14 +2696,25 @@ void CmndWifi(void)
|
||||||
WifiEnable();
|
WifiEnable();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} else if ((XdrvMailbox.payload >= 2) && (XdrvMailbox.payload <= 4)) {
|
} else if ((XdrvMailbox.payload >= 2) &&
|
||||||
|
#ifdef ESP32
|
||||||
|
#if ESP_IDF_VERSION_MAJOR >= 5
|
||||||
|
(XdrvMailbox.payload <= 5)
|
||||||
|
#else // ESP_IDF_VERSION_MAJOR < 5
|
||||||
|
(XdrvMailbox.payload <= 4)
|
||||||
|
#endif // ESP_IDF_VERSION_MAJOR
|
||||||
|
#else // ESP8266
|
||||||
|
(XdrvMailbox.payload <= 4)
|
||||||
|
#endif // ESP32/ESP8266
|
||||||
|
) {
|
||||||
// Wifi 2 = B
|
// Wifi 2 = B
|
||||||
// Wifi 3 = BG
|
// Wifi 3 = BG
|
||||||
// Wifi 4 = BGN
|
// Wifi 4 = BGN
|
||||||
|
// Wifi 5 = BGNAX
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
Wifi.phy_mode = XdrvMailbox.payload - 1;
|
Wifi.phy_mode = XdrvMailbox.payload - 1;
|
||||||
#endif
|
#endif
|
||||||
WiFi.setPhyMode(WiFiPhyMode_t(XdrvMailbox.payload - 1)); // 1-B/2-BG/3-BGN
|
WiFi.setPhyMode(WiFiPhyMode_t(XdrvMailbox.payload - 1)); // 1-B/2-BG/3-BGN/4-BGNAX
|
||||||
}
|
}
|
||||||
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());
|
||||||
|
|
|
@ -228,7 +228,7 @@ void WifiBegin(uint8_t flag, uint8_t channel) {
|
||||||
// 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
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
if (Wifi.phy_mode) {
|
if (Wifi.phy_mode) {
|
||||||
WiFi.setPhyMode(WiFiPhyMode_t(Wifi.phy_mode)); // 1-B/2-BG/3-BGN
|
WiFi.setPhyMode(WiFiPhyMode_t(Wifi.phy_mode)); // 1-B/2-BG/3-BGN/4-BGNAX
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!WiFi.getAutoConnect()) { WiFi.setAutoConnect(true); }
|
if (!WiFi.getAutoConnect()) { WiFi.setAutoConnect(true); }
|
||||||
|
|
Loading…
Reference in New Issue