fix(ota): prevent connection aborts by disabling socket keep-alive, keeping RF awake, and enabling dynamic mbedTLS buffers
All checks were successful
ESP32 Build & Release / build (push) Successful in 1m14s

This commit is contained in:
2026-09-12 17:51:34 +02:00
parent 4f7b1870bb
commit d1a4c18967
3 changed files with 27 additions and 8 deletions

View File

@@ -34,6 +34,7 @@ static SemaphoreHandle_t s_wifi_mux = NULL;
static SemaphoreHandle_t s_net_lock = NULL;
static bool s_manual_disconnect = false;
static esp_netif_t *s_sta_netif = NULL;
static bool s_power_save_enabled = true;
/* ------------------------------------------------------------------ */
@@ -205,9 +206,14 @@ static void wifi_event_handler(void *arg, esp_event_base_t base, int32_t id, voi
dns_fallback.ip.u_addr.ip4.addr = ESP_IP4TOADDR(8, 8, 8, 8);
esp_netif_set_dns_info(s_sta_netif, ESP_NETIF_DNS_FALLBACK, &dns_fallback);
}
/* Enable modem power saving when idle on station network */
esp_wifi_set_ps(WIFI_PS_MIN_MODEM);
ESP_LOGI(TAG, "Wi-Fi modem sleep enabled (WIFI_PS_MIN_MODEM: ~30-40 mA saved)");
/* Enable modem power saving only if power save is allowed */
if (s_power_save_enabled) {
esp_wifi_set_ps(WIFI_PS_MIN_MODEM);
ESP_LOGI(TAG, "Wi-Fi modem sleep enabled (WIFI_PS_MIN_MODEM: ~30-40 mA saved)");
} else {
esp_wifi_set_ps(WIFI_PS_NONE);
ESP_LOGI(TAG, "Wi-Fi power save disabled (WIFI_PS_NONE)");
}
}
}
@@ -510,8 +516,6 @@ esp_err_t wifi_manager_start(void)
return ESP_OK;
}
static bool s_power_save_enabled = true;
esp_err_t wifi_manager_acquire_net_lock(TickType_t timeout_ticks)
{
if (!s_net_lock) {