github esp-rs/esp-hal esp-radio-v1.0.0-beta.1

latest release: api-baselines
one month ago

This is our second 1.0.0 beta release of esp-radio. We're continuing to refine the API as we move closer to 1.0 proper, and we're still looking for feedback.

We released esp-generate@1.4 to accompany this release.

API Documentation

Migration from 1.0.0-beta.0

Wi-Fi

Credentials are configured via AuthenticationMethodConfig (#6146)

StationConfig and AccessPointConfig no longer expose separate auth_method and password fields. Authentication is now configured through a single AuthenticationMethodConfig, which carries the password for the selected method.

// Before
let config = StationConfig::default()
    .with_ssid("SSID")
    .with_auth_method(AuthenticationMethod::Wpa2Personal)
    .with_password("PASSWORD".into());

// After
let config = StationConfig::default()
    .with_ssid("SSID".try_into()?)
    .with_authentication(AuthenticationMethodConfig::Wpa2Personal(
        "PASSWORD".try_into()?,
    ));

Ssid and Password reject oversized values (#6146)

Ssid is now constructed via TryFrom, and passwords use a dedicated Password type. Oversized SSIDs (> 32 bytes) and passwords (> 64 bytes) are now rejected with an error instead of being silently truncated. Use try_into() / try_from() and handle the Result.

connect_async returns ConnectionError (#5872)

WifiController::connect_async now returns Result<sta::ConnectedInfo, ConnectionError> instead of Result<sta::ConnectedInfo, WifiError>, and WifiError::Disconnected no longer carries the AP info.

// Before
let info = controller.connect_async().await?; // Result<sta::ConnectedInfo, WifiError>

// After
match controller.connect_async().await {
    Ok(info) => { /* sta::ConnectedInfo */ }
    Err(ConnectionError::Failed(disconnected)) => { /* connection attempt failed */ }
    Err(ConnectionError::WifiError(e)) => { /* underlying Wi-Fi error */ }
}

WifiError::Failed renamed to WifiError::Other (#6309)

Rename any matches on WifiError::Failed to WifiError::Other. Unknown or unmapped Wi-Fi driver error codes now also map to WifiError::Other instead of panicking.

sta_disconnected_pm default changed (#6144)

ControllerConfig::sta_disconnected_pm now defaults to CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE instead of always being false. Set it explicitly if you relied on the previous default.

ESP-NOW & Sniffer

ESP-NOW and Sniffer instances no longer borrow the controller (#6281)

WifiController::esp_now() and WifiController::sniffer() now return instances that no longer borrow the controller, and EspNow, EspNowManager, EspNowSender, EspNowReceiver, and Sniffer no longer carry a lifetime parameter. Wi-Fi stays initialized until the returned instance is dropped. Remove any lifetime annotations from stored types.

// Before
let esp_now: EspNow<'_> = controller.esp_now();

// After
let esp_now: EspNow = controller.esp_now();

set_rate replaced with set_peer_rate (#5884)

EspNow::set_rate and EspNowManager::set_rate have been replaced with set_peer_rate(peer_address, RateConfig), allowing the rate to be configured per peer.

// Before
esp_now.set_rate(WifiPhyRate::Rate1mL)?;

// After
esp_now.set_peer_rate(&peer_address, RateConfig::default())?;

ESP_NOW_MAX_DATA_LEN split into V1/V2 (#6285)

ESP_NOW_MAX_DATA_LEN has been replaced by ESP_NOW_MAX_DATA_LEN_V1 and ESP_NOW_MAX_DATA_LEN_V2. Use the constant that matches the ESP-NOW protocol version you're targeting.

BLE

bt-hci updated to 0.9 (#5821)

The BLE HCI implementation now uses bt-hci 0.9. Update your bt-hci (and trouble-host, if used) dependencies to compatible versions.

Don't miss a new esp-hal release

NewReleases is sending notifications on new releases.