refactor: drive display via hsmc statechart

Replaces the ad-hoc display loop with a declarative hsmc statechart
(Off/On.{Splash.{LearnMore,Info}, Dashboard.{Listening,Transmitting}})
and swaps the Radio→Display channel from a RadioStatus watch to a
typed RadioEvent queue. The radio task now emits discrete mode and
packet events instead of publishing full status snapshots; the
display consumes them through the statechart, which also handles the
5 s splash alternation and 1 s sparkline tick via `on(after …)` /
`on(every …)` transitions.

Also:
- Add hsmc dep and embassy/tokio feature shims (hsmc proc macro
  evaluates `cfg(feature = "embassy")` in this crate).
- Fix USB disconnect path in `host/usb.rs` so the DTR branch always
  runs on read error (was early-continuing, starving display/radio
  reset).
This commit is contained in:
swaits committed 2026-04-16 13:26:04 -06:00
1 parent 272abceedb
commit 596bc3ed96
7 files changed
+661 -347

No files matched your search

+15
View File
@@ -30,6 +30,7 @@ embassy-usb-driver = "0.2"
ucobs = { version = "0.3", features = ["legacy-msrv"] }
heapless = "0.9"
donglora-protocol = { path = "../protocol" }
hsmc = { path = "../../hsmc/hsmc", default-features = false, features = ["embassy"] }
lora-phy = "3.0"
portable-atomic = { version = "1", optional = true, default-features = false, features = ["critical-section"] }
static_cell = "2.1"
@@ -88,31 +89,43 @@ minijinja = "2.18"
owo-colors = "4.3"
[features]
# The `embassy` feature gates the async-actions codepath inside the `hsmc`
# statechart macro. Its `#[cfg(feature = "embassy")]` attributes are
# evaluated in *this* crate's context (a proc-macro cfg quirk), so every
# board feature must enable it. `tokio` is declared only to silence the
# macro's `#[cfg(feature = "tokio")]` checks.
embassy = []
tokio = []
heltec_v3 = [
"embassy",
"dep:esp-backtrace",
"dep:esp-hal",
"dep:esp-println",
"dep:esp-rtos",
]
heltec_v3_uart = [
"embassy",
"dep:esp-backtrace",
"dep:esp-hal",
"dep:esp-println",
"dep:esp-rtos",
]
heltec_v4 = [
"embassy",
"dep:esp-backtrace",
"dep:esp-hal",
"dep:esp-println",
"dep:esp-rtos",
]
elecrow_thinknode_m2 = [
"embassy",
"dep:esp-backtrace",
"dep:esp-hal",
"dep:esp-println",
"dep:esp-rtos",
]
rak_wisblock_4631 = [
"embassy",
"dep:cortex-m",
"dep:cortex-m-rt",
"cortex-m-rt/set-vtor",
@@ -123,6 +136,7 @@ rak_wisblock_4631 = [
"embassy-executor/executor-thread",
]
wio_tracker_l1 = [
"embassy",
"dep:cortex-m",
"dep:cortex-m-rt",
"cortex-m-rt/set-vtor",
@@ -133,6 +147,7 @@ wio_tracker_l1 = [
"embassy-executor/executor-thread",
]
waveshare_rp2040_lora = [
"embassy",
"dep:cortex-m",
"dep:cortex-m-rt",
"dep:defmt-rtt",