diff --git a/src/applogic/mod.rs b/src/applogic/mod.rs index e9ce2d1..6835e26 100644 --- a/src/applogic/mod.rs +++ b/src/applogic/mod.rs @@ -126,7 +126,7 @@ impl TimingData { .likely_time() .map(|val| Self::time_to_duration_sec(now, val)); let max_end_sec = value - .min_end_time() + .max_end_time() .map(|val| Self::time_to_duration_sec(now, val)); if let Some(min_end_sec) = min { diff --git a/src/screen.rs b/src/screen.rs index 0d1dab7..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,9 +273,10 @@ where } else { // only clear maneuver and timing area otherwise + 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(), 67), + geometry::Size::new(self.size.width.into(), sig_total_height), ) .into_styled(Self::BK_STYLE) .draw(&mut self.target)?; @@ -337,14 +342,17 @@ where ) .draw(&mut self.target)?; - // TODO: only on big screen!? - text::Text::with_alignment( - &alloc::format!("{}-{max}s", 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),