Переглянути джерело

rename System.sbas to dgps, log event SBAS->DGPS

The flag is set from GGA's fix-quality field (DGPS fix indicator),
entirely independent of CONFFLAG_ENABLE_SBAS (our own SBAS-search
config toggle) - the display code already correctly labelled it
"DGPS", but the internal name and the debug log's "SBAS on"/"SBAS off"
transition event collided with the unrelated sbas_search= config
line, making it look like the firmware itself was reporting on a
setting it doesn't control.
k4be 1 тиждень тому
батько
коміт
254a59481a
8 змінених файлів з 25 додано та 23 видалено
  1. 5 5
      gps-test-tool/main.c
  2. 2 2
      gps-test-tool/main.h
  3. 1 1
      soft/display.c
  4. 8 6
      soft/main.c
  5. 1 1
      soft/main.h
  6. 2 2
      soft/nmea.c
  7. 5 5
      soft/syslog.c
  8. 1 1
      soft/syslog.h

+ 5 - 5
gps-test-tool/main.c

@@ -139,7 +139,7 @@ int process_nmea_file(const char *input_file, const char *output_gpx,
     #define FIX_HOLD_EPOCHS 5
     unsigned char fix_ok_prev = 0;
     unsigned char fix_hold_counter = 0;
-    unsigned char sbas_prev = 0xFF; /* 0xFF: not yet known, suppress the first (non-)transition */
+    unsigned char dgps_prev = 0xFF; /* 0xFF: not yet known, suppress the first (non-)transition */
     time_t next_status_utc = 0;
     time_t next_summary_utc = 0;
     while (fgets(line, sizeof(line), input)) {
@@ -194,10 +194,10 @@ int process_nmea_file(const char *input_file, const char *output_gpx,
                         log_fix_lost();
                 }
             }
-            if (System.sbas != sbas_prev) {
-                if (sbas_prev != 0xFF)
-                    log_sbas_transition();
-                sbas_prev = System.sbas;
+            if (System.dgps != dgps_prev) {
+                if (dgps_prev != 0xFF)
+                    log_dgps_transition();
+                dgps_prev = System.dgps;
             }
             if (!next_status_utc)
                 next_status_utc = utc + 60;

+ 2 - 2
gps-test-tool/main.h

@@ -245,7 +245,7 @@ struct system_s {
     unsigned keypress:1;
     unsigned location_valid:2;
     unsigned sat_count_low:1;
-    unsigned sbas:1;
+    unsigned dgps:1; /* GGA reports a DGPS-quality fix - the receiver's own doing, not CONFFLAG_ENABLE_SBAS (our SBAS-search request) */
     unsigned satellites_used:5;
 };
 
@@ -355,7 +355,7 @@ void log_boot_record(void);
 void log_status_line(void);
 void log_fix_event(void);
 void log_fix_lost(void);
-void log_sbas_transition(void);
+void log_dgps_transition(void);
 void log_session_summary(unsigned char final);
 void log_pause_event(unsigned char started);
 void gps_powered_on(void);

+ 1 - 1
soft/display.c

@@ -227,7 +227,7 @@ void disp_func_ele_sat(void) {
 		xsprintf(disp.line1, PSTR("ele = %.1fm"), location.alt);
 	}
 	xsprintf(disp.line2, PSTR("%2d satelit"), System.satellites_used);
-	if (System.sbas)
+	if (System.dgps)
 		strcat_P(disp.line2, PSTR(", DGPS"));
 }
 

+ 8 - 6
soft/main.c

@@ -465,7 +465,7 @@ int main (void)
 	unsigned char already_logging = 0;
 	static unsigned char fix_ok_prev = 0;
 	static unsigned char fix_hold_counter = 0;
-	static unsigned char sbas_prev = 0xFF; /* 0xFF: not yet known, suppress the first (non-)transition */
+	static unsigned char dgps_prev = 0xFF; /* 0xFF: not yet known, suppress the first (non-)transition */
 	static unsigned long int last_summary_uptime = 0;
 
 	ioinit();
@@ -604,11 +604,13 @@ int main (void)
 				}
 			}
 
-			/* SBAS/DGPS on-off transitions */
-			if (System.sbas != sbas_prev) {
-				if (sbas_prev != 0xFF)
-					log_sbas_transition();
-				sbas_prev = System.sbas;
+			/* DGPS-quality-fix on-off transitions (the receiver's own doing,
+			 * e.g. from SBAS - not necessarily caused by our own SBAS-search
+			 * request, CONFFLAG_ENABLE_SBAS) */
+			if (System.dgps != dgps_prev) {
+				if (dgps_prev != 0xFF)
+					log_dgps_transition();
+				dgps_prev = System.dgps;
 			}
 
 			if (timer_expired(status_log)) {

+ 1 - 1
soft/main.h

@@ -207,7 +207,7 @@ struct system_s {
 	unsigned temperature_ok:1;
 	unsigned satellites_used:5;
 	unsigned location_valid:2;
-	unsigned sbas:1;
+	unsigned dgps:1; /* GGA reports a DGPS-quality fix - the receiver's own doing, not CONFFLAG_ENABLE_SBAS (our SBAS-search request) */
 	unsigned gps_initialized:2;
 	unsigned gps_only:1;
 	unsigned tracking_paused:1;

+ 2 - 2
soft/nmea.c

@@ -307,9 +307,9 @@ static void gp_gga_parse(const char *str) {
 	if (!p)
 		return;
 	if (*p == '2')
-		System.sbas = 1;
+		System.dgps = 1;
 	else
-		System.sbas = 0;
+		System.dgps = 0;
 
 	p = gp_col(str, 9); /* MSL altitude */
 	if (!p)

+ 5 - 5
soft/syslog.c

@@ -122,7 +122,7 @@ void gps_powered_on(void) {
 void log_fix_event(void) {
 	log_prefix();
 	xprintf(PSTR("FIX %uD"), (unsigned int)System.fix_type);
-	xputs_P(System.sbas ? PSTR("/D") : PSTR(""));
+	xputs_P(System.dgps ? PSTR("/D") : PSTR(""));
 	if (!fix_had_first) {
 		unsigned long int ttff = get_uptime_ms() - gps_on_uptime;
 		xprintf(PSTR(" ttff=%lu.%01lus"), ttff/1000, (ttff%1000)/100);
@@ -138,10 +138,10 @@ void log_fix_lost(void) {
 	xprintf(PSTR("FIX LOST sats=%u\r\n"), (unsigned int)System.satellites_used);
 }
 
-void log_sbas_transition(void) {
+void log_dgps_transition(void) {
 	log_prefix();
-	xputs_P(PSTR("SBAS "));
-	xputs_P(System.sbas ? PSTR("on") : PSTR("off"));
+	xputs_P(PSTR("DGPS "));
+	xputs_P(System.dgps ? PSTR("on") : PSTR("off"));
 	xputs_P(PSTR("\r\n"));
 }
 
@@ -226,7 +226,7 @@ void log_status_line(void) {
 		xprintf(PSTR(" t=%.1f"), (double)System.temperature);
 	xprintf(PSTR(" sats=%u hdop=%.2f fix=%u"), (unsigned int)System.satellites_used,
 		(double)System.hdop_x100/100.0, (unsigned int)System.fix_type);
-	xputs_P(System.sbas ? PSTR("D") : PSTR(""));
+	xputs_P(System.dgps ? PSTR("D") : PSTR(""));
 	xprintf(PSTR(" dist=%.2f gain=%.1f/raw%.1f loss=%.1f/raw%.1f wr=%lu rej=%lu"),
 		(double)System.distance/100.0, (double)System.elevation_gain/10.0, (double)System.elevation_gain_raw/10.0,
 		(double)System.elevation_loss/10.0, (double)System.elevation_loss_raw/10.0,

+ 1 - 1
soft/syslog.h

@@ -13,7 +13,7 @@ void log_boot_record(void);
 void log_config(void);
 void log_fix_event(void);
 void log_fix_lost(void);
-void log_sbas_transition(void);
+void log_dgps_transition(void);
 void log_pause_event(unsigned char started);
 void log_reject(unsigned char reason);
 void log_reject_flush(void);