altos: Don't add AO_LOG_FLIGHT to existing GPS logs
authorKeith Packard <keithp@keithp.com>
Mon, 1 Sep 2014 23:12:29 +0000 (18:12 -0500)
committerKeith Packard <keithp@keithp.com>
Mon, 1 Sep 2014 23:12:29 +0000 (18:12 -0500)
When appending to a TeleGPS log, don't stick another flight value into
the log. That just confuses the ground station software.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/kernel/ao_log.c
src/kernel/ao_log.h
src/kernel/ao_tracker.c

index dc3b6486caabea5355753cea8e446fd1eb213dac..40a96ef7f259fa4811d6faa11c9567fbd323b6ec 100644 (file)
@@ -192,12 +192,14 @@ ao_log_find_max_erase_flight(void) __reentrant
                ao_flight_number = 1;
 }
 
-void
+uint8_t
 ao_log_scan(void) __reentrant
 {
        uint8_t         log_slot;
        uint8_t         log_slots;
-#if !FLIGHT_LOG_APPEND
+#if FLIGHT_LOG_APPEND
+       uint8_t         ret;
+#else
        uint8_t         log_want;
 #endif
 
@@ -248,9 +250,13 @@ ao_log_scan(void) __reentrant
                                empty = ao_log_current_pos;
                        }
                }
+               ret = 1;
        } else {
                ao_log_find_max_erase_flight();
+               ret = 0;
        }
+       ao_wakeup(&ao_flight_number);
+       return ret;
 #else
 
        if (ao_flight_number)
@@ -278,8 +284,9 @@ ao_log_scan(void) __reentrant
                if (++log_slot >= log_slots)
                        log_slot = 0;
        } while (log_slot != log_want);
-#endif
        ao_wakeup(&ao_flight_number);
+       return 0;
+#endif
 }
 
 void
index c5fa7faba6d867bee81ab990fcdf35eafa0d69c1..c13a2580f71e3bdae2af7be7d978b71d6d921eff 100644 (file)
@@ -72,7 +72,7 @@ ao_log(void);
 /* functions provided in ao_log.c */
 
 /* Figure out the current flight number */
-void
+uint8_t
 ao_log_scan(void) __reentrant;
 
 /* Return the position of the start of the given log slot */
index d94340484a8221248d89068bad9320c141e3fbf0..9b007af82109defdc752e56cfcd375a374c5b1e6 100644 (file)
@@ -72,7 +72,7 @@ ao_tracker(void)
 #if !HAS_USB_CONNECT
        ao_tracker_force_telem = 1;
 #endif
-       ao_log_scan();
+       log_started = ao_log_scan();
 
        ao_rdf_set(1);
 
@@ -181,8 +181,7 @@ void
 ao_tracker_erase_end(void)
 {
        if (erasing_current) {
-               ao_log_scan();
-               log_started = 0;
+               log_started = ao_log_scan();
                ao_mutex_put(&tracker_mutex);
        }
 }