38 lines
1.1 KiB
Rust
38 lines
1.1 KiB
Rust
use crate::display::primary_lcd::PrimaryLcdDisplay;
|
|
|
|
use crate::navigation::navigation::{Action, Navigable, NewState};
|
|
use crate::views::{menu_item, view::View};
|
|
|
|
use embedded_graphics::pixelcolor::Rgb565;
|
|
use embedded_graphics::prelude::RgbColor;
|
|
use embedded_graphics_core::draw_target::DrawTarget;
|
|
pub const MAX_SELECTED: i8 = 2;
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct SettingsMenu {
|
|
pub selected: i32,
|
|
}
|
|
|
|
impl Navigable for SettingsMenu {
|
|
fn display(
|
|
&self,
|
|
display: &mut PrimaryLcdDisplay<'static>,
|
|
) -> impl core::future::Future<Output = ()> + Send {
|
|
display.clear(Rgb565::BLACK).unwrap();
|
|
menu_item::show(display, "System Inforation", 0, self.selected);
|
|
menu_item::show(display, "Wifi Information", 1, self.selected);
|
|
|
|
core::future::ready(())
|
|
}
|
|
|
|
fn handle_input(&self, input: Action) -> impl core::future::Future<Output = NewState> + Send {
|
|
async move {
|
|
NewState {
|
|
view: View::Settings(SettingsMenu { selected: 0 }),
|
|
replace_view: true,
|
|
redraw: !matches!(input, Action::Timer),
|
|
}
|
|
}
|
|
}
|
|
}
|