diff options
author | Keith Packard <keithp@keithp.com> | 2019-06-18 23:16:12 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2019-06-18 23:16:12 -0700 |
commit | c4b8aff07d5366cef2c7209729f6cd22fa67de0c (patch) | |
tree | 9028f2421cf2217d5501c5aee6e335ac700396e0 /src/micropeak-v2.0/ao_micropeak.c | |
parent | 835faccc2c1141f7cd8ff93629d583fcaf785e48 (diff) |
altos/micropeak-v2: Erase log space at end of BOOST_DELAY
We have to erase the log before the flight starts, so this seems like
the latest possible moment.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/micropeak-v2.0/ao_micropeak.c')
-rw-r--r-- | src/micropeak-v2.0/ao_micropeak.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/micropeak-v2.0/ao_micropeak.c b/src/micropeak-v2.0/ao_micropeak.c index dd86ba1c..0b9972e9 100644 --- a/src/micropeak-v2.0/ao_micropeak.c +++ b/src/micropeak-v2.0/ao_micropeak.c @@ -164,6 +164,13 @@ ao_battery_voltage(void) return 330 * stm_cal.vrefint_cal / vrefint; } +static void +ao_log_erase(void) +{ + uint32_t pos; + for (pos = 0; pos < ao_storage_log_max; pos += ao_storage_block) + ao_storage_erase(pos); +} uint8_t ao_on_battery; @@ -186,6 +193,7 @@ ao_micropeak(void) #if BOOST_DELAY ao_delay(BOOST_DELAY); #endif + ao_log_erase(); ao_microflight(); @@ -239,9 +247,7 @@ ao_log_delete(void) /* Look for the flight log matching the requested flight */ if (cmd_flight == 1 && ao_log_present()) { - uint32_t pos; - for (pos = 0; pos < ao_storage_log_max; pos += ao_storage_block) - ao_storage_erase(pos); + ao_log_erase(); puts("Erased"); return; } |