Skip to content

Commit

Permalink
patches: Update for ESP-IDF 5.3 and arduino-esp32 3.1.
Browse files Browse the repository at this point in the history
Remove patches that were backported to 4.4 or are just not necessary
anymore. Update other patches to compile against the new versions.

Currently not all patches are applied automatically, for example
lib-builder/managed_components/*
  • Loading branch information
rtrbt committed Oct 24, 2024
1 parent 2c1127c commit e9559ca
Show file tree
Hide file tree
Showing 32 changed files with 506 additions and 1,221 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
From 0cd6d432a38a5ff1a89f34778fec9df78236fd08 Mon Sep 17 00:00:00 2001
From 2b8d6d219b740426a957a525ea43392fefc5fd7b Mon Sep 17 00:00:00 2001
From: Erik Fleckstein <[email protected]>
Date: Fri, 3 Dec 2021 14:02:41 +0100
Date: Wed, 16 Oct 2024 10:41:08 +0200
Subject: [PATCH] ETH: Make eth_handle public.

---
libraries/Ethernet/src/ETH.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libraries/Ethernet/src/ETH.h b/libraries/Ethernet/src/ETH.h
index 918cd357..824b066d 100644
index 14d2d042..10ab283b 100644
--- a/libraries/Ethernet/src/ETH.h
+++ b/libraries/Ethernet/src/ETH.h
@@ -57,7 +57,7 @@ typedef enum { ETH_PHY_LAN8720, ETH_PHY_TLK110, ETH_PHY_RTL8201, ETH_PHY_DP83848
#define ETH_PHY_IP101 ETH_PHY_TLK110
@@ -182,8 +182,8 @@ protected:
public:
void _onEthEvent(int32_t event_id, void *event_data);

class ETHClass {
- private:
+ public:
bool initialized;
bool staticIP;
#if ESP_IDF_VERSION_MAJOR > 3
-private:
esp_eth_handle_t _eth_handle;
+private:
uint8_t _eth_index;
eth_phy_type_t _phy_type;
esp_eth_netif_glue_handle_t _glue_handle;
--
2.33.1
2.47.0

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,47 +1,45 @@
From bd8c0377eac15db67cac1746bebc411aeed94933 Mon Sep 17 00:00:00 2001
From 84d66d04511edab3be8c2f62f982f342326522e4 Mon Sep 17 00:00:00 2001
From: Erik Fleckstein <[email protected]>
Date: Mon, 13 Nov 2023 13:09:19 +0100
Date: Wed, 16 Oct 2024 10:49:53 +0200
Subject: [PATCH] Remove automatic reconnect if first connect after startup
fails.

---
libraries/WiFi/src/WiFiGeneric.cpp | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
libraries/WiFi/src/STA.cpp | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/libraries/WiFi/src/WiFiGeneric.cpp b/libraries/WiFi/src/WiFiGeneric.cpp
index 3760285d..d182adc6 100644
--- a/libraries/WiFi/src/WiFiGeneric.cpp
+++ b/libraries/WiFi/src/WiFiGeneric.cpp
@@ -1036,8 +1036,6 @@ void WiFiGenericClass::removeEvent(wifi_event_id_t id)
*/
esp_err_t WiFiGenericClass::_eventCallback(arduino_event_t *event)
{
- static bool first_connect = true;
-
if(!event) return ESP_OK; //Null would crash this function
diff --git a/libraries/WiFi/src/STA.cpp b/libraries/WiFi/src/STA.cpp
index 443d2621..582d5c52 100644
--- a/libraries/WiFi/src/STA.cpp
+++ b/libraries/WiFi/src/STA.cpp
@@ -106,7 +106,6 @@ static void _onStaArduinoEvent(arduino_event_t *ev) {
if (_sta_network_if == NULL || ev->event_id < ARDUINO_EVENT_WIFI_STA_START || ev->event_id > ARDUINO_EVENT_WIFI_STA_LOST_IP) {
return;
}
- static bool first_connect = true;
log_v("Arduino STA Event: %d - %s", ev->event_id, Network.eventName(ev->event_id));

log_d("Arduino Event: %d - %s", event->event_id, WiFi.eventName(event->event_id));
@@ -1065,7 +1063,7 @@ esp_err_t WiFiGenericClass::_eventCallback(arduino_event_t *event)
log_w("Reason: %u - %s", reason, WiFi.disconnectReasonName((wifi_err_reason_t)reason));
if(reason == WIFI_REASON_NO_AP_FOUND) {
WiFiSTAClass::_setStatus(WL_NO_SSID_AVAIL);
- } else if((reason == WIFI_REASON_AUTH_FAIL) && !first_connect){
+ } else if((reason == WIFI_REASON_AUTH_FAIL)){
WiFiSTAClass::_setStatus(WL_CONNECT_FAILED);
} else if(reason == WIFI_REASON_BEACON_TIMEOUT || reason == WIFI_REASON_HANDSHAKE_TIMEOUT) {
WiFiSTAClass::_setStatus(WL_CONNECTION_LOST);
@@ -1079,11 +1077,6 @@ esp_err_t WiFiGenericClass::_eventCallback(arduino_event_t *event)
bool DoReconnect = false;
if(reason == WIFI_REASON_ASSOC_LEAVE) { //Voluntarily disconnected. Don't reconnect!
}
- else if(first_connect) { //Retry once for all failure reasons
- first_connect = false;
- DoReconnect = true;
- log_d("WiFi Reconnect Running");
- }
else if(WiFi.getAutoReconnect() && _isReconnectableReason(reason)) {
DoReconnect = true;
log_d("WiFi AutoReconnect Running");
if (ev->event_id == ARDUINO_EVENT_WIFI_STA_START) {
@@ -135,7 +134,7 @@ static void _onStaArduinoEvent(arduino_event_t *ev) {
log_w("Reason: %u - %s", reason, WiFi.STA.disconnectReasonName((wifi_err_reason_t)reason));
if (reason == WIFI_REASON_NO_AP_FOUND) {
_sta_network_if->_setStatus(WL_NO_SSID_AVAIL);
- } else if ((reason == WIFI_REASON_AUTH_FAIL) && !first_connect) {
+ } else if ((reason == WIFI_REASON_AUTH_FAIL)) {
_sta_network_if->_setStatus(WL_CONNECT_FAILED);
} else if (reason == WIFI_REASON_BEACON_TIMEOUT || reason == WIFI_REASON_HANDSHAKE_TIMEOUT) {
_sta_network_if->_setStatus(WL_CONNECTION_LOST);
@@ -147,10 +146,6 @@ static void _onStaArduinoEvent(arduino_event_t *ev) {

bool DoReconnect = false;
if (reason == WIFI_REASON_ASSOC_LEAVE) { //Voluntarily disconnected. Don't reconnect!
- } else if (first_connect) { //Retry once for all failure reasons
- first_connect = false;
- DoReconnect = true;
- log_d("WiFi Reconnect Running");
} else if (_sta_network_if->getAutoReconnect() && _is_staReconnectableReason(reason)) {
DoReconnect = true;
log_d("WiFi AutoReconnect Running");
--
2.42.0
2.47.0

75 changes: 38 additions & 37 deletions software/patches/arduino-esp32/0007-WiFi-Disable-11b-rates.patch
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
From ae2270cb8d16c9cb3b63707ef67b03255943d160 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mattias=20Sch=C3=A4ffersmann?= <mattias@tinkerforge.com>
Date: Thu, 23 May 2024 17:13:04 +0200
From e9f4396e362918b8fe535c764b222dcec941f8e2 Mon Sep 17 00:00:00 2001
From: Erik Fleckstein <erik@tinkerforge.com>
Date: Wed, 16 Oct 2024 10:54:17 +0200
Subject: [PATCH] WiFi: Disable 11b rates

802.11b has been obsolete for about 20 years. Keeping compatibility around
slows down devices not 20 years old.
---
libraries/WiFi/src/WiFiGeneric.cpp | 15 +++++++++++++++
libraries/WiFi/src/WiFiGeneric.cpp | 16 ++++++++++++++++
libraries/WiFi/src/WiFiGeneric.h | 2 ++
2 files changed, 17 insertions(+)
2 files changed, 18 insertions(+)

diff --git a/libraries/WiFi/src/WiFiGeneric.cpp b/libraries/WiFi/src/WiFiGeneric.cpp
index 98fb6e60..d7328f8d 100644
index ccc95181..2f363389 100644
--- a/libraries/WiFi/src/WiFiGeneric.cpp
+++ b/libraries/WiFi/src/WiFiGeneric.cpp
@@ -766,6 +766,7 @@ static std::vector<WiFiEventCbList_t> cbEventList;
@@ -333,6 +333,7 @@ static bool espWiFiStop() {

bool WiFiGenericClass::_persistent = true;
bool WiFiGenericClass::_long_range = false;
+bool WiFiGenericClass::_disable_sta_11b = true;
wifi_mode_t WiFiGenericClass::_forceSleepLastMode = WIFI_MODE_NULL;
#if CONFIG_IDF_TARGET_ESP32S2
wifi_ps_type_t WiFiGenericClass::_sleepEnabled = WIFI_PS_NONE;
@@ -1238,6 +1239,14 @@ void WiFiGenericClass::enableLongRange(bool enable)
_long_range = enable;
@@ -444,6 +445,15 @@ void WiFiGenericClass::enableLongRange(bool enable) {
_long_range = enable;
}

+/**
Expand All @@ -34,42 +34,43 @@ index 98fb6e60..d7328f8d 100644
+{
+ _disable_sta_11b = disable;
+}
+
/**
* set new mode
@@ -1286,6 +1295,12 @@ bool WiFiGenericClass::mode(wifi_mode_t m)
}
}
* @param m WiFiMode_t
@@ -526,6 +536,12 @@ bool WiFiGenericClass::mode(wifi_mode_t m) {
}
}
+ // 11b is long obsolete. true = disable. Don't care if it can't be disabled.
+ // Disable both because neither can be changed when trying to switch mode later.
+ // Always disable 11b on AP because beacons are sent at minimum rate.
+ esp_wifi_config_11b_rate(WIFI_IF_STA, _disable_sta_11b);
+ esp_wifi_config_11b_rate(WIFI_IF_AP, true);
}
+ // 11b is long obsolete. true = disable. Don't care if it can't be disabled.
+ // Disable both because neither can be changed when trying to switch mode later.
+ // Always disable 11b on AP because beacons are sent at minimum rate.
+ esp_wifi_config_11b_rate(WIFI_IF_STA, _disable_sta_11b);
+ esp_wifi_config_11b_rate(WIFI_IF_AP, true);
+
if(!espWiFiStart()){
return false;
}
if (!espWiFiStart()) {
return false;
}
diff --git a/libraries/WiFi/src/WiFiGeneric.h b/libraries/WiFi/src/WiFiGeneric.h
index 894c1346..e5d04100 100644
index 2a5ca812..1886b95b 100644
--- a/libraries/WiFi/src/WiFiGeneric.h
+++ b/libraries/WiFi/src/WiFiGeneric.h
@@ -173,6 +173,7 @@ class WiFiGenericClass
@@ -92,6 +92,7 @@ public:

void persistent(bool persistent);
void enableLongRange(bool enable);
+ void disableSTA11b(bool disable);
void persistent(bool persistent);
void enableLongRange(bool enable);
+ void disableSTA11b(bool disable);

static bool mode(wifi_mode_t);
static wifi_mode_t getMode();
@@ -205,6 +206,7 @@ class WiFiGenericClass
protected:
static bool _persistent;
static bool _long_range;
+ static bool _disable_sta_11b;
static wifi_mode_t _forceSleepLastMode;
static wifi_ps_type_t _sleepEnabled;
static bool _wifiUseStaticBuffers;
static bool mode(wifi_mode_t);
static wifi_mode_t getMode();
@@ -133,6 +134,7 @@ public:
protected:
static bool _persistent;
static bool _long_range;
+ static bool _disable_sta_11b;
static wifi_mode_t _forceSleepLastMode;
static wifi_ps_type_t _sleepEnabled;
static bool _wifiUseStaticBuffers;
--
2.39.2
2.47.0

Loading

0 comments on commit e9559ca

Please sign in to comment.