Files
squeezelite-esp32/protobuf/proto/Buttons.proto
2025-03-18 17:38:34 -04:00

107 lines
2.9 KiB
Protocol Buffer

syntax = "proto3";
package sys.btns;
import "nanopb.proto";
import "GPIO.proto";
import "customoptions.proto";
option (nanopb_fileopt).enum_to_string = true;
enum actions {
A_NONE = 0;
A_POWER = 1;
A_VOLUP = 2;
A_VOLDOWN = 3;
A_TOGGLE = 4;
A_PLAY = 5;
A_PAUSE = 6;
A_STOP = 7;
A_REW = 8;
A_FWD = 9;
A_PREV = 10;
A_NEXT = 11;
B_UP = 12;
B_DOWN = 13;
B_LEFT = 14;
B_RIGHT = 15;
B_PS1 = 16;
B_PS2 = 17;
B_PS3 = 18;
B_PS4 = 19;
B_PS5 = 20;
B_PS6 = 21;
B_PS7 = 22;
B_PS8 = 23;
B_PS9 = 24;
B_PS10 = 25;
KNOB_LEFT = 26;
KNOB_RIGHT = 27;
KNOB_PUSH = 28;
A_SLEEP = 29;
REMAP=30;
MAX=31;
}
message action {
option (nanopb_msgopt).packed_struct = true;
actions type = 1;
string profile_name = 2 [(nanopb).type = FT_POINTER];
}
message press {
option (nanopb_msgopt).packed_struct = true;
option (nanopb_msgopt).msgid = 10004;
action pressed = 1;
action released = 2;
}
message btn {
option (nanopb_msgopt).packed_struct = true;
option (nanopb_msgopt).msgid = 10005;
gpio.config gpio = 1 [(cust_field).v_msg='{"pin":-1,"level":"LOW"}'];
bool pull = 2;
int32 debounce = 3;
int32 shifter = 4 [(cust_field).v_int32=-1];
int32 longduration = 5;
press normal = 6;
press longpress = 7;
press shifted = 8;
press longshifted = 9;
}
message profile {
option (nanopb_msgopt).packed_struct = true;
string profile_name = 1 [(nanopb).max_length= 128];
repeated btn buttons = 2 [(nanopb).type = FT_POINTER];
}
message knob_only {
option (nanopb_msgopt).packed_struct = true;
option (nanopb_msgopt).msgid = 10006;
// This mode attempts to offer a single knob full navigation which is a bit contorded due to LMS UI's
// principles. Left, Right and Press obey to LMS's navigation rules and especially Press always goes to
// lower submenu item, even when navigating in the Music Library. That causes a challenge as there is no
// 'Play', 'Back' or 'Pause' button. Workaround are as of below:
// - longpress is 'Play'
// - double press is 'Back' (Left in LMS's terminology).
// - a quick left-right movement on the encoder is 'Pause'
//
// The speed of double click (or left-right) can be set using the optional parameter of 'knobonly'.
// This is not a perfect solution, and other ideas are welcome. Be aware that the longer you set double
// click speed, the less responsive the interface will be. The reason is that I need to wait for that
// delay before deciding if it's a single or double click. It can also make menu navigation "hesitations"
// being easily interpreted as 'Pause'
bool enable = 1; // Enable/disable
int32 delay_ms = 2; // optionally set the delay
}
message rotary {
option (nanopb_msgopt).packed_struct = true;
option (nanopb_msgopt).msgid = 10007;
int32 A = 1 [(cust_field).v_int32=-1];
int32 B = 2 [(cust_field).v_int32=-1];
int32 SW = 3 [(cust_field).v_int32=-1];
knob_only knobonly = 4;
bool volume = 5;
bool longpress = 6;
}