projects
/
gps-watch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
common: Store distance travelled in Logger instance.
[gps-watch.git]
/
src
/
application
/
main.rs
diff --git
a/src/application/main.rs
b/src/application/main.rs
index 5ec2f96b7c98dc7d87d9f5d01adfee0b8b91e247..dc955ce7af46fb39fc5b37721e4b12c5b7cbcbd3 100644
(file)
--- a/
src/application/main.rs
+++ b/
src/application/main.rs
@@
-225,8
+225,6
@@
pub unsafe extern "C" fn _start() -> ! {
let mut prev_tap = gps::TimeAndPos::new();
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;
loop {
let mut tap = gps::TimeAndPos::new();
let mut show_time = false;
@@
-237,8
+235,6
@@
pub unsafe extern "C" fn _start() -> ! {
if is_recording {
logger.log(&prev_tap, &tap);
if is_recording {
logger.log(&prev_tap, &tap);
- total_distance_cm += tap.distance_cm(&prev_tap) as u32;
-
show_distance = true;
}
show_distance = true;
}
@@
-282,7
+278,8
@@
pub unsafe extern "C" fn _start() -> ! {
if show_distance {
let mut distance_m_s = [b' '; 8];
if show_distance {
let mut distance_m_s = [b' '; 8];
- common::fmt::fmt_u32(&mut distance_m_s, total_distance_cm / 100);
+ common::fmt::fmt_u32(&mut distance_m_s,
+ logger.total_distance_cm / 100);
screen.clear();
screen.draw_text(&distance_m_s);
screen.clear();
screen.draw_text(&distance_m_s);
@@
-313,15
+310,13
@@
pub unsafe extern "C" fn _start() -> ! {
shell.update(&mut logger);
if pta12.has_been_held_for_ms(1500) {
shell.update(&mut logger);
if pta12.has_been_held_for_ms(1500) {
- is_recording = !is_recording;
-
- if is_recording {
- logger.start_recording(&prev_tap);
- } else {
- logger.stop_recording(&prev_tap);
- }
+ is_recording = !is_recording;
- total_distance_cm = 0;
+ if is_recording {
+ logger.start_recording(&prev_tap);
+ } else {
+ logger.stop_recording(&prev_tap);
+ }
}
if reset_requested() {
}
if reset_requested() {