Make physical buttons pressable in simulator
This commit is contained in:
parent
b4ba566ef5
commit
a3265543a5
|
@ -4,16 +4,16 @@
|
|||
#include "platform/driver/button/ButtonController.hpp"
|
||||
#include <stdint.h>
|
||||
|
||||
constexpr uint8_t KEY_BTN1 = 1;
|
||||
constexpr uint8_t KEY_BTN2 = 2;
|
||||
constexpr uint8_t KEY_BTN3 = 3;
|
||||
constexpr uint8_t KEY_BTN4 = 4;
|
||||
constexpr uint8_t KEY_BTN5 = 5;
|
||||
constexpr uint8_t KEY_BTN6 = 6;
|
||||
constexpr uint8_t KEY_ENC1_CW = 21;
|
||||
constexpr uint8_t KEY_ENC1_CCW = 22;
|
||||
constexpr uint8_t KEY_ENC2_CW = 23;
|
||||
constexpr uint8_t KEY_ENC2_CCW = 24;
|
||||
constexpr uint8_t KEY_BTN1 = '1';
|
||||
constexpr uint8_t KEY_BTN2 = '2';
|
||||
constexpr uint8_t KEY_BTN3 = '3';
|
||||
constexpr uint8_t KEY_BTN4 = '4';
|
||||
constexpr uint8_t KEY_BTN5 = '5';
|
||||
constexpr uint8_t KEY_BTN6 = '6';
|
||||
constexpr uint8_t KEY_ENC1_CW = 'l';
|
||||
constexpr uint8_t KEY_ENC1_CCW = 'h';
|
||||
constexpr uint8_t KEY_ENC2_CW = 'j';
|
||||
constexpr uint8_t KEY_ENC2_CCW = 'k';
|
||||
|
||||
class STWButtonController : public touchgfx::ButtonController {
|
||||
public:
|
||||
|
|
|
@ -304,46 +304,46 @@ void DriverViewViewBase::setupScreen()
|
|||
|
||||
void DriverViewViewBase::handleKeyEvent(uint8_t key)
|
||||
{
|
||||
if(22 == key)
|
||||
if(104 == key)
|
||||
{
|
||||
//SelectPreviousField
|
||||
//When hardware button 22 clicked call virtual function
|
||||
//When hardware button 104 clicked call virtual function
|
||||
//Call selectPrevField
|
||||
selectPrevField();
|
||||
|
||||
}
|
||||
|
||||
if(21 == key)
|
||||
if(108 == key)
|
||||
{
|
||||
//SelectNextField
|
||||
//When hardware button 21 clicked call virtual function
|
||||
//When hardware button 108 clicked call virtual function
|
||||
//Call selectNextField
|
||||
selectNextField();
|
||||
|
||||
}
|
||||
|
||||
if(24 == key)
|
||||
if(107 == key)
|
||||
{
|
||||
//SelectPreviousFieldType
|
||||
//When hardware button 24 clicked call virtual function
|
||||
//When hardware button 107 clicked call virtual function
|
||||
//Call selectPrevFieldType
|
||||
selectPrevFieldType();
|
||||
|
||||
}
|
||||
|
||||
if(23 == key)
|
||||
if(106 == key)
|
||||
{
|
||||
//SelectNextFieldType
|
||||
//When hardware button 23 clicked call virtual function
|
||||
//When hardware button 106 clicked call virtual function
|
||||
//Call selectNextFieldType
|
||||
selectNextFieldType();
|
||||
|
||||
}
|
||||
|
||||
if(6 == key)
|
||||
if(54 == key)
|
||||
{
|
||||
//ConfirmFieldType
|
||||
//When hardware button 6 clicked call virtual function
|
||||
//When hardware button 54 clicked call virtual function
|
||||
//Call confirmFieldType
|
||||
confirmFieldType();
|
||||
|
||||
|
|
|
@ -73,28 +73,28 @@ void MissionSelectViewBase::setupScreen()
|
|||
|
||||
void MissionSelectViewBase::handleKeyEvent(uint8_t key)
|
||||
{
|
||||
if(23 == key)
|
||||
if(106 == key)
|
||||
{
|
||||
//SelectNextMission
|
||||
//When hardware button 23 clicked call virtual function
|
||||
//When hardware button 106 clicked call virtual function
|
||||
//Call incMission
|
||||
incMission();
|
||||
|
||||
}
|
||||
|
||||
if(24 == key)
|
||||
if(107 == key)
|
||||
{
|
||||
//SelectPrevMission
|
||||
//When hardware button 24 clicked call virtual function
|
||||
//When hardware button 107 clicked call virtual function
|
||||
//Call decMission
|
||||
decMission();
|
||||
|
||||
}
|
||||
|
||||
if(6 == key)
|
||||
if(54 == key)
|
||||
{
|
||||
//ConfirmMission
|
||||
//When hardware button 6 clicked call virtual function
|
||||
//When hardware button 54 clicked call virtual function
|
||||
//Call confirmMission
|
||||
confirmMission();
|
||||
|
||||
|
|
|
@ -60,46 +60,46 @@ void VehicleConfigViewBase::setupScreen()
|
|||
|
||||
void VehicleConfigViewBase::handleKeyEvent(uint8_t key)
|
||||
{
|
||||
if(22 == key)
|
||||
if(104 == key)
|
||||
{
|
||||
//SelectPreviousParam
|
||||
//When hardware button 22 clicked call virtual function
|
||||
//When hardware button 104 clicked call virtual function
|
||||
//Call selectPrevParam
|
||||
selectPrevParam();
|
||||
|
||||
}
|
||||
|
||||
if(21 == key)
|
||||
if(108 == key)
|
||||
{
|
||||
//SelectNextParam
|
||||
//When hardware button 21 clicked call virtual function
|
||||
//When hardware button 108 clicked call virtual function
|
||||
//Call selectNextParam
|
||||
selectNextParam();
|
||||
|
||||
}
|
||||
|
||||
if(24 == key)
|
||||
if(106 == key)
|
||||
{
|
||||
//DecreaseParam
|
||||
//When hardware button 24 clicked call virtual function
|
||||
//When hardware button 106 clicked call virtual function
|
||||
//Call decParam
|
||||
decParam();
|
||||
|
||||
}
|
||||
|
||||
if(23 == key)
|
||||
if(107 == key)
|
||||
{
|
||||
//IncreaseParam
|
||||
//When hardware button 23 clicked call virtual function
|
||||
//When hardware button 107 clicked call virtual function
|
||||
//Call incParam
|
||||
incParam();
|
||||
|
||||
}
|
||||
|
||||
if(6 == key)
|
||||
if(54 == key)
|
||||
{
|
||||
//ConfirmParam
|
||||
//When hardware button 6 clicked call virtual function
|
||||
//When hardware button 54 clicked call virtual function
|
||||
//Call confirmParam
|
||||
confirmParam();
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@
|
|||
"InteractionName": "SelectNextMission",
|
||||
"Trigger": {
|
||||
"Type": "TriggerPhysicalButtonClicked",
|
||||
"ButtonKey": 23
|
||||
"ButtonKey": 106
|
||||
},
|
||||
"Action": {
|
||||
"Type": "ActionCustom",
|
||||
|
@ -127,7 +127,7 @@
|
|||
"InteractionName": "SelectPrevMission",
|
||||
"Trigger": {
|
||||
"Type": "TriggerPhysicalButtonClicked",
|
||||
"ButtonKey": 24
|
||||
"ButtonKey": 107
|
||||
},
|
||||
"Action": {
|
||||
"Type": "ActionCustom",
|
||||
|
@ -138,7 +138,7 @@
|
|||
"InteractionName": "ConfirmMission",
|
||||
"Trigger": {
|
||||
"Type": "TriggerPhysicalButtonClicked",
|
||||
"ButtonKey": 6
|
||||
"ButtonKey": 54
|
||||
},
|
||||
"Action": {
|
||||
"Type": "ActionCustom",
|
||||
|
@ -796,7 +796,7 @@
|
|||
"InteractionName": "SelectPreviousField",
|
||||
"Trigger": {
|
||||
"Type": "TriggerPhysicalButtonClicked",
|
||||
"ButtonKey": 22
|
||||
"ButtonKey": 104
|
||||
},
|
||||
"Action": {
|
||||
"Type": "ActionCustom",
|
||||
|
@ -807,7 +807,7 @@
|
|||
"InteractionName": "SelectNextField",
|
||||
"Trigger": {
|
||||
"Type": "TriggerPhysicalButtonClicked",
|
||||
"ButtonKey": 21
|
||||
"ButtonKey": 108
|
||||
},
|
||||
"Action": {
|
||||
"Type": "ActionCustom",
|
||||
|
@ -818,7 +818,7 @@
|
|||
"InteractionName": "SelectPreviousFieldType",
|
||||
"Trigger": {
|
||||
"Type": "TriggerPhysicalButtonClicked",
|
||||
"ButtonKey": 24
|
||||
"ButtonKey": 107
|
||||
},
|
||||
"Action": {
|
||||
"Type": "ActionCustom",
|
||||
|
@ -829,7 +829,7 @@
|
|||
"InteractionName": "SelectNextFieldType",
|
||||
"Trigger": {
|
||||
"Type": "TriggerPhysicalButtonClicked",
|
||||
"ButtonKey": 23
|
||||
"ButtonKey": 106
|
||||
},
|
||||
"Action": {
|
||||
"Type": "ActionCustom",
|
||||
|
@ -840,7 +840,7 @@
|
|||
"InteractionName": "ConfirmFieldType",
|
||||
"Trigger": {
|
||||
"Type": "TriggerPhysicalButtonClicked",
|
||||
"ButtonKey": 6
|
||||
"ButtonKey": 54
|
||||
},
|
||||
"Action": {
|
||||
"Type": "ActionCustom",
|
||||
|
@ -974,7 +974,7 @@
|
|||
"InteractionName": "SelectPreviousParam",
|
||||
"Trigger": {
|
||||
"Type": "TriggerPhysicalButtonClicked",
|
||||
"ButtonKey": 22
|
||||
"ButtonKey": 104
|
||||
},
|
||||
"Action": {
|
||||
"Type": "ActionCustom",
|
||||
|
@ -985,7 +985,7 @@
|
|||
"InteractionName": "SelectNextParam",
|
||||
"Trigger": {
|
||||
"Type": "TriggerPhysicalButtonClicked",
|
||||
"ButtonKey": 21
|
||||
"ButtonKey": 108
|
||||
},
|
||||
"Action": {
|
||||
"Type": "ActionCustom",
|
||||
|
@ -996,7 +996,7 @@
|
|||
"InteractionName": "DecreaseParam",
|
||||
"Trigger": {
|
||||
"Type": "TriggerPhysicalButtonClicked",
|
||||
"ButtonKey": 24
|
||||
"ButtonKey": 106
|
||||
},
|
||||
"Action": {
|
||||
"Type": "ActionCustom",
|
||||
|
@ -1007,7 +1007,7 @@
|
|||
"InteractionName": "IncreaseParam",
|
||||
"Trigger": {
|
||||
"Type": "TriggerPhysicalButtonClicked",
|
||||
"ButtonKey": 23
|
||||
"ButtonKey": 107
|
||||
},
|
||||
"Action": {
|
||||
"Type": "ActionCustom",
|
||||
|
@ -1018,7 +1018,7 @@
|
|||
"InteractionName": "ConfirmParam",
|
||||
"Trigger": {
|
||||
"Type": "TriggerPhysicalButtonClicked",
|
||||
"ButtonKey": 6
|
||||
"ButtonKey": 54
|
||||
},
|
||||
"Action": {
|
||||
"Type": "ActionCustom",
|
||||
|
|
Loading…
Reference in New Issue