fix recon start and mode change (#1208)

This commit is contained in:
gullradriel 2023-06-28 22:21:13 +02:00 committed by GitHub
parent 7b1541d2e8
commit 19b77bf03b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1339,7 +1339,7 @@ size_t ReconView::change_mode(freqman_index_t new_mod) {
field_bw.on_change = [this](size_t, OptionsField::value_t) {}; field_bw.on_change = [this](size_t, OptionsField::value_t) {};
recon_stop_recording(); recon_stop_recording();
remove_child(record_view.get()); remove_child(record_view.get());
record_view.reset();
if (new_mod == SPEC_MODULATION) { if (new_mod == SPEC_MODULATION) {
audio::output::stop(); audio::output::stop();
record_view = std::make_unique<RecordView>(Rect{0, 0, 30 * 8, 1 * 16}, record_view = std::make_unique<RecordView>(Rect{0, 0, 30 * 8, 1 * 16},
@ -1350,14 +1350,12 @@ size_t ReconView::change_mode(freqman_index_t new_mod) {
u"AUTO_AUDIO_", u"AUDIO", u"AUTO_AUDIO_", u"AUDIO",
RecordView::FileType::WAV, 4096, 4); RecordView::FileType::WAV, 4096, 4);
} }
add_child(record_view.get());
record_view->hidden(true); record_view->hidden(true);
record_view->set_filename_date_frequency(true); record_view->set_filename_date_frequency(true);
record_view->on_error = [this](std::string message) { record_view->on_error = [this](std::string message) {
nav_.display_modal("Error", message); nav_.display_modal("Error", message);
}; };
add_child(record_view.get());
receiver_model.disable(); receiver_model.disable();
baseband::shutdown(); baseband::shutdown();
size_t recording_sampling_rate = 0; size_t recording_sampling_rate = 0;
@ -1440,14 +1438,12 @@ size_t ReconView::change_mode(freqman_index_t new_mod) {
} }
if (new_mod != SPEC_MODULATION) if (new_mod != SPEC_MODULATION)
record_view->set_sampling_rate(recording_sampling_rate); record_view->set_sampling_rate(recording_sampling_rate);
field_mode.set_selected_index(new_mod); field_mode.set_selected_index(new_mod);
field_mode.on_change = [this](size_t, OptionsField::value_t v) { field_mode.on_change = [this](size_t, OptionsField::value_t v) {
if (v != -1) { if (v != -1) {
change_mode(v); change_mode(v);
} }
}; };
// for some motive, audio output gets stopped. // for some motive, audio output gets stopped.
if (!recon && field_mode.selected_index_value() != SPEC_MODULATION) if (!recon && field_mode.selected_index_value() != SPEC_MODULATION)
audio::output::start(); // so if recon was stopped we resume audio audio::output::start(); // so if recon was stopped we resume audio