From 477cf600966f6d57375bbdf3750ca01c3b4d7279 Mon Sep 17 00:00:00 2001 From: Jannik Beyerstedt Date: Sat, 15 Aug 2026 19:11:15 +0200 Subject: [PATCH] FIXUP: cleanup big screen additions --- src/screen.rs | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/screen.rs b/src/screen.rs index bd01d63..909ddb5 100644 --- a/src/screen.rs +++ b/src/screen.rs @@ -91,6 +91,8 @@ where const SMALL_TEXT_STYLE: mono_font::MonoTextStyle<'static, pixelcolor::Rgb565> = mono_font::MonoTextStyle::new(&profont::PROFONT_14_POINT, Self::COLOR_FG); + const BIG_HEIGHT_THLD: u16 = 172; + pub fn new(target: D, display_size: DisplaySize) -> Self { Self { target, @@ -261,6 +263,8 @@ where ) -> Result<(), D::Error> { let num_signals = data.signal_groups.len(); + let is_big_height = self.size.height > Self::BIG_HEIGHT_THLD; + if let Some(prev) = prev_data && prev.signal_groups.len() != num_signals { @@ -269,8 +273,7 @@ where } else { // only clear maneuver and timing area otherwise - // TODO: 67 when small display, - let sig_total_height = 67 + 20; // TODO: tweak to actual size + let sig_total_height = 67 + if is_big_height { 20 } else { 0 }; primitives::Rectangle::new( geometry::Point::new(0, 105 + self.size.offset_top), geometry::Size::new(self.size.width.into(), sig_total_height), @@ -339,15 +342,17 @@ where ) .draw(&mut self.target)?; - // TODO: only on big screen!? - // TODO: show as diff to likely time? - text::Text::with_alignment( - &alloc::format!("{}-{max}", timing.min_end_sec), - geometry::Point::new(centerline, 185 + self.size.offset_top), - Self::MID_TEXT_STYLE, - text::Alignment::Center, - ) - .draw(&mut self.target)?; + // only for big screen + if is_big_height { + // TODO: show as diff to likely time? + text::Text::with_alignment( + &alloc::format!("{}-{max}", timing.min_end_sec), + geometry::Point::new(centerline, 185 + self.size.offset_top), + Self::MID_TEXT_STYLE, + text::Alignment::Center, + ) + .draw(&mut self.target)?; + } } else { text::Text::with_alignment( &alloc::format!("{}s", timing.min_end_sec),