mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Display remaining capture time on SD card.
This commit is contained in:
parent
f157c13442
commit
b2322370a9
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,6 +95,11 @@ private:
|
||||
"",
|
||||
};
|
||||
|
||||
Text text_time_recorded {
|
||||
{ 23 * 8, 0 * 16, 7 * 8, 16 },
|
||||
"",
|
||||
};
|
||||
|
||||
std::unique_ptr<CaptureThread> capture_thread;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user