- log_current_pos = ao_log_pos(slot);
- log_end_pos = log_current_pos + ao_config.flight_log_max;
- while (log_current_pos < log_end_pos) {
- uint8_t i;
- static __xdata uint8_t b;
-
- /*
- * Check to see if we've reached the end of
- * the used memory to avoid re-erasing the same
- * memory over and over again
- */
- for (i = 0; i < 16; i++) {
- if (ao_storage_read(log_current_pos + i, &b, 1))
- if (b != 0xff)
- break;
- }
- if (i == 16)
- break;
- ao_storage_erase(log_current_pos);
- log_current_pos += ao_storage_block;
- }
+ start_pos = ao_log_pos_block_start(slot);
+ end_pos = ao_log_pos_block_end(slot);
+ return ao_storage_erase(start_pos, end_pos - start_pos);