Merge pull request #871 from Brumi-2021/Add_tick_box_sel_common_RX_TX_freq_to_MIC_APP

Add Separated/common freq control in Mic App
This commit is contained in:
gullradriel 2023-04-04 18:53:43 +02:00 committed by GitHub
commit 0e5ae7a6a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 15 deletions

View File

@ -180,7 +180,10 @@ void MicTXView::rxaudio(bool is_on) {
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.
receiver_model.set_tuning_frequency(rx_frequency); // Now with seperate controls!
if (bool_same_F_tx_rx_enabled) // when stop TX ,define to which freq RX we return
receiver_model.set_tuning_frequency(tx_frequency); // Update freq also for RX = TX
else
receiver_model.set_tuning_frequency(rx_frequency); // Now with seperate freq controls!
receiver_model.set_lna(rx_lna);
receiver_model.set_vga(rx_vga);
receiver_model.set_rf_amp(rx_amp);
@ -237,6 +240,7 @@ MicTXView::MicTXView(
&field_frequency,
&options_tone_key,
&check_rogerbeep,
&check_common_freq_tx_rx, // added to handle common or separate freq- TX/RX
&check_rxactive,
&field_volume,
&field_rxbw,
@ -266,6 +270,7 @@ MicTXView::MicTXView(
&field_frequency,
&options_tone_key,
&check_rogerbeep,
&check_common_freq_tx_rx, // added to handle common or separate freq- TX/RX
&check_rxactive,
&field_volume,
&field_rxbw,
@ -332,8 +337,12 @@ MicTXView::MicTXView(
field_frequency.set_step(receiver_model.frequency_step());
field_frequency.on_change = [this](rf::Frequency f) {
tx_frequency = f;
if(!rx_enabled)
if(!rx_enabled) { // not activated receiver. just update freq TX
transmitter_model.set_tuning_frequency(f);
} else { // activated receiver.
if (bool_same_F_tx_rx_enabled) // user selected common freq- TX = RX
receiver_model.set_tuning_frequency(f); //Update common freq also for RX
}
};
field_frequency.on_edit = [this, &nav]() {
focused_ui = 0;
@ -341,8 +350,12 @@ MicTXView::MicTXView(
auto new_view = nav.push<FrequencyKeypadView>(tx_frequency);
new_view->on_changed = [this](rf::Frequency f) {
tx_frequency = f;
if(!rx_enabled)
if(!rx_enabled) {
transmitter_model.set_tuning_frequency(f);
} else {
if (bool_same_F_tx_rx_enabled)
receiver_model.set_tuning_frequency(f); //Update freq also for RX
}
this->field_frequency.set_value(f);
set_dirty();
};
@ -511,6 +524,13 @@ MicTXView::MicTXView(
rogerbeep_enabled = v;
};
check_common_freq_tx_rx.on_select = [this](Checkbox&, bool v) {
bool_same_F_tx_rx_enabled = v;
field_rxfrequency.hidden(v); //Hide or show separated freq RX field . (When no hide user can enter down indep. freq for RX)
set_dirty(); //Refresh GUI interface
receiver_model.set_tuning_frequency(v ? tx_frequency : rx_frequency); // To go to the proper tuned freq. when toggling it
};
field_va_level.on_change = [this](int32_t v) {
va_level = v;
vumeter.set_mark(v);
@ -563,12 +583,12 @@ MicTXView::MicTXView(
rx_frequency = receiver_model.tuning_frequency();
field_rxfrequency.set_value(rx_frequency);
field_rxfrequency.set_step(receiver_model.frequency_step());
field_rxfrequency.on_change = [this](rf::Frequency f) {
field_rxfrequency.on_change = [this](rf::Frequency f) { // available when field rxfrequency not hidden => user selected separated freq RX/TX-
rx_frequency = f;
if(rx_enabled)
receiver_model.set_tuning_frequency(f);
};
field_rxfrequency.on_edit = [this, &nav]() {
field_rxfrequency.on_edit = [this, &nav]() { // available when field rxfrequency not hidden => user selected separated freq RX/TX-
focused_ui = 1;
// TODO: Provide separate modal method/scheme?
auto new_view = nav.push<FrequencyKeypadView>(rx_frequency);

View File

@ -80,6 +80,7 @@ private:
bool va_enabled { false };
bool ptt_enabled { true };
bool rogerbeep_enabled { false };
bool bool_same_F_tx_rx_enabled { false };
bool rx_enabled { false };
uint32_t tone_key_index { };
float mic_gain { 1.0 };
@ -123,9 +124,9 @@ private:
{ {20 * 8, 10 * 8 }, "DEC:", Color::light_grey() },
{ { 4 * 8, ( 13 * 8 ) - 2 }, "TONE KEY:", Color::light_grey() },
{ { 7 * 8, 23 * 8 }, "VOL:", Color::light_grey() },
{ {14 * 8, 23 * 8 }, "RXBW:", Color::light_grey() }, //we remove the label "FM" because we will display all MOD types RX_BW.
{ {17 * 8, 25 * 8 }, "SQ:", Color::light_grey() },
{ { 5 * 8, 25 * 8 }, "F:", Color::light_grey() },
{ {14 * 8, 23 * 8 }, "RXBW:", Color::light_grey() }, //we remove the label "FM" because we will display all MOD types RX_BW.
{ {20 * 8, 25 * 8 }, "SQ:", Color::light_grey() },
{ { 5 * 8, 25 * 8 }, "F_RX:", Color::light_grey() },
{ { 5 * 8, 27 * 8 }, "LNA:", Color::light_grey()},
{ {12 * 8, 27 * 8 }, "VGA:", Color::light_grey()},
{ {19 * 8, 27 * 8 }, "AMP:", Color::light_grey()}
@ -145,8 +146,8 @@ private:
{ { 4 * 8, ( 13 * 8 ) - 2 }, "TONE KEY:", Color::light_grey() },
{ { (6 * 8)+4, 23 * 8 }, "VOL:", Color::light_grey() },
{ {14 * 8, 23 * 8 }, "RXBW:", Color::light_grey() }, //we remove the label "FM" because we will display all MOD types RX_BW.
{ {17 * 8, 25 * 8 }, "SQ:", Color::light_grey() },
{ { 5 * 8, 25 * 8 }, "F:", Color::light_grey() },
{ {20 * 8, 25 * 8 }, "SQ:", Color::light_grey() },
{ { 5 * 8, 25 * 8 }, "F_RX:", Color::light_grey() },
{ { 5 * 8, 27 * 8 }, "LNA:", Color::light_grey()},
{ {12 * 8, 27 * 8 }, "VGA:", Color::light_grey()},
{ {19 * 8, 27 * 8 }, "AMP:", Color::light_grey()}
@ -287,7 +288,7 @@ OptionsField options_wm8731_boost_mode {
};
Checkbox check_rogerbeep {
{ 3 * 8, ( 16 * 8 ) + 4 },
{ 3 * 8, ( 16 * 8 ) + 7 },
10,
"Roger beep",
false
@ -295,11 +296,18 @@ OptionsField options_wm8731_boost_mode {
Checkbox check_rxactive {
{ 3 * 8, ( 21 * 8 ) - 4 },
8,
18, // it was 8, but if it is string size should be 18
"RX audio listening",
false
};
Checkbox check_common_freq_tx_rx {
{ 18 * 8, ( 16* 8 ) + 7 },
8,
"F = F_RX",
false
};
NumberField field_volume {
{ 11* 8, 23 * 8 },
2,
@ -319,7 +327,7 @@ OptionsField options_wm8731_boost_mode {
};
NumberField field_squelch {
{ 20 * 8, 25 * 8 },
{ 23 * 8, 25 * 8 },
2,
{ 0, 99 },
1,
@ -327,7 +335,7 @@ OptionsField options_wm8731_boost_mode {
};
FrequencyField field_rxfrequency {
{ 7 * 8, 25 * 8 },
{ 10 * 8, 25 * 8 },
};
NumberField field_rxlna {
@ -347,7 +355,7 @@ OptionsField options_wm8731_boost_mode {
};
NumberField field_rxamp {
{ 23 * 8, 27 * 8 },
{ 24 * 8, 27 * 8 },
1,
{ 0, 1 },
1,