altoslib: Missed a couple of easy mini voltage API changes
[fw/altos] / src / core / ao_log_telem.c
index 096ad9191e6255d930bb5596d2ef953d32daa518..095aca371d0227b0851a143b8e567ef4a6e6a261 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-#include "ao.h"
+#include <ao.h>
+#include <ao_flight.h>
+#include <ao_sample.h>
 
 __code uint8_t ao_log_format = AO_LOG_FORMAT_TELEMETRY;
 
 static __data uint8_t                  ao_log_monitor_pos;
 __pdata enum ao_flight_state           ao_flight_state;
-__pdata int16_t                                ao_max_height;  /* max of ao_height */
+__xdata int16_t                                ao_max_height;  /* max of ao_height */
 __pdata int16_t                                sense_d, sense_m;
 __pdata uint8_t                                ao_igniter_present;
 
@@ -90,6 +92,8 @@ ao_log_single(void)
        ao_log_running = 1;
        ao_log_single_restart();
        ao_flight_state = ao_flight_startup;
+       ao_monitor_set(sizeof(struct ao_telemetry_generic));
+
        for (;;) {
                while (!ao_log_running)
                        ao_sleep(&ao_log_running);
@@ -98,9 +102,9 @@ ao_log_single(void)
                while (ao_log_running) {
                        /* Write samples to EEPROM */
                        while (ao_log_monitor_pos != ao_monitor_head) {
-                               memcpy(&ao_log_single_write_data.telemetry,
-                                      &ao_monitor_ring[ao_log_monitor_pos],
-                                      AO_LOG_SINGLE_SIZE);
+                               ao_xmemcpy(&ao_log_single_write_data.telemetry,
+                                          &ao_monitor_ring[ao_log_monitor_pos],
+                                          AO_LOG_SINGLE_SIZE);
                                ao_log_single_write();
                                ao_log_monitor_pos = ao_monitor_ring_next(ao_log_monitor_pos);
                                ao_log_telem_track();