X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Fcore%2Fao_log_telem.c;h=34abe879b210bf20637f108afe6d0be3c49998f7;hp=1b472efe38614a7d2d52cb2dd6b896b3c836a1dc;hb=b33a92e372327158ab21c1bb2d091c58761efe10;hpb=7e2b5e2957ddcb808723081ca7e046a28b7e70e5 diff --git a/src/core/ao_log_telem.c b/src/core/ao_log_telem.c index 1b472efe..34abe879 100644 --- a/src/core/ao_log_telem.c +++ b/src/core/ao_log_telem.c @@ -17,14 +17,52 @@ #include "ao.h" +__code uint8_t ao_log_format = AO_LOG_FORMAT_TELEMETRY; + +static __data uint8_t ao_log_monitor_pos; + +void +ao_log_single(void) +{ + ao_storage_setup(); + + /* This can take a while, so let the rest + * of the system finish booting before we start + */ + ao_delay(AO_SEC_TO_TICKS(2)); + + ao_log_single_restart(); + for (;;) { + while (!ao_log_running) + ao_sleep(&ao_log_running); + + ao_log_monitor_pos = ao_monitor_head; + 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_log_single_write(); + ao_log_monitor_pos = ao_monitor_ring_next(ao_log_monitor_pos); + } + /* Wait for more ADC data to arrive */ + ao_sleep(DATA_TO_XDATA(&ao_monitor_head)); + } + } +} + void -ao_log_write_erase(uint8_t pos) +ao_log_single_list(void) { - (void) pos; + if (ao_log_current_pos != 0) + printf("flight 1 start %x end %x\n", + 0, + (uint16_t) ((ao_log_current_pos + 0xff) >> 8)); + printf ("done\n"); } -uint8_t -ao_log_present(void) +void +ao_log_single_extra_query(void) { - return 0; }