mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-01-26 06:26:17 -05:00
Restore use of ReceiverModel::Mode enum.
This commit is contained in:
parent
4d3294c228
commit
c5f8daa210
@ -149,10 +149,9 @@ AnalogAudioView::AnalogAudioView(
|
|||||||
this->on_vga_changed(v_db);
|
this->on_vga_changed(v_db);
|
||||||
};
|
};
|
||||||
|
|
||||||
options_modulation.set_by_value(1);
|
options_modulation.set_by_value(toUType(ReceiverModel::Mode::AMAudio));
|
||||||
options_modulation.on_change = [this](size_t n, OptionsField::value_t v) {
|
options_modulation.on_change = [this](size_t, OptionsField::value_t v) {
|
||||||
(void)n;
|
this->on_modulation_changed(static_cast<ReceiverModel::Mode>(v));
|
||||||
this->on_modulation_changed(v);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
field_volume.set_value((receiver_model.headphone_volume() - wolfson::wm8731::headphone_gain_range.max).decibel() + 99);
|
field_volume.set_value((receiver_model.headphone_volume() - wolfson::wm8731::headphone_gain_range.max).decibel() + 99);
|
||||||
@ -229,63 +228,58 @@ void AnalogAudioView::on_vga_changed(int32_t v_db) {
|
|||||||
receiver_model.set_vga(v_db);
|
receiver_model.set_vga(v_db);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalogAudioView::on_modulation_changed(int32_t mode) {
|
void AnalogAudioView::on_modulation_changed(const ReceiverModel::Mode mode) {
|
||||||
// remove_child(widget_content.get());
|
|
||||||
// widget_content.reset();
|
|
||||||
|
|
||||||
// TODO: Terrible kludge because widget system doesn't notify Waterfall that
|
// TODO: Terrible kludge because widget system doesn't notify Waterfall that
|
||||||
// it's being shown or hidden.
|
// it's being shown or hidden.
|
||||||
waterfall.on_hide();
|
waterfall.on_hide();
|
||||||
|
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
default:
|
default:
|
||||||
case 1:
|
case ReceiverModel::Mode::AMAudio:
|
||||||
receiver_model.set_baseband_configuration({
|
receiver_model.set_baseband_configuration({
|
||||||
.mode = toUType(ReceiverModel::Mode::AMAudio),
|
.mode = toUType(mode),
|
||||||
.sampling_rate = 3072000,
|
.sampling_rate = 3072000,
|
||||||
.decimation_factor = 1,
|
.decimation_factor = 1,
|
||||||
});
|
});
|
||||||
receiver_model.set_baseband_bandwidth(1750000);
|
receiver_model.set_baseband_bandwidth(1750000);
|
||||||
receiver_model.enable();
|
receiver_model.enable();
|
||||||
model.configure_am(0);
|
model.configure_am(0);
|
||||||
waterfall.on_show();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case ReceiverModel::Mode::NarrowbandFMAudio:
|
||||||
receiver_model.set_baseband_configuration({
|
receiver_model.set_baseband_configuration({
|
||||||
.mode = toUType(ReceiverModel::Mode::NarrowbandFMAudio),
|
.mode = toUType(mode),
|
||||||
.sampling_rate = 3072000,
|
.sampling_rate = 3072000,
|
||||||
.decimation_factor = 1,
|
.decimation_factor = 1,
|
||||||
});
|
});
|
||||||
receiver_model.set_baseband_bandwidth(1750000);
|
receiver_model.set_baseband_bandwidth(1750000);
|
||||||
receiver_model.enable();
|
receiver_model.enable();
|
||||||
model.configure_nbfm(1);
|
model.configure_nbfm(0);
|
||||||
waterfall.on_show();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case ReceiverModel::Mode::WidebandFMAudio:
|
||||||
receiver_model.set_baseband_configuration({
|
receiver_model.set_baseband_configuration({
|
||||||
.mode = toUType(ReceiverModel::Mode::WidebandFMAudio),
|
.mode = toUType(mode),
|
||||||
.sampling_rate = 3072000,
|
.sampling_rate = 3072000,
|
||||||
.decimation_factor = 1,
|
.decimation_factor = 1,
|
||||||
});
|
});
|
||||||
receiver_model.set_baseband_bandwidth(1750000);
|
receiver_model.set_baseband_bandwidth(1750000);
|
||||||
receiver_model.enable();
|
receiver_model.enable();
|
||||||
model.configure_wfm();
|
model.configure_wfm();
|
||||||
waterfall.on_show();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case ReceiverModel::Mode::SpectrumAnalysis:
|
||||||
receiver_model.set_baseband_configuration({
|
receiver_model.set_baseband_configuration({
|
||||||
.mode = 4,
|
.mode = toUType(mode),
|
||||||
.sampling_rate = 20000000,
|
.sampling_rate = 20000000,
|
||||||
.decimation_factor = 1,
|
.decimation_factor = 1,
|
||||||
});
|
});
|
||||||
receiver_model.set_baseband_bandwidth(12000000);
|
receiver_model.set_baseband_bandwidth(12000000);
|
||||||
receiver_model.enable();
|
receiver_model.enable();
|
||||||
waterfall.on_show();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
waterfall.on_show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalogAudioView::on_show_options_frequency() {
|
void AnalogAudioView::on_show_options_frequency() {
|
||||||
|
@ -93,10 +93,10 @@ private:
|
|||||||
{ 0 * 8, 0 * 16 },
|
{ 0 * 8, 0 * 16 },
|
||||||
4,
|
4,
|
||||||
{
|
{
|
||||||
{ " AM ", 1 },
|
{ " AM ", toUType(ReceiverModel::Mode::AMAudio) },
|
||||||
{ "NFM ", 2 },
|
{ "NFM ", toUType(ReceiverModel::Mode::NarrowbandFMAudio) },
|
||||||
{ "WFM ", 3 },
|
{ "WFM ", toUType(ReceiverModel::Mode::WidebandFMAudio) },
|
||||||
{ "SPEC", 4 },
|
{ "SPEC", toUType(ReceiverModel::Mode::SpectrumAnalysis) },
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ private:
|
|||||||
void on_rf_amp_changed(bool v);
|
void on_rf_amp_changed(bool v);
|
||||||
void on_lna_changed(int32_t v_db);
|
void on_lna_changed(int32_t v_db);
|
||||||
void on_vga_changed(int32_t v_db);
|
void on_vga_changed(int32_t v_db);
|
||||||
void on_modulation_changed(int32_t v);
|
void on_modulation_changed(const ReceiverModel::Mode mode);
|
||||||
void on_show_options_frequency();
|
void on_show_options_frequency();
|
||||||
void on_show_options_rf_gain();
|
void on_show_options_rf_gain();
|
||||||
void on_frequency_step_changed(rf::Frequency f);
|
void on_frequency_step_changed(rf::Frequency f);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user