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
9 changed files with 104 additions and 150 deletions

View File

@@ -190,6 +190,10 @@ TransmitterView::~TransmitterView() {
}
/* 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) {
// Not using TransmitterView2, but if we delete it,we got , top line 1 a blanking rect.
@@ -219,36 +223,49 @@ void TransmitterView2::update_gainlevel_styles() {
}
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);
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() {
field_gain.set_value(transmitter_model.tx_gain());
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();
}
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({
&text_gain,
&field_gain,
&text_amp,
&field_amp,
&(short_UI ? text_gain_amp_short_UI : text_gain_amp),
&(short_UI ? field_gain_short_UI : field_gain),
&(short_UI ? field_amp_short_UI : field_amp),
});
field_gain.on_change = [this](uint32_t tx_gain) {
on_tx_gain_changed(tx_gain);
};
field_amp.on_change = [this](uint32_t rf_amp) {
on_tx_amp_changed((bool) rf_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) {
on_tx_gain_changed(tx_gain);
};
field_amp.on_change = [this](uint32_t rf_amp) {
on_tx_amp_changed((bool) rf_amp);
};
}
}
TransmitterView2::~TransmitterView2() {

View File

@@ -169,7 +169,7 @@ private:
class TransmitterView2 : public View {
public:
TransmitterView2(const Coord y);
TransmitterView2(const Coord x, const Coord y, bool short_UI);
~TransmitterView2();
@@ -193,9 +193,9 @@ private:
.foreground = Color::red(),
};
Text text_gain {
Text text_gain_amp {
{ 0, 3 * 8, 5 * 8, 1 * 16 },
"Gain:"
"Gain: Amp:"
};
NumberField field_gain {
@@ -206,11 +206,6 @@ private:
' '
};
Text text_amp {
{ 8 * 8, 3 * 8, 5 * 8, 1 * 16 },
"Amp:"
};
NumberField field_amp {
{ 12 * 8, 3 * 8 },
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_amp_changed(bool rf_amp);