Gui: refactor buttons remapping (#1949)

* Gui: refactor buttons remapping
  Instead of calling 3 separate functions with a ton of switch/case statements,
  use a 2-dimensional lookup table to remap buttons based on the orientation.
* Gui: cleanup input mapping and fix incorrect asserts
* SnakeGame: handle input special case

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
Vasyl "vk" Kaigorodov
2022-11-02 15:36:17 +01:00
committed by GitHub
parent 104a1998a5
commit abfa804ae0
6 changed files with 51 additions and 67 deletions

View File

@@ -60,8 +60,9 @@ const char* input_get_type_name(InputType type) {
return "Long";
case InputTypeRepeat:
return "Repeat";
default:
return "Unknown";
}
return "Unknown";
}
int32_t input_srv(void* p) {

View File

@@ -22,6 +22,7 @@ typedef enum {
InputTypeShort, /**< Short event, emitted after InputTypeRelease done withing INPUT_LONG_PRESS interval */
InputTypeLong, /**< Long event, emmited after INPUT_LONG_PRESS interval, asynchronouse to InputTypeRelease */
InputTypeRepeat, /**< Repeat event, emmited with INPUT_REPEATE_PRESS period after InputTypeLong event */
InputTypeMAX, /**< Special value for exceptional */
} InputType;
/** Input Event, dispatches with FuriPubSub */