1
- From ae2270cb8d16c9cb3b63707ef67b03255943d160 Mon Sep 17 00:00:00 2001
2
- From: =?UTF-8?q?Mattias=20Sch=C3=A4ffersmann?= <mattias @tinkerforge.com>
3
- Date: Thu, 23 May 2024 17:13:04 +0200
1
+ From e9f4396e362918b8fe535c764b222dcec941f8e2 Mon Sep 17 00:00:00 2001
2
+ From: Erik Fleckstein <erik @tinkerforge.com>
3
+ Date: Wed, 16 Oct 2024 10:54:17 +0200
4
4
Subject: [PATCH] WiFi: Disable 11b rates
5
5
6
6
802.11b has been obsolete for about 20 years. Keeping compatibility around
7
7
slows down devices not 20 years old.
8
8
---
9
- libraries/WiFi/src/WiFiGeneric.cpp | 15 +++++++++++++++
9
+ libraries/WiFi/src/WiFiGeneric.cpp | 16 + +++++++++++++++
10
10
libraries/WiFi/src/WiFiGeneric.h | 2 ++
11
- 2 files changed, 17 insertions(+)
11
+ 2 files changed, 18 insertions(+)
12
12
13
13
diff --git a/libraries/WiFi/src/WiFiGeneric.cpp b/libraries/WiFi/src/WiFiGeneric.cpp
14
- index 98fb6e60..d7328f8d 100644
14
+ index ccc95181..2f363389 100644
15
15
--- a/libraries/WiFi/src/WiFiGeneric.cpp
16
16
+++ b/libraries/WiFi/src/WiFiGeneric.cpp
17
- @@ -766 ,6 +766 ,7 @@ static std::vector<WiFiEventCbList_t> cbEventList;
17
+ @@ -333 ,6 +333 ,7 @@ static bool espWiFiStop() {
18
18
19
19
bool WiFiGenericClass::_persistent = true;
20
20
bool WiFiGenericClass::_long_range = false;
21
21
+ bool WiFiGenericClass::_disable_sta_11b = true;
22
22
wifi_mode_t WiFiGenericClass::_forceSleepLastMode = WIFI_MODE_NULL;
23
23
#if CONFIG_IDF_TARGET_ESP32S2
24
24
wifi_ps_type_t WiFiGenericClass::_sleepEnabled = WIFI_PS_NONE;
25
- @@ -1238 ,6 +1239,14 @@ void WiFiGenericClass::enableLongRange(bool enable)
26
- _long_range = enable;
25
+ @@ -444 ,6 +445,15 @@ void WiFiGenericClass::enableLongRange(bool enable) {
26
+ _long_range = enable;
27
27
}
28
28
29
29
+ /**
@@ -34,42 +34,43 @@ index 98fb6e60..d7328f8d 100644
34
34
+ {
35
35
+ _disable_sta_11b = disable;
36
36
+ }
37
-
37
+ +
38
38
/**
39
39
* set new mode
40
- @@ -1286,6 +1295,12 @@ bool WiFiGenericClass::mode(wifi_mode_t m)
41
- }
42
- }
40
+ * @param m WiFiMode_t
41
+ @@ -526,6 +536,12 @@ bool WiFiGenericClass::mode(wifi_mode_t m) {
42
+ }
43
43
}
44
- + // 11b is long obsolete. true = disable. Don't care if it can't be disabled.
45
- + // Disable both because neither can be changed when trying to switch mode later.
46
- + // Always disable 11b on AP because beacons are sent at minimum rate.
47
- + esp_wifi_config_11b_rate(WIFI_IF_STA, _disable_sta_11b);
48
- + esp_wifi_config_11b_rate(WIFI_IF_AP, true);
44
+ }
45
+ + // 11b is long obsolete. true = disable. Don't care if it can't be disabled.
46
+ + // Disable both because neither can be changed when trying to switch mode later.
47
+ + // Always disable 11b on AP because beacons are sent at minimum rate.
48
+ + esp_wifi_config_11b_rate(WIFI_IF_STA, _disable_sta_11b);
49
+ + esp_wifi_config_11b_rate(WIFI_IF_AP, true);
49
50
+
50
- if (!espWiFiStart()){
51
- return false;
52
- }
51
+ if (!espWiFiStart()) {
52
+ return false;
53
+ }
53
54
diff --git a/libraries/WiFi/src/WiFiGeneric.h b/libraries/WiFi/src/WiFiGeneric.h
54
- index 894c1346..e5d04100 100644
55
+ index 2a5ca812..1886b95b 100644
55
56
--- a/libraries/WiFi/src/WiFiGeneric.h
56
57
+++ b/libraries/WiFi/src/WiFiGeneric.h
57
- @@ -173 ,6 +173 ,7 @@ class WiFiGenericClass
58
+ @@ -92 ,6 +92 ,7 @@ public:
58
59
59
- void persistent(bool persistent);
60
- void enableLongRange(bool enable);
61
- + void disableSTA11b(bool disable);
60
+ void persistent(bool persistent);
61
+ void enableLongRange(bool enable);
62
+ + void disableSTA11b(bool disable);
62
63
63
- static bool mode(wifi_mode_t);
64
- static wifi_mode_t getMode();
65
- @@ -205 ,6 +206 ,7 @@ class WiFiGenericClass
66
- protected:
67
- static bool _persistent;
68
- static bool _long_range;
69
- + static bool _disable_sta_11b;
70
- static wifi_mode_t _forceSleepLastMode;
71
- static wifi_ps_type_t _sleepEnabled;
72
- static bool _wifiUseStaticBuffers;
64
+ static bool mode(wifi_mode_t);
65
+ static wifi_mode_t getMode();
66
+ @@ -133 ,6 +134 ,7 @@ public:
67
+ protected:
68
+ static bool _persistent;
69
+ static bool _long_range;
70
+ + static bool _disable_sta_11b;
71
+ static wifi_mode_t _forceSleepLastMode;
72
+ static wifi_ps_type_t _sleepEnabled;
73
+ static bool _wifiUseStaticBuffers;
73
74
- -
74
- 2.39.2
75
+ 2.47.0
75
76
0 commit comments