mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-31 07:01:03 +00:00
Move defines to input broker
This commit is contained in:
committed by
Thomas Göttgens
parent
8e0a342f06
commit
962d9ff220
@@ -4,6 +4,20 @@
|
||||
#define ANYKEY 0xFF
|
||||
#define MATRIXKEY 0xFE
|
||||
|
||||
#define INPUT_BROKER_MSG_BRIGHTNESS_UP 0x11
|
||||
#define INPUT_BROKER_MSG_BRIGHTNESS_DOWN 0x12
|
||||
#define INPUT_BROKER_MSG_REBOOT 0x90
|
||||
#define INPUT_BROKER_MSG_SHUTDOWN 0x9b
|
||||
#define INPUT_BROKER_MSG_GPS_TOGGLE 0x9e
|
||||
#define INPUT_BROKER_MSG_MUTE_TOGGLE 0xac
|
||||
#define INPUT_BROKER_MSG_SEND_PING 0xaf
|
||||
#define INPUT_BROKER_MSG_LEFT 0xb4
|
||||
#define INPUT_BROKER_MSG_UP 0xb5
|
||||
#define INPUT_BROKER_MSG_DOWN 0xb6
|
||||
#define INPUT_BROKER_MSG_RIGHT 0xb7
|
||||
#define INPUT_BROKER_MSG_FN_SYMBOL_ON 0xf1
|
||||
#define INPUT_BROKER_MSG_FN_SYMBOL_OFF 0xf2
|
||||
|
||||
typedef struct _InputEvent {
|
||||
const char *source;
|
||||
char inputEvent;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "configuration.h"
|
||||
#if ARCH_PORTDUINO
|
||||
#include "LinuxInput.h"
|
||||
#include "modules/CannedMessageModule.h"
|
||||
#include "platform/portduino/PortduinoGlue.h"
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
@@ -148,11 +147,11 @@ int32_t LinuxInput::runOnce()
|
||||
case KEY_LEFT: // Left
|
||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT;
|
||||
break;
|
||||
e.kbchar = CANNED_MESSAGE_KEY_LEFT;
|
||||
e.kbchar = INPUT_BROKER_MSG_LEFT;
|
||||
case KEY_RIGHT: // Right
|
||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT;
|
||||
break;
|
||||
e.kbchar = CANNED_MESSAGE_KEY_RIGHT;
|
||||
e.kbchar = INPUT_BROKER_MSG_RIGHT;
|
||||
case KEY_ENTER: // Enter
|
||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT;
|
||||
break;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "SerialKeyboard.h"
|
||||
#include "configuration.h"
|
||||
#include "modules/CannedMessageModule.h"
|
||||
|
||||
#ifdef INPUTBROKER_SERIAL_TYPE
|
||||
#define CANNED_MESSAGE_MODULE_ENABLE 1 // in case it's not set in the variant file
|
||||
@@ -88,7 +87,7 @@ int32_t SerialKeyboard::runOnce()
|
||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP;
|
||||
} else if (!(shiftRegister2 & (1 << 2))) {
|
||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT;
|
||||
e.kbchar = CANNED_MESSAGE_KEY_RIGHT;
|
||||
e.kbchar = INPUT_BROKER_MSG_RIGHT;
|
||||
} else if (!(shiftRegister2 & (1 << 1))) {
|
||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT;
|
||||
} else if (!(shiftRegister2 & (1 << 0))) {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include "configuration.h"
|
||||
#include "detect/ScanI2C.h"
|
||||
#include "detect/ScanI2CTwoWire.h"
|
||||
#include "modules/CannedMessageModule.h"
|
||||
|
||||
extern ScanI2C::DeviceAddress cardkb_found;
|
||||
extern uint8_t kb_model;
|
||||
@@ -95,7 +94,7 @@ int32_t KbI2cBase::runOnce()
|
||||
case 'e': // sym e
|
||||
if (is_sym) {
|
||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP;
|
||||
e.kbchar = CANNED_MESSAGE_KEY_UP;
|
||||
e.kbchar = INPUT_BROKER_MSG_UP;
|
||||
is_sym = false; // reset sym state after second keypress
|
||||
} else {
|
||||
e.inputEvent = ANYKEY;
|
||||
@@ -105,7 +104,7 @@ int32_t KbI2cBase::runOnce()
|
||||
case 'x': // sym x
|
||||
if (is_sym) {
|
||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_DOWN;
|
||||
e.kbchar = CANNED_MESSAGE_KEY_DOWN;
|
||||
e.kbchar = INPUT_BROKER_MSG_DOWN;
|
||||
is_sym = false; // reset sym state after second keypress
|
||||
} else {
|
||||
e.inputEvent = ANYKEY;
|
||||
@@ -135,8 +134,8 @@ int32_t KbI2cBase::runOnce()
|
||||
case 0x13: // Code scanner says the SYM key is 0x13
|
||||
is_sym = !is_sym;
|
||||
e.inputEvent = ANYKEY;
|
||||
e.kbchar = is_sym ? CANNED_MESSAGE_KEY_FN_SYMBOL_ON // send 0xf1 to tell CannedMessages to display that
|
||||
: CANNED_MESSAGE_KEY_FN_SYMBOL_OFF; // the modifier key is active
|
||||
e.kbchar = is_sym ? INPUT_BROKER_MSG_FN_SYMBOL_ON // send 0xf1 to tell CannedMessages to display that
|
||||
: INPUT_BROKER_MSG_FN_SYMBOL_OFF; // the modifier key is active
|
||||
break;
|
||||
case 0x0a: // apparently Enter on Q10 is a line feed instead of carriage return
|
||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT;
|
||||
@@ -215,7 +214,7 @@ int32_t KbI2cBase::runOnce()
|
||||
if (is_sym) {
|
||||
is_sym = false;
|
||||
e.inputEvent = ANYKEY;
|
||||
e.kbchar = CANNED_MESSAGE_KEY_MUTE_TOGGLE; // mute notifications
|
||||
e.kbchar = INPUT_BROKER_MSG_MUTE_TOGGLE; // mute notifications
|
||||
} else {
|
||||
e.inputEvent = ANYKEY;
|
||||
e.kbchar = c;
|
||||
@@ -225,7 +224,7 @@ int32_t KbI2cBase::runOnce()
|
||||
if (is_sym) {
|
||||
is_sym = false;
|
||||
e.inputEvent = ANYKEY;
|
||||
e.kbchar = CANNED_MESSAGE_KEY_BRIGHTNESS_UP; // Increase Brightness code
|
||||
e.kbchar = INPUT_BROKER_MSG_BRIGHTNESS_UP; // Increase Brightness code
|
||||
} else {
|
||||
e.inputEvent = ANYKEY;
|
||||
e.kbchar = c;
|
||||
@@ -235,7 +234,7 @@ int32_t KbI2cBase::runOnce()
|
||||
if (is_sym) {
|
||||
is_sym = false;
|
||||
e.inputEvent = ANYKEY;
|
||||
e.kbchar = CANNED_MESSAGE_KEY_BRIGHTNESS_DOWN; // Decrease Brightness code
|
||||
e.kbchar = INPUT_BROKER_MSG_BRIGHTNESS_DOWN; // Decrease Brightness code
|
||||
} else {
|
||||
e.inputEvent = ANYKEY;
|
||||
e.kbchar = c;
|
||||
@@ -245,7 +244,7 @@ int32_t KbI2cBase::runOnce()
|
||||
if (is_sym) {
|
||||
is_sym = false;
|
||||
e.inputEvent = ANYKEY;
|
||||
e.kbchar = CANNED_MESSAGE_KEY_SEND_PING; // (fn + space)
|
||||
e.kbchar = INPUT_BROKER_MSG_SEND_PING; // (fn + space)
|
||||
} else {
|
||||
e.inputEvent = ANYKEY;
|
||||
e.kbchar = c;
|
||||
@@ -255,7 +254,7 @@ int32_t KbI2cBase::runOnce()
|
||||
if (is_sym) {
|
||||
is_sym = false;
|
||||
e.inputEvent = ANYKEY;
|
||||
e.kbchar = CANNED_MESSAGE_KEY_GPS_TOGGLE;
|
||||
e.kbchar = INPUT_BROKER_MSG_GPS_TOGGLE;
|
||||
} else {
|
||||
e.inputEvent = ANYKEY;
|
||||
e.kbchar = c;
|
||||
@@ -270,33 +269,33 @@ int32_t KbI2cBase::runOnce()
|
||||
break;
|
||||
case 0xb5: // Up
|
||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP;
|
||||
e.kbchar = CANNED_MESSAGE_KEY_UP;
|
||||
e.kbchar = INPUT_BROKER_MSG_UP;
|
||||
break;
|
||||
case 0xb6: // Down
|
||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_DOWN;
|
||||
e.kbchar = CANNED_MESSAGE_KEY_DOWN;
|
||||
e.kbchar = INPUT_BROKER_MSG_DOWN;
|
||||
break;
|
||||
case 0xb4: // Left
|
||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT;
|
||||
e.kbchar = CANNED_MESSAGE_KEY_LEFT;
|
||||
e.kbchar = INPUT_BROKER_MSG_LEFT;
|
||||
break;
|
||||
case 0xb7: // Right
|
||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT;
|
||||
e.kbchar = CANNED_MESSAGE_KEY_RIGHT;
|
||||
e.kbchar = INPUT_BROKER_MSG_RIGHT;
|
||||
break;
|
||||
case 0xc: // Modifier key: 0xc is alt+c (Other options could be: 0xea = shift+mic button or 0x4 shift+$(speaker))
|
||||
// toggle moddifiers button.
|
||||
is_sym = !is_sym;
|
||||
e.inputEvent = ANYKEY;
|
||||
e.kbchar = is_sym ? CANNED_MESSAGE_KEY_FN_SYMBOL_ON // send 0xf1 to tell CannedMessages to display that the
|
||||
: CANNED_MESSAGE_KEY_FN_SYMBOL_OFF; // modifier key is active
|
||||
e.kbchar = is_sym ? INPUT_BROKER_MSG_FN_SYMBOL_ON // send 0xf1 to tell CannedMessages to display that the
|
||||
: INPUT_BROKER_MSG_FN_SYMBOL_OFF; // modifier key is active
|
||||
break;
|
||||
case 0x90: // fn+r CANNED_MESSAGE_KEY_REBOOT
|
||||
case 0x90: // fn+r INPUT_BROKER_MSG_REBOOT
|
||||
case 0x91: // fn+t
|
||||
case 0x9b: // fn+s CANNED_MESSAGE_KEY_SHUTDOWN
|
||||
case 0xac: // fn+m CANNED_MESSAGE_KEY_MUTE_TOGGLE
|
||||
case 0x9e: // fn+g CANNED_MESSAGE_KEY_GPS_TOGGLE
|
||||
case 0xaf: // fn+space CANNED_MESSAGE_KEY_SEND_PING
|
||||
case 0x9b: // fn+s INPUT_BROKER_MSG_SHUTDOWN
|
||||
case 0xac: // fn+m INPUT_BROKER_MSG_MUTE_TOGGLE
|
||||
case 0x9e: // fn+g INPUT_BROKER_MSG_GPS_TOGGLE
|
||||
case 0xaf: // fn+space INPUT_BROKER_MSG_SEND_PING
|
||||
// just pass those unmodified
|
||||
e.inputEvent = ANYKEY;
|
||||
e.kbchar = c;
|
||||
|
||||
Reference in New Issue
Block a user