Ver Fonte

Add elevation gain/loss display screen; require multiple consecutive speed points before auto-unpause

k4be há 1 semana atrás
pai
commit
6e0e9f220f
5 ficheiros alterados com 23 adições e 4 exclusões
  1. 5 0
      soft/display.c
  2. 1 0
      soft/display.h
  3. 10 4
      soft/main.c
  4. 1 0
      soft/main.h
  5. 6 0
      soft/working_modes.c

+ 5 - 0
soft/display.c

@@ -231,6 +231,11 @@ void disp_func_ele_sat(void) {
 		strcat_P(disp.line2, PSTR(", DGPS"));
 }
 
+void disp_func_elevation_gain(void) {
+	xsprintf(disp.line1, PSTR("Wznios: %.1fm"), (float)System.elevation_gain / 10.0);
+	xsprintf(disp.line2, PSTR("Zjazd: %.1fm"), (float)System.elevation_loss / 10.0);
+}
+
 static void format_time(char *buf, unsigned int seconds) {
 	unsigned int hours;
 	unsigned char mins, secs;

+ 1 - 0
soft/display.h

@@ -25,6 +25,7 @@ void display_refresh(unsigned char changed);
 void disp_func_main_default(void);
 void disp_func_coord(void);
 void disp_func_ele_sat(void);
+void disp_func_elevation_gain(void);
 void disp_distance_and_time(void);
 void disp_speed(void);
 void disp_time(void);

+ 10 - 4
soft/main.c

@@ -274,12 +274,18 @@ static inline void auto_pause_process(void) {
 		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) { /* immediately unpause when set speed is exceeded */
-		auto_pause.point_counter = 0;
-		auto_unpause();
-		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;

+ 1 - 0
soft/main.h

@@ -211,6 +211,7 @@ struct location_s {
 struct auto_pause_s {
 	unsigned char point_counter;
 	unsigned long int prev_distance;
+	unsigned char speed_counter;
 };
 
 extern volatile struct system_s System;

+ 6 - 0
soft/working_modes.c

@@ -114,6 +114,12 @@ __flash const struct menu_pos default_menu_list[] = {
 		.display = disp_func_ele_sat,
 		.func = enter_main_menu,
 	},
+	{
+		.type = MENU_TYPE_FUNCTION,
+		.display_type = MENU_DISPLAY_TYPE_FUNCTION,
+		.display = disp_func_elevation_gain,
+		.func = enter_main_menu,
+	},
 	{
 		.type = MENU_TYPE_FUNCTION,
 		.display_type = MENU_DISPLAY_TYPE_FUNCTION,