Skip to content

Commit 70877df

Browse files
rtrbtMattiasTF
authored andcommitted
WiFi: Disable 11b rates
802.11b has been obsolete for about 20 years. Keeping compatibility around slows down devices not 20 years old.
1 parent 83e4de5 commit 70877df

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

libraries/WiFi/src/WiFiGeneric.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ static bool espWiFiStop() {
450450

451451
bool WiFiGenericClass::_persistent = true;
452452
bool WiFiGenericClass::_long_range = false;
453+
bool WiFiGenericClass::_disable_sta_11b = true;
453454
wifi_mode_t WiFiGenericClass::_forceSleepLastMode = WIFI_MODE_NULL;
454455
#if CONFIG_IDF_TARGET_ESP32S2
455456
wifi_ps_type_t WiFiGenericClass::_sleepEnabled = WIFI_PS_NONE;
@@ -563,6 +564,15 @@ void WiFiGenericClass::enableLongRange(bool enable) {
563564
_long_range = enable;
564565
}
565566

567+
/**
568+
* disable 11b rates
569+
* @param disable
570+
*/
571+
void WiFiGenericClass::disableSTA11b(bool disable)
572+
{
573+
_disable_sta_11b = disable;
574+
}
575+
566576
/**
567577
* set new mode
568578
* @param m WiFiMode_t
@@ -672,6 +682,12 @@ bool WiFiGenericClass::mode(wifi_mode_t m) {
672682
}
673683
}
674684
}
685+
// 11b is long obsolete. true = disable. Don't care if it can't be disabled.
686+
// Disable both because neither can be changed when trying to switch mode later.
687+
// Always disable 11b on AP because beacons are sent at minimum rate.
688+
esp_wifi_config_11b_rate(WIFI_IF_STA, _disable_sta_11b);
689+
esp_wifi_config_11b_rate(WIFI_IF_AP, true);
690+
675691
if (!espWiFiStart()) {
676692
return false;
677693
}

libraries/WiFi/src/WiFiGeneric.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ class WiFiGenericClass {
102102

103103
void persistent(bool persistent);
104104
void enableLongRange(bool enable);
105+
void disableSTA11b(bool disable);
105106

106107
static bool mode(wifi_mode_t);
107108
static wifi_mode_t getMode();
@@ -143,6 +144,7 @@ class WiFiGenericClass {
143144
protected:
144145
static bool _persistent;
145146
static bool _long_range;
147+
static bool _disable_sta_11b;
146148
static wifi_mode_t _forceSleepLastMode;
147149
static wifi_ps_type_t _sleepEnabled;
148150
static bool _wifiUseStaticBuffers;

0 commit comments

Comments
 (0)