Switch from GPLv2 to GPLv2+
[fw/altos] / src / kernel / ao_log_gps.c
index 8bf529f40b862a2eff145338bd2e83346aee08bb..02551169fd46f80a18a8839f5518ef9d63c22da1 100644 (file)
@@ -3,7 +3,8 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
 #include <ao_distance.h>
 #include <ao_tracker.h>
 
-static __xdata uint8_t ao_log_mutex;
 static __xdata struct ao_log_gps log;
 
 __code uint8_t ao_log_format = AO_LOG_FORMAT_TELEGPS;
+__code uint8_t ao_log_size = sizeof (struct ao_log_gps);
 
 static uint8_t
 ao_log_csum(__xdata uint8_t *b) __reentrant
@@ -76,7 +77,8 @@ ao_log_gps_data(uint16_t tick, struct ao_telemetry_location *gps_data)
        log.type = AO_LOG_GPS_TIME;
        log.u.gps.latitude = gps_data->latitude;
        log.u.gps.longitude = gps_data->longitude;
-       log.u.gps.altitude = gps_data->altitude;
+       log.u.gps.altitude_low = gps_data->altitude_low;
+       log.u.gps.altitude_high = gps_data->altitude_high;
 
        log.u.gps.hour = gps_data->hour;
        log.u.gps.minute = gps_data->minute;
@@ -136,3 +138,16 @@ ao_log_flight(uint8_t slot)
                return log.u.flight.flight;
        return 0;
 }
+
+uint8_t
+ao_log_check(uint32_t pos)
+{
+       if (!ao_storage_read(pos,
+                            &log,
+                            sizeof (struct ao_log_gps)))
+               return 0;
+
+       if (ao_log_dump_check_data())
+               return 1;
+       return 0;
+}