feat: add display UI with splash screen, dashboard, and RSSI sparkline
Implement full SSD1306 OLED display support: - Splash screen on boot (1.5s) with project name, version, board - Dashboard showing radio state, config, counters, RSSI/SNR - RSSI history sparkline (64-sample ring buffer, 2px-wide bars) - DisplayOn/DisplayOff host commands routed via dedicated channel - Pure render functions against generic DrawTarget (no hardware coupling) - Display on/off control bypasses radio task entirely Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
17624 files changed
+4564928
-38
No files matched your search
Vendored
+80
@@ -0,0 +1,80 @@
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
use darling::{util, Error, FromDeriveInput, Result};
|
||||
use syn::{parse_quote, Attribute};
|
||||
|
||||
fn unique_idents(attrs: Vec<Attribute>) -> Result<BTreeSet<String>> {
|
||||
let mut errors = Error::accumulator();
|
||||
let idents = attrs
|
||||
.into_iter()
|
||||
.filter_map(|attr| {
|
||||
let path = attr.path();
|
||||
errors.handle(
|
||||
path.get_ident()
|
||||
.map(std::string::ToString::to_string)
|
||||
.ok_or_else(|| {
|
||||
Error::custom(format!("`{}` is not an ident", util::path_to_string(path)))
|
||||
.with_span(path)
|
||||
}),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
|
||||
errors.finish_with(idents)
|
||||
}
|
||||
|
||||
#[derive(FromDeriveInput)]
|
||||
#[darling(attributes(a), forward_attrs)]
|
||||
struct Receiver {
|
||||
#[darling(with = unique_idents)]
|
||||
attrs: BTreeSet<String>,
|
||||
other: Option<bool>,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn succeeds_on_no_attrs() {
|
||||
let di = Receiver::from_derive_input(&parse_quote! {
|
||||
struct Demo;
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
assert!(di.attrs.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn succeeds_on_valid_input() {
|
||||
let di = Receiver::from_derive_input(&parse_quote! {
|
||||
#[allow(dead_code)]
|
||||
/// testing
|
||||
#[another]
|
||||
struct Demo;
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(di.attrs.len(), 3);
|
||||
assert!(di.attrs.contains("allow"));
|
||||
assert!(di.attrs.contains("another"));
|
||||
assert!(di.attrs.contains("doc"));
|
||||
assert_eq!(di.other, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn errors_combined_with_others() {
|
||||
let e = Receiver::from_derive_input(&parse_quote! {
|
||||
#[path::to::attr(dead_code)]
|
||||
#[a(other = 5)]
|
||||
struct Demo;
|
||||
})
|
||||
.map(|_| "Should have failed")
|
||||
.unwrap_err();
|
||||
|
||||
let error = e.to_string();
|
||||
|
||||
assert_eq!(e.len(), 2);
|
||||
|
||||
// Look for the error on the field `other`
|
||||
assert!(error.contains("at other"));
|
||||
|
||||
// Look for the invalid path from attrs conversion
|
||||
assert!(error.contains("`path::to::attr`"));
|
||||
}
|
||||
Reference in new issue
Block a user