Explorar o código

add paused/skipped/accepted point counters to summaries

Points processed only showed the total; there was no visibility into
how a session's points broke down (during a pause, dropped by the
skip_points warm-up, rejected, sitting in the averaging window, or
actually saved), which made diagnosing filter/pause behavior harder
than it needed to be. Track System.points_paused/points_skipped/
points_accepted, and print them (plus the existing rejected_count and
points_written) in both the test tool's own summary and the firmware's
periodic SUMMARY log line.
k4be hai 1 semana
pai
achega
e201aacb8a
Modificáronse 6 ficheiros con 34 adicións e 1 borrados
  1. 10 0
      gps-test-tool/main.c
  2. 3 0
      gps-test-tool/main.h
  3. 6 0
      soft/gpx.c
  4. 3 0
      soft/main.c
  5. 4 0
      soft/main.h
  6. 8 1
      soft/syslog.c

+ 10 - 0
gps-test-tool/main.c

@@ -222,8 +222,18 @@ int process_nmea_file(const char *input_file, const char *output_gpx,
     {
         unsigned int moving = get_logging_time();
         unsigned long int stopped = get_pause_time();
+        /* points_accepted counts every point past all reject checks, at
+         * AVG_COUNT=3 samples per written trkpt with filters enabled (1:1
+         * with filters disabled, so this is 0 in that mode). */
+        unsigned long int averaged_out = System.points_accepted - System.points_written *
+            (filters_enabled ? 3UL : 1UL);
         fprintf(debug_output, "\n=== Summary ===\n");
         fprintf(debug_output, "Points processed: %d\n", point_count);
+        fprintf(debug_output, "Points during pauses: %lu\n", System.points_paused);
+        fprintf(debug_output, "Points skipped (warm-up): %lu\n", System.points_skipped);
+        fprintf(debug_output, "Points rejected: %lu\n", System.rejected_count);
+        fprintf(debug_output, "Points averaged out: %lu\n", averaged_out);
+        fprintf(debug_output, "Points saved: %lu\n", System.points_written);
         fprintf(debug_output, "Total distance: %.2f km\n", System.distance / 100000.0);
         fprintf(debug_output, "Elevation gain: %.1f m\n", System.elevation_gain / 10.0);
         fprintf(debug_output, "Elevation loss: %.1f m\n", System.elevation_loss / 10.0);

+ 3 - 0
gps-test-tool/main.h

@@ -226,6 +226,9 @@ struct system_s {
     unsigned long int alt_max;          /* dm; highest smoothed altitude seen */
     unsigned long int points_written;
     unsigned long int rejected_count;
+    unsigned long int points_paused;
+    unsigned long int points_skipped;
+    unsigned long int points_accepted;
     unsigned long int speed_accum_x100;
     unsigned long int speed_sample_count;
     unsigned int hdop_x100;

+ 6 - 0
soft/gpx.c

@@ -215,6 +215,9 @@ void gpx_process_point(struct location_s *loc, FIL *file){
 	static struct location_s nloc;
 	static struct location_s filtered_loc;
 
+	if (tracking_is_paused())
+		System.points_paused++;
+
 	if (gpx.last_point_time && loc->time - gpx.last_point_time > FIX_GAP_SECONDS) {
 		if (get_flag(CONFFLAG_VERBOSE_LOG))
 			xputs_P(PSTR("FIX GAP: resetting warm-up/filter state\r\n"));
@@ -231,6 +234,7 @@ void gpx_process_point(struct location_s *loc, FIL *file){
 
 	if (gpx.point_count < System.conf.skip_points) { /* Skipping initial points */
 		gpx.point_count++;
+		System.points_skipped++;
 		return;
 	}
 
@@ -250,6 +254,7 @@ void gpx_process_point(struct location_s *loc, FIL *file){
 
 		gpx_write(loc, file);
 		System.points_written++;
+		System.points_accepted++;
 
 		/* Calculate distance and elevation from filtered points */
 		if (gpx.last_distance_point.lat != 0) {
@@ -334,6 +339,7 @@ void gpx_process_point(struct location_s *loc, FIL *file){
 		if (get_flag(CONFFLAG_VERBOSE_LOG))
 			xputs_P(PSTR("ACCEPT\r\n"));
 		log_reject_flush(); /* close out any pending reject burst now that good data has resumed */
+		System.points_accepted++;
 
 		/* Calculate distance and elevation for accepted point */
 		if (gpx.last_distance_point.lat != 0) {

+ 3 - 0
soft/main.c

@@ -377,6 +377,9 @@ void reset_counters(void) {
 	System.speed_sample_count = 0;
 	System.points_written = 0;
 	System.rejected_count = 0;
+	System.points_paused = 0;
+	System.points_skipped = 0;
+	System.points_accepted = 0;
 	System.bat_volt_min = 99.0;
 	System.time_start = 0;
 	System.current_pause_start = 0;

+ 4 - 0
soft/main.h

@@ -197,6 +197,10 @@ struct system_s {
 	unsigned long int speed_sample_count; // number of samples in speed_accum_x100
 	unsigned long int points_written; // count of accepted/written track points this session
 	unsigned long int rejected_count; // count of rejected candidate points this session (unsigned long: a poor-fix session can reject far more than 65535 times)
+	unsigned long int points_paused; // count of candidate points seen while tracking_is_paused(), this session
+	unsigned long int points_skipped; // count of candidate points dropped by the skip_points warm-up (after boot or a fix gap), this session
+	unsigned long int points_accepted; // count of candidate points that passed every reject check, this session; with filters enabled, points_accepted - points_written*AVG_COUNT is "averaged out, not yet flushed".
+		// points_paused + points_skipped + rejected_count + points_accepted may fall a couple short of the true candidate-point total: the sliding window used for the distance/altitude spike checks needs a couple of points to refill after each reset (boot, or a fix gap) before it can even decide reject-vs-accept, and those few points aren't tallied anywhere.
 	unsigned int hdop_x100; // HDOP * 100, from GSA
 	unsigned char fix_type; // FIX_TYPE_* from GSA
 	unsigned char speed; // km/h

+ 8 - 1
soft/syslog.c

@@ -253,6 +253,13 @@ void log_session_summary(unsigned char final) {
 	xprintf(PSTR("%uh%02um altmax=%.1f vmin=%.3f rej=%lu"), h, m,
 		(double)System.alt_max/10.0, (double)System.bat_volt_min, System.rejected_count);
 	/* Both averages should track each other; a growing gap is worth noticing. */
-	xprintf(PSTR(" avg_speed=%.2f avg_dist=%.2f\r\n"),
+	xprintf(PSTR(" avg_speed=%.2f avg_dist=%.2f"),
 		(double)get_avg_speed_x100()/100.0, (double)get_dist_avg_speed_x100()/100.0);
+	/* points_accepted is pre-averaging: with filters enabled (AVG_COUNT
+	 * samples per written trkpt), points_accepted - points_written*AVG_COUNT
+	 * is however many accepted points are sitting in the averaging window,
+	 * not yet flushed to a trkpt - "averaged out" here, since it never will
+	 * be on its own (the group only flushes once it reaches AVG_COUNT). */
+	xprintf(PSTR(" paused=%lu skipped=%lu accepted=%lu wr=%lu\r\n"),
+		System.points_paused, System.points_skipped, System.points_accepted, System.points_written);
 }