CaptureAppView::CaptureAppView(NavigationView& nav) { baseband::run_image(portapack::spi_flash::image_tag_capture); add_children({ { &rssi, &channel, &field_frequency, &field_frequency_step, &field_rf_amp, &field_lna, &field_vga, &record_view, &waterfall, } }); field_frequency.set_value(target_frequency()); field_frequency.set_step(receiver_model.frequency_step()); field_frequency.on_change = [this](rf::Frequency f) { this->on_target_frequency_changed(f); }; field_frequency.on_edit = [this, &nav]() { // TODO: Provide separate modal method/scheme? auto new_view = nav.push<FrequencyKeypadView>(this->target_frequency()); new_view->on_changed = [this](rf::Frequency f) { this->on_target_frequency_changed(f); this->field_frequency.set_value(f); }; }; field_frequency_step.set_by_value(receiver_model.frequency_step()); field_frequency_step.on_change = [this](size_t, OptionsField::value_t v) { receiver_model.set_frequency_step(v); this->field_frequency.set_step(v); }; radio::enable({ tuning_frequency(), sampling_rate, baseband_bandwidth, rf::Direction::Receive, receiver_model.rf_amp(), static_cast<int8_t>(receiver_model.lna()), static_cast<int8_t>(receiver_model.vga()), }); record_view.set_sampling_rate(sampling_rate / 8); record_view.on_error = [&nav](std::string message) { nav.display_modal("Error", message); }; }
AnalogAudioView::AnalogAudioView( NavigationView& nav ) { add_children({ { &rssi, &channel, &audio, &field_frequency, &field_lna, &field_vga, &options_modulation, &field_volume, &record_view, &waterfall, } }); field_frequency.set_value(receiver_model.tuning_frequency()); field_frequency.set_step(receiver_model.frequency_step()); field_frequency.on_change = [this](rf::Frequency f) { this->on_tuning_frequency_changed(f); }; field_frequency.on_edit = [this, &nav]() { // TODO: Provide separate modal method/scheme? auto new_view = nav.push<FrequencyKeypadView>(receiver_model.tuning_frequency()); new_view->on_changed = [this](rf::Frequency f) { this->on_tuning_frequency_changed(f); this->field_frequency.set_value(f); }; }; field_frequency.on_show_options = [this]() { this->on_show_options_frequency(); }; field_lna.on_show_options = [this]() { this->on_show_options_rf_gain(); }; field_vga.on_show_options = [this]() { this->on_show_options_rf_gain(); }; const auto modulation = receiver_model.modulation(); options_modulation.set_by_value(toUType(modulation)); options_modulation.on_change = [this](size_t, OptionsField::value_t v) { this->on_modulation_changed(static_cast<ReceiverModel::Mode>(v)); }; options_modulation.on_show_options = [this]() { this->on_show_options_modulation(); }; field_volume.set_value((receiver_model.headphone_volume() - audio::headphone::volume_range().max).decibel() + 99); field_volume.on_change = [this](int32_t v) { this->on_headphone_volume_changed(v); }; record_view.on_error = [&nav](std::string message) { nav.display_modal("Error", message); }; audio::output::start(); update_modulation(static_cast<ReceiverModel::Mode>(modulation)); }