Extending Power Colour Warning in 3 Tx App's (#1005)

Extended color scheme for transmit fields
This commit is contained in:
Brumi-2021 2023-05-18 17:04:58 +02:00 committed by GitHub
parent d059248802
commit 3af282c10a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 104 additions and 150 deletions

View File

@ -141,17 +141,8 @@ void GpsSimAppView::start() {
} }
); );
} }
field_rfgain.on_change = [this](int32_t v) {
tx_gain = v;
};
field_rfgain.set_value(tx_gain);
receiver_model.set_tx_gain(tx_gain);
rf_amp =(transmitter_model.rf_amp() ); // recover rf_amp settings applied from ui_transmiter.cpp
field_rfamp.on_change = [this](int32_t v) {
rf_amp = (bool)v;
};
field_rfamp.set_value(rf_amp ? 14 : 0);
radio::enable({ radio::enable({
receiver_model.tuning_frequency(), receiver_model.tuning_frequency(),
@ -193,21 +184,16 @@ GpsSimAppView::GpsSimAppView(
NavigationView& nav NavigationView& nav
) : nav_ (nav) ) : nav_ (nav)
{ {
tx_gain = 35;field_rfgain.set_value(tx_gain); // Initial default value (-12 dB's max 47dBs ).
field_rfamp.set_value(rf_amp ? 14 : 0); // Initial default value True. (TX RF amp on , +14dB's)
baseband::run_image(portapack::spi_flash::image_tag_gps); baseband::run_image(portapack::spi_flash::image_tag_gps);
add_children({ add_children({
&labels,
&button_open, &button_open,
&text_filename, &text_filename,
&text_sample_rate, &text_sample_rate,
&text_duration, &text_duration,
&progressbar, &progressbar,
&field_frequency, &field_frequency,
&field_rfgain, &tx_view, // now it handles previous rfgain , rfamp.
&field_rfamp, // let's not use common persistent rf_amp , local rfamp is enough
&check_loop, &check_loop,
&button_play, &button_play,
&waterfall, &waterfall,

View File

@ -24,6 +24,9 @@
#ifndef __GPS_SIM_APP_HPP__ #ifndef __GPS_SIM_APP_HPP__
#define __GPS_SIM_APP_HPP__ #define __GPS_SIM_APP_HPP__
#define SHORT_UI true
#define NORMAL_UI false
#include "ui_widget.hpp" #include "ui_widget.hpp"
#include "ui_navigation.hpp" #include "ui_navigation.hpp"
#include "ui_receiver.hpp" #include "ui_receiver.hpp"
@ -32,6 +35,7 @@
#include <string> #include <string>
#include <memory> #include <memory>
#include "ui_transmitter.hpp"
namespace ui { namespace ui {
@ -77,10 +81,6 @@ private:
std::unique_ptr<ReplayThread> replay_thread { }; std::unique_ptr<ReplayThread> replay_thread { };
bool ready_signal { false }; bool ready_signal { false };
Labels labels {
{ { 10 * 8, 2 * 16 }, "GAIN A:", Color::light_grey() }
};
Button button_open { Button button_open {
{ 0 * 8, 0 * 16, 10 * 8, 2 * 16 }, { 0 * 8, 0 * 16, 10 * 8, 2 * 16 },
"Open file" "Open file"
@ -106,20 +106,12 @@ private:
FrequencyField field_frequency { FrequencyField field_frequency {
{ 0 * 8, 2 * 16 }, { 0 * 8, 2 * 16 },
}; };
NumberField field_rfgain {
{ 14 * 8, 2 * 16 }, TransmitterView2 tx_view { // new handling of NumberField field_rfgain, NumberField field_rfamp
2, 74, 1*8, SHORT_UI // x(columns), y (line) position. (Used in Replay / GPS Simul / Playlist App)
{ 0, 47 }, // 10*8, 2*8, NORMAL_UI // x(columns), y (line) position. (Used in Mic App)
1,
' '
};
NumberField field_rfamp { // previously we were using "RFAmpField field_rf_amp" but that is general Receiver amp setting.
{ 19 * 8, 2 * 16 },
2,
{ 0, 14 }, // this time we will display GUI , 0 or 14 dBs same as Mic and Replay App
14,
' '
}; };
Checkbox check_loop { Checkbox check_loop {
{ 21 * 8, 2 * 16 }, { 21 * 8, 2 * 16 },
4, 4,

View File

@ -141,21 +141,12 @@ void ReplayAppView::start() {
} }
); );
} }
field_rfgain.on_change = [this](int32_t v) {
tx_gain = v;
};
field_rfgain.set_value(tx_gain);
receiver_model.set_tx_gain(tx_gain);
field_rfamp.on_change = [this](int32_t v) {
rf_amp = (bool)v;
};
field_rfamp.set_value(rf_amp ? 14 : 0);
//Enable Bias Tee if selected //Enable Bias Tee if selected
radio::set_antenna_bias(portapack::get_antenna_bias()); radio::set_antenna_bias(portapack::get_antenna_bias());
rf_amp =(transmitter_model.rf_amp() ); // recover rf_amp settings applied from ui_transmiter.cpp
radio::enable({ radio::enable({
receiver_model.tuning_frequency(), receiver_model.tuning_frequency(),
sample_rate * 8, sample_rate * 8,
@ -203,32 +194,16 @@ ReplayAppView::ReplayAppView(
NavigationView& nav NavigationView& nav
) : nav_ (nav) ) : nav_ (nav)
{ {
tx_gain = 35;field_rfgain.set_value(tx_gain); // Initial default value (-12 dB's max ).
field_rfamp.set_value(rf_amp ? 14 : 0); // Initial default value True. (TX RF amp on , +14dB's)
field_rfamp.on_change = [this](int32_t v) { // allow initial value change just after opened file.
rf_amp = (bool)v;
};
field_rfamp.set_value(rf_amp ? 14 : 0);
field_rfgain.on_change = [this](int32_t v) { // allow initial value change just after opened file.
tx_gain = v;
};
field_rfgain.set_value(tx_gain);
baseband::run_image(portapack::spi_flash::image_tag_replay); baseband::run_image(portapack::spi_flash::image_tag_replay);
add_children({ add_children({
&labels,
&button_open, &button_open,
&text_filename, &text_filename,
&text_sample_rate, &text_sample_rate,
&text_duration, &text_duration,
&progressbar, &progressbar,
&field_frequency, &field_frequency,
&field_rfgain, &tx_view, // now it handles previous rfgain , rfamp.
&field_rfamp, // let's not use common rf_amp
&check_loop, &check_loop,
&button_play, &button_play,
&waterfall, &waterfall,

View File

@ -23,6 +23,9 @@
#ifndef __REPLAY_APP_HPP__ #ifndef __REPLAY_APP_HPP__
#define __REPLAY_APP_HPP__ #define __REPLAY_APP_HPP__
#define SHORT_UI true
#define NORMAL_UI false
#include "ui_widget.hpp" #include "ui_widget.hpp"
#include "ui_navigation.hpp" #include "ui_navigation.hpp"
#include "ui_receiver.hpp" #include "ui_receiver.hpp"
@ -31,6 +34,7 @@
#include <string> #include <string>
#include <memory> #include <memory>
#include "ui_transmitter.hpp"
namespace ui { namespace ui {
@ -76,10 +80,6 @@ private:
std::unique_ptr<ReplayThread> replay_thread { }; std::unique_ptr<ReplayThread> replay_thread { };
bool ready_signal { false }; bool ready_signal { false };
Labels labels {
{ { 10 * 8, 2 * 16 }, "GAIN A:", Color::light_grey() }
};
Button button_open { Button button_open {
{ 0 * 8, 0 * 16, 10 * 8, 2 * 16 }, { 0 * 8, 0 * 16, 10 * 8, 2 * 16 },
"Open file" "Open file"
@ -106,20 +106,11 @@ private:
{ 0 * 8, 2 * 16 }, { 0 * 8, 2 * 16 },
}; };
NumberField field_rfgain { TransmitterView2 tx_view { // new handling of NumberField field_rfgain, NumberField field_rfamp
{ 14 * 8, 2 * 16 }, 74, 1*8, SHORT_UI // x(columns), y (line) position. (Uused in Repay / GPS Simul / Playlist App)
2, // 10*8, 2*8, NORMAL_UI // x(columns), y (line) position. (Used in Mic App)
{ 0, 47 },
1,
' '
};
NumberField field_rfamp { // previously I was using "RFAmpField field_rf_amp" but that is general Receiver amp setting.
{ 19 * 8, 2 * 16 },
2,
{ 0, 14 }, // this time we will display GUI , 0 or 14 dBs same as Mic App
14,
' '
}; };
Checkbox check_loop { Checkbox check_loop {
{ 21 * 8, 2 * 16 }, { 21 * 8, 2 * 16 },
4, 4,

View File

@ -23,6 +23,9 @@
#ifndef __UI_MICTX_H__ #ifndef __UI_MICTX_H__
#define __UI_MICTX_H__ #define __UI_MICTX_H__
#define SHORT_UI true
#define NORMAL_UI false
#include "ui.hpp" #include "ui.hpp"
#include "ui_widget.hpp" #include "ui_widget.hpp"
#include "ui_navigation.hpp" #include "ui_navigation.hpp"
@ -211,7 +214,8 @@ OptionsField options_wm8731_boost_mode {
}; };
TransmitterView2 tx_view { // new handling of NumberField field_rfgain, NumberField field_rfamp TransmitterView2 tx_view { // new handling of NumberField field_rfgain, NumberField field_rfamp
2 * 8 // y line position. // 3*8, 2*8, SHORT_UI // x(columns), y (line) position. (used in Replay / GPS Simul / Playlist App's)
3*8, 2*8, NORMAL_UI // x(columns), y (line) position. (used in Mic App)
}; };
OptionsField options_mode { OptionsField options_mode {

View File

@ -181,21 +181,12 @@ void PlaylistView::start() {
} }
); );
} }
field_rfgain.on_change = [this](int32_t v) {
tx_gain = v;
};
field_rfgain.set_value(tx_gain);
receiver_model.set_tx_gain(tx_gain);
field_rfamp.on_change = [this](int32_t v) {
rf_amp = (bool)v;
};
field_rfamp.set_value(rf_amp ? 14 : 0);
//Enable Bias Tee if selected //Enable Bias Tee if selected
radio::set_antenna_bias(portapack::get_antenna_bias()); radio::set_antenna_bias(portapack::get_antenna_bias());
rf_amp =(transmitter_model.rf_amp() ); // recover rf_amp settings applied from ui_transmiter.cpp
radio::enable({ radio::enable({
receiver_model.tuning_frequency(), receiver_model.tuning_frequency(),
sample_rate * 8, sample_rate * 8,
@ -244,22 +235,16 @@ PlaylistView::PlaylistView(
NavigationView& nav NavigationView& nav
) : nav_ (nav) ) : nav_ (nav)
{ {
tx_gain = 35;field_rfgain.set_value(tx_gain); // Initial default value (-12 dB's max ).
field_rfamp.set_value(rf_amp ? 14 : 0); // Initial default value True. (TX RF amp on , +14dB's)
baseband::run_image(portapack::spi_flash::image_tag_replay); baseband::run_image(portapack::spi_flash::image_tag_replay);
add_children({ add_children({
&labels,
&button_open, &button_open,
&text_filename, &text_filename,
&text_sample_rate, &text_sample_rate,
&text_duration, &text_duration,
&progressbar, &progressbar,
&field_frequency, &field_frequency,
&field_rfgain, &tx_view, // this handles now the previous rfgain, rfamp
&field_rfamp, // let's not use common rf_amp
&check_loop, &check_loop,
&button_play, &button_play,
&waterfall, &waterfall,

View File

@ -20,7 +20,8 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#define SHORT_UI true
#define NORMAL_UI false
#include "ui_widget.hpp" #include "ui_widget.hpp"
#include "ui_navigation.hpp" #include "ui_navigation.hpp"
@ -31,6 +32,7 @@
#include <string> #include <string>
#include <memory> #include <memory>
#include <deque> #include <deque>
#include "ui_transmitter.hpp"
namespace ui { namespace ui {
@ -86,10 +88,6 @@ private:
std::unique_ptr<ReplayThread> replay_thread { }; std::unique_ptr<ReplayThread> replay_thread { };
bool ready_signal { false }; bool ready_signal { false };
Labels labels {
{ { 10 * 8, 2 * 16 }, "GAIN A:", Color::light_grey() }
};
Button button_open { Button button_open {
{ 0 * 8, 0 * 16, 10 * 8, 2 * 16 }, { 0 * 8, 0 * 16, 10 * 8, 2 * 16 },
"Open file" "Open file"
@ -117,20 +115,11 @@ private:
{ 0 * 8, 2 * 16 }, { 0 * 8, 2 * 16 },
}; };
NumberField field_rfgain { TransmitterView2 tx_view { // new handling of NumberField field_rfgain, NumberField field_rfamp
{ 14 * 8, 2 * 16 }, 74, 1*8, SHORT_UI // x(columns), y (line) position. (Used in Repay / GPS Simul / Play list App)
2, // 10*8, 2*8, NORMAL_UI // x(columns), y (line) position. (Used in Mic App)
{ 0, 47 },
1,
' '
};
NumberField field_rfamp { // previously I was using "RFAmpField field_rf_amp" but that is general Receiver amp setting.
{ 19 * 8, 2 * 16 },
2,
{ 0, 14 }, // this time we will display GUI , 0 or 14 dBs same as Mic App
14,
' '
}; };
Checkbox check_loop { Checkbox check_loop {
{ 21 * 8, 2 * 16 }, { 21 * 8, 2 * 16 },
4, 4,

View File

@ -190,6 +190,10 @@ TransmitterView::~TransmitterView() {
} }
/* TransmitterView2 *******************************************************/ /* TransmitterView2 *******************************************************/
// Derivative from TransmitterView (that handles many param. freq, fre_step, start_button, gain, amp, used in the majority of the TX App's.
// This one ,is a simple version , it is only handling 2 x param (TX GAIN and AMP ) in one line .
// We use normal character lines , in Mic App, called (x pos, y pos, NORMAL_UI)
// We use short compact char lines , in Replay / GPS Simul / Playlist App , called (x pos , y pos,SHORT_UI )
void TransmitterView2::paint(Painter& painter) { void TransmitterView2::paint(Painter& painter) {
// Not using TransmitterView2, but if we delete it,we got , top line 1 a blanking rect. // Not using TransmitterView2, but if we delete it,we got , top line 1 a blanking rect.
@ -219,37 +223,50 @@ void TransmitterView2::update_gainlevel_styles() {
} }
field_gain.set_style(new_style_ptr); field_gain.set_style(new_style_ptr);
text_gain.set_style(new_style_ptr); text_gain_amp.set_style(new_style_ptr);
field_amp.set_style(new_style_ptr); field_amp.set_style(new_style_ptr);
text_amp.set_style(new_style_ptr);
field_gain_short_UI.set_style(new_style_ptr);
text_gain_amp_short_UI.set_style(new_style_ptr);
field_amp_short_UI.set_style(new_style_ptr);
} }
void TransmitterView2::on_show() { void TransmitterView2::on_show() {
field_gain.set_value(transmitter_model.tx_gain()); field_gain.set_value(transmitter_model.tx_gain());
field_amp.set_value(transmitter_model.rf_amp() ? 14 : 0); field_amp.set_value(transmitter_model.rf_amp() ? 14 : 0);
field_gain_short_UI.set_value(transmitter_model.tx_gain());
field_amp_short_UI.set_value(transmitter_model.rf_amp() ? 14 : 0);
update_gainlevel_styles(); update_gainlevel_styles();
} }
TransmitterView2::TransmitterView2( const Coord y) TransmitterView2::TransmitterView2( const Coord x, const Coord y, bool short_UI)
{ {
set_parent_rect({ 3*8, y, 20 * 8, 1 * 8 }); // set_parent_rect({ 0, y, 30 * 8, 6 * 8 }); set_parent_rect({ x , y, 20 * 8, 1 * 8 }); // set_parent_rect({ 0, y, 30 * 8, 6 * 8 });
add_children({ add_children({
&text_gain, &(short_UI ? text_gain_amp_short_UI : text_gain_amp),
&field_gain, &(short_UI ? field_gain_short_UI : field_gain),
&text_amp, &(short_UI ? field_amp_short_UI : field_amp),
&field_amp,
}); });
if (short_UI) {
field_gain_short_UI.on_change = [this](uint32_t tx_gain) {
on_tx_gain_changed(tx_gain);
};
field_amp_short_UI.on_change = [this](uint32_t rf_amp) {
on_tx_amp_changed((bool) rf_amp);
};
} else {
field_gain.on_change = [this](uint32_t tx_gain) { field_gain.on_change = [this](uint32_t tx_gain) {
on_tx_gain_changed(tx_gain); on_tx_gain_changed(tx_gain);
}; };
field_amp.on_change = [this](uint32_t rf_amp) { field_amp.on_change = [this](uint32_t rf_amp) {
on_tx_amp_changed((bool) rf_amp); on_tx_amp_changed((bool) rf_amp);
}; };
} }
}
TransmitterView2::~TransmitterView2() { TransmitterView2::~TransmitterView2() {
audio::output::stop(); audio::output::stop();

View File

@ -169,7 +169,7 @@ private:
class TransmitterView2 : public View { class TransmitterView2 : public View {
public: public:
TransmitterView2(const Coord y); TransmitterView2(const Coord x, const Coord y, bool short_UI);
~TransmitterView2(); ~TransmitterView2();
@ -193,9 +193,9 @@ private:
.foreground = Color::red(), .foreground = Color::red(),
}; };
Text text_gain { Text text_gain_amp {
{ 0, 3 * 8, 5 * 8, 1 * 16 }, { 0, 3 * 8, 5 * 8, 1 * 16 },
"Gain:" "Gain: Amp:"
}; };
NumberField field_gain { NumberField field_gain {
@ -206,11 +206,6 @@ private:
' ' ' '
}; };
Text text_amp {
{ 8 * 8, 3 * 8, 5 * 8, 1 * 16 },
"Amp:"
};
NumberField field_amp { NumberField field_amp {
{ 12 * 8, 3 * 8 }, { 12 * 8, 3 * 8 },
2, 2,
@ -219,6 +214,26 @@ private:
' ' ' '
}; };
Text text_gain_amp_short_UI {
{ 0, (3 * 8)-1, 5 * 8, 1 * 16 },
"Gain A:"
};
NumberField field_gain_short_UI {
{ (4 * 8)+2 , 3 * 8 },
2,
{ max2837::tx::gain_db_range.minimum, max2837::tx::gain_db_range.maximum },
max2837::tx::gain_db_step,
' '
};
NumberField field_amp_short_UI {
{ (9 * 8)-2, 3 * 8 },
2,
{ 0, 14 },
14,
' '
};
void on_tx_gain_changed(int32_t tx_gain); void on_tx_gain_changed(int32_t tx_gain);
void on_tx_amp_changed(bool rf_amp); void on_tx_amp_changed(bool rf_amp);