mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-15 09:56:00 -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
|
@ -31,106 +31,94 @@ using namespace encoders;
|
|||
namespace ui {
|
||||
|
||||
class KeyfobView : public View {
|
||||
public:
|
||||
KeyfobView(NavigationView& nav);
|
||||
~KeyfobView();
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "Key fob TX"; };
|
||||
public:
|
||||
KeyfobView(NavigationView& nav);
|
||||
~KeyfobView();
|
||||
|
||||
private:
|
||||
NavigationView& nav_;
|
||||
|
||||
// app save settings
|
||||
std::app_settings settings { };
|
||||
std::app_settings::AppSettings app_settings { };
|
||||
void focus() override;
|
||||
|
||||
// 1013210ns / bit
|
||||
static constexpr uint32_t subaru_samples_per_bit = (OOK_SAMPLERATE * 0.00101321);
|
||||
static constexpr uint32_t repeats = 4;
|
||||
|
||||
uint8_t frame[10] { };
|
||||
|
||||
void generate_payload(size_t& bitstream_length);
|
||||
size_t generate_frame();
|
||||
void start_tx();
|
||||
void on_tx_progress(const uint32_t progress, const bool done);
|
||||
void update_progress(const uint32_t progress);
|
||||
void on_make_change(size_t index);
|
||||
void on_command_change(uint32_t value);
|
||||
|
||||
// DEBUG
|
||||
void update_symfields();
|
||||
|
||||
uint8_t subaru_get_checksum();
|
||||
bool subaru_is_valid();
|
||||
uint16_t subaru_get_code();
|
||||
void subaru_set_code(const uint16_t code);
|
||||
int32_t subaru_get_command();
|
||||
void subaru_set_command(const uint32_t command);
|
||||
std::string title() const override { return "Key fob TX"; };
|
||||
|
||||
Labels labels {
|
||||
{ { 5 * 8, 1 * 16 }, "Make:", Color::light_grey() },
|
||||
{ { 2 * 8, 2 * 16 }, "Command:", Color::light_grey() },
|
||||
{ { 2 * 8, 4 * 16 }, "Payload: #####", Color::light_grey() },
|
||||
{ { 2 * 8, 7 * 16 }, "Checksum is fixed just", Color::light_grey() },
|
||||
{ { 2 * 8, 8 * 16 }, "before transmission.", Color::light_grey() },
|
||||
};
|
||||
private:
|
||||
NavigationView& nav_;
|
||||
|
||||
OptionsField options_make {
|
||||
{ 10 * 8, 1 * 16 },
|
||||
8,
|
||||
{
|
||||
{ "Subaru", 0 }
|
||||
}
|
||||
};
|
||||
|
||||
OptionsField options_command {
|
||||
{ 10 * 8, 2 * 16 },
|
||||
6,
|
||||
{
|
||||
{ "Lock", 1 },
|
||||
{ "Unlock", 2 },
|
||||
{ "Trunk", 11 },
|
||||
{ "Panic", 10 }
|
||||
}
|
||||
};
|
||||
|
||||
SymField field_payload_a {
|
||||
{ 2 * 8, 5 * 16 },
|
||||
10,
|
||||
SymField::SYMFIELD_HEX
|
||||
};
|
||||
SymField field_payload_b {
|
||||
{ 13 * 8, 5 * 16 },
|
||||
10,
|
||||
SymField::SYMFIELD_HEX
|
||||
};
|
||||
|
||||
Text text_status {
|
||||
{ 2 * 8, 13 * 16, 128, 16 },
|
||||
"Ready"
|
||||
};
|
||||
|
||||
ProgressBar progressbar {
|
||||
{ 2 * 8, 13 * 16 + 20, 208, 16 }
|
||||
};
|
||||
|
||||
TransmitterView tx_view {
|
||||
16 * 16,
|
||||
0,
|
||||
15,
|
||||
true
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
};
|
||||
// app save settings
|
||||
std::app_settings settings{};
|
||||
std::app_settings::AppSettings app_settings{};
|
||||
|
||||
// 1013210ns / bit
|
||||
static constexpr uint32_t subaru_samples_per_bit = (OOK_SAMPLERATE * 0.00101321);
|
||||
static constexpr uint32_t repeats = 4;
|
||||
|
||||
uint8_t frame[10]{};
|
||||
|
||||
void generate_payload(size_t& bitstream_length);
|
||||
size_t generate_frame();
|
||||
void start_tx();
|
||||
void on_tx_progress(const uint32_t progress, const bool done);
|
||||
void update_progress(const uint32_t progress);
|
||||
void on_make_change(size_t index);
|
||||
void on_command_change(uint32_t value);
|
||||
|
||||
// DEBUG
|
||||
void update_symfields();
|
||||
|
||||
uint8_t subaru_get_checksum();
|
||||
bool subaru_is_valid();
|
||||
uint16_t subaru_get_code();
|
||||
void subaru_set_code(const uint16_t code);
|
||||
int32_t subaru_get_command();
|
||||
void subaru_set_command(const uint32_t command);
|
||||
|
||||
Labels labels{
|
||||
{{5 * 8, 1 * 16}, "Make:", Color::light_grey()},
|
||||
{{2 * 8, 2 * 16}, "Command:", Color::light_grey()},
|
||||
{{2 * 8, 4 * 16}, "Payload: #####", Color::light_grey()},
|
||||
{{2 * 8, 7 * 16}, "Checksum is fixed just", Color::light_grey()},
|
||||
{{2 * 8, 8 * 16}, "before transmission.", Color::light_grey()},
|
||||
};
|
||||
|
||||
OptionsField options_make{
|
||||
{10 * 8, 1 * 16},
|
||||
8,
|
||||
{{"Subaru", 0}}};
|
||||
|
||||
OptionsField options_command{
|
||||
{10 * 8, 2 * 16},
|
||||
6,
|
||||
{{"Lock", 1},
|
||||
{"Unlock", 2},
|
||||
{"Trunk", 11},
|
||||
{"Panic", 10}}};
|
||||
|
||||
SymField field_payload_a{
|
||||
{2 * 8, 5 * 16},
|
||||
10,
|
||||
SymField::SYMFIELD_HEX};
|
||||
SymField field_payload_b{
|
||||
{13 * 8, 5 * 16},
|
||||
10,
|
||||
SymField::SYMFIELD_HEX};
|
||||
|
||||
Text text_status{
|
||||
{2 * 8, 13 * 16, 128, 16},
|
||||
"Ready"};
|
||||
|
||||
ProgressBar progressbar{
|
||||
{2 * 8, 13 * 16 + 20, 208, 16}};
|
||||
|
||||
TransmitterView tx_view{
|
||||
16 * 16,
|
||||
0,
|
||||
15,
|
||||
true};
|
||||
|
||||
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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue