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>
55 lines
1.4 KiB
Rust
55 lines
1.4 KiB
Rust
use std::fmt::{self, Debug, Display};
|
|
|
|
/// Errors that can occur when serializing or deserializing TOML.
|
|
pub struct Error(Box<ErrorInner>);
|
|
|
|
pub(crate) enum ErrorInner {
|
|
Ser(crate::ser::Error),
|
|
De(crate::de::Error),
|
|
}
|
|
|
|
impl Error {
|
|
/// Produces a (line, column) pair of the position of the error if
|
|
/// available.
|
|
///
|
|
/// All indexes are 0-based.
|
|
pub fn line_col(&self) -> Option<(usize, usize)> {
|
|
match &*self.0 {
|
|
ErrorInner::Ser(_) => None,
|
|
ErrorInner::De(error) => error.line_col(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<crate::ser::Error> for Error {
|
|
fn from(error: crate::ser::Error) -> Self {
|
|
Error(Box::new(ErrorInner::Ser(error)))
|
|
}
|
|
}
|
|
|
|
impl From<crate::de::Error> for Error {
|
|
fn from(error: crate::de::Error) -> Self {
|
|
Error(Box::new(ErrorInner::De(error)))
|
|
}
|
|
}
|
|
|
|
impl Display for Error {
|
|
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
|
match &*self.0 {
|
|
ErrorInner::Ser(error) => Display::fmt(error, formatter),
|
|
ErrorInner::De(error) => Display::fmt(error, formatter),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Debug for Error {
|
|
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
|
match &*self.0 {
|
|
ErrorInner::Ser(error) => Debug::fmt(error, formatter),
|
|
ErrorInner::De(error) => Debug::fmt(error, formatter),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl std::error::Error for Error {}
|