|
|
@@ -18,7 +18,6 @@ FIL system_log; /* System log file */
|
|
|
char Line[100]; /* Line buffer */
|
|
|
time_t utc; /* current time */
|
|
|
struct location_s location;
|
|
|
-struct auto_pause_s auto_pause;
|
|
|
volatile unsigned long int uptime_ms; /* milliseconds since MCU startup, for the system log */
|
|
|
static unsigned int io_max_ms; /* longest single SD f_write()/f_sync() duration since the last status line, ms */
|
|
|
|
|
|
@@ -355,51 +354,6 @@ void close_files(unsigned char flush_logs) {
|
|
|
disk_ioctl(0, CTRL_POWER, 0);
|
|
|
}
|
|
|
|
|
|
-static inline void auto_unpause(void) {
|
|
|
- if (!System.tracking_auto_paused)
|
|
|
- return;
|
|
|
- System.tracking_auto_paused = 0;
|
|
|
- log_pause_event(0);
|
|
|
- beep(50, 4);
|
|
|
-}
|
|
|
-
|
|
|
-static inline void auto_pause_activate(void) {
|
|
|
- System.tracking_auto_paused = 1;
|
|
|
- log_pause_event(1);
|
|
|
- beep(50, 3);
|
|
|
-}
|
|
|
-
|
|
|
-static inline void auto_pause_process(void) {
|
|
|
- if (System.tracking_paused || !get_flag(CONFFLAG_AUTO_PAUSE)) { /* remove auto-pause */
|
|
|
- System.tracking_auto_paused = 0;
|
|
|
- auto_pause.prev_distance = System.distance;
|
|
|
- auto_pause.point_counter = 0;
|
|
|
- auto_pause.speed_counter = 0;
|
|
|
- return;
|
|
|
- }
|
|
|
- if (System.speed >= System.conf.auto_pause_speed) { /* unpause when set speed is exceeded for 3 consecutive measurements */
|
|
|
- if (++auto_pause.speed_counter >= 3) {
|
|
|
- auto_pause.point_counter = 0;
|
|
|
- auto_pause.speed_counter = 0;
|
|
|
- auto_unpause();
|
|
|
- return;
|
|
|
- }
|
|
|
- } else {
|
|
|
- auto_pause.speed_counter = 0;
|
|
|
- }
|
|
|
- if (++auto_pause.point_counter < System.conf.auto_pause_time)
|
|
|
- return;
|
|
|
- auto_pause.point_counter = 0;
|
|
|
- if ((System.distance - auto_pause.prev_distance)/100 > System.conf.auto_pause_dist) {
|
|
|
- if (System.tracking_auto_paused)
|
|
|
- auto_unpause(); /* unpause when distance exceeded */
|
|
|
- } else {
|
|
|
- if (!System.tracking_auto_paused)
|
|
|
- auto_pause_activate(); /* pause otherwise */
|
|
|
- }
|
|
|
- auto_pause.prev_distance = System.distance;
|
|
|
-}
|
|
|
-
|
|
|
void reset_counters(void) {
|
|
|
System.distance = 0;
|
|
|
System.elevation_gain = 0;
|