mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-23 14:24:18 -04:00
MIC TX Now includes RX with Volume and Squelch
You can enable RX and adjust VOLUME and SQUELCH into your liking. Sadly enough, you will NOT be able to use VOICE ACTIVATION when RX is enabled (to ensure there will be NO audio feedback defeating the VA sensing) A "bug" that won over me, but perhaps and hopefully other coder can easily fix: The Vumeter will momentarily "dissappear" when enabling RX. But it will reappear as soon as you start TX. Or when you turn off RX. I enabled the PEAK LEVEL MARK on the Vumeter, so you can easily see in which level your input voice / signal is peaking and regulate the MIC gain accordingly in an easier / more robust way. Side enhancement: Took off the dark green, yellow and red coloring from the vumeter when no signal is present, and replaced it with dark_grey. I know that some coloring is "eye-candy" but the vu-meter is more readable with this new contrast.
This commit is contained in:
parent
62821a79e5
commit
72f3eea131
3 changed files with 132 additions and 46 deletions
|
@ -61,22 +61,22 @@ void MicTXView::configure_baseband() {
|
|||
|
||||
void MicTXView::set_tx(bool enable) {
|
||||
if (enable) {
|
||||
if (rx_enabled) //If audio RX is enabled
|
||||
rxaudio(false); //Then turn off audio RX
|
||||
transmitting = true;
|
||||
configure_baseband();
|
||||
transmitter_model.enable();
|
||||
portapack::pin_i2s0_rx_sda.mode(3); // This is already done in audio::init but gets changed by the CPLD overlay reprogramming
|
||||
//gpio_tx.write(1);
|
||||
//led_tx.on();
|
||||
} else {
|
||||
if (transmitting && rogerbeep_enabled) {
|
||||
baseband::request_beep();
|
||||
transmitting = false;
|
||||
} else {
|
||||
baseband::request_beep(); //Transmit the roger beep
|
||||
transmitting = false; //And flag the end of the transmission so ...
|
||||
} else { // (if roger beep was enabled, this will be executed after the beep ends transmitting.
|
||||
transmitting = false;
|
||||
configure_baseband();
|
||||
transmitter_model.disable();
|
||||
//gpio_tx.write(0);
|
||||
//led_tx.off();
|
||||
if (rx_enabled) //If audio RX is enabled and we've been transmitting
|
||||
rxaudio(true); //Turn back on audio RX
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -120,6 +120,39 @@ void MicTXView::do_timing() {
|
|||
|
||||
void MicTXView::on_tuning_frequency_changed(rf::Frequency f) {
|
||||
transmitter_model.set_tuning_frequency(f);
|
||||
//if ( rx_enabled )
|
||||
receiver_model.set_tuning_frequency(f); //Update freq also for RX
|
||||
}
|
||||
|
||||
void MicTXView::rxaudio(bool is_on) {
|
||||
if (is_on) {
|
||||
baseband::shutdown();
|
||||
baseband::run_image(portapack::spi_flash::image_tag_nfm_audio);
|
||||
receiver_model.set_modulation(ReceiverModel::Mode::NarrowbandFMAudio);
|
||||
//receiver_model.set_sampling_rate(sampling_rate); //**
|
||||
//receiver_model.set_baseband_bandwidth(1750000); //**
|
||||
receiver_model.enable();
|
||||
receiver_model.set_tuning_frequency(field_frequency.value()); //probably this too can be commented out.
|
||||
audio::output::start();
|
||||
|
||||
} else { //These incredibly convoluted steps are required for the vumeter to reappear when stopping RX.
|
||||
receiver_model.disable();
|
||||
baseband::shutdown();
|
||||
baseband::run_image(portapack::spi_flash::image_tag_mic_tx);
|
||||
audio::input::start();
|
||||
transmitter_model.enable();
|
||||
portapack::pin_i2s0_rx_sda.mode(3);
|
||||
transmitting = false;
|
||||
configure_baseband();
|
||||
transmitter_model.disable();
|
||||
}
|
||||
}
|
||||
|
||||
void MicTXView::on_headphone_volume_changed(int32_t v) {
|
||||
//if (rx_enabled) {
|
||||
const auto new_volume = volume_t::decibel(v - 99) + audio::headphone::volume_range().max;
|
||||
receiver_model.set_headphone_volume(new_volume);
|
||||
//}
|
||||
}
|
||||
|
||||
MicTXView::MicTXView(
|
||||
|
@ -142,9 +175,12 @@ MicTXView::MicTXView(
|
|||
&field_frequency,
|
||||
&options_tone_key,
|
||||
&check_rogerbeep,
|
||||
&check_rxactive,
|
||||
&field_volume,
|
||||
&field_squelch,
|
||||
&text_ptt
|
||||
});
|
||||
|
||||
|
||||
tone_keys_populate(options_tone_key);
|
||||
options_tone_key.on_change = [this](size_t i, int32_t) {
|
||||
tone_key_index = i;
|
||||
|
@ -168,6 +204,7 @@ MicTXView::MicTXView(
|
|||
new_view->on_changed = [this](rf::Frequency f) {
|
||||
this->on_tuning_frequency_changed(f);
|
||||
this->field_frequency.set_value(f);
|
||||
set_dirty();
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -178,16 +215,15 @@ MicTXView::MicTXView(
|
|||
|
||||
check_va.on_select = [this](Checkbox&, bool v) {
|
||||
va_enabled = v;
|
||||
text_ptt.hidden(v);
|
||||
set_dirty();
|
||||
text_ptt.hidden(v); //hide / show PTT text
|
||||
check_rxactive.hidden(v); //hide / show the RX AUDIO
|
||||
set_dirty(); //Refresh display
|
||||
};
|
||||
check_va.set_value(false);
|
||||
|
||||
check_rogerbeep.on_select = [this](Checkbox&, bool v) {
|
||||
rogerbeep_enabled = v;
|
||||
};
|
||||
check_rogerbeep.set_value(false);
|
||||
|
||||
|
||||
field_va_level.on_change = [this](int32_t v) {
|
||||
va_level = v;
|
||||
vumeter.set_mark(v);
|
||||
|
@ -203,7 +239,23 @@ MicTXView::MicTXView(
|
|||
decay_ms = v;
|
||||
};
|
||||
field_va_decay.set_value(1000);
|
||||
|
||||
|
||||
check_rxactive.on_select = [this](Checkbox&, bool v) {
|
||||
//vumeter.set_value(0); //Start with a clean vumeter
|
||||
rx_enabled = v;
|
||||
check_va.hidden(v); //Hide or show voice activation
|
||||
rxaudio(v); //Activate-Deactivate audio rx accordingly
|
||||
set_dirty(); //Refresh interface
|
||||
};
|
||||
|
||||
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_squelch.on_change = [this](int32_t v) {
|
||||
receiver_model.set_squelch_level(100 - v);
|
||||
};
|
||||
field_squelch.set_value(0);
|
||||
|
||||
transmitter_model.set_sampling_rate(sampling_rate);
|
||||
transmitter_model.set_baseband_bandwidth(1750000);
|
||||
|
||||
|
@ -216,6 +268,8 @@ MicTXView::MicTXView(
|
|||
MicTXView::~MicTXView() {
|
||||
audio::input::stop();
|
||||
transmitter_model.disable();
|
||||
if (rx_enabled) //Also turn off audio rx if enabled
|
||||
rxaudio(false);
|
||||
baseband::shutdown();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue