Watch
0
0
Fork
You've already forked esp32-c_its-companion
0

screen: Keep GNSS status on normal display clear

This commit is contained in:
Jannik Beyerstedt 2026-09-07 13:42:44 +02:00
commit 828e596dea

View file

@ -220,7 +220,28 @@ where
Ok(()) Ok(())
} }
/// Clears the screen, but keeps the GNSS status row
fn clear(&mut self) -> Result<(), D::Error> fn clear(&mut self) -> Result<(), D::Error>
where
D: DrawTarget<Color = pixelcolor::Rgb565>,
{
// this only differes from clear_all on big screens
if self.is_big_height() {
#[allow(clippy::cast_sign_loss)]
let max_y = (250 + self.size.offset_top) as u32;
primitives::Rectangle::new(
geometry::Point::new(0, 0),
geometry::Size::new(self.size.width.into(), max_y),
)
.into_styled(Self::BK_STYLE)
.draw(&mut self.target)
} else {
self.clear_all()
}
}
fn clear_all(&mut self) -> Result<(), D::Error>
where where
D: DrawTarget<Color = pixelcolor::Rgb565>, D: DrawTarget<Color = pixelcolor::Rgb565>,
{ {
@ -302,7 +323,7 @@ where
// uses full screen width and height // uses full screen width and height
// - from 0 to 105+67 = 172 pixels for small screens // - from 0 to 105+67 = 172 pixels for small screens
// - from 0 to 105+67+20 = 192 pixels for big screens // - from 0 to 105+67+20 = 192 pixels for big screens
#[allow(unused)] #[allow(unused, clippy::too_many_lines)]
fn draw_glosa( fn draw_glosa(
&mut self, &mut self,
data: &applogic::GlosaSignalInfo, data: &applogic::GlosaSignalInfo,
@ -397,7 +418,7 @@ where
text::Alignment::Center, text::Alignment::Center,
) )
.draw(&mut self.target)?; .draw(&mut self.target)?;
}; }
// draw maneuver // draw maneuver
text::Text::with_alignment( text::Text::with_alignment(
@ -453,7 +474,7 @@ where
fn draw_slash_screen(&mut self) -> Result<(), D::Error> { fn draw_slash_screen(&mut self) -> Result<(), D::Error> {
let text_style = mono_font::MonoTextStyle::new(&profont::PROFONT_18_POINT, Self::COLOR_FG); let text_style = mono_font::MonoTextStyle::new(&profont::PROFONT_18_POINT, Self::COLOR_FG);
self.clear()?; self.clear_all()?;
let sig_width = i32::from(self.size.width) / 3; let sig_width = i32::from(self.size.width) / 3;
let circle_dia = 50; let circle_dia = 50;