let mut prev_tap = gps::TimeAndPos::new();
+ let mut total_distance_cm = 0;
+
loop {
let mut tap = gps::TimeAndPos::new();
let mut show_time = false;
+ let mut show_distance = false;
let old_gps_has_fix = gps_has_fix;
while gps.update(&mut tap, uart0_try_read) {
if is_recording {
logger.log(&prev_tap, &tap);
+
+ total_distance_cm += tap.distance_cm(&prev_tap) as u32;
+
+ show_distance = true;
}
prev_tap = tap;
});
}
- if show_time {
+ if show_distance {
+ let mut distance_m_s = [b' '; 8];
+
+ common::fmt::fmt_u32(&mut distance_m_s, total_distance_cm / 100);
+
+ screen.clear();
+ screen.draw_text(&distance_m_s);
+
+ display.draw(&screen);
+ } else if show_time {
if let Some(tm) = Time::from_unix_time(prev_tap.unix_time) {
let mut time_s = [b' '; 8];
tm.fmt_time(&mut time_s);
} else {
logger.stop_recording(&prev_tap);
}
+
+ total_distance_cm = 0;
}
}