diff --git a/firmware/application/baseband_api.cpp b/firmware/application/baseband_api.cpp index 62dfbcc1b..e30e1392a 100644 --- a/firmware/application/baseband_api.cpp +++ b/firmware/application/baseband_api.cpp @@ -99,8 +99,9 @@ void set_afsk_data(const uint32_t afsk_samples_per_bit, const uint32_t afsk_phas send_message(&message); } -void set_audiotx_data(const uint32_t bw) { +void set_audiotx_data(const uint32_t divider, const uint32_t bw) { const AudioTXConfigMessage message { + divider, bw }; send_message(&message); diff --git a/firmware/application/baseband_api.hpp b/firmware/application/baseband_api.hpp index 01fea3952..c4d959c72 100644 --- a/firmware/application/baseband_api.hpp +++ b/firmware/application/baseband_api.hpp @@ -53,7 +53,7 @@ struct WFMConfig { }; void set_ccir_data( const uint32_t samples_per_tone, const uint16_t tone_count); -void set_audiotx_data(const uint32_t bw); +void set_audiotx_data(const uint32_t divider, const uint32_t bw); void set_fifo_data(const int8_t * data); void set_pwmrssi(int32_t avg, bool enabled); void set_afsk_data(const uint32_t afsk_samples_per_bit, const uint32_t afsk_phase_inc_mark, const uint32_t afsk_phase_inc_space, diff --git a/firmware/application/file.cpp b/firmware/application/file.cpp index a0ebd7f3c..ffcfd1826 100644 --- a/firmware/application/file.cpp +++ b/firmware/application/file.cpp @@ -138,7 +138,7 @@ static std::string find_last_file_matching_pattern(const std::string& pattern) { return last_match; } -static std::string remove_filename_extension(const std::string& filename) { +std::string remove_filename_extension(const std::string& filename) { const auto extension_index = filename.find_last_of('.'); return filename.substr(0, extension_index); } @@ -178,14 +178,14 @@ std::string next_filename_stem_matching_pattern(const std::string& filename_stem return filename_stem; } -std::vector scan_root_files(const std::string& extension) { +std::vector scan_root_files(const std::string& directory, const std::string& extension) { std::vector file_list { }; std::string fname; FRESULT res; DIR dir; static FILINFO fno; - res = f_opendir(&dir, "/"); + res = f_opendir(&dir, directory.c_str()); if (res == FR_OK) { for (;;) { res = f_readdir(&dir, &fno); diff --git a/firmware/application/file.hpp b/firmware/application/file.hpp index 05c7f74b2..91d1acc93 100644 --- a/firmware/application/file.hpp +++ b/firmware/application/file.hpp @@ -35,8 +35,9 @@ #include #include +std::string remove_filename_extension(const std::string& filename); std::string next_filename_stem_matching_pattern(const std::string& filename_stem_pattern); -std::vector scan_root_files(const std::string& extension); +std::vector scan_root_files(const std::string& directory, const std::string& extension); namespace std { namespace filesystem { diff --git a/firmware/application/ui_about.cpp b/firmware/application/ui_about.cpp index e520f2904..2be3ce2ce 100644 --- a/firmware/application/ui_about.cpp +++ b/firmware/application/ui_about.cpp @@ -59,7 +59,7 @@ void AboutView::on_show() { transmitter_model.set_baseband_bandwidth(1750000); transmitter_model.enable(); - baseband::set_audiotx_data(15); + baseband::set_audiotx_data(32, 15); //audio::headphone::set_volume(volume_t::decibel(0 - 99) + audio::headphone::volume_range().max); } diff --git a/firmware/application/ui_about.hpp b/firmware/application/ui_about.hpp index 2195c4ca3..91158275a 100644 --- a/firmware/application/ui_about.hpp +++ b/firmware/application/ui_about.hpp @@ -113,7 +113,7 @@ private: // 0123456789A 0123456789A const credits_t credits[10] = { {"GURUS", "J. BOONE", false}, - {"GURYS", "M. OSSMANN", true}, + {"GURUS", "M. OSSMANN", true}, {"BUGS", "FURRTEK", true}, {"RDS WAVE", "C. JACQUET", true}, {"POCSAG RX", "T. SAILER", false}, diff --git a/firmware/application/ui_soundboard.cpp b/firmware/application/ui_soundboard.cpp index ed9e03b6e..705da133b 100644 --- a/firmware/application/ui_soundboard.cpp +++ b/firmware/application/ui_soundboard.cpp @@ -25,6 +25,7 @@ #include "ui_soundboard.hpp" #include "ch.h" +#include "file.hpp" #include "ui_alphanum.hpp" #include "ff.h" @@ -108,7 +109,9 @@ void SoundBoardView::on_tuning_frequency_changed(rf::Frequency f) { void SoundBoardView::play_sound(uint16_t id) { - auto error = file.open(sounds[id].filename); + if (sounds[id].size == 0) return; + + auto error = file.open("/wav/" + sounds[id].filename); if (error.is_valid()) return; sample_duration = sounds[id].sample_duration; @@ -132,7 +135,7 @@ void SoundBoardView::play_sound(uint16_t id) { transmitter_model.set_baseband_bandwidth(1750000); transmitter_model.enable(); - baseband::set_audiotx_data(number_bw.value()); + baseband::set_audiotx_data(1536000 / sounds[id].sample_rate, number_bw.value()); } void SoundBoardView::show_infos(uint16_t id) { @@ -174,7 +177,6 @@ void SoundBoardView::change_page(Button& button, const KeyEvent key) { refresh_buttons(button.id); } } - if (button.screen_pos().x > 120) { if ((key == KeyEvent::Right) && (page < max_page - 1)) { page++; @@ -204,12 +206,12 @@ SoundBoardView::SoundBoardView( baseband::run_image(portapack::spi_flash::image_tag_audio_tx); - file_list = scan_root_files(".WAV"); + file_list = scan_root_files("/wav", ".WAV"); c = 0; for (auto& file_name : file_list) { - auto error = file.open(file_name); + auto error = file.open("/wav/" + file_name); file.seek(40); file.read(file_buffer, 4); @@ -240,7 +242,7 @@ SoundBoardView::SoundBoardView( sounds[c].sample_duration = size; sounds[c].filename = file_name; - sounds[c].shortname = file_name.substr(0, file_name.find_last_of(".")); + sounds[c].shortname = remove_filename_extension(file_name); c++; if (c == 100) break; @@ -271,8 +273,6 @@ SoundBoardView::SoundBoardView( }; const auto button_dir = [this](Button& button, const KeyEvent key) { - (void)button; - this->change_page(button, key); }; diff --git a/firmware/application/ui_soundboard.hpp b/firmware/application/ui_soundboard.hpp index 324166d41..bb8054042 100644 --- a/firmware/application/ui_soundboard.hpp +++ b/firmware/application/ui_soundboard.hpp @@ -52,14 +52,14 @@ private: tx_modes tx_mode = NORMAL; struct sound { - std::string filename; - std::string shortname; - bool stereo; - bool sixteenbit; - uint32_t sample_rate; - uint32_t size; - uint32_t sample_duration; - uint32_t ms_duration; + std::string filename = ""; + std::string shortname = ""; + bool stereo = false; + bool sixteenbit = false; + uint32_t sample_rate = 0; + uint32_t size = 0; + uint32_t sample_duration = 0; + uint32_t ms_duration = 0; }; uint32_t cnt; diff --git a/firmware/baseband/proc_audiotx.cpp b/firmware/baseband/proc_audiotx.cpp index 22b5adb8e..05ef3e1c5 100644 --- a/firmware/baseband/proc_audiotx.cpp +++ b/firmware/baseband/proc_audiotx.cpp @@ -34,12 +34,12 @@ void AudioTXProcessor::execute(const buffer_c8_t& buffer){ if (!configured) return; - ai = 0; + //ai = 0; for (size_t i = 0; ibw); + divider = message->divider; as = 0; configured = true; diff --git a/firmware/baseband/proc_audiotx.hpp b/firmware/baseband/proc_audiotx.hpp index 2cad1548e..fc23f0bd5 100644 --- a/firmware/baseband/proc_audiotx.hpp +++ b/firmware/baseband/proc_audiotx.hpp @@ -42,7 +42,9 @@ private: FIFO audio_fifo = { audio_fifo_data, 11 }; // 43ms @ 48000Hz uint32_t bw; - uint8_t as = 0, ai; + uint32_t divider; + uint8_t as = 0; + int8_t re, im; int8_t sample; diff --git a/firmware/common/message.hpp b/firmware/common/message.hpp index 71a6f31e6..0f0c438a5 100644 --- a/firmware/common/message.hpp +++ b/firmware/common/message.hpp @@ -561,12 +561,15 @@ public: class AudioTXConfigMessage : public Message { public: constexpr AudioTXConfigMessage( + const uint32_t divider, const uint32_t bw ) : Message { ID::AudioTXConfig }, + divider(divider), bw(bw) { } + const uint32_t divider; const uint32_t bw; }; diff --git a/firmware/portapack-h1-havoc.bin b/firmware/portapack-h1-havoc.bin index 1758558ba..811bd6114 100644 Binary files a/firmware/portapack-h1-havoc.bin and b/firmware/portapack-h1-havoc.bin differ diff --git a/pictures/about.png b/pictures/about.png new file mode 100644 index 000000000..92ba75646 Binary files /dev/null and b/pictures/about.png differ diff --git a/pictures/afsk.png b/pictures/afsk.png new file mode 100644 index 000000000..5c2e08d29 Binary files /dev/null and b/pictures/afsk.png differ diff --git a/pictures/config.png b/pictures/config.png new file mode 100644 index 000000000..33bbb84a9 Binary files /dev/null and b/pictures/config.png differ diff --git a/pictures/lcr.png b/pictures/lcr.png new file mode 100644 index 000000000..8f7d12bc5 Binary files /dev/null and b/pictures/lcr.png differ diff --git a/pictures/ook_enc.png b/pictures/ook_enc.png new file mode 100644 index 000000000..dbb8670c0 Binary files /dev/null and b/pictures/ook_enc.png differ diff --git a/pictures/pocsag.png b/pictures/pocsag.png new file mode 100644 index 000000000..17e5c6ec0 Binary files /dev/null and b/pictures/pocsag.png differ diff --git a/pictures/rds.png b/pictures/rds.png new file mode 100644 index 000000000..9e692b6f1 Binary files /dev/null and b/pictures/rds.png differ diff --git a/pictures/soundboard.png b/pictures/soundboard.png new file mode 100644 index 000000000..fcffbf44f Binary files /dev/null and b/pictures/soundboard.png differ diff --git a/pictures/xylos.png b/pictures/xylos.png new file mode 100644 index 000000000..f83a88082 Binary files /dev/null and b/pictures/xylos.png differ