+ public int log_available() {
+ switch (log_format) {
+ case Altos.AO_LOG_FORMAT_TINY:
+ if (stored_flight == 0)
+ return 1;
+ return 0;
+ default:
+ if (flight_log_max <= 0)
+ return 1;
+ int log_space = storage_size - storage_erase_unit;
+ int log_used = stored_flight * flight_log_max;
+
+ if (log_used >= log_space)
+ return 0;
+ return (log_space - log_used) / flight_log_max;
+ }
+ }
+