diff --git a/firmware/application/analog_audio_app.cpp b/firmware/application/analog_audio_app.cpp index fa2ba2e4e..872a57c27 100644 --- a/firmware/application/analog_audio_app.cpp +++ b/firmware/application/analog_audio_app.cpp @@ -271,6 +271,8 @@ void AnalogAudioView::update_modulation(const ReceiverModel::Mode modulation) { audio::output::mute(); record_view.stop(); + baseband::shutdown(); + portapack::spi_flash::image_tag_t image_tag; switch(modulation) { case ReceiverModel::Mode::AMAudio: image_tag = portapack::spi_flash::image_tag_am_audio; break; diff --git a/firmware/application/baseband_api.cpp b/firmware/application/baseband_api.cpp index 599a31b8a..0e50c5c1b 100644 --- a/firmware/application/baseband_api.cpp +++ b/firmware/application/baseband_api.cpp @@ -90,17 +90,30 @@ void stop() { send_message(&message); } +static bool baseband_image_running = false; + void run_image(const portapack::spi_flash::image_tag_t image_tag) { + if( baseband_image_running ) { + chDbgPanic("BBRunning"); + } + m4_init(image_tag, portapack::memory::map::m4_code); + baseband_image_running = true; creg::m4txevent::enable(); } void shutdown() { + if( !baseband_image_running ) { + return; + } + creg::m4txevent::disable(); ShutdownMessage message; send_message(&message); + + baseband_image_running = false; } void spectrum_streaming_start() {