diff options
| author | Keith Packard <keithp@keithp.com> | 2017-10-22 15:44:32 -0500 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2017-10-28 08:42:18 -0700 | 
| commit | 83929cd290279963b01b2ccd52c70d61bdeff6b0 (patch) | |
| tree | 1e76700f3322f9db686c661cbec036d8000510a9 /src/kernel/ao_gps_report_metrum.c | |
| parent | 256ddea8c430b4b5dcb8bb95c19ad26032129e1b (diff) | |
altos: Share common logging code. Deal with corrupt initial flight records
Move common logging APIs from per-format files into ao_log.c. Then,
change that code to check the first log record in a slot (containing
the flight number) to see if it's invalid and deal with it. That
involves not re-using that slot, and allowing it to be erased.
Corrupted log blocks are reported with a negative flight number.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/kernel/ao_gps_report_metrum.c')
| -rw-r--r-- | src/kernel/ao_gps_report_metrum.c | 8 | 
1 files changed, 4 insertions, 4 deletions
diff --git a/src/kernel/ao_gps_report_metrum.c b/src/kernel/ao_gps_report_metrum.c index 508f1519..523fb17f 100644 --- a/src/kernel/ao_gps_report_metrum.c +++ b/src/kernel/ao_gps_report_metrum.c @@ -47,7 +47,7 @@ ao_gps_report_metrum(void)  			gps_log.u.gps.longitude = gps_data.longitude;  			gps_log.u.gps.altitude_low = gps_data.altitude_low;  			gps_log.u.gps.altitude_high = gps_data.altitude_high; -			ao_log_metrum(&gps_log); +			ao_log_write(&gps_log);  			gps_log.type = AO_LOG_GPS_TIME;  			gps_log.u.gps_time.hour = gps_data.hour; @@ -58,7 +58,7 @@ ao_gps_report_metrum(void)  			gps_log.u.gps_time.month = gps_data.month;  			gps_log.u.gps_time.day = gps_data.day;  			gps_log.u.gps_time.pdop = gps_data.pdop; -			ao_log_metrum(&gps_log); +			ao_log_write(&gps_log);  		}  		if ((new & AO_GPS_NEW_TRACKING) && (n = gps_tracking_data.channels)) { @@ -71,7 +71,7 @@ ao_gps_report_metrum(void)  					if (i == 4) {  						gps_log.u.gps_sat.channels = i;  						gps_log.u.gps_sat.more = 1; -						ao_log_metrum(&gps_log); +						ao_log_write(&gps_log);  						i = 0;  					}  					gps_log.u.gps_sat.sats[i].svid = svid; @@ -82,7 +82,7 @@ ao_gps_report_metrum(void)  			if (i) {  				gps_log.u.gps_sat.channels = i;  				gps_log.u.gps_sat.more = 0; -				ao_log_metrum(&gps_log); +				ao_log_write(&gps_log);  			}  		}  	}  | 
