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

Compare commits

...
Author SHA1 Message Date
477cf60096 FIXUP: cleanup big screen additions 2026-08-15 19:11:15 +02:00
2f9841f45f WIP 2026-08-15 16:31:59 +02:00
f0366a0f69 fixup: max end time 2026-08-15 16:30:43 +02:00
96b38a4142 fixup: clear timing area 2026-08-15 16:24:45 +02:00
2 changed files with 18 additions and 10 deletions

View file

@ -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 {

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