You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
12
12
-`rustyfarian-esp-idf-mqtt`: non-blocking `MqttHandle::try_publish`, `try_publish_retained`, and `try_publish_with` with `TryPublishError` for time-critical loops
13
13
-`wifi-pure`: `WifiPowerSave` enum (`None`, `MinModem`, `MaxModem`) and `WiFiConfig::with_power_save()` builder method
14
14
-`rustyfarian-esp-idf-wifi`: applies configured power save mode via `esp_wifi_set_ps()` after Wi-Fi start
15
+
-`rustyfarian-esp-idf-espnow`: `EspIdfEspNow::init_with_radio()` starts and owns the Wi-Fi radio for ESP-NOW-only devices (ADR 008)
16
+
-`rustyfarian-esp-idf-espnow`: `EspIdfEspNow::default_interface()` returns the correct `WifiInterface` based on init mode
17
+
-`espnow-pure`: `PeerConfig::with_ap_interface()` builder method for ESP-NOW-only devices
Devices that use ESP-NOW without connecting to a Wi-Fi access point (e.g. LED matrix, nunchuck controller) must manually initialise the Wi-Fi radio before calling `EspIdfEspNow::init()`.
Additionally, ESP-NOW-only devices must manually override `PeerConfig::interface` from the default `WifiInterface::Sta` to `WifiInterface::Ap`, because there is no STA connection.
19
+
This is a known ESP-NOW quirk that catches every new consumer and wastes debugging time.
20
+
21
+
Evidence from downstream firmware:
22
+
-`firmware-rgb-matrix/src/main.rs` — raw `EspWifi::new()` + `.start()`
23
+
-`firmware-rgb-nunchuck/src/main.rs` — same pattern + manual `brain_peer.interface = WifiInterface::Ap`
24
+
25
+
### Design decisions under evaluation
26
+
27
+
**Where to store the radio**
28
+
29
+
`init_with_radio()` must keep the `EspWifi` instance alive — if dropped, the radio shuts down and ESP-NOW stops working.
30
+
Two options: a separate wrapper struct, or an `Option<EspWifi<'static>>` field on the existing `EspIdfEspNow`.
31
+
A separate struct would duplicate the `EspNowDriver` trait implementation.
32
+
33
+
**WifiInterface auto-detection**
34
+
35
+
Consumers who use `init_with_radio()` (no STA connection) always need `WifiInterface::Ap` on their peers.
36
+
The driver knows whether it owns the radio, so it can expose a `default_interface()` method to guide callers.
37
+
38
+
**PeerConfig ergonomics**
39
+
40
+
`PeerConfig` in `espnow-pure` defaults `interface` to `Sta`.
41
+
A builder method for the AP case would eliminate the field-level override that every ESP-NOW-only device needs.
42
+
43
+
## Decision
44
+
45
+
Add `init_with_radio()` to `EspIdfEspNow` and a `with_ap_interface()` builder to `PeerConfig`.
46
+
Leave the existing `init()` unchanged for devices that manage Wi-Fi themselves.
47
+
48
+
### Changes to `rustyfarian-esp-idf-espnow`
49
+
50
+
- Add `_wifi: Option<EspWifi<'static>>` field to `EspIdfEspNow`.
51
+
Existing `init()` sets it to `None`; `init_with_radio()` stores `Some(wifi)`.
0 commit comments