Skip to content

Commit aa2dca6

Browse files
committed
Utilize reserved phy_init partition on ESP32 for wifi calibration data
The `phy_init` partition has been reserved, but not used. By using the `WIFI_STORAGE_FLASH` location the calibration data is preserved across restarts in flash significantly improving connection times. The data stored using `WIFI_STORAGE_RAM` is lost at boot up and needs to be recalibrated, the option `WIFI_STORAGE_FLASH` will still load the data into ram from flash, but this is much faster than performing a full calibration every boot, and should significantly help battery powered devices that spend time in deep sleep and only wake to collect and relay sensor data to the network. Signed-off-by: Winford <winford@object.stream>
1 parent 74258a1 commit aa2dca6

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717

1818
### Fixed
1919
- ESP32: improved sntp sync speed from a cold boot.
20+
- Utilize reserved `phy_init` partition on ESP32 to store wifi calibration for faster connections.
2021

2122
## [0.6.6] - Unreleased
2223

src/platforms/esp32/components/avm_builtins/network_driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ static void start_network(Context *ctx, term pid, term ref, term config)
690690
port_send_reply(ctx, pid, ref, error);
691691
return;
692692
}
693-
if (UNLIKELY((err = esp_wifi_set_storage(WIFI_STORAGE_RAM)) != ESP_OK)) {
693+
if (UNLIKELY((err = esp_wifi_set_storage(WIFI_STORAGE_FLASH)) != ESP_OK)) {
694694
ESP_LOGE(TAG, "Failed to set ESP WiFi storage");
695695
term error = port_create_error_tuple(ctx, term_from_int(err));
696696
port_send_reply(ctx, pid, ref, error);

0 commit comments

Comments
 (0)