Make physical buttons pressable in simulator

This commit is contained in:
Jasper Blanckenburg 2023-05-24 00:02:30 +02:00
parent b4ba566ef5
commit a3265543a5
5 changed files with 49 additions and 49 deletions

View File

@ -4,16 +4,16 @@
#include "platform/driver/button/ButtonController.hpp" #include "platform/driver/button/ButtonController.hpp"
#include <stdint.h> #include <stdint.h>
constexpr uint8_t KEY_BTN1 = 1; constexpr uint8_t KEY_BTN1 = '1';
constexpr uint8_t KEY_BTN2 = 2; constexpr uint8_t KEY_BTN2 = '2';
constexpr uint8_t KEY_BTN3 = 3; constexpr uint8_t KEY_BTN3 = '3';
constexpr uint8_t KEY_BTN4 = 4; constexpr uint8_t KEY_BTN4 = '4';
constexpr uint8_t KEY_BTN5 = 5; constexpr uint8_t KEY_BTN5 = '5';
constexpr uint8_t KEY_BTN6 = 6; constexpr uint8_t KEY_BTN6 = '6';
constexpr uint8_t KEY_ENC1_CW = 21; constexpr uint8_t KEY_ENC1_CW = 'l';
constexpr uint8_t KEY_ENC1_CCW = 22; constexpr uint8_t KEY_ENC1_CCW = 'h';
constexpr uint8_t KEY_ENC2_CW = 23; constexpr uint8_t KEY_ENC2_CW = 'j';
constexpr uint8_t KEY_ENC2_CCW = 24; constexpr uint8_t KEY_ENC2_CCW = 'k';
class STWButtonController : public touchgfx::ButtonController { class STWButtonController : public touchgfx::ButtonController {
public: public:

View File

@ -304,46 +304,46 @@ void DriverViewViewBase::setupScreen()
void DriverViewViewBase::handleKeyEvent(uint8_t key) void DriverViewViewBase::handleKeyEvent(uint8_t key)
{ {
if(22 == key) if(104 == key)
{ {
//SelectPreviousField //SelectPreviousField
//When hardware button 22 clicked call virtual function //When hardware button 104 clicked call virtual function
//Call selectPrevField //Call selectPrevField
selectPrevField(); selectPrevField();
} }
if(21 == key) if(108 == key)
{ {
//SelectNextField //SelectNextField
//When hardware button 21 clicked call virtual function //When hardware button 108 clicked call virtual function
//Call selectNextField //Call selectNextField
selectNextField(); selectNextField();
} }
if(24 == key) if(107 == key)
{ {
//SelectPreviousFieldType //SelectPreviousFieldType
//When hardware button 24 clicked call virtual function //When hardware button 107 clicked call virtual function
//Call selectPrevFieldType //Call selectPrevFieldType
selectPrevFieldType(); selectPrevFieldType();
} }
if(23 == key) if(106 == key)
{ {
//SelectNextFieldType //SelectNextFieldType
//When hardware button 23 clicked call virtual function //When hardware button 106 clicked call virtual function
//Call selectNextFieldType //Call selectNextFieldType
selectNextFieldType(); selectNextFieldType();
} }
if(6 == key) if(54 == key)
{ {
//ConfirmFieldType //ConfirmFieldType
//When hardware button 6 clicked call virtual function //When hardware button 54 clicked call virtual function
//Call confirmFieldType //Call confirmFieldType
confirmFieldType(); confirmFieldType();

View File

@ -73,28 +73,28 @@ void MissionSelectViewBase::setupScreen()
void MissionSelectViewBase::handleKeyEvent(uint8_t key) void MissionSelectViewBase::handleKeyEvent(uint8_t key)
{ {
if(23 == key) if(106 == key)
{ {
//SelectNextMission //SelectNextMission
//When hardware button 23 clicked call virtual function //When hardware button 106 clicked call virtual function
//Call incMission //Call incMission
incMission(); incMission();
} }
if(24 == key) if(107 == key)
{ {
//SelectPrevMission //SelectPrevMission
//When hardware button 24 clicked call virtual function //When hardware button 107 clicked call virtual function
//Call decMission //Call decMission
decMission(); decMission();
} }
if(6 == key) if(54 == key)
{ {
//ConfirmMission //ConfirmMission
//When hardware button 6 clicked call virtual function //When hardware button 54 clicked call virtual function
//Call confirmMission //Call confirmMission
confirmMission(); confirmMission();

View File

@ -60,46 +60,46 @@ void VehicleConfigViewBase::setupScreen()
void VehicleConfigViewBase::handleKeyEvent(uint8_t key) void VehicleConfigViewBase::handleKeyEvent(uint8_t key)
{ {
if(22 == key) if(104 == key)
{ {
//SelectPreviousParam //SelectPreviousParam
//When hardware button 22 clicked call virtual function //When hardware button 104 clicked call virtual function
//Call selectPrevParam //Call selectPrevParam
selectPrevParam(); selectPrevParam();
} }
if(21 == key) if(108 == key)
{ {
//SelectNextParam //SelectNextParam
//When hardware button 21 clicked call virtual function //When hardware button 108 clicked call virtual function
//Call selectNextParam //Call selectNextParam
selectNextParam(); selectNextParam();
} }
if(24 == key) if(106 == key)
{ {
//DecreaseParam //DecreaseParam
//When hardware button 24 clicked call virtual function //When hardware button 106 clicked call virtual function
//Call decParam //Call decParam
decParam(); decParam();
} }
if(23 == key) if(107 == key)
{ {
//IncreaseParam //IncreaseParam
//When hardware button 23 clicked call virtual function //When hardware button 107 clicked call virtual function
//Call incParam //Call incParam
incParam(); incParam();
} }
if(6 == key) if(54 == key)
{ {
//ConfirmParam //ConfirmParam
//When hardware button 6 clicked call virtual function //When hardware button 54 clicked call virtual function
//Call confirmParam //Call confirmParam
confirmParam(); confirmParam();

View File

@ -116,7 +116,7 @@
"InteractionName": "SelectNextMission", "InteractionName": "SelectNextMission",
"Trigger": { "Trigger": {
"Type": "TriggerPhysicalButtonClicked", "Type": "TriggerPhysicalButtonClicked",
"ButtonKey": 23 "ButtonKey": 106
}, },
"Action": { "Action": {
"Type": "ActionCustom", "Type": "ActionCustom",
@ -127,7 +127,7 @@
"InteractionName": "SelectPrevMission", "InteractionName": "SelectPrevMission",
"Trigger": { "Trigger": {
"Type": "TriggerPhysicalButtonClicked", "Type": "TriggerPhysicalButtonClicked",
"ButtonKey": 24 "ButtonKey": 107
}, },
"Action": { "Action": {
"Type": "ActionCustom", "Type": "ActionCustom",
@ -138,7 +138,7 @@
"InteractionName": "ConfirmMission", "InteractionName": "ConfirmMission",
"Trigger": { "Trigger": {
"Type": "TriggerPhysicalButtonClicked", "Type": "TriggerPhysicalButtonClicked",
"ButtonKey": 6 "ButtonKey": 54
}, },
"Action": { "Action": {
"Type": "ActionCustom", "Type": "ActionCustom",
@ -796,7 +796,7 @@
"InteractionName": "SelectPreviousField", "InteractionName": "SelectPreviousField",
"Trigger": { "Trigger": {
"Type": "TriggerPhysicalButtonClicked", "Type": "TriggerPhysicalButtonClicked",
"ButtonKey": 22 "ButtonKey": 104
}, },
"Action": { "Action": {
"Type": "ActionCustom", "Type": "ActionCustom",
@ -807,7 +807,7 @@
"InteractionName": "SelectNextField", "InteractionName": "SelectNextField",
"Trigger": { "Trigger": {
"Type": "TriggerPhysicalButtonClicked", "Type": "TriggerPhysicalButtonClicked",
"ButtonKey": 21 "ButtonKey": 108
}, },
"Action": { "Action": {
"Type": "ActionCustom", "Type": "ActionCustom",
@ -818,7 +818,7 @@
"InteractionName": "SelectPreviousFieldType", "InteractionName": "SelectPreviousFieldType",
"Trigger": { "Trigger": {
"Type": "TriggerPhysicalButtonClicked", "Type": "TriggerPhysicalButtonClicked",
"ButtonKey": 24 "ButtonKey": 107
}, },
"Action": { "Action": {
"Type": "ActionCustom", "Type": "ActionCustom",
@ -829,7 +829,7 @@
"InteractionName": "SelectNextFieldType", "InteractionName": "SelectNextFieldType",
"Trigger": { "Trigger": {
"Type": "TriggerPhysicalButtonClicked", "Type": "TriggerPhysicalButtonClicked",
"ButtonKey": 23 "ButtonKey": 106
}, },
"Action": { "Action": {
"Type": "ActionCustom", "Type": "ActionCustom",
@ -840,7 +840,7 @@
"InteractionName": "ConfirmFieldType", "InteractionName": "ConfirmFieldType",
"Trigger": { "Trigger": {
"Type": "TriggerPhysicalButtonClicked", "Type": "TriggerPhysicalButtonClicked",
"ButtonKey": 6 "ButtonKey": 54
}, },
"Action": { "Action": {
"Type": "ActionCustom", "Type": "ActionCustom",
@ -974,7 +974,7 @@
"InteractionName": "SelectPreviousParam", "InteractionName": "SelectPreviousParam",
"Trigger": { "Trigger": {
"Type": "TriggerPhysicalButtonClicked", "Type": "TriggerPhysicalButtonClicked",
"ButtonKey": 22 "ButtonKey": 104
}, },
"Action": { "Action": {
"Type": "ActionCustom", "Type": "ActionCustom",
@ -985,7 +985,7 @@
"InteractionName": "SelectNextParam", "InteractionName": "SelectNextParam",
"Trigger": { "Trigger": {
"Type": "TriggerPhysicalButtonClicked", "Type": "TriggerPhysicalButtonClicked",
"ButtonKey": 21 "ButtonKey": 108
}, },
"Action": { "Action": {
"Type": "ActionCustom", "Type": "ActionCustom",
@ -996,7 +996,7 @@
"InteractionName": "DecreaseParam", "InteractionName": "DecreaseParam",
"Trigger": { "Trigger": {
"Type": "TriggerPhysicalButtonClicked", "Type": "TriggerPhysicalButtonClicked",
"ButtonKey": 24 "ButtonKey": 106
}, },
"Action": { "Action": {
"Type": "ActionCustom", "Type": "ActionCustom",
@ -1007,7 +1007,7 @@
"InteractionName": "IncreaseParam", "InteractionName": "IncreaseParam",
"Trigger": { "Trigger": {
"Type": "TriggerPhysicalButtonClicked", "Type": "TriggerPhysicalButtonClicked",
"ButtonKey": 23 "ButtonKey": 107
}, },
"Action": { "Action": {
"Type": "ActionCustom", "Type": "ActionCustom",
@ -1018,7 +1018,7 @@
"InteractionName": "ConfirmParam", "InteractionName": "ConfirmParam",
"Trigger": { "Trigger": {
"Type": "TriggerPhysicalButtonClicked", "Type": "TriggerPhysicalButtonClicked",
"ButtonKey": 6 "ButtonKey": 54
}, },
"Action": { "Action": {
"Type": "ActionCustom", "Type": "ActionCustom",