mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-12 17:49:31 +00:00
Added remaining buttons for TouchTunes remote
LCR transmit UI cleanup CC1101 data whitening function Uniformized tx progress message handling
This commit is contained in:
@@ -25,7 +25,9 @@
|
||||
#include "transmitter_model.hpp"
|
||||
|
||||
// The coding in notpike's script is quite complex, using multiple LUTs to form the data sent to the YSO.
|
||||
// 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 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).
|
||||
|
||||
// Pin 0 - On/Off
|
||||
// ffff00 a2888a2aaaa8888aa2aa2220
|
||||
@@ -57,14 +59,44 @@
|
||||
// The hex data only seems scrambled because of the shift induced by the short or long gaps (10 or 1000)
|
||||
// The radio frame's duration depends on the value of the bits
|
||||
|
||||
const uint16_t button_codes[7] = {
|
||||
0x7887, // On/Off
|
||||
0xB34C, // Pause
|
||||
0xF10E, // P1
|
||||
0xDD22, // OK
|
||||
0xF40B, // Zone 1 Vol+
|
||||
0xF609, // Zone 2 Vol+
|
||||
0xFC03 // Zone 3 Vol+
|
||||
#define TOUCHTUNES_MAX_PIN 255
|
||||
#define TOUCHTUNES_REPEATS 4
|
||||
#define TOUCHTUNES_SYNC_WORD 0x5D
|
||||
|
||||
// Each 16bit button code is actually 8bit followed by its complement
|
||||
const uint8_t button_codes[32] = {
|
||||
0xB3, // Pause
|
||||
0x78, // On/Off
|
||||
0xF1, // P1
|
||||
0x60, // P2
|
||||
0xCA, // P3
|
||||
0x20, // F1
|
||||
0xF2, // Up
|
||||
0xA0, // F2
|
||||
0x84, // Left
|
||||
0xDD, // 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
|
||||
0xF4, // Zone 1 Vol+
|
||||
0xF6, // Zone 2 Vol+
|
||||
0xFC, // Zone 3 Vol+
|
||||
0x50, // Zone 1 Vol-
|
||||
0x10, // Zone 2 Vol-
|
||||
0x40, // Zone 3 Vol-
|
||||
};
|
||||
|
||||
namespace ui {
|
||||
@@ -79,10 +111,6 @@ public:
|
||||
std::string title() const override { return "TouchTunes TX"; };
|
||||
|
||||
private:
|
||||
Labels labels {
|
||||
{ { 2 * 8, 2 * 8 }, "PIN:", Color::light_grey() }
|
||||
};
|
||||
|
||||
uint32_t scan_button_index { };
|
||||
uint32_t pin { 0 };
|
||||
|
||||
@@ -95,66 +123,90 @@ private:
|
||||
tx_modes tx_mode = IDLE;
|
||||
|
||||
void start_tx(const uint32_t button_index);
|
||||
void on_tx_progress(const int progress, const bool done);
|
||||
void stop_tx();
|
||||
void on_tx_progress(const uint32_t progress, const bool done);
|
||||
|
||||
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 * 16 },
|
||||
{ 6 * 8, 1 * 8 },
|
||||
3,
|
||||
{ 0, 255 },
|
||||
1,
|
||||
' '
|
||||
};
|
||||
|
||||
Button button_on_off {
|
||||
{ 2 * 8, 3 * 16, 8 * 8, 2 * 16 },
|
||||
"ON/OFF"
|
||||
};
|
||||
|
||||
Button button_pause {
|
||||
{ 2 * 8, 6 * 16, 8 * 8, 2 * 16 },
|
||||
"PAUSE"
|
||||
};
|
||||
Button button_p1 {
|
||||
{ 11 * 8, 6 * 16, 8 * 8, 2 * 16 },
|
||||
"P1"
|
||||
};
|
||||
Button button_ok {
|
||||
{ 20 * 8, 6 * 16, 8 * 8, 2 * 16 },
|
||||
"OK"
|
||||
};
|
||||
|
||||
Button button_vol_inc1 {
|
||||
{ 2 * 8, 9 * 16, 8 * 8, 2 * 16 },
|
||||
"VOL+ 1"
|
||||
};
|
||||
Button button_vol_inc2 {
|
||||
{ 11 * 8, 9 * 16, 8 * 8, 2 * 16 },
|
||||
"VOL+ 2"
|
||||
};
|
||||
Button button_vol_inc3 {
|
||||
{ 20 * 8, 9 * 16, 8 * 8, 2 * 16 },
|
||||
"VOL+ 3"
|
||||
'0'
|
||||
};
|
||||
|
||||
Checkbox check_scan {
|
||||
{ 2 * 8, 13 * 16 },
|
||||
{ 2 * 8, 27 * 8 },
|
||||
4,
|
||||
"Scan"
|
||||
};
|
||||
|
||||
Text text_status {
|
||||
{ 2 * 8, 15 * 16, 128, 16 },
|
||||
{ 2 * 8, 33 * 8, 128, 16 },
|
||||
"Ready"
|
||||
};
|
||||
|
||||
ProgressBar progressbar {
|
||||
{ 2 * 8, 15 * 16 + 20, 208, 16 }
|
||||
{ 2 * 8, 35 * 8, 208, 16 }
|
||||
};
|
||||
|
||||
MessageHandlerRegistration message_handler_tx_done {
|
||||
Message::ID::TXDone,
|
||||
MessageHandlerRegistration message_handler_tx_progress {
|
||||
Message::ID::TXProgress,
|
||||
[this](const Message* const p) {
|
||||
const auto message = *reinterpret_cast<const TXDoneMessage*>(p);
|
||||
const auto message = *reinterpret_cast<const TXProgressMessage*>(p);
|
||||
this->on_tx_progress(message.progress, message.done);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user