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

@ -1,7 +1,7 @@
/*
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
* Copyright (C) 2016 Furrtek
*
*
* This file is part of PortaPack.
*
* This program is free software; you can redistribute it and/or modify
@ -36,216 +36,213 @@ using namespace adsb;
namespace ui {
class Compass : public Widget {
public:
Compass(const Point parent_pos);
public:
Compass(const Point parent_pos);
void set_value(uint32_t new_value);
void set_value(uint32_t new_value);
void paint(Painter&) override;
void paint(Painter&) override;
private:
const range_t<uint32_t> range { 0, 359 };
uint32_t value_ { 0 };
private:
const range_t<uint32_t> range{0, 359};
uint32_t value_{0};
};
class ADSBPositionView : public OptionTabView {
public:
ADSBPositionView(NavigationView& nav, Rect parent_rect);
void collect_frames(const uint32_t ICAO_address, std::vector<ADSBFrame>& frame_list);
public:
ADSBPositionView(NavigationView& nav, Rect parent_rect);
private:
GeoPos geopos {
{ 0, 2 * 16 },
GeoPos::FEET
};
Button button_set_map {
{ 8 * 8, 6 * 16, 14 * 8, 2 * 16 },
"Set from map"
};
void collect_frames(const uint32_t ICAO_address, std::vector<ADSBFrame>& frame_list);
private:
GeoPos geopos{
{0, 2 * 16},
GeoPos::FEET};
Button button_set_map{
{8 * 8, 6 * 16, 14 * 8, 2 * 16},
"Set from map"};
};
class ADSBCallsignView : public OptionTabView {
public:
ADSBCallsignView(NavigationView& nav, Rect parent_rect);
void collect_frames(const uint32_t ICAO_address, std::vector<ADSBFrame>& frame_list);
public:
ADSBCallsignView(NavigationView& nav, Rect parent_rect);
private:
std::string callsign = "TEST1234";
Labels labels_callsign {
{ { 2 * 8, 5 * 8 }, "Callsign:", Color::light_grey() }
};
Button button_callsign {
{ 12 * 8, 2 * 16, 10 * 8, 2 * 16 },
""
};
void collect_frames(const uint32_t ICAO_address, std::vector<ADSBFrame>& frame_list);
private:
std::string callsign = "TEST1234";
Labels labels_callsign{
{{2 * 8, 5 * 8}, "Callsign:", Color::light_grey()}};
Button button_callsign{
{12 * 8, 2 * 16, 10 * 8, 2 * 16},
""};
};
class ADSBSpeedView : public OptionTabView {
public:
ADSBSpeedView(Rect parent_rect);
void collect_frames(const uint32_t ICAO_address, std::vector<ADSBFrame>& frame_list);
public:
ADSBSpeedView(Rect parent_rect);
private:
Labels labels_speed {
{ { 1 * 8, 6 * 16 }, "Speed: kn Bearing: *", Color::light_grey() }
};
Labels labels_vert_rate {
{ { 1 * 8, 8 * 16 }, "Vert. rate: ft/min, (+/-)", Color::light_grey() }
};
void collect_frames(const uint32_t ICAO_address, std::vector<ADSBFrame>& frame_list);
Compass compass {
{ 21 * 8, 2 * 16 }
};
NumberField field_angle {
{ 21 * 8 + 20, 6 * 16 }, 3, { 0, 359 }, 1, ' ', true
};
NumberField field_speed {
{ 8 * 8, 6 * 16 }, 3, { 0, 999 }, 5, ' '
};
NumberField field_vert_rate {
{ 11 * 8, 8 * 16 }, 5, { -4096, 4096 }, 64, ' ' // Let's limit to +/-5k aprox , Ex. max safe descent vertical rate aprox -1000 ft/min on an instrument approach. , std step is 64
};
private:
Labels labels_speed{
{{1 * 8, 6 * 16}, "Speed: kn Bearing: *", Color::light_grey()}};
Labels labels_vert_rate{
{{1 * 8, 8 * 16}, "Vert. rate: ft/min, (+/-)", Color::light_grey()}};
Compass compass{
{21 * 8, 2 * 16}};
NumberField field_angle{
{21 * 8 + 20, 6 * 16},
3,
{0, 359},
1,
' ',
true};
NumberField field_speed{
{8 * 8, 6 * 16},
3,
{0, 999},
5,
' '};
NumberField field_vert_rate{
{11 * 8, 8 * 16},
5,
{-4096, 4096},
64,
' ' // Let's limit to +/-5k aprox , Ex. max safe descent vertical rate aprox -1000 ft/min on an instrument approach. , std step is 64
};
};
class ADSBSquawkView : public OptionTabView {
public:
ADSBSquawkView(Rect parent_rect);
void collect_frames(const uint32_t ICAO_address, std::vector<ADSBFrame>& frame_list);
public:
ADSBSquawkView(Rect parent_rect);
private:
Labels labels_squawk {
{ { 2 * 8, 2 * 16 }, "Squawk:", Color::light_grey() }
};
SymField field_squawk {
{ 10 * 8, 2 * 16 },
4,
SymField::SYMFIELD_OCT
};
void collect_frames(const uint32_t ICAO_address, std::vector<ADSBFrame>& frame_list);
private:
Labels labels_squawk{
{{2 * 8, 2 * 16}, "Squawk:", Color::light_grey()}};
SymField field_squawk{
{10 * 8, 2 * 16},
4,
SymField::SYMFIELD_OCT};
};
class ADSBTXThread {
public:
ADSBTXThread(std::vector<ADSBFrame> frames);
~ADSBTXThread();
public:
ADSBTXThread(std::vector<ADSBFrame> frames);
~ADSBTXThread();
ADSBTXThread(const ADSBTXThread&) = delete;
ADSBTXThread(ADSBTXThread&&) = delete;
ADSBTXThread& operator=(const ADSBTXThread&) = delete;
ADSBTXThread& operator=(ADSBTXThread&&) = delete;
ADSBTXThread(const ADSBTXThread&) = delete;
ADSBTXThread(ADSBTXThread&&) = delete;
ADSBTXThread& operator=(const ADSBTXThread&) = delete;
ADSBTXThread& operator=(ADSBTXThread&&) = delete;
private:
std::vector<ADSBFrame> frames_ { };
Thread* thread { nullptr };
private:
std::vector<ADSBFrame> frames_{};
Thread* thread{nullptr};
static msg_t static_fn(void* arg);
void run();
static msg_t static_fn(void* arg);
void run();
};
class ADSBTxView : public View {
public:
ADSBTxView(NavigationView& nav);
~ADSBTxView();
void focus() override;
std::string title() const override { return "ADS-B TX"; };
public:
ADSBTxView(NavigationView& nav);
~ADSBTxView();
private:
/*enum tx_modes {
IDLE = 0,
SINGLE,
SEQUENCE
};*/
/*const float plane_lats[12] = {
0,
-1,
-2,
-3,
-4,
-5,
-4.5,
-5,
-4,
-3,
-2,
-1
};
const float plane_lons[12] = {
0,
1,
1,
1,
2,
1,
0,
-1,
-2,
-1,
-1,
-1
};*/
void focus() override;
// app save settings
std::app_settings settings { };
std::app_settings::AppSettings app_settings { };
//tx_modes tx_mode = IDLE;
NavigationView& nav_;
std::vector<ADSBFrame> frames { };
void start_tx();
void generate_frames();
Rect view_rect = { 0, 7 * 8, 240, 192 };
ADSBPositionView view_position { nav_, view_rect };
ADSBCallsignView view_callsign { nav_, view_rect };
ADSBSpeedView view_speed { view_rect };
ADSBSquawkView view_squawk { view_rect };
TabView tab_view {
{ "Position", Color::cyan(), &view_position },
{ "Callsign", Color::green(), &view_callsign },
{ "Speed", Color::yellow(), &view_speed },
{ "Squawk", Color::orange(), &view_squawk }
};
Labels labels {
{ { 2 * 8, 4 * 8 }, "ICAO24:", Color::light_grey() }
};
SymField sym_icao {
{ 10 * 8, 4 * 8 },
6,
SymField::SYMFIELD_HEX
};
Text text_frame {
{ 1 * 8, 29 * 8, 14 * 8, 16 },
"-"
};
TransmitterView tx_view {
16 * 16,
1000000,
0
};
std::unique_ptr<ADSBTXThread> tx_thread { };
std::string title() const override { return "ADS-B TX"; };
private:
/*enum tx_modes {
IDLE = 0,
SINGLE,
SEQUENCE
};*/
/*const float plane_lats[12] = {
0,
-1,
-2,
-3,
-4,
-5,
-4.5,
-5,
-4,
-3,
-2,
-1
};
const float plane_lons[12] = {
0,
1,
1,
1,
2,
1,
0,
-1,
-2,
-1,
-1,
-1
};*/
// app save settings
std::app_settings settings{};
std::app_settings::AppSettings app_settings{};
// tx_modes tx_mode = IDLE;
NavigationView& nav_;
std::vector<ADSBFrame> frames{};
void start_tx();
void generate_frames();
Rect view_rect = {0, 7 * 8, 240, 192};
ADSBPositionView view_position{nav_, view_rect};
ADSBCallsignView view_callsign{nav_, view_rect};
ADSBSpeedView view_speed{view_rect};
ADSBSquawkView view_squawk{view_rect};
TabView tab_view{
{"Position", Color::cyan(), &view_position},
{"Callsign", Color::green(), &view_callsign},
{"Speed", Color::yellow(), &view_speed},
{"Squawk", Color::orange(), &view_squawk}};
Labels labels{
{{2 * 8, 4 * 8}, "ICAO24:", Color::light_grey()}};
SymField sym_icao{
{10 * 8, 4 * 8},
6,
SymField::SYMFIELD_HEX};
Text text_frame{
{1 * 8, 29 * 8, 14 * 8, 16},
"-"};
TransmitterView tx_view{
16 * 16,
1000000,
0};
std::unique_ptr<ADSBTXThread> tx_thread{};
};
} /* namespace ui */