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

@ -31,100 +31,95 @@
namespace ui {
class RSSI : public Widget {
public:
std::function<void(RSSI&)> on_select { };
std::function<void(RSSI&)> on_touch_release { }; // Executed when releasing touch, after on_select.
std::function<void(RSSI&)> on_touch_press { }; // Executed when touching, before on_select.
std::function<bool(RSSI&, KeyEvent)> on_dir { };
std::function<void(RSSI&)> on_highlight { };
class RSSI : public Widget {
public:
std::function<void(RSSI&)> on_select{};
std::function<void(RSSI&)> on_touch_release{}; // Executed when releasing touch, after on_select.
std::function<void(RSSI&)> on_touch_press{}; // Executed when touching, before on_select.
std::function<bool(RSSI&, KeyEvent)> on_dir{};
std::function<void(RSSI&)> on_highlight{};
RSSI(Rect parent_rect, bool instant_exec); // instant_exec: Execute on_select when you touching instead of releasing
RSSI(
Rect parent_rect
) : RSSI { parent_rect, false }
{
}
RSSI(Rect parent_rect, bool instant_exec); // instant_exec: Execute on_select when you touching instead of releasing
RSSI(
Rect parent_rect)
: RSSI{parent_rect, false} {
}
RSSI(
) : RSSI { { }, { } }
{
}
RSSI()
: RSSI{{}, {}} {
}
int16_t get_min();
int16_t get_avg();
int16_t get_max();
int16_t get_delta();
void set_vertical_rssi(bool enabled);
void set_peak(bool enabled, size_t duration);
int16_t get_min();
int16_t get_avg();
int16_t get_max();
int16_t get_delta();
void set_vertical_rssi(bool enabled);
void set_peak(bool enabled, size_t duration);
void paint(Painter& painter) override;
void on_focus() override;
bool on_key(const KeyEvent key) override;
bool on_touch(const TouchEvent event) override;
void paint(Painter& painter) override;
void on_focus() override;
bool on_key(const KeyEvent key) override;
bool on_touch(const TouchEvent event) override;
private:
int16_t min_ = 0;
int16_t avg_ = 0;
int16_t max_ = 0;
int16_t peak_ = 0 ;
size_t peak_duration_ = 0 ;
bool instant_exec_ { false };
private:
int16_t min_ = 0;
int16_t avg_ = 0;
int16_t max_ = 0;
int16_t peak_ = 0;
size_t peak_duration_ = 0;
bool instant_exec_{false};
bool pitch_rssi_enabled = false;
bool vertical_rssi_enabled = false; // scale [vertically/from bottom to top]
// instead of [horizontally/from left to right]
bool peak_enabled = false;
size_t peak_duration = 1000; // peak duration in msec before being reset to actual max_rssi
bool pitch_rssi_enabled = false;
bool vertical_rssi_enabled = false; // scale [vertically/from bottom to top]
// instead of [horizontally/from left to right]
bool peak_enabled = false;
size_t peak_duration = 1000; // peak duration in msec before being reset to actual max_rssi
MessageHandlerRegistration message_handler_stats {
Message::ID::RSSIStatistics,
[this](const Message* const p) {
this->on_statistics_update(static_cast<const RSSIStatisticsMessage*>(p)->statistics);
}
};
MessageHandlerRegistration message_handler_stats{
Message::ID::RSSIStatistics,
[this](const Message* const p) {
this->on_statistics_update(static_cast<const RSSIStatisticsMessage*>(p)->statistics);
}};
MessageHandlerRegistration message_handler_pitch_rssi {
Message::ID::PitchRSSIConfigure,
[this](const Message* const p) {
const auto message = *reinterpret_cast<const PitchRSSIConfigureMessage*>(p);
this->set_pitch_rssi(message.enabled);
}
};
MessageHandlerRegistration message_handler_pitch_rssi{
Message::ID::PitchRSSIConfigure,
[this](const Message* const p) {
const auto message = *reinterpret_cast<const PitchRSSIConfigureMessage*>(p);
this->set_pitch_rssi(message.enabled);
}};
void on_statistics_update(const RSSIStatistics& statistics);
void set_pitch_rssi(bool enabled);
};
void on_statistics_update(const RSSIStatistics& statistics);
void set_pitch_rssi(bool enabled);
};
struct RSSIGraph_entry {
int16_t rssi_min { 0 };
int16_t rssi_avg { 0 };
int16_t rssi_max { 0 };
int16_t db { 0 };
};
struct RSSIGraph_entry {
int16_t rssi_min{0};
int16_t rssi_avg{0};
int16_t rssi_max{0};
int16_t db{0};
};
using RSSIGraphList = std::vector<RSSIGraph_entry>;
using RSSIGraphList = std::vector<RSSIGraph_entry>;
class RSSIGraph : public Widget {
public:
RSSIGraph(
const Rect parent_rect
) : Widget { parent_rect }
{
}
void paint(Painter& painter) override;
void add_values(int16_t rssi_min, int16_t rssi_avg, int16_t rssi_max, int16_t db );
void set_nb_columns( int16_t nb );
void on_hide() override ;
void on_show() override ;
class RSSIGraph : public Widget {
public:
RSSIGraph(
const Rect parent_rect)
: Widget{parent_rect} {
}
void paint(Painter& painter) override;
void add_values(int16_t rssi_min, int16_t rssi_avg, int16_t rssi_max, int16_t db);
void set_nb_columns(int16_t nb);
private:
uint16_t nb_columns_before_hide = 16 ;
uint16_t nb_columns = 16 ;
RSSIGraphList graph_list { } ;
};
void on_hide() override;
void on_show() override;
}
private:
uint16_t nb_columns_before_hide = 16;
uint16_t nb_columns = 16;
RSSIGraphList graph_list{};
};
#endif/*__UI_RSSI_H__*/
} // namespace ui
#endif /*__UI_RSSI_H__*/