Rebased code from new eried repo commits. Changed to to reflect strijar implementation. Fixed previous issue with old ssb-am-tx ui_mictx code.

This commit is contained in:
DESKTOP-R56EVJP\Alex 2021-03-21 20:11:40 -05:00
parent 603b7fb1ab
commit f65852ff05
20 changed files with 1545 additions and 16 deletions

View file

@ -65,8 +65,13 @@ void MicTXView::configure_baseband() {
sampling_rate / 20, // Update vu-meter at 20Hz
transmitting ? transmitter_model.channel_bandwidth() : 0,
mic_gain,
TONES_F2D(tone_key_frequency(tone_key_index), sampling_rate)
TONES_F2D(tone_key_frequency(tone_key_index), sampling_rate),
enable_am,
enable_dsb,
enable_usb,
enable_lsb
);
}
void MicTXView::set_tx(bool enable) {
@ -143,8 +148,20 @@ void MicTXView::rxaudio(bool is_on) {
if (is_on) {
audio::input::stop();
baseband::shutdown();
baseband::run_image(portapack::spi_flash::image_tag_nfm_audio);
receiver_model.set_modulation(ReceiverModel::Mode::NarrowbandFMAudio);
if (enable_am || enable_usb || enable_lsb || enable_dsb) {
baseband::run_image(portapack::spi_flash::image_tag_am_audio);
receiver_model.set_modulation(ReceiverModel::Mode::AMAudio);
if (options_mode.selected_index() < 4)
receiver_model.set_am_configuration(options_mode.selected_index() - 1);
else
receiver_model.set_am_configuration(0);
}
else {
baseband::run_image(portapack::spi_flash::image_tag_nfm_audio);
receiver_model.set_modulation(ReceiverModel::Mode::NarrowbandFMAudio);
}
receiver_model.set_sampling_rate(3072000);
receiver_model.set_baseband_bandwidth(1750000);
// receiver_model.set_tuning_frequency(field_frequency.value()); //probably this too can be commented out.
@ -155,15 +172,15 @@ void MicTXView::rxaudio(bool is_on) {
receiver_model.enable();
audio::output::start();
} else { //These incredibly convoluted steps are required for the vumeter to reappear when stopping RX.
receiver_model.set_modulation(ReceiverModel::Mode::NarrowbandFMAudio); //This fixes something with AM RX...
receiver_model.disable();
baseband::shutdown();
baseband::run_image(portapack::spi_flash::image_tag_mic_tx);
audio::input::start();
// transmitter_model.enable();
audio::output::stop();
audio::input::start();
portapack::pin_i2s0_rx_sda.mode(3);
// transmitting = false;
configure_baseband();
// transmitter_model.disable();
}
}
@ -198,11 +215,13 @@ MicTXView::MicTXView(
&field_bw,
&field_rfgain,
&field_rfamp,
&options_mode,
&field_frequency,
&options_tone_key,
&check_rogerbeep,
&check_rxactive,
&field_volume,
&field_rxbw,
&field_squelch,
&field_rxfrequency,
&field_rxlna,
@ -262,6 +281,42 @@ MicTXView::MicTXView(
};
field_rfamp.set_value(rf_amp ? 14 : 0);
options_mode.on_change = [this](size_t, int32_t v) {
enable_am = false;
enable_usb = false;
enable_lsb = false;
enable_dsb = false;
switch(v) {
case 0:
enable_am = false;
enable_usb = false;
enable_lsb = false;
enable_dsb = false;
field_bw.set_value(transmitter_model.channel_bandwidth() / 1000);
//if (rx_enabled)
rxaudio(rx_enabled); //Update now if we have RX audio on
break;
case 1:
enable_am = true;
rxaudio(rx_enabled); //Update now if we have RX audio on
break;
case 2:
enable_usb = true;
rxaudio(rx_enabled); //Update now if we have RX audio on
break;
case 3:
enable_lsb = true;
rxaudio(rx_enabled); //Update now if we have RX audio on
break;
case 4:
enable_dsb = true;
rxaudio(rx_enabled); //Update now if we have RX audio on
break;
}
//configure_baseband();
};
/*
check_va.on_select = [this](Checkbox&, bool v) {
va_enabled = v;
@ -331,6 +386,21 @@ MicTXView::MicTXView(
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); };
field_rxbw.on_change = [this](size_t, int32_t v) {
switch(v) {
case 0:
receiver_model.set_nbfm_configuration(0);
break;
case 1:
receiver_model.set_nbfm_configuration(1);
break;
case 2:
receiver_model.set_nbfm_configuration(2);
break;
}
};
field_rxbw.set_selected_index(2);
field_squelch.on_change = [this](int32_t v) {
receiver_model.set_squelch_level(100 - v);
};