diff --git a/firmware/application/main.cpp b/firmware/application/main.cpp index 3bfc3dc82..ded06ac97 100755 --- a/firmware/application/main.cpp +++ b/firmware/application/main.cpp @@ -33,6 +33,7 @@ //BUG: SCANNER Lock on frequency, if frequency jump, still locked on first one //BUG: SCANNER Multiple slices +//TODO: Make tone generator class for baseband (with freq, samplerate and mixing ratio parameters) //TODO: Cap Wav viewer position //TODO: Adapt wav viewer position step //TODO: Use unit_auto_scale diff --git a/firmware/application/radio.cpp b/firmware/application/radio.cpp index 2b55b3c58..6c6e556bf 100644 --- a/firmware/application/radio.cpp +++ b/firmware/application/radio.cpp @@ -36,6 +36,8 @@ #include "hackrf_gpio.hpp" using namespace hackrf::one; +#include "cpld_update.hpp" + #include "portapack.hpp" namespace radio { @@ -105,6 +107,17 @@ void init() { void set_direction(const rf::Direction new_direction) { /* TODO: Refactor all the various "Direction" enumerations into one. */ /* TODO: Only make changes if direction changes, but beware of clock enabling. */ + + if (direction != new_direction) { + if (new_direction == rf::Direction::Transmit) { + hackrf::cpld::init_from_eeprom(); + } else { + if( !hackrf::cpld::load_sram() ) { + chSysHalt(); + } + } + } + direction = new_direction; second_if.set_mode((direction == rf::Direction::Transmit) ? max2837::Mode::Transmit : max2837::Mode::Receive); diff --git a/firmware/application/ui_mictx.cpp b/firmware/application/ui_mictx.cpp index fec6c966c..5b231434c 100644 --- a/firmware/application/ui_mictx.cpp +++ b/firmware/application/ui_mictx.cpp @@ -129,9 +129,9 @@ MicTXView::MicTXView( ) { pins[P6_2].mode(3); // Set P6_2 pin function to I2S0_RX_SDA - - baseband::run_image(portapack::spi_flash::image_tag_mic_tx); + baseband::run_image(portapack::spi_flash::image_tag_mic_tx); + add_children({ &labels, &vumeter, @@ -220,7 +220,7 @@ MicTXView::MicTXView( set_tx(false); - audio::set_rate(audio::Rate::Hz_48000); + audio::set_rate(audio::Rate::Hz_24000); audio::input::start(); } diff --git a/firmware/application/ui_mictx.hpp b/firmware/application/ui_mictx.hpp index 561b65334..50c3f9f97 100644 --- a/firmware/application/ui_mictx.hpp +++ b/firmware/application/ui_mictx.hpp @@ -74,7 +74,7 @@ private: bool rogerbeep_enabled { }; uint32_t tone_key_index { }; bool tone_key_enabled { }; - uint32_t mic_gain_x10 { }; + uint32_t mic_gain_x10 { 10 }; uint32_t audio_level { 0 }; uint32_t va_level { }; uint32_t attack_ms { }; diff --git a/firmware/baseband/proc_mictx.cpp b/firmware/baseband/proc_mictx.cpp index 9fb10515f..d902093d8 100644 --- a/firmware/baseband/proc_mictx.cpp +++ b/firmware/baseband/proc_mictx.cpp @@ -39,7 +39,7 @@ void MicTXProcessor::execute(const buffer_c8_t& buffer){ for (size_t i = 0; i < buffer.count; i++) { if (!play_beep) { - sample = audio_buffer.p[i >> 5] >> 8; // 1536000 / 32 = 48000 + sample = audio_buffer.p[i >> 6] >> 8; // 1536000 / 64 = 24000 sample = (sample * (int32_t)gain_x10) / 10; power += (sample < 0) ? -sample : sample; // Power average for UI vu-meter