X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao_log.c;h=107c4323b53d41cab23df34a9324e8d99e23fc6c;hp=bcd852c0bc5089780eb5fa38889575c592f11757;hb=4d83eef0fe1d24a845ab29a535dfc56e13e7ee20;hpb=5ed3b1cb52b573db1fee9655a29a0e6dd72f53fe diff --git a/ao_log.c b/ao_log.c index bcd852c0..107c4323 100644 --- a/ao_log.c +++ b/ao_log.c @@ -121,13 +121,15 @@ ao_log(void) log.type = AO_LOG_FLIGHT; log.tick = ao_flight_tick; - log.u.flight.serial = 0; + log.u.flight.ground_accel = ao_ground_accel; log.u.flight.flight = ao_log_dump_flight + 1; ao_log_data(&log); - for (;;) { - while (!ao_log_running) - ao_sleep(&ao_log_running); + /* Write the whole contents of the ring to the log + * when starting up. + */ + ao_log_adc_pos = ao_adc_ring_next(ao_adc_head); + for (;;) { /* Write samples to EEPROM */ while (ao_log_adc_pos != ao_adc_head) { log.type = AO_LOG_SENSOR; @@ -164,6 +166,10 @@ ao_log(void) /* Wait for a while */ ao_delay(AO_MS_TO_TICKS(100)); + + /* Stop logging when told to */ + while (!ao_log_running) + ao_sleep(&ao_log_running); } }