fw-rust: Improve setup screen
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Remove redundant match arms when handling inputs and code when drawing the setup screen.
This commit is contained in:
parent
c36581e703
commit
b51511dbab
1 changed files with 5 additions and 17 deletions
|
@ -99,8 +99,7 @@ impl Setup {
|
||||||
Selection::Back => match input {
|
Selection::Back => match input {
|
||||||
Input::Next => Selection::Backlight,
|
Input::Next => Selection::Backlight,
|
||||||
Input::Previous => Selection::Contrast,
|
Input::Previous => Selection::Contrast,
|
||||||
Input::Select => return Event::Screen(Screens::Home(Home::new())),
|
_ => return Event::Screen(Screens::Home(Home::new())),
|
||||||
Input::Back => return Event::Screen(Screens::Home(Home::new())),
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -108,11 +107,12 @@ impl Setup {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn draw(&self, lcd: &mut Lcd) {
|
pub fn draw(&self, lcd: &mut Lcd) {
|
||||||
match &self.active {
|
|
||||||
Selection::Contrast => {
|
|
||||||
lcd.fill_area(0, 0, 33, 2, 0xFF);
|
lcd.fill_area(0, 0, 33, 2, 0xFF);
|
||||||
lcd.print_inverted(33, 0, "SETUP");
|
lcd.print_inverted(33, 0, "SETUP");
|
||||||
lcd.fill_area(69, 0, 33, 2, 0xFF);
|
lcd.fill_area(69, 0, 33, 2, 0xFF);
|
||||||
|
|
||||||
|
match &self.active {
|
||||||
|
Selection::Contrast => {
|
||||||
lcd.print(0, 2, "BACKLIGHT:");
|
lcd.print(0, 2, "BACKLIGHT:");
|
||||||
lcd.print_u8(81, 2, 3, self.backlight);
|
lcd.print_u8(81, 2, 3, self.backlight);
|
||||||
lcd.print_inverted(0, 4, "CONTRAST:");
|
lcd.print_inverted(0, 4, "CONTRAST:");
|
||||||
|
@ -120,9 +120,6 @@ impl Setup {
|
||||||
lcd.print(36, 6, "BACK");
|
lcd.print(36, 6, "BACK");
|
||||||
}
|
}
|
||||||
Selection::ContrastEdit => {
|
Selection::ContrastEdit => {
|
||||||
lcd.fill_area(0, 0, 33, 2, 0xFF);
|
|
||||||
lcd.print_inverted(33, 0, "SETUP");
|
|
||||||
lcd.fill_area(69, 0, 33, 2, 0xFF);
|
|
||||||
lcd.print(0, 2, "BACKLIGHT:");
|
lcd.print(0, 2, "BACKLIGHT:");
|
||||||
lcd.print_u8(81, 2, 3, self.backlight);
|
lcd.print_u8(81, 2, 3, self.backlight);
|
||||||
lcd.print(0, 4, "CONTRAST:");
|
lcd.print(0, 4, "CONTRAST:");
|
||||||
|
@ -130,9 +127,6 @@ impl Setup {
|
||||||
lcd.print(36, 6, "BACK");
|
lcd.print(36, 6, "BACK");
|
||||||
}
|
}
|
||||||
Selection::Backlight => {
|
Selection::Backlight => {
|
||||||
lcd.fill_area(0, 0, 33, 2, 0xFF);
|
|
||||||
lcd.print_inverted(33, 0, "SETUP");
|
|
||||||
lcd.fill_area(69, 0, 33, 2, 0xFF);
|
|
||||||
lcd.print_inverted(0, 2, "BACKLIGHT:");
|
lcd.print_inverted(0, 2, "BACKLIGHT:");
|
||||||
lcd.print_u8(81, 2, 3, self.backlight);
|
lcd.print_u8(81, 2, 3, self.backlight);
|
||||||
lcd.print(0, 4, "CONTRAST:");
|
lcd.print(0, 4, "CONTRAST:");
|
||||||
|
@ -140,9 +134,6 @@ impl Setup {
|
||||||
lcd.print(36, 6, "BACK");
|
lcd.print(36, 6, "BACK");
|
||||||
}
|
}
|
||||||
Selection::BacklightEdit => {
|
Selection::BacklightEdit => {
|
||||||
lcd.fill_area(0, 0, 33, 2, 0xFF);
|
|
||||||
lcd.print_inverted(33, 0, "SETUP");
|
|
||||||
lcd.fill_area(69, 0, 33, 2, 0xFF);
|
|
||||||
lcd.print(0, 2, "BACKLIGHT:");
|
lcd.print(0, 2, "BACKLIGHT:");
|
||||||
lcd.print_u8_inverted(81, 2, 3, self.backlight);
|
lcd.print_u8_inverted(81, 2, 3, self.backlight);
|
||||||
lcd.print(0, 4, "CONTRAST:");
|
lcd.print(0, 4, "CONTRAST:");
|
||||||
|
@ -150,9 +141,6 @@ impl Setup {
|
||||||
lcd.print(36, 6, "BACK");
|
lcd.print(36, 6, "BACK");
|
||||||
}
|
}
|
||||||
Selection::Back => {
|
Selection::Back => {
|
||||||
lcd.fill_area(0, 0, 33, 2, 0xFF);
|
|
||||||
lcd.print_inverted(33, 0, "SETUP");
|
|
||||||
lcd.fill_area(69, 0, 33, 2, 0xFF);
|
|
||||||
lcd.print(0, 2, "BACKLIGHT:");
|
lcd.print(0, 2, "BACKLIGHT:");
|
||||||
lcd.print_u8(81, 2, 3, self.backlight);
|
lcd.print_u8(81, 2, 3, self.backlight);
|
||||||
lcd.print(0, 4, "CONTRAST:");
|
lcd.print(0, 4, "CONTRAST:");
|
||||||
|
|
Loading…
Reference in a new issue