Numbers station works, very basic

Added utilities, whip antenna length calculator
Modal errors/abort
This commit is contained in:
furrtek
2016-12-06 13:31:38 +01:00
parent d18b6d135d
commit e56fa0f479
32 changed files with 642 additions and 153 deletions

View File

@@ -74,10 +74,11 @@ void SoundBoardView::prepare_audio() {
}
pbar.set_value(cnt);
size_t bytes_read = file.read(audio_buffer, 1024).value();
file.read(audio_buffer, 1024);
for (size_t n = 0; n < 1024; n++)
// Unsigned to signed, pretty stupid :/
for (size_t n = 0; n < bytes_read; n++)
audio_buffer[n] -= 0x80;
cnt += 1024;
@@ -87,6 +88,10 @@ void SoundBoardView::prepare_audio() {
void SoundBoardView::focus() {
buttons[0].focus();
if (!max_sound) {
nav_.display_modal("No files", "No files in /wav/ directory", ABORT, nullptr);
}
}
void SoundBoardView::on_tuning_frequency_changed(rf::Frequency f) {
@@ -202,7 +207,7 @@ void SoundBoardView::on_ctcss_changed(uint32_t v) {
SoundBoardView::SoundBoardView(
NavigationView& nav
)
) : nav_ (nav)
{
std::vector<std::string> file_list;
std::string file_name;
@@ -256,11 +261,6 @@ SoundBoardView::SoundBoardView(
}
}
if (!c) {
nav.display_modal("No files", "No files in /wav/ directory");
nav.pop();
}
max_sound = c;
max_page = max_sound / 21; // 21 buttons per page