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

Compare commits

..
2 changed files with 10 additions and 18 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
.max_end_time()
.min_end_time()
.map(|val| Self::time_to_duration_sec(now, val));
if let Some(min_end_sec) = min {

View file

@ -91,8 +91,6 @@ 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,
@ -263,8 +261,6 @@ 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
{
@ -273,10 +269,9 @@ 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(), sig_total_height),
geometry::Size::new(self.size.width.into(), 67),
)
.into_styled(Self::BK_STYLE)
.draw(&mut self.target)?;
@ -342,17 +337,14 @@ where
)
.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)?;
}
// 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)?;
} else {
text::Text::with_alignment(
&alloc::format!("{}s", timing.min_end_sec),