mirror of https://github.com/arendst/Tasmota.git
Change ESP32 WiFi phy modes 11n and 11ax represented as HT20, HT40 and HE20 (#19350)
This commit is contained in:
parent
0814acb8dc
commit
4b44d2fa32
|
@ -18,6 +18,7 @@ All notable changes to this project will be documented in this file.
|
|||
- ESP32 LVGL library from v9.0.0 to v9.1.0 (#21008)
|
||||
- berry.exe (pre-compiled for Windows) updated to latest Berry patches (#21024)
|
||||
- Some `display.ini` to utouch (#21029)
|
||||
- ESP32 WiFi phy modes 11n and 11ax represented as HT20, HT40 and HE20 (#19350)
|
||||
|
||||
### Fixed
|
||||
- BTHome, prep BLE5 (#20989)
|
||||
|
|
|
@ -151,6 +151,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
|
|||
- NeoPool webUI pH alarms (4 & 5) completed (#20743)[#20743](https://github.com/arendst/Tasmota/issues/20743)
|
||||
- Prevent shutter MQTT broadcast with activated ShutterLock [#20827](https://github.com/arendst/Tasmota/issues/20827)
|
||||
- Some `display.ini` to utouch [#21029](https://github.com/arendst/Tasmota/issues/21029)
|
||||
- ESP32 WiFi phy modes 11n and 11ax represented as HT20, HT40 and HE20 [#19350](https://github.com/arendst/Tasmota/issues/19350)
|
||||
- berry.exe (pre-compiled for Windows) updated to latest Berry patches [#21024](https://github.com/arendst/Tasmota/issues/21024)
|
||||
- Berry class `int64` made immutable [#20727](https://github.com/arendst/Tasmota/issues/20727)
|
||||
- Matter reduce memory usage when reading with wildcards [#20809](https://github.com/arendst/Tasmota/issues/20809)
|
||||
|
|
|
@ -124,13 +124,24 @@ void WiFiClass32::setSleepMode(int iSleepMode) {
|
|||
}
|
||||
|
||||
int WiFiClass32::getPhyMode() {
|
||||
int phy_mode = 0; // " BGNL"
|
||||
uint8_t protocol_bitmap;
|
||||
if (esp_wifi_get_protocol(WIFI_IF_STA, &protocol_bitmap) == ESP_OK) {
|
||||
if (protocol_bitmap & 1) { phy_mode = TAS_WIFI_PHY_MODE_11B; } // 1 = 11b (WIFI_PHY_MODE_11B)
|
||||
if (protocol_bitmap & 2) { phy_mode = TAS_WIFI_PHY_MODE_11G; } // 2 = 11bg (WIFI_PHY_MODE_11G)
|
||||
if (protocol_bitmap & 4) { phy_mode = TAS_WIFI_PHY_MODE_11N; } // 3 = 11bgn (WIFI_PHY_MODE_11N)
|
||||
if (protocol_bitmap & 8) { phy_mode = 4; } // Low rate (WIFI_PHY_MODE_LR)
|
||||
/*
|
||||
typedef enum
|
||||
{
|
||||
WIFI_PHY_MODE_LR, // PHY mode for Low Rate
|
||||
WIFI_PHY_MODE_11B, // PHY mode for 11b
|
||||
WIFI_PHY_MODE_11G, // PHY mode for 11g
|
||||
WIFI_PHY_MODE_HT20, // PHY mode for Bandwidth HT20 (11n)
|
||||
WIFI_PHY_MODE_HT40, // PHY mode for Bandwidth HT40 (11n)
|
||||
WIFI_PHY_MODE_HE20, // PHY mode for Bandwidth HE20 (11ax)
|
||||
} wifi_phy_mode_t;
|
||||
*/
|
||||
int phy_mode = 0; // "low rate|11b|11g|HT20|HT40|HE20"
|
||||
wifi_phy_mode_t WiFiMode;
|
||||
if (esp_wifi_sta_get_negotiated_phymode(&WiFiMode) == ESP_OK) {
|
||||
phy_mode = (int)WiFiMode;
|
||||
if (phy_mode > 5) {
|
||||
phy_mode = 5;
|
||||
}
|
||||
}
|
||||
return phy_mode;
|
||||
}
|
||||
|
|
|
@ -126,8 +126,6 @@ const uint8_t MAX_BUTTON_TEXT = 32; // Max number of GUI button labels
|
|||
const uint8_t MAX_GROUP_TOPICS = 4; // Max number of Group Topics
|
||||
const uint8_t MAX_DEV_GROUP_NAMES = 4; // Max number of Device Group names
|
||||
|
||||
const static char kWifiPhyMode[] PROGMEM = " bgnl"; // Wi-Fi Modes
|
||||
|
||||
#ifdef ESP8266
|
||||
const uint8_t MAX_ADCS = 1; // Max number of ESP8266 ADC pins
|
||||
const uint8_t MAX_SWITCHES_TXT = 8; // Max number of switches user text
|
||||
|
|
|
@ -2686,7 +2686,8 @@ void CmndWifi(void)
|
|||
#endif
|
||||
WiFi.setPhyMode(WiFiPhyMode_t(XdrvMailbox.payload - 1)); // 1-B/2-BG/3-BGN
|
||||
}
|
||||
Response_P(PSTR("{\"" D_JSON_WIFI "\":\"%s\",\"" D_JSON_WIFI_MODE "\":\"11%c\"}"), GetStateText(Settings->flag4.network_wifi), pgm_read_byte(&kWifiPhyMode[WiFi.getPhyMode() & 0x3]) );
|
||||
Response_P(PSTR("{\"" D_JSON_WIFI "\":\"%s\",\"" D_JSON_WIFI_MODE "\":\"%s\"}"),
|
||||
GetStateText(Settings->flag4.network_wifi), WifiGetPhyMode().c_str());
|
||||
}
|
||||
|
||||
void CmndDnsTimeout(void) {
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
* ESP32, ESP32-S2, ESP32-S3, ESP32-C2, ESP32-C3, ESP32-C6 and ESP32-H2 Support
|
||||
\*********************************************************************************************/
|
||||
|
||||
// 11b 11g 11n 11n 11ax
|
||||
const static char kWifiPhyMode[] PROGMEM = "low rate|11b|11g|HT20|HT40|HE20"; // Wi-Fi Modes
|
||||
|
||||
#include "soc/soc.h"
|
||||
#include "soc/spi_reg.h"
|
||||
// ESP32_ARCH contains the name of the architecture (used by autoconf)
|
||||
|
@ -976,6 +979,11 @@ String ESP_getEfuseMac(void) {
|
|||
return String(ESP.getEfuseMac());
|
||||
}
|
||||
|
||||
String WifiGetPhyMode(void) {
|
||||
char stemp[10];
|
||||
return String(GetTextIndexed(stemp, sizeof(stemp), WiFi.getPhyMode(), kWifiPhyMode));
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
* High entropy hardware random generator
|
||||
* Thanks to DigitalAlchemist
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
* ESP8266 and ESP8285 Support
|
||||
\*********************************************************************************************/
|
||||
|
||||
const static char kWifiPhyMode[] PROGMEM = "low rate|11b|11g|11n"; // Wi-Fi Modes
|
||||
|
||||
extern "C" {
|
||||
extern struct rst_info resetInfo;
|
||||
}
|
||||
|
@ -258,6 +260,11 @@ String ESP_getEfuseMac(void) {
|
|||
return String(macStr);
|
||||
}
|
||||
|
||||
String WifiGetPhyMode(void) {
|
||||
char stemp[10];
|
||||
return String(GetTextIndexed(stemp, sizeof(stemp), WiFi.getPhyMode() & 0x3, kWifiPhyMode));
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
* High entropy hardware random generator
|
||||
* Thanks to DigitalAlchemist
|
||||
|
|
|
@ -877,9 +877,9 @@ void MqttShowState(void)
|
|||
|
||||
if (!TasmotaGlobal.global_state.wifi_down) {
|
||||
int32_t rssi = WiFi.RSSI();
|
||||
ResponseAppend_P(PSTR(",\"" D_JSON_WIFI "\":{\"" D_JSON_AP "\":%d,\"" D_JSON_SSID "\":\"%s\",\"" D_JSON_BSSID "\":\"%s\",\"" D_JSON_CHANNEL "\":%d,\"" D_JSON_WIFI_MODE "\":\"11%c\",\"" D_JSON_RSSI "\":%d,\"" D_JSON_SIGNAL "\":%d,\"" D_JSON_LINK_COUNT "\":%d,\"" D_JSON_DOWNTIME "\":\"%s\"}"),
|
||||
ResponseAppend_P(PSTR(",\"" D_JSON_WIFI "\":{\"" D_JSON_AP "\":%d,\"" D_JSON_SSID "\":\"%s\",\"" D_JSON_BSSID "\":\"%s\",\"" D_JSON_CHANNEL "\":%d,\"" D_JSON_WIFI_MODE "\":\"%s\",\"" D_JSON_RSSI "\":%d,\"" D_JSON_SIGNAL "\":%d,\"" D_JSON_LINK_COUNT "\":%d,\"" D_JSON_DOWNTIME "\":\"%s\"}"),
|
||||
Settings->sta_active +1, EscapeJSONString(SettingsText(SET_STASSID1 + Settings->sta_active)).c_str(), WiFi.BSSIDstr().c_str(), WiFi.channel(),
|
||||
pgm_read_byte(&kWifiPhyMode[WiFi.getPhyMode() & 0x3]), WifiGetRssiAsQuality(rssi), rssi,
|
||||
WifiGetPhyMode().c_str(), WifiGetRssiAsQuality(rssi), rssi,
|
||||
WifiLinkCount(), WifiDowntime().c_str());
|
||||
}
|
||||
|
||||
|
|
|
@ -259,8 +259,8 @@ void WifiBegin(uint8_t flag, uint8_t channel) {
|
|||
WiFi.begin(SettingsText(SET_STASSID1 + Settings->sta_active), SettingsText(SET_STAPWD1 + Settings->sta_active));
|
||||
}
|
||||
delay(500);
|
||||
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECTING_TO_AP "%d %s%s " D_IN_MODE " 11%c " D_AS " %s..."),
|
||||
Settings->sta_active +1, SettingsText(SET_STASSID1 + Settings->sta_active), stemp, pgm_read_byte(&kWifiPhyMode[WiFi.getPhyMode() & 0x3]), TasmotaGlobal.hostname);
|
||||
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECTING_TO_AP "%d %s%s " D_IN_MODE " %s " D_AS " %s..."),
|
||||
Settings->sta_active +1, SettingsText(SET_STASSID1 + Settings->sta_active), stemp, WifiGetPhyMode().c_str(), TasmotaGlobal.hostname);
|
||||
|
||||
if (Settings->flag5.wait_for_wifi_result) { // SetOption142 - (Wifi) Wait 1 second for wifi connection solving some FRITZ!Box modem issues (1)
|
||||
WiFi.waitForConnectResult(1000); // https://github.com/arendst/Tasmota/issues/14985
|
||||
|
|
|
@ -2439,11 +2439,11 @@ void HandleInformation(void) {
|
|||
}
|
||||
if (Settings->flag4.network_wifi) {
|
||||
int32_t rssi = WiFi.RSSI();
|
||||
WSContentSend_P(PSTR("}1" D_AP "%d " D_INFORMATION "}2" D_SSID " %s<br>" D_RSSI " %d%%, %d dBm<br>" D_MODE " 11%c<br>" D_CHANNEL " %d<br>" D_BSSID " %s"),
|
||||
WSContentSend_P(PSTR("}1" D_AP "%d " D_INFORMATION "}2" D_SSID " %s<br>" D_RSSI " %d%%, %d dBm<br>" D_MODE " %s<br>" D_CHANNEL " %d<br>" D_BSSID " %s"),
|
||||
Settings->sta_active +1,
|
||||
SettingsTextEscaped(SET_STASSID1 + Settings->sta_active).c_str(),
|
||||
WifiGetRssiAsQuality(rssi), rssi,
|
||||
pgm_read_byte(&kWifiPhyMode[WiFi.getPhyMode() & 0x3]),
|
||||
WifiGetPhyMode().c_str(),
|
||||
WiFi.channel(),
|
||||
WiFi.BSSIDstr().c_str());
|
||||
WSContentSeparatorIFat();
|
||||
|
|
Loading…
Reference in New Issue