|
@@ -47,7 +47,7 @@ struct avg_store_s {
|
|
|
time_t time;
|
|
|
};
|
|
|
|
|
|
-static struct {
|
|
|
+static struct gpx_s {
|
|
|
struct prev_points_s prev_points;
|
|
|
unsigned char avg_count;
|
|
|
unsigned char paused;
|
|
@@ -122,6 +122,10 @@ void gpx_save_single_point(struct location_s *loc) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+unsigned char is_paused(void) {
|
|
|
+ return gpx.paused;
|
|
|
+}
|
|
|
+
|
|
|
unsigned char gpx_write(struct location_s *loc, FIL *file) {
|
|
|
unsigned int bw;
|
|
|
const char *time;
|
|
@@ -132,6 +136,7 @@ unsigned char gpx_write(struct location_s *loc, FIL *file) {
|
|
|
strcpy_P(buf, xml_trkseg_end);
|
|
|
gpx.paused = 1;
|
|
|
gpx.point_count = 0;
|
|
|
+ System.current_pause_start = utc;
|
|
|
} else {
|
|
|
return 0; /* nothing to store */
|
|
|
}
|
|
@@ -140,6 +145,8 @@ unsigned char gpx_write(struct location_s *loc, FIL *file) {
|
|
|
strcpy_P(buf, xml_trkseg_start);
|
|
|
f_write(file, buf, strlen(buf), &bw);
|
|
|
gpx.paused = 0;
|
|
|
+ if (System.current_pause_start)
|
|
|
+ System.pause_time += utc - System.current_pause_start;
|
|
|
}
|
|
|
time = get_iso_time(loc->time, 0);
|
|
|
xsprintf(buf, PSTR("\t\t\t<trkpt lat=\"%.8f\" lon=\"%.8f\">\n\t\t\t\t<time>%s</time>\n"), loc->lat, loc->lon, time);
|
|
@@ -286,7 +293,8 @@ float distance(struct location_s *pos1, struct location_s *pos2){
|
|
|
}
|
|
|
|
|
|
void add_distance(float dist) {
|
|
|
- System.distance += (dist+0.005)*100.0;
|
|
|
+ if (!gpx.paused)
|
|
|
+ System.distance += (dist+0.005)*100.0;
|
|
|
xprintf(PSTR("Distance: %f m; sum: %f m\r\n"), dist, System.distance/100.0);
|
|
|
}
|
|
|
|