35 lines
1.1 KiB
Rust
35 lines
1.1 KiB
Rust
use crate::navigation::navigation::{Action, Navigable, NewState};
|
|
use crate::navigation::outputs::Outputs;
|
|
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, outputs: &mut Outputs) -> impl core::future::Future<Output = ()> + Send {
|
|
let display = &mut outputs.primary_display;
|
|
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),
|
|
}
|
|
}
|
|
}
|
|
}
|