mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-01-25 22:16:14 -05:00
Tx led fix & UI tweak & Rx frequency
This commit is contained in:
parent
4197b5c083
commit
0f88efc44e
@ -37,7 +37,17 @@ using namespace portapack;
|
|||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
void MicTXView::focus() {
|
void MicTXView::focus() {
|
||||||
|
switch(focused_ui) {
|
||||||
|
case 0:
|
||||||
field_frequency.focus();
|
field_frequency.focus();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
field_rxfrequency.focus();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
field_frequency.focus();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MicTXView::update_vumeter() {
|
void MicTXView::update_vumeter() {
|
||||||
@ -65,6 +75,7 @@ void MicTXView::set_tx(bool enable) {
|
|||||||
rxaudio(false); //Then turn off audio RX
|
rxaudio(false); //Then turn off audio RX
|
||||||
transmitting = true;
|
transmitting = true;
|
||||||
configure_baseband();
|
configure_baseband();
|
||||||
|
transmitter_model.set_tuning_frequency(tx_frequency);
|
||||||
transmitter_model.set_tx_gain(tx_gain);
|
transmitter_model.set_tx_gain(tx_gain);
|
||||||
transmitter_model.set_rf_amp(rf_amp);
|
transmitter_model.set_rf_amp(rf_amp);
|
||||||
transmitter_model.enable();
|
transmitter_model.enable();
|
||||||
@ -120,11 +131,13 @@ void MicTXView::do_timing() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Hmmmm. Maybe useless now.
|
||||||
void MicTXView::on_tuning_frequency_changed(rf::Frequency f) {
|
void MicTXView::on_tuning_frequency_changed(rf::Frequency f) {
|
||||||
transmitter_model.set_tuning_frequency(f);
|
transmitter_model.set_tuning_frequency(f);
|
||||||
//if ( rx_enabled )
|
//if ( rx_enabled )
|
||||||
receiver_model.set_tuning_frequency(f); //Update freq also for RX
|
receiver_model.set_tuning_frequency(f); //Update freq also for RX
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
void MicTXView::rxaudio(bool is_on) {
|
void MicTXView::rxaudio(bool is_on) {
|
||||||
if (is_on) {
|
if (is_on) {
|
||||||
@ -134,7 +147,8 @@ void MicTXView::rxaudio(bool is_on) {
|
|||||||
receiver_model.set_modulation(ReceiverModel::Mode::NarrowbandFMAudio);
|
receiver_model.set_modulation(ReceiverModel::Mode::NarrowbandFMAudio);
|
||||||
receiver_model.set_sampling_rate(3072000);
|
receiver_model.set_sampling_rate(3072000);
|
||||||
receiver_model.set_baseband_bandwidth(1750000);
|
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(field_frequency.value()); //probably this too can be commented out.
|
||||||
|
receiver_model.set_tuning_frequency(rx_frequency); // Now with seperate controls!
|
||||||
receiver_model.set_lna(rx_lna);
|
receiver_model.set_lna(rx_lna);
|
||||||
receiver_model.set_vga(rx_vga);
|
receiver_model.set_vga(rx_vga);
|
||||||
receiver_model.set_rf_amp(rx_amp);
|
receiver_model.set_rf_amp(rx_amp);
|
||||||
@ -150,8 +164,6 @@ void MicTXView::rxaudio(bool is_on) {
|
|||||||
// transmitting = false;
|
// transmitting = false;
|
||||||
configure_baseband();
|
configure_baseband();
|
||||||
// transmitter_model.disable();
|
// transmitter_model.disable();
|
||||||
transmitter_model.set_tx_gain(transmitter_model.tx_gain());
|
|
||||||
transmitter_model.set_rf_amp(transmitter_model.rf_amp());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,6 +206,7 @@ MicTXView::MicTXView(
|
|||||||
&check_rxactive,
|
&check_rxactive,
|
||||||
&field_volume,
|
&field_volume,
|
||||||
&field_squelch,
|
&field_squelch,
|
||||||
|
&field_rxfrequency,
|
||||||
&field_rxlna,
|
&field_rxlna,
|
||||||
&field_rxvga,
|
&field_rxvga,
|
||||||
&field_rxamp,
|
&field_rxamp,
|
||||||
@ -214,16 +227,22 @@ MicTXView::MicTXView(
|
|||||||
};
|
};
|
||||||
options_gain.set_selected_index(1); // x1.0
|
options_gain.set_selected_index(1); // x1.0
|
||||||
|
|
||||||
|
tx_frequency = transmitter_model.tuning_frequency();
|
||||||
field_frequency.set_value(transmitter_model.tuning_frequency());
|
field_frequency.set_value(transmitter_model.tuning_frequency());
|
||||||
field_frequency.set_step(receiver_model.frequency_step());
|
field_frequency.set_step(receiver_model.frequency_step());
|
||||||
field_frequency.on_change = [this](rf::Frequency f) {
|
field_frequency.on_change = [this](rf::Frequency f) {
|
||||||
this->on_tuning_frequency_changed(f);
|
tx_frequency = f;
|
||||||
|
if(!rx_enabled)
|
||||||
|
transmitter_model.set_tuning_frequency(f);
|
||||||
};
|
};
|
||||||
field_frequency.on_edit = [this, &nav]() {
|
field_frequency.on_edit = [this, &nav]() {
|
||||||
// TODO: Provide separate modal method/scheme?
|
// TODO: Provide separate modal method/scheme?
|
||||||
auto new_view = nav.push<FrequencyKeypadView>(receiver_model.tuning_frequency());
|
auto new_view = nav.push<FrequencyKeypadView>(tx_frequency);
|
||||||
new_view->on_changed = [this](rf::Frequency f) {
|
new_view->on_changed = [this](rf::Frequency f) {
|
||||||
this->on_tuning_frequency_changed(f);
|
focused_ui = 0;
|
||||||
|
tx_frequency = f;
|
||||||
|
if(!rx_enabled)
|
||||||
|
transmitter_model.set_tuning_frequency(f);
|
||||||
this->field_frequency.set_value(f);
|
this->field_frequency.set_value(f);
|
||||||
set_dirty();
|
set_dirty();
|
||||||
};
|
};
|
||||||
@ -322,6 +341,27 @@ MicTXView::MicTXView(
|
|||||||
field_squelch.set_value(0);
|
field_squelch.set_value(0);
|
||||||
receiver_model.set_squelch_level(0);
|
receiver_model.set_squelch_level(0);
|
||||||
|
|
||||||
|
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) {
|
||||||
|
rx_frequency = f;
|
||||||
|
if(rx_enabled)
|
||||||
|
receiver_model.set_tuning_frequency(f);
|
||||||
|
};
|
||||||
|
field_rxfrequency.on_edit = [this, &nav]() {
|
||||||
|
// TODO: Provide separate modal method/scheme?
|
||||||
|
auto new_view = nav.push<FrequencyKeypadView>(rx_frequency);
|
||||||
|
new_view->on_changed = [this](rf::Frequency f) {
|
||||||
|
focused_ui = 1;
|
||||||
|
rx_frequency = f;
|
||||||
|
if(rx_enabled)
|
||||||
|
receiver_model.set_tuning_frequency(f);
|
||||||
|
this->field_rxfrequency.set_value(f);
|
||||||
|
set_dirty();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
rx_lna = receiver_model.lna();
|
rx_lna = receiver_model.lna();
|
||||||
field_rxlna.on_change = [this](int32_t v) {
|
field_rxlna.on_change = [this](int32_t v) {
|
||||||
@ -339,10 +379,10 @@ MicTXView::MicTXView(
|
|||||||
|
|
||||||
rx_amp = receiver_model.rf_amp();
|
rx_amp = receiver_model.rf_amp();
|
||||||
field_rxamp.on_change = [this](int32_t v) {
|
field_rxamp.on_change = [this](int32_t v) {
|
||||||
rx_amp = (bool)v;
|
rx_amp = v;
|
||||||
receiver_model.set_rf_amp(rx_amp);
|
receiver_model.set_rf_amp(rx_amp);
|
||||||
};
|
};
|
||||||
field_rxamp.set_value(rx_amp ? 14 : 0);
|
field_rxamp.set_value(rx_amp);
|
||||||
|
|
||||||
transmitter_model.set_sampling_rate(sampling_rate);
|
transmitter_model.set_sampling_rate(sampling_rate);
|
||||||
transmitter_model.set_baseband_bandwidth(1750000);
|
transmitter_model.set_baseband_bandwidth(1750000);
|
||||||
@ -355,6 +395,7 @@ MicTXView::MicTXView(
|
|||||||
|
|
||||||
MicTXView::~MicTXView() {
|
MicTXView::~MicTXView() {
|
||||||
audio::input::stop();
|
audio::input::stop();
|
||||||
|
transmitter_model.set_tuning_frequency(tx_frequency); // Save Tx frequency instead of Rx. Or maybe we need some "System Wide" changes to seperate Tx and Rx frequency.
|
||||||
transmitter_model.disable();
|
transmitter_model.disable();
|
||||||
if (rx_enabled) //Also turn off audio rx if enabled
|
if (rx_enabled) //Also turn off audio rx if enabled
|
||||||
rxaudio(false);
|
rxaudio(false);
|
||||||
|
@ -64,7 +64,7 @@ private:
|
|||||||
void update_vumeter();
|
void update_vumeter();
|
||||||
void do_timing();
|
void do_timing();
|
||||||
void set_tx(bool enable);
|
void set_tx(bool enable);
|
||||||
void on_tuning_frequency_changed(rf::Frequency f);
|
// void on_tuning_frequency_changed(rf::Frequency f);
|
||||||
void on_tx_progress(const bool done);
|
void on_tx_progress(const bool done);
|
||||||
void configure_baseband();
|
void configure_baseband();
|
||||||
|
|
||||||
@ -91,6 +91,9 @@ private:
|
|||||||
int32_t rx_lna { 32 };
|
int32_t rx_lna { 32 };
|
||||||
int32_t rx_vga { 32 };
|
int32_t rx_vga { 32 };
|
||||||
bool rx_amp { false };
|
bool rx_amp { false };
|
||||||
|
rf::Frequency tx_frequency { 0 };
|
||||||
|
rf::Frequency rx_frequency { 0 };
|
||||||
|
int32_t focused_ui { 0 };
|
||||||
|
|
||||||
|
|
||||||
Labels labels {
|
Labels labels {
|
||||||
@ -106,9 +109,10 @@ private:
|
|||||||
{ { 4 * 8, ( 19 * 8 ) - 2 }, "TONE KEY:", Color::light_grey() },
|
{ { 4 * 8, ( 19 * 8 ) - 2 }, "TONE KEY:", Color::light_grey() },
|
||||||
{ { 9 * 8, 30 * 8 }, "VOL:", Color::light_grey() },
|
{ { 9 * 8, 30 * 8 }, "VOL:", Color::light_grey() },
|
||||||
{ { 5 * 8, 32 * 8 }, "SQUELCH:", Color::light_grey() },
|
{ { 5 * 8, 32 * 8 }, "SQUELCH:", Color::light_grey() },
|
||||||
{ { 5 * 8, 34 * 8 }, "LNA:", Color::light_grey()},
|
{ { 5 * 8, 34 * 8 }, "FREQUENCY:", Color::light_grey() },
|
||||||
{ {12 * 8, 34 * 8 }, "VGA:", Color::light_grey()},
|
{ { 5 * 8, 36 * 8 }, "LNA:", Color::light_grey()},
|
||||||
{ {19 * 8, 34 * 8 }, "AMP:", Color::light_grey()}
|
{ {12 * 8, 36 * 8 }, "VGA:", Color::light_grey()},
|
||||||
|
{ {19 * 8, 36 * 8 }, "AMP:", Color::light_grey()}
|
||||||
};
|
};
|
||||||
|
|
||||||
VuMeter vumeter {
|
VuMeter vumeter {
|
||||||
@ -230,8 +234,12 @@ private:
|
|||||||
' ',
|
' ',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FrequencyField field_rxfrequency {
|
||||||
|
{ 15 * 8, 34 * 8 },
|
||||||
|
};
|
||||||
|
|
||||||
NumberField field_rxlna {
|
NumberField field_rxlna {
|
||||||
{ 9 * 8, 34 * 8 },
|
{ 9 * 8, 36 * 8 },
|
||||||
2,
|
2,
|
||||||
{ 0, 40 },
|
{ 0, 40 },
|
||||||
8,
|
8,
|
||||||
@ -239,7 +247,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
NumberField field_rxvga {
|
NumberField field_rxvga {
|
||||||
{ 16 * 8, 34 * 8 },
|
{ 16 * 8, 36 * 8 },
|
||||||
2,
|
2,
|
||||||
{ 0, 62 },
|
{ 0, 62 },
|
||||||
2,
|
2,
|
||||||
@ -247,10 +255,10 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
NumberField field_rxamp {
|
NumberField field_rxamp {
|
||||||
{ 23 * 8, 34 * 8 },
|
{ 23 * 8, 36 * 8 },
|
||||||
2,
|
1,
|
||||||
{ 0, 14 },
|
{ 0, 1 },
|
||||||
14,
|
1,
|
||||||
' ',
|
' ',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -157,13 +157,14 @@ bool set_tuning_frequency(const rf::Frequency frequency) {
|
|||||||
|
|
||||||
void set_rf_amp(const bool rf_amp) {
|
void set_rf_amp(const bool rf_amp) {
|
||||||
rf_path.set_rf_amp(rf_amp);
|
rf_path.set_rf_amp(rf_amp);
|
||||||
|
/*
|
||||||
if (direction == rf::Direction::Transmit) {
|
if (direction == rf::Direction::Transmit) {
|
||||||
if (rf_amp)
|
if (rf_amp)
|
||||||
led_tx.on();
|
led_tx.on();
|
||||||
else
|
else
|
||||||
led_tx.off();
|
led_tx.off();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_lna_gain(const int_fast8_t db) {
|
void set_lna_gain(const int_fast8_t db) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user