Display remaining capture time on SD card.

This commit is contained in:
Jared Boone 2016-05-11 11:22:57 -07:00
parent f157c13442
commit b2322370a9
2 changed files with 11 additions and 0 deletions

View File

@ -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");
}
}

View File

@ -95,6 +95,11 @@ private:
"",
};
Text text_time_recorded {
{ 23 * 8, 0 * 16, 7 * 8, 16 },
"",
};
std::unique_ptr<CaptureThread> capture_thread;
};