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:
jLynx 2023-05-19 08:16:05 +12:00 committed by GitHub
parent 7aca7ce74d
commit 033c4e9a5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
599 changed files with 70746 additions and 66896 deletions

View file

@ -38,140 +38,127 @@
namespace ui {
class SpectrumPainterView : public View {
public:
SpectrumPainterView(NavigationView& nav);
~SpectrumPainterView();
public:
SpectrumPainterView(NavigationView& nav);
~SpectrumPainterView();
SpectrumPainterView(const SpectrumPainterView&) = delete;
SpectrumPainterView(SpectrumPainterView&&) = delete;
SpectrumPainterView& operator=(const SpectrumPainterView&) = delete;
SpectrumPainterView& operator=(SpectrumPainterView&&) = delete;
SpectrumPainterView(const SpectrumPainterView&) = delete;
SpectrumPainterView(SpectrumPainterView&&) = delete;
SpectrumPainterView& operator=(const SpectrumPainterView&) = delete;
SpectrumPainterView& operator=(SpectrumPainterView&&) = delete;
void focus() override;
void paint(Painter& painter) override;
std::string title() const override { return "Spec.Painter"; };
void focus() override;
void paint(Painter& painter) override;
private:
void on_target_frequency_changed(rf::Frequency f);
void set_target_frequency(const rf::Frequency new_value);
rf::Frequency target_frequency() const;
std::string title() const override { return "Spec.Painter"; };
NavigationView& nav_;
bool image_input_avaliable { false };
bool tx_active { false };
uint32_t tx_mode { 0 };
uint16_t tx_current_line { 0 };
uint16_t tx_current_max_lines { 0 };
uint16_t tx_current_width { 0 };
systime_t tx_timestamp_start { 0 };
private:
void on_target_frequency_changed(rf::Frequency f);
void set_target_frequency(const rf::Frequency new_value);
rf::Frequency target_frequency() const;
inline uint32_t tx_time_elapsed() {
auto now = chTimeNow();
return now - tx_timestamp_start;
}
NavigationView& nav_;
bool image_input_avaliable{false};
bool tx_active{false};
uint32_t tx_mode{0};
uint16_t tx_current_line{0};
uint16_t tx_current_max_lines{0};
uint16_t tx_current_width{0};
systime_t tx_timestamp_start{0};
int32_t tx_gain { 47 };
bool rf_amp { false };
inline uint32_t tx_time_elapsed() {
auto now = chTimeNow();
return now - tx_timestamp_start;
}
SpectrumInputImageView input_image { nav_ };
SpectrumInputTextView input_text { nav_ };
std::array<View*, 2> input_views { { &input_image, &input_text } };
int32_t tx_gain{47};
bool rf_amp{false};
TabView tab_view {
{ "Image", Color::white(), input_views[0] },
{ "Text", Color::white(), input_views[1] }
};
SpectrumInputImageView input_image{nav_};
SpectrumInputTextView input_text{nav_};
static constexpr int32_t footer_location = 15 * 16 + 8;
ProgressBar progressbar {
{ 4, footer_location - 16, 240-8, 16 }
};
std::array<View*, 2> input_views{{&input_image, &input_text}};
Labels labels {
{ { 10 * 8, footer_location + 1 * 16 }, "GAIN A:", Color::light_grey() },
{ { 1 * 8, footer_location + 2 * 16 }, "BW: Du: P:", Color::light_grey() },
};
TabView tab_view{
{"Image", Color::white(), input_views[0]},
{"Text", Color::white(), input_views[1]}};
FrequencyField field_frequency {
{ 0 * 8, footer_location + 1 * 16 },
};
NumberField field_rfgain {
{ 14 * 8, footer_location + 1 * 16 },
2,
{ 0, 47 },
1,
' '
};
static constexpr int32_t footer_location = 15 * 16 + 8;
ProgressBar progressbar{
{4, footer_location - 16, 240 - 8, 16}};
NumberField field_rfamp {
{ 19 * 8, footer_location + 1 * 16 },
2,
{ 0, 14 },
14,
' '
};
Labels labels{
{{10 * 8, footer_location + 1 * 16}, "GAIN A:", Color::light_grey()},
{{1 * 8, footer_location + 2 * 16}, "BW: Du: P:", Color::light_grey()},
};
Checkbox check_loop {
{ 21 * 8, footer_location + 1 * 16 },
4,
"Loop",
true
};
FrequencyField field_frequency{
{0 * 8, footer_location + 1 * 16},
};
ImageButton button_play {
{ 28 * 8, footer_location + 1 * 16, 2 * 8, 1 * 16 },
&bitmap_play,
Color::green(),
Color::black()
};
NumberField field_rfgain{
{14 * 8, footer_location + 1 * 16},
2,
{0, 47},
1,
' '};
OptionsField option_bandwidth {
{ 4 * 8, footer_location + 2 * 16 },
5,
{
BW_OPTIONS
}
};
NumberField field_duration {
{ 13 * 8, footer_location + 2 * 16 },
3,
{ 1, 999 },
1,
' '
};
NumberField field_rfamp{
{19 * 8, footer_location + 1 * 16},
2,
{0, 14},
14,
' '};
NumberField field_pause {
{ 19 * 8, footer_location + 2 * 16 },
2,
{ 0, 99 },
1,
' '
};
Checkbox check_loop{
{21 * 8, footer_location + 1 * 16},
4,
"Loop",
true};
SpectrumPainterFIFO* fifo { nullptr };
void start_tx();
void frame_sync();
void stop_tx();
ImageButton button_play{
{28 * 8, footer_location + 1 * 16, 2 * 8, 1 * 16},
&bitmap_play,
Color::green(),
Color::black()};
MessageHandlerRegistration message_handler_fifo_signal {
Message::ID::SpectrumPainterBufferResponseConfigure,
[this](const Message* const p) {
const auto message = static_cast<const SpectrumPainterBufferConfigureResponseMessage*>(p);
this->fifo = message->fifo;
this->start_tx();
}
};
OptionsField option_bandwidth{
{4 * 8, footer_location + 2 * 16},
5,
{BW_OPTIONS}};
MessageHandlerRegistration message_handler_sample {
Message::ID::DisplayFrameSync,
[this](const Message* const) {
this->frame_sync();
}
};
NumberField field_duration{
{13 * 8, footer_location + 2 * 16},
3,
{1, 999},
1,
' '};
NumberField field_pause{
{19 * 8, footer_location + 2 * 16},
2,
{0, 99},
1,
' '};
SpectrumPainterFIFO* fifo{nullptr};
void start_tx();
void frame_sync();
void stop_tx();
MessageHandlerRegistration message_handler_fifo_signal{
Message::ID::SpectrumPainterBufferResponseConfigure,
[this](const Message* const p) {
const auto message = static_cast<const SpectrumPainterBufferConfigureResponseMessage*>(p);
this->fifo = message->fifo;
this->start_tx();
}};
MessageHandlerRegistration message_handler_sample{
Message::ID::DisplayFrameSync,
[this](const Message* const) {
this->frame_sync();
}};
};
}
} // namespace ui