Skip to content

Commit ddb1c2e

Browse files
committed
Merge pull request #1451 from UncleGrumpy/wifi_calibration
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. These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
2 parents 03dcfa5 + aa2dca6 commit ddb1c2e

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
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818

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

2223
## [0.6.6] - Unreleased
2324

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)