Upside down / left handed orientation support (#2462)

* Add backup files to .gitignore
* Added lefty support in Settings > System > hand Orient: Fixes: #1015
* Left handed mode
* Fix lefthanded mode on vertical interfaces
* Input: new composite sequence identifier
* Gui: move input mapping from Canvas to ViewPort, properly handle input mapping on View switch in ViewDispatcher
* Rpc: proper input sequencing and tagging in RpcGui
* Rpc: remove magic from RpcGui

Co-authored-by: MrDaGree <5050898+MrDaGree@users.noreply.github.com>
Co-authored-by: Willy-JL <willy.leslie@icloud.com>
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
Co-authored-by: Sergey Gavrilov <who.just.the.doctor@gmail.com>
This commit is contained in:
Michal Suchánek
2023-03-09 18:13:18 +01:00
committed by GitHub
parent 4fd043398a
commit 780da7d4d5
11 changed files with 133 additions and 48 deletions

View File

@@ -23,7 +23,8 @@ inline static void input_timer_stop(FuriTimer* timer_id) {
void input_press_timer_callback(void* arg) {
InputPinState* input_pin = arg;
InputEvent event;
event.sequence = input_pin->counter;
event.sequence_source = INPUT_SEQUENCE_SOURCE_HARDWARE;
event.sequence_counter = input_pin->counter;
event.key = input_pin->pin->key;
input_pin->press_counter++;
if(input_pin->press_counter == INPUT_LONG_PRESS_COUNTS) {
@@ -114,16 +115,17 @@ int32_t input_srv(void* p) {
// Common state info
InputEvent event;
event.sequence_source = INPUT_SEQUENCE_SOURCE_HARDWARE;
event.key = input->pin_states[i].pin->key;
// Short / Long / Repeat timer routine
if(state) {
input->counter++;
input->pin_states[i].counter = input->counter;
event.sequence = input->pin_states[i].counter;
event.sequence_counter = input->pin_states[i].counter;
input_timer_start(input->pin_states[i].press_timer, INPUT_PRESS_TICKS);
} else {
event.sequence = input->pin_states[i].counter;
event.sequence_counter = input->pin_states[i].counter;
input_timer_stop(input->pin_states[i].press_timer);
if(input->pin_states[i].press_counter < INPUT_LONG_PRESS_COUNTS) {
event.type = InputTypeShort;

View File

@@ -12,6 +12,8 @@ extern "C" {
#endif
#define RECORD_INPUT_EVENTS "input_events"
#define INPUT_SEQUENCE_SOURCE_HARDWARE (0u)
#define INPUT_SEQUENCE_SOURCE_SOFTWARE (1u)
/** Input Types
* Some of them are physical events and some logical
@@ -27,7 +29,13 @@ typedef enum {
/** Input Event, dispatches with FuriPubSub */
typedef struct {
uint32_t sequence;
union {
uint32_t sequence;
struct {
uint8_t sequence_source : 2;
uint32_t sequence_counter : 30;
};
};
InputKey key;
InputType type;
} InputEvent;