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

FIXUP: cleanup big screen additions

This commit is contained in:
Jannik Beyerstedt 2026-08-15 19:11:15 +02:00
commit 477cf60096

View file

@ -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),