mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-20 12:54:33 -04:00
Formatted code (#1007)
* Updated style * Updated files * fixed new line * Updated spacing * File fix WIP * Updated to clang 13 * updated comment style * Removed old comment code
This commit is contained in:
parent
7aca7ce74d
commit
033c4e9a5b
599 changed files with 70746 additions and 66896 deletions
|
@ -37,212 +37,195 @@
|
|||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
#define POWER_THRESHOLD_HIGH 47
|
||||
#define POWER_THRESHOLD_MED 38
|
||||
#define POWER_THRESHOLD_LOW 17
|
||||
#define POWER_THRESHOLD_HIGH 47
|
||||
#define POWER_THRESHOLD_MED 38
|
||||
#define POWER_THRESHOLD_LOW 17
|
||||
|
||||
namespace ui {
|
||||
|
||||
class TXGainField : public NumberField {
|
||||
public:
|
||||
std::function<void(void)> on_show_options { };
|
||||
public:
|
||||
std::function<void(void)> on_show_options{};
|
||||
|
||||
TXGainField(Point parent_pos);
|
||||
TXGainField(Point parent_pos);
|
||||
};
|
||||
|
||||
class TransmitterView : public View {
|
||||
public:
|
||||
std::function<void(void)> on_edit_frequency { };
|
||||
std::function<void(void)> on_start { };
|
||||
std::function<void(void)> on_stop { };
|
||||
|
||||
TransmitterView(const Coord y, const uint64_t frequency_step, const uint32_t channel_bandwidth, const bool lock);
|
||||
TransmitterView(
|
||||
const Coord y, const uint32_t frequency_step, const uint32_t channel_bandwidth
|
||||
) : TransmitterView { y, frequency_step, channel_bandwidth, false }
|
||||
{
|
||||
}
|
||||
|
||||
~TransmitterView();
|
||||
|
||||
void on_show() override;
|
||||
void paint(Painter& painter) override;
|
||||
void focus() override;
|
||||
|
||||
void set_transmitting(const bool transmitting);
|
||||
public:
|
||||
std::function<void(void)> on_edit_frequency{};
|
||||
std::function<void(void)> on_start{};
|
||||
std::function<void(void)> on_stop{};
|
||||
|
||||
private:
|
||||
const Style style_start {
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::green(),
|
||||
};
|
||||
const Style style_stop {
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::red(),
|
||||
};
|
||||
const Style style_locked {
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::dark_grey(),
|
||||
};
|
||||
const Style style_power_low {
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::yellow(),
|
||||
};
|
||||
const Style style_power_med {
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::orange(),
|
||||
};
|
||||
const Style style_power_high {
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::red(),
|
||||
};
|
||||
TransmitterView(const Coord y, const uint64_t frequency_step, const uint32_t channel_bandwidth, const bool lock);
|
||||
TransmitterView(
|
||||
const Coord y,
|
||||
const uint32_t frequency_step,
|
||||
const uint32_t channel_bandwidth)
|
||||
: TransmitterView{y, frequency_step, channel_bandwidth, false} {
|
||||
}
|
||||
|
||||
bool lock_ { false };
|
||||
bool transmitting_ { false };
|
||||
|
||||
FrequencyField field_frequency {
|
||||
{ 0, 1 * 8 }
|
||||
};
|
||||
|
||||
Text text_gain {
|
||||
{ 0, 3 * 8, 5 * 8, 1 * 16 },
|
||||
"Gain:"
|
||||
};
|
||||
|
||||
NumberField field_gain {
|
||||
{ 5 * 8, 3 * 8 },
|
||||
2,
|
||||
{ max2837::tx::gain_db_range.minimum, max2837::tx::gain_db_range.maximum },
|
||||
max2837::tx::gain_db_step,
|
||||
' '
|
||||
};
|
||||
~TransmitterView();
|
||||
|
||||
Text text_bw {
|
||||
{ 18 * 8, 1 * 8, 3 * 8, 1 * 16 },
|
||||
"kHz"
|
||||
};
|
||||
NumberField field_bw {
|
||||
{ 15 * 8, 1 * 8 },
|
||||
3,
|
||||
{ 1, 150 },
|
||||
1,
|
||||
' '
|
||||
};
|
||||
|
||||
Text text_amp {
|
||||
{ 11 * 8, 3 * 8, 5 * 8, 1 * 16 },
|
||||
"Amp:"
|
||||
};
|
||||
void on_show() override;
|
||||
void paint(Painter& painter) override;
|
||||
void focus() override;
|
||||
|
||||
NumberField field_amp {
|
||||
{ 16 * 8, 3 * 8 },
|
||||
2,
|
||||
{ 0, 14 },
|
||||
14,
|
||||
' '
|
||||
};
|
||||
void set_transmitting(const bool transmitting);
|
||||
|
||||
Button button_start {
|
||||
{ 21 * 8, 1 * 8, 9 * 8, 32 },
|
||||
"START"
|
||||
};
|
||||
|
||||
FrequencyStepView field_frequency_step {
|
||||
{ 10 * 8 - 4, 1 * 8 },
|
||||
};
|
||||
private:
|
||||
const Style style_start{
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::green(),
|
||||
};
|
||||
const Style style_stop{
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::red(),
|
||||
};
|
||||
const Style style_locked{
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::dark_grey(),
|
||||
};
|
||||
const Style style_power_low{
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::yellow(),
|
||||
};
|
||||
const Style style_power_med{
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::orange(),
|
||||
};
|
||||
const Style style_power_high{
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::red(),
|
||||
};
|
||||
|
||||
void on_tuning_frequency_changed(rf::Frequency f);
|
||||
void on_channel_bandwidth_changed(uint32_t channel_bandwidth);
|
||||
void on_tx_gain_changed(int32_t tx_gain);
|
||||
void on_tx_amp_changed(bool rf_amp);
|
||||
bool lock_{false};
|
||||
bool transmitting_{false};
|
||||
|
||||
void update_gainlevel_styles(void);
|
||||
FrequencyField field_frequency{
|
||||
{0, 1 * 8}};
|
||||
|
||||
Text text_gain{
|
||||
{0, 3 * 8, 5 * 8, 1 * 16},
|
||||
"Gain:"};
|
||||
|
||||
NumberField field_gain{
|
||||
{5 * 8, 3 * 8},
|
||||
2,
|
||||
{max2837::tx::gain_db_range.minimum, max2837::tx::gain_db_range.maximum},
|
||||
max2837::tx::gain_db_step,
|
||||
' '};
|
||||
|
||||
Text text_bw{
|
||||
{18 * 8, 1 * 8, 3 * 8, 1 * 16},
|
||||
"kHz"};
|
||||
NumberField field_bw{
|
||||
{15 * 8, 1 * 8},
|
||||
3,
|
||||
{1, 150},
|
||||
1,
|
||||
' '};
|
||||
|
||||
Text text_amp{
|
||||
{11 * 8, 3 * 8, 5 * 8, 1 * 16},
|
||||
"Amp:"};
|
||||
|
||||
NumberField field_amp{
|
||||
{16 * 8, 3 * 8},
|
||||
2,
|
||||
{0, 14},
|
||||
14,
|
||||
' '};
|
||||
|
||||
Button button_start{
|
||||
{21 * 8, 1 * 8, 9 * 8, 32},
|
||||
"START"};
|
||||
|
||||
FrequencyStepView field_frequency_step{
|
||||
{10 * 8 - 4, 1 * 8},
|
||||
};
|
||||
|
||||
void on_tuning_frequency_changed(rf::Frequency f);
|
||||
void on_channel_bandwidth_changed(uint32_t channel_bandwidth);
|
||||
void on_tx_gain_changed(int32_t tx_gain);
|
||||
void on_tx_amp_changed(bool rf_amp);
|
||||
|
||||
void update_gainlevel_styles(void);
|
||||
};
|
||||
|
||||
|
||||
class TransmitterView2 : public View {
|
||||
public:
|
||||
|
||||
TransmitterView2(const Coord x, const Coord y, bool short_UI);
|
||||
public:
|
||||
TransmitterView2(const Coord x, const Coord y, bool short_UI);
|
||||
|
||||
~TransmitterView2();
|
||||
|
||||
void on_show() override;
|
||||
void paint(Painter& painter) override;
|
||||
|
||||
private:
|
||||
const Style style_power_low {
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::yellow(),
|
||||
};
|
||||
const Style style_power_med {
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::orange(),
|
||||
};
|
||||
const Style style_power_high {
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::red(),
|
||||
};
|
||||
~TransmitterView2();
|
||||
|
||||
Text text_gain_amp {
|
||||
{ 0, 3 * 8, 5 * 8, 1 * 16 },
|
||||
"Gain: Amp:"
|
||||
};
|
||||
|
||||
NumberField field_gain {
|
||||
{ 5 * 8, 3 * 8 },
|
||||
2,
|
||||
{ max2837::tx::gain_db_range.minimum, max2837::tx::gain_db_range.maximum },
|
||||
max2837::tx::gain_db_step,
|
||||
' '
|
||||
};
|
||||
void on_show() override;
|
||||
void paint(Painter& painter) override;
|
||||
|
||||
NumberField field_amp {
|
||||
{ 12 * 8, 3 * 8 },
|
||||
2,
|
||||
{ 0, 14 },
|
||||
14,
|
||||
' '
|
||||
};
|
||||
private:
|
||||
const Style style_power_low{
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::yellow(),
|
||||
};
|
||||
const Style style_power_med{
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::orange(),
|
||||
};
|
||||
const Style style_power_high{
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::red(),
|
||||
};
|
||||
|
||||
Text text_gain_amp_short_UI {
|
||||
{ 0, (3 * 8)-1, 5 * 8, 1 * 16 },
|
||||
"Gain A:"
|
||||
};
|
||||
Text text_gain_amp{
|
||||
{0, 3 * 8, 5 * 8, 1 * 16},
|
||||
"Gain: Amp:"};
|
||||
|
||||
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_gain{
|
||||
{5 * 8, 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,
|
||||
' '
|
||||
};
|
||||
NumberField field_amp{
|
||||
{12 * 8, 3 * 8},
|
||||
2,
|
||||
{0, 14},
|
||||
14,
|
||||
' '};
|
||||
|
||||
void on_tx_gain_changed(int32_t tx_gain);
|
||||
void on_tx_amp_changed(bool rf_amp);
|
||||
Text text_gain_amp_short_UI{
|
||||
{0, (3 * 8) - 1, 5 * 8, 1 * 16},
|
||||
"Gain A:"};
|
||||
|
||||
void update_gainlevel_styles(void);
|
||||
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);
|
||||
|
||||
void update_gainlevel_styles(void);
|
||||
};
|
||||
|
||||
|
||||
|
||||
} /* namespace ui */
|
||||
|
||||
#endif/*__UI_TRANSMITTER_H__*/
|
||||
#endif /*__UI_TRANSMITTER_H__*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue