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
+68
@@ -0,0 +1,68 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use winnow::prelude::*;
|
||||
use winnow::Result;
|
||||
use winnow::{
|
||||
ascii::{digit1 as digits, multispace0 as multispaces},
|
||||
combinator::alt,
|
||||
combinator::delimited,
|
||||
combinator::repeat,
|
||||
token::one_of,
|
||||
};
|
||||
|
||||
// Parser definition
|
||||
|
||||
pub(crate) fn expr(i: &mut &str) -> Result<i64> {
|
||||
let init = term.parse_next(i)?;
|
||||
|
||||
repeat(0.., (one_of(['+', '-']), term))
|
||||
.fold(
|
||||
move || init,
|
||||
|acc, (op, val): (char, i64)| {
|
||||
if op == '+' {
|
||||
acc + val
|
||||
} else {
|
||||
acc - val
|
||||
}
|
||||
},
|
||||
)
|
||||
.parse_next(i)
|
||||
}
|
||||
|
||||
// We read an initial factor and for each time we find
|
||||
// a * or / operator followed by another factor, we do
|
||||
// the math by folding everything
|
||||
pub(crate) fn term(i: &mut &str) -> Result<i64> {
|
||||
let init = factor.parse_next(i)?;
|
||||
|
||||
repeat(0.., (one_of(['*', '/']), factor))
|
||||
.fold(
|
||||
move || init,
|
||||
|acc, (op, val): (char, i64)| {
|
||||
if op == '*' {
|
||||
acc * val
|
||||
} else {
|
||||
acc / val
|
||||
}
|
||||
},
|
||||
)
|
||||
.parse_next(i)
|
||||
}
|
||||
|
||||
// We transform an integer string into a i64, ignoring surrounding whitespace
|
||||
// We look for a digit suite, and try to convert it.
|
||||
// If either str::from_utf8 or FromStr::from_str fail,
|
||||
// we fallback to the parens parser defined above
|
||||
pub(crate) fn factor(i: &mut &str) -> Result<i64> {
|
||||
delimited(
|
||||
multispaces,
|
||||
alt((digits.try_map(FromStr::from_str), parens)),
|
||||
multispaces,
|
||||
)
|
||||
.parse_next(i)
|
||||
}
|
||||
|
||||
// We parse any expr surrounded by parens, ignoring all whitespace around those
|
||||
fn parens(i: &mut &str) -> Result<i64> {
|
||||
delimited('(', expr, ')').parse_next(i)
|
||||
}
|
||||
Reference in new issue
Block a user