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

@ -29,7 +29,7 @@
// The format is actually very simple if it is rather seen as short and long gaps between pulses (as seen in many OOK remotes).
// The frames and data rate suspiciously match the NEC infrared protocol (http://www.sbprojects.com/knowledge/ir/nec.php) without
// the address complement. The exact data rate would be 1786 baud (560us/fragment).
// NotPike: The data rate should be 1786 but the remote was transmitting at 1766
// NotPike: The data rate should be 1786 but the remote was transmitting at 1766
// Pin 0 - On/Off
// ffff00 a2888a2aaaa8888aa2aa2220
@ -67,159 +67,150 @@
// Each 16bit button code is actually 8bit followed by its complement
const uint8_t button_codes[32] = {
0x32, // Pause
0x78, // On/Off
0x70, // P1
0x60, // P2
0xCA, // P3
0x20, // F1
0xF2, // Up
0xA0, // F2
0x84, // Left
0x44, // OK
0xC4, // Right
0x30, // F3
0x80, // Down
0xB0, // F4
0xF0, // 1
0x08, // 2
0x88, // 3
0x48, // 4
0xC8, // 5
0x28, // 6
0xA8, // 7
0x68, // 8
0xE8, // 9
0x18, // Music_Karaoke
0x98, // 0
0x58, // Lock_Queue
0xD0, // Zone 1 Vol+
0x90, // Zone 2 Vol+
0xC0, // Zone 3 Vol+
0x50, // Zone 1 Vol-
0x10, // Zone 2 Vol-
0x40, // Zone 3 Vol-
0x32, // Pause
0x78, // On/Off
0x70, // P1
0x60, // P2
0xCA, // P3
0x20, // F1
0xF2, // Up
0xA0, // F2
0x84, // Left
0x44, // OK
0xC4, // Right
0x30, // F3
0x80, // Down
0xB0, // F4
0xF0, // 1
0x08, // 2
0x88, // 3
0x48, // 4
0xC8, // 5
0x28, // 6
0xA8, // 7
0x68, // 8
0xE8, // 9
0x18, // Music_Karaoke
0x98, // 0
0x58, // Lock_Queue
0xD0, // Zone 1 Vol+
0x90, // Zone 2 Vol+
0xC0, // Zone 3 Vol+
0x50, // Zone 1 Vol-
0x10, // Zone 2 Vol-
0x40, // Zone 3 Vol-
};
namespace ui {
class TouchTunesView : public View {
public:
TouchTunesView(NavigationView& nav);
~TouchTunesView();
void focus() override;
std::string title() const override { return "TouchTunes"; };
public:
TouchTunesView(NavigationView& nav);
~TouchTunesView();
private:
uint32_t scan_button_index { };
uint32_t pin { 0 };
enum tx_modes {
IDLE = 0,
SINGLE,
SCAN
};
tx_modes tx_mode = IDLE;
void start_tx(const uint32_t button_index);
void stop_tx();
void on_tx_progress(const uint32_t progress, const bool done);
void start_ew();
void stop_ew();
void focus() override;
struct remote_layout_t {
Point position;
std::string text;
};
const std::array<remote_layout_t, 32> remote_layout { {
{ { 12 * 8, 0 }, "PAUSE" },
{ { 21 * 8, 0 }, "POWER" },
{ { 14 * 8, 5 * 8 }, "P1" },
{ { 18 * 8, 5 * 8 }, "P2" },
{ { 22 * 8, 5 * 8 }, "P3" },
{ { 14 * 8, 10 * 8 }, "F1" },
{ { 18 * 8 + 4, 10 * 8 }, "^" },
{ { 22 * 8, 10 * 8 }, "F2" },
{ { 14 * 8, 14 * 8 }, "<" },
{ { 18 * 8, 14 * 8 }, "OK" },
{ { 23 * 8, 14 * 8 }, ">" },
{ { 14 * 8, 18 * 8 }, "F3" },
{ { 18 * 8 + 4, 18 * 8 }, "V" },
{ { 22 * 8, 18 * 8 }, "F4" },
{ { 0 * 8, 5 * 8 }, "1" },
{ { 4 * 8, 5 * 8 }, "2" },
{ { 8 * 8, 5 * 8 }, "3" },
{ { 0 * 8, 10 * 8 }, "4" },
{ { 4 * 8, 10 * 8 }, "5" },
{ { 8 * 8, 10 * 8 }, "6" },
{ { 0 * 8, 15 * 8 }, "7" },
{ { 4 * 8, 15 * 8 }, "8" },
{ { 8 * 8, 15 * 8 }, "9" },
{ { 0 * 8, 20 * 8 }, "*" },
{ { 4 * 8, 20 * 8 }, "0" },
{ { 8 * 8, 20 * 8 }, "#" },
{ { 13 * 8, 23 * 8 }, "+" },
{ { 18 * 8, 23 * 8 }, "+" },
{ { 23 * 8, 23 * 8 }, "+" },
{ { 13 * 8, 29 * 8 }, "-" },
{ { 18 * 8, 29 * 8 }, "-" },
{ { 23 * 8, 29 * 8 }, "-" }
} };
Labels labels {
{ { 2 * 8, 1 * 8 }, "PIN:", Color::light_grey() },
{ { 13 * 8 + 4, 27 * 8 }, "VOL1 VOL2 VOL3", Color::light_grey() }
};
std::array<Button, 32> buttons { };
std::string title() const override { return "TouchTunes"; };
NumberField field_pin {
{ 6 * 8, 1 * 8 },
3,
{ 0, 255 },
1,
'0'
};
Checkbox check_scan {
{ 2 * 8, 25 * 8 },
4,
"Scan"
};
private:
uint32_t scan_button_index{};
uint32_t pin{0};
Checkbox check_ew {
{ 2 * 8, 29 * 8 },
4,
"EW Mode"
};
enum tx_modes {
IDLE = 0,
SINGLE,
SCAN
};
Text text_status {
{ 2 * 8, 33 * 8, 128, 16 },
"Ready"
};
ProgressBar progressbar {
{ 2 * 8, 35 * 8, 208, 16 }
};
MessageHandlerRegistration message_handler_tx_progress {
Message::ID::TXProgress,
[this](const Message* const p) {
const auto message = *reinterpret_cast<const TXProgressMessage*>(p);
this->on_tx_progress(message.progress, message.done);
}
};
tx_modes tx_mode = IDLE;
void start_tx(const uint32_t button_index);
void stop_tx();
void on_tx_progress(const uint32_t progress, const bool done);
void start_ew();
void stop_ew();
struct remote_layout_t {
Point position;
std::string text;
};
const std::array<remote_layout_t, 32> remote_layout{{{{12 * 8, 0}, "PAUSE"},
{{21 * 8, 0}, "POWER"},
{{14 * 8, 5 * 8}, "P1"},
{{18 * 8, 5 * 8}, "P2"},
{{22 * 8, 5 * 8}, "P3"},
{{14 * 8, 10 * 8}, "F1"},
{{18 * 8 + 4, 10 * 8}, "^"},
{{22 * 8, 10 * 8}, "F2"},
{{14 * 8, 14 * 8}, "<"},
{{18 * 8, 14 * 8}, "OK"},
{{23 * 8, 14 * 8}, ">"},
{{14 * 8, 18 * 8}, "F3"},
{{18 * 8 + 4, 18 * 8}, "V"},
{{22 * 8, 18 * 8}, "F4"},
{{0 * 8, 5 * 8}, "1"},
{{4 * 8, 5 * 8}, "2"},
{{8 * 8, 5 * 8}, "3"},
{{0 * 8, 10 * 8}, "4"},
{{4 * 8, 10 * 8}, "5"},
{{8 * 8, 10 * 8}, "6"},
{{0 * 8, 15 * 8}, "7"},
{{4 * 8, 15 * 8}, "8"},
{{8 * 8, 15 * 8}, "9"},
{{0 * 8, 20 * 8}, "*"},
{{4 * 8, 20 * 8}, "0"},
{{8 * 8, 20 * 8}, "#"},
{{13 * 8, 23 * 8}, "+"},
{{18 * 8, 23 * 8}, "+"},
{{23 * 8, 23 * 8}, "+"},
{{13 * 8, 29 * 8}, "-"},
{{18 * 8, 29 * 8}, "-"},
{{23 * 8, 29 * 8}, "-"}}};
Labels labels{
{{2 * 8, 1 * 8}, "PIN:", Color::light_grey()},
{{13 * 8 + 4, 27 * 8}, "VOL1 VOL2 VOL3", Color::light_grey()}};
std::array<Button, 32> buttons{};
NumberField field_pin{
{6 * 8, 1 * 8},
3,
{0, 255},
1,
'0'};
Checkbox check_scan{
{2 * 8, 25 * 8},
4,
"Scan"};
Checkbox check_ew{
{2 * 8, 29 * 8},
4,
"EW Mode"};
Text text_status{
{2 * 8, 33 * 8, 128, 16},
"Ready"};
ProgressBar progressbar{
{2 * 8, 35 * 8, 208, 16}};
MessageHandlerRegistration message_handler_tx_progress{
Message::ID::TXProgress,
[this](const Message* const p) {
const auto message = *reinterpret_cast<const TXProgressMessage*>(p);
this->on_tx_progress(message.progress, message.done);
}};
};
} /* namespace ui */