Skip to content

Commit

Permalink
Generalize waiting screen
Browse files Browse the repository at this point in the history
  • Loading branch information
zargony committed Sep 24, 2024
1 parent 3dd6ea2 commit 4dad7a3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 8 additions & 4 deletions firmware/src/screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,12 @@ impl Screen for Splash {
}
}

/// Wait for network to become available
pub struct WifiConnecting;
/// Wait while a lengthy action is in progress
pub enum PleaseWait {
WifiConnecting,
}

impl Screen for WifiConnecting {
impl Screen for PleaseWait {
fn draw<D: DrawTarget<Color = BinaryColor>>(
&self,
target: &mut D,
Expand All @@ -110,7 +112,9 @@ impl Screen for WifiConnecting {
target,
)?;
SMALL_FONT.render_aligned(
"WLAN Verbindung\nwird aufgebaut",
match *self {
Self::WifiConnecting => "WLAN Verbindung\nwird aufgebaut",
},
Point::new(63, 27 + 12),
VerticalPosition::Baseline,
HorizontalAlignment::Center,
Expand Down
4 changes: 3 additions & 1 deletion firmware/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ impl<'a, I2C: I2c, IRQ: Wait<Error = Infallible>> Ui<'a, I2C, IRQ> {
return Ok(());
}

self.display.screen(&screen::WifiConnecting).await?;
self.display
.screen(&screen::PleaseWait::WifiConnecting)
.await?;

let wait_cancel = async { while self.keypad.read().await != Key::Cancel {} };
match with_timeout(NETWORK_TIMEOUT, select(self.wifi.wait_up(), wait_cancel)).await {
Expand Down

0 comments on commit 4dad7a3

Please sign in to comment.