mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-10-19 09:31:59 +00:00
Display remaining capture time on SD card.
This commit is contained in:
@@ -151,6 +151,7 @@ RecordView::RecordView(
|
||||
&button_record,
|
||||
&text_record_filename,
|
||||
&text_record_dropped,
|
||||
&text_time_recorded,
|
||||
} });
|
||||
|
||||
button_record.on_select = [this](ImageButton&) {
|
||||
@@ -245,6 +246,11 @@ void RecordView::on_tick_second() {
|
||||
const auto dropped_percent = std::min(99U, capture_thread->state().dropped_percent());
|
||||
const auto s = to_string_dec_uint(dropped_percent, 2, ' ') + "\%";
|
||||
text_record_dropped.set(s);
|
||||
|
||||
const auto space_info = std::filesystem::space("");
|
||||
const uint32_t bytes_per_second = file_type == FileType::WAV ? (sampling_rate * 2) : (sampling_rate * 4);
|
||||
const uint32_t free_seconds = space_info.free / bytes_per_second;
|
||||
text_time_recorded.set(to_string_dec_uint(free_seconds, 6, ' ') + "s");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user