2022-03-28 16:55:58 +02:00
|
|
|
#include "kbI2cBase.h"
|
2022-05-07 20:31:21 +10:00
|
|
|
#include "configuration.h"
|
2023-03-08 19:13:46 -08:00
|
|
|
#include "detect/ScanI2C.h"
|
2024-05-19 19:32:08 +02:00
|
|
|
#include "detect/ScanI2CTwoWire.h"
|
2024-09-04 06:20:26 -04:00
|
|
|
#include "modules/CannedMessageModule.h"
|
2022-03-28 16:55:58 +02:00
|
|
|
|
2023-03-08 19:13:46 -08:00
|
|
|
extern ScanI2C::DeviceAddress cardkb_found;
|
2022-11-13 14:56:52 +01:00
|
|
|
extern uint8_t kb_model;
|
2022-09-06 15:58:33 +08:00
|
|
|
|
2022-03-28 16:55:58 +02:00
|
|
|
KbI2cBase::KbI2cBase(const char *name) : concurrency::OSThread(name)
|
|
|
|
|
{
|
|
|
|
|
this->_originName = name;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-08 19:13:46 -08:00
|
|
|
uint8_t read_from_14004(TwoWire *i2cBus, uint8_t reg, uint8_t *data, uint8_t length)
|
2022-10-06 16:00:33 +02:00
|
|
|
{
|
2023-01-21 14:34:29 +01:00
|
|
|
uint8_t readflag = 0;
|
2023-03-08 19:13:46 -08:00
|
|
|
i2cBus->beginTransmission(CARDKB_ADDR);
|
|
|
|
|
i2cBus->write(reg);
|
|
|
|
|
i2cBus->endTransmission(); // stop transmitting
|
2023-01-21 14:34:29 +01:00
|
|
|
delay(20);
|
2023-03-08 19:13:46 -08:00
|
|
|
i2cBus->requestFrom(CARDKB_ADDR, (int)length);
|
2023-01-21 14:34:29 +01:00
|
|
|
int i = 0;
|
2023-03-08 19:13:46 -08:00
|
|
|
while (i2cBus->available()) // slave may send less than requested
|
2023-01-21 14:34:29 +01:00
|
|
|
{
|
2023-03-08 19:13:46 -08:00
|
|
|
data[i++] = i2cBus->read(); // receive a byte as a proper uint8_t
|
2023-01-21 14:34:29 +01:00
|
|
|
readflag = 1;
|
|
|
|
|
}
|
|
|
|
|
return readflag;
|
2022-10-06 16:00:33 +02:00
|
|
|
}
|
|
|
|
|
|
2022-03-28 16:55:58 +02:00
|
|
|
int32_t KbI2cBase::runOnce()
|
|
|
|
|
{
|
2023-03-08 19:13:46 -08:00
|
|
|
if (!i2cBus) {
|
|
|
|
|
switch (cardkb_found.port) {
|
|
|
|
|
case ScanI2C::WIRE1:
|
|
|
|
|
#ifdef I2C_SDA1
|
|
|
|
|
LOG_DEBUG("Using I2C Bus 1 (the second one)\n");
|
|
|
|
|
i2cBus = &Wire1;
|
2023-08-19 15:37:42 +02:00
|
|
|
if (cardkb_found.address == BBQ10_KB_ADDR) {
|
|
|
|
|
Q10keyboard.begin(BBQ10_KB_ADDR, &Wire1);
|
|
|
|
|
Q10keyboard.setBacklight(0);
|
|
|
|
|
}
|
2023-03-08 19:13:46 -08:00
|
|
|
break;
|
|
|
|
|
#endif
|
|
|
|
|
case ScanI2C::WIRE:
|
|
|
|
|
LOG_DEBUG("Using I2C Bus 0 (the first one)\n");
|
|
|
|
|
i2cBus = &Wire;
|
2023-08-19 15:37:42 +02:00
|
|
|
if (cardkb_found.address == BBQ10_KB_ADDR) {
|
|
|
|
|
Q10keyboard.begin(BBQ10_KB_ADDR, &Wire);
|
|
|
|
|
Q10keyboard.setBacklight(0);
|
|
|
|
|
}
|
2023-03-08 19:13:46 -08:00
|
|
|
break;
|
|
|
|
|
case ScanI2C::NO_I2C:
|
|
|
|
|
default:
|
|
|
|
|
i2cBus = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-19 15:37:42 +02:00
|
|
|
switch (kb_model) {
|
|
|
|
|
case 0x11: { // BB Q10
|
|
|
|
|
int keyCount = Q10keyboard.keyCount();
|
|
|
|
|
while (keyCount--) {
|
|
|
|
|
const BBQ10Keyboard::KeyEvent key = Q10keyboard.keyEvent();
|
|
|
|
|
if ((key.key != 0x00) && (key.state == BBQ10Keyboard::StateRelease)) {
|
|
|
|
|
InputEvent e;
|
|
|
|
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
|
|
|
|
|
e.source = this->_originName;
|
|
|
|
|
switch (key.key) {
|
2023-08-24 14:24:26 +02:00
|
|
|
case 'p': // TAB
|
2023-08-25 16:44:39 +02:00
|
|
|
case 't': // TAB as well
|
2023-08-24 14:24:26 +02:00
|
|
|
if (is_sym) {
|
2023-08-25 09:27:09 +02:00
|
|
|
e.inputEvent = ANYKEY;
|
2023-08-24 14:24:26 +02:00
|
|
|
e.kbchar = 0x09; // TAB Scancode
|
|
|
|
|
is_sym = false; // reset sym state after second keypress
|
|
|
|
|
} else {
|
|
|
|
|
e.inputEvent = ANYKEY;
|
|
|
|
|
e.kbchar = key.key;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'q': // ESC
|
|
|
|
|
if (is_sym) {
|
|
|
|
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_CANCEL;
|
|
|
|
|
e.kbchar = 0x1b;
|
|
|
|
|
is_sym = false; // reset sym state after second keypress
|
|
|
|
|
} else {
|
|
|
|
|
e.inputEvent = ANYKEY;
|
|
|
|
|
e.kbchar = key.key;
|
|
|
|
|
}
|
2023-08-19 15:37:42 +02:00
|
|
|
break;
|
|
|
|
|
case 0x08: // Back
|
|
|
|
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_BACK;
|
|
|
|
|
e.kbchar = key.key;
|
|
|
|
|
break;
|
2023-08-22 11:23:19 +02:00
|
|
|
case 'e': // sym e
|
|
|
|
|
if (is_sym) {
|
|
|
|
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP;
|
2024-09-04 06:20:26 -04:00
|
|
|
e.kbchar = CANNED_MESSAGE_KEY_UP;
|
2023-08-23 09:44:20 +02:00
|
|
|
is_sym = false; // reset sym state after second keypress
|
2023-08-22 11:23:19 +02:00
|
|
|
} else {
|
|
|
|
|
e.inputEvent = ANYKEY;
|
|
|
|
|
e.kbchar = key.key;
|
|
|
|
|
}
|
2023-08-19 15:37:42 +02:00
|
|
|
break;
|
2023-08-22 11:23:19 +02:00
|
|
|
case 'x': // sym x
|
|
|
|
|
if (is_sym) {
|
|
|
|
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_DOWN;
|
2024-09-04 06:20:26 -04:00
|
|
|
e.kbchar = CANNED_MESSAGE_KEY_DOWN;
|
2023-08-23 09:44:20 +02:00
|
|
|
is_sym = false; // reset sym state after second keypress
|
2023-08-22 11:23:19 +02:00
|
|
|
} else {
|
|
|
|
|
e.inputEvent = ANYKEY;
|
|
|
|
|
e.kbchar = key.key;
|
|
|
|
|
}
|
2023-08-19 15:37:42 +02:00
|
|
|
break;
|
2023-08-22 11:23:19 +02:00
|
|
|
case 's': // sym s
|
|
|
|
|
if (is_sym) {
|
|
|
|
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT;
|
|
|
|
|
e.kbchar = 0x00; // tweak for destSelect
|
2023-08-23 09:44:20 +02:00
|
|
|
is_sym = false; // reset sym state after second keypress
|
2023-08-22 11:23:19 +02:00
|
|
|
} else {
|
|
|
|
|
e.inputEvent = ANYKEY;
|
|
|
|
|
e.kbchar = key.key;
|
|
|
|
|
}
|
2023-08-19 15:37:42 +02:00
|
|
|
break;
|
2023-08-22 11:23:19 +02:00
|
|
|
case 'f': // sym f
|
|
|
|
|
if (is_sym) {
|
|
|
|
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT;
|
|
|
|
|
e.kbchar = 0x00; // tweak for destSelect
|
2023-08-23 09:44:20 +02:00
|
|
|
is_sym = false; // reset sym state after second keypress
|
2023-08-22 11:23:19 +02:00
|
|
|
} else {
|
|
|
|
|
e.inputEvent = ANYKEY;
|
|
|
|
|
e.kbchar = key.key;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2023-08-23 09:44:20 +02:00
|
|
|
case 0x13: // Code scanner says the SYM key is 0x13
|
2023-08-22 11:23:19 +02:00
|
|
|
is_sym = !is_sym;
|
Added modifier key combination to allow keyboard shortcuts on t-deck (#3668)
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Changed modifier key to alt+c
* Added screen brightness functionality
Use modifier key with o(+) to increase brightness or i(-) to decrease.
Currently there are 4 levels of brightness, (L, ML, MH, H). I would like to add a popup message to tell you the brightness.
* Added checks to disable screen brightness changes on unsupported hardware
* Setting the brightness code to work on only applicable devices
* Added "function symbol" display to bottom right corner of screen. Now shows when mute is active or modifier key is pressed. Also fixed some other minor issues.
* commented out a log
* Reworked how modifier functions worked, added
I wasn’t happy with my previous implementation, and I think it would have caused issues with other devices. This should work on all devices.
* Added back the function I moved causing issue with versions
* Fixed the version conflicts, everything seems to work fine now
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
2024-05-08 08:37:50 -04:00
|
|
|
e.inputEvent = ANYKEY;
|
2024-09-04 06:20:26 -04:00
|
|
|
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
|
2023-08-19 15:37:42 +02:00
|
|
|
break;
|
|
|
|
|
case 0x0a: // apparently Enter on Q10 is a line feed instead of carriage return
|
|
|
|
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT;
|
|
|
|
|
break;
|
|
|
|
|
case 0x00: // nopress
|
|
|
|
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
|
|
|
|
|
break;
|
|
|
|
|
default: // all other keys
|
|
|
|
|
e.inputEvent = ANYKEY;
|
|
|
|
|
e.kbchar = key.key;
|
2023-08-23 09:44:20 +02:00
|
|
|
is_sym = false; // reset sym state after second keypress
|
2023-08-19 15:37:42 +02:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (e.inputEvent != meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE) {
|
|
|
|
|
this->notifyObservers(&e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x02: {
|
2022-10-06 16:00:33 +02:00
|
|
|
// RAK14004
|
|
|
|
|
uint8_t rDataBuf[8] = {0};
|
|
|
|
|
uint8_t PrintDataBuf = 0;
|
2023-03-08 19:13:46 -08:00
|
|
|
if (read_from_14004(i2cBus, 0x01, rDataBuf, 0x04) == 1) {
|
2022-10-06 16:00:33 +02:00
|
|
|
for (uint8_t aCount = 0; aCount < 0x04; aCount++) {
|
2023-01-21 14:34:29 +01:00
|
|
|
for (uint8_t bCount = 0; bCount < 0x04; bCount++) {
|
2022-10-06 16:00:33 +02:00
|
|
|
if (((rDataBuf[aCount] >> bCount) & 0x01) == 0x01) {
|
|
|
|
|
PrintDataBuf = aCount * 0x04 + bCount + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (PrintDataBuf != 0) {
|
2022-12-29 20:41:37 -06:00
|
|
|
LOG_DEBUG("RAK14004 key 0x%x pressed\n", PrintDataBuf);
|
2022-10-06 16:00:33 +02:00
|
|
|
InputEvent e;
|
|
|
|
|
e.inputEvent = MATRIXKEY;
|
|
|
|
|
e.source = this->_originName;
|
|
|
|
|
e.kbchar = PrintDataBuf;
|
|
|
|
|
this->notifyObservers(&e);
|
|
|
|
|
}
|
2023-08-19 15:37:42 +02:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x00: // CARDKB
|
|
|
|
|
case 0x10: { // T-DECK
|
|
|
|
|
|
|
|
|
|
i2cBus->requestFrom((int)cardkb_found.address, 1);
|
2022-05-07 20:31:21 +10:00
|
|
|
|
2024-01-12 02:00:31 -06:00
|
|
|
if (i2cBus->available()) {
|
2023-03-08 19:13:46 -08:00
|
|
|
char c = i2cBus->read();
|
2022-10-06 16:00:33 +02:00
|
|
|
InputEvent e;
|
2023-01-21 18:22:19 +01:00
|
|
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
|
2022-10-06 16:00:33 +02:00
|
|
|
e.source = this->_originName;
|
|
|
|
|
switch (c) {
|
Added modifier key combination to allow keyboard shortcuts on t-deck (#3668)
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Changed modifier key to alt+c
* Added screen brightness functionality
Use modifier key with o(+) to increase brightness or i(-) to decrease.
Currently there are 4 levels of brightness, (L, ML, MH, H). I would like to add a popup message to tell you the brightness.
* Added checks to disable screen brightness changes on unsupported hardware
* Setting the brightness code to work on only applicable devices
* Added "function symbol" display to bottom right corner of screen. Now shows when mute is active or modifier key is pressed. Also fixed some other minor issues.
* commented out a log
* Reworked how modifier functions worked, added
I wasn’t happy with my previous implementation, and I think it would have caused issues with other devices. This should work on all devices.
* Added back the function I moved causing issue with versions
* Fixed the version conflicts, everything seems to work fine now
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
2024-05-08 08:37:50 -04:00
|
|
|
case 0x71: // This is the button q. If modifier and q pressed, it cancels the input
|
|
|
|
|
if (is_sym) {
|
|
|
|
|
is_sym = false;
|
|
|
|
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_CANCEL;
|
|
|
|
|
} else {
|
|
|
|
|
e.inputEvent = ANYKEY;
|
|
|
|
|
e.kbchar = c;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 0x74: // letter t. if modifier and t pressed call 'tab'
|
|
|
|
|
if (is_sym) {
|
|
|
|
|
is_sym = false;
|
|
|
|
|
e.inputEvent = ANYKEY;
|
|
|
|
|
e.kbchar = 0x09; // TAB Scancode
|
|
|
|
|
} else {
|
|
|
|
|
e.inputEvent = ANYKEY;
|
|
|
|
|
e.kbchar = c;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 0x6d: // letter m. Modifier makes it mute notifications
|
|
|
|
|
if (is_sym) {
|
|
|
|
|
is_sym = false;
|
|
|
|
|
e.inputEvent = ANYKEY;
|
2024-09-04 06:20:26 -04:00
|
|
|
e.kbchar = CANNED_MESSAGE_KEY_MUTE_TOGGLE; // mute notifications
|
Added modifier key combination to allow keyboard shortcuts on t-deck (#3668)
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Changed modifier key to alt+c
* Added screen brightness functionality
Use modifier key with o(+) to increase brightness or i(-) to decrease.
Currently there are 4 levels of brightness, (L, ML, MH, H). I would like to add a popup message to tell you the brightness.
* Added checks to disable screen brightness changes on unsupported hardware
* Setting the brightness code to work on only applicable devices
* Added "function symbol" display to bottom right corner of screen. Now shows when mute is active or modifier key is pressed. Also fixed some other minor issues.
* commented out a log
* Reworked how modifier functions worked, added
I wasn’t happy with my previous implementation, and I think it would have caused issues with other devices. This should work on all devices.
* Added back the function I moved causing issue with versions
* Fixed the version conflicts, everything seems to work fine now
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
2024-05-08 08:37:50 -04:00
|
|
|
} else {
|
|
|
|
|
e.inputEvent = ANYKEY;
|
|
|
|
|
e.kbchar = c;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 0x6f: // letter o(+). Modifier makes screen increase in brightness
|
|
|
|
|
if (is_sym) {
|
|
|
|
|
is_sym = false;
|
|
|
|
|
e.inputEvent = ANYKEY;
|
2024-09-04 06:20:26 -04:00
|
|
|
e.kbchar = CANNED_MESSAGE_KEY_BRIGHTNESS_UP; // Increase Brightness code
|
Added modifier key combination to allow keyboard shortcuts on t-deck (#3668)
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Changed modifier key to alt+c
* Added screen brightness functionality
Use modifier key with o(+) to increase brightness or i(-) to decrease.
Currently there are 4 levels of brightness, (L, ML, MH, H). I would like to add a popup message to tell you the brightness.
* Added checks to disable screen brightness changes on unsupported hardware
* Setting the brightness code to work on only applicable devices
* Added "function symbol" display to bottom right corner of screen. Now shows when mute is active or modifier key is pressed. Also fixed some other minor issues.
* commented out a log
* Reworked how modifier functions worked, added
I wasn’t happy with my previous implementation, and I think it would have caused issues with other devices. This should work on all devices.
* Added back the function I moved causing issue with versions
* Fixed the version conflicts, everything seems to work fine now
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
2024-05-08 08:37:50 -04:00
|
|
|
} else {
|
|
|
|
|
e.inputEvent = ANYKEY;
|
|
|
|
|
e.kbchar = c;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 0x69: // letter i(-). Modifier makes screen decrease in brightness
|
|
|
|
|
if (is_sym) {
|
|
|
|
|
is_sym = false;
|
|
|
|
|
e.inputEvent = ANYKEY;
|
2024-09-04 06:20:26 -04:00
|
|
|
e.kbchar = CANNED_MESSAGE_KEY_BRIGHTNESS_DOWN; // Decrease Brightness code
|
Added modifier key combination to allow keyboard shortcuts on t-deck (#3668)
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Changed modifier key to alt+c
* Added screen brightness functionality
Use modifier key with o(+) to increase brightness or i(-) to decrease.
Currently there are 4 levels of brightness, (L, ML, MH, H). I would like to add a popup message to tell you the brightness.
* Added checks to disable screen brightness changes on unsupported hardware
* Setting the brightness code to work on only applicable devices
* Added "function symbol" display to bottom right corner of screen. Now shows when mute is active or modifier key is pressed. Also fixed some other minor issues.
* commented out a log
* Reworked how modifier functions worked, added
I wasn’t happy with my previous implementation, and I think it would have caused issues with other devices. This should work on all devices.
* Added back the function I moved causing issue with versions
* Fixed the version conflicts, everything seems to work fine now
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
2024-05-08 08:37:50 -04:00
|
|
|
} else {
|
|
|
|
|
e.inputEvent = ANYKEY;
|
|
|
|
|
e.kbchar = c;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 0x20: // Space. Send network ping like double press does
|
|
|
|
|
if (is_sym) {
|
|
|
|
|
is_sym = false;
|
|
|
|
|
e.inputEvent = ANYKEY;
|
2024-09-04 06:20:26 -04:00
|
|
|
e.kbchar = CANNED_MESSAGE_KEY_SEND_PING; // (fn + space)
|
Added modifier key combination to allow keyboard shortcuts on t-deck (#3668)
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Changed modifier key to alt+c
* Added screen brightness functionality
Use modifier key with o(+) to increase brightness or i(-) to decrease.
Currently there are 4 levels of brightness, (L, ML, MH, H). I would like to add a popup message to tell you the brightness.
* Added checks to disable screen brightness changes on unsupported hardware
* Setting the brightness code to work on only applicable devices
* Added "function symbol" display to bottom right corner of screen. Now shows when mute is active or modifier key is pressed. Also fixed some other minor issues.
* commented out a log
* Reworked how modifier functions worked, added
I wasn’t happy with my previous implementation, and I think it would have caused issues with other devices. This should work on all devices.
* Added back the function I moved causing issue with versions
* Fixed the version conflicts, everything seems to work fine now
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
2024-05-08 08:37:50 -04:00
|
|
|
} else {
|
|
|
|
|
e.inputEvent = ANYKEY;
|
|
|
|
|
e.kbchar = c;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 0x67: // letter g. toggle gps
|
|
|
|
|
if (is_sym) {
|
|
|
|
|
is_sym = false;
|
|
|
|
|
e.inputEvent = ANYKEY;
|
2024-09-04 06:20:26 -04:00
|
|
|
e.kbchar = CANNED_MESSAGE_KEY_GPS_TOGGLE;
|
Added modifier key combination to allow keyboard shortcuts on t-deck (#3668)
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Changed modifier key to alt+c
* Added screen brightness functionality
Use modifier key with o(+) to increase brightness or i(-) to decrease.
Currently there are 4 levels of brightness, (L, ML, MH, H). I would like to add a popup message to tell you the brightness.
* Added checks to disable screen brightness changes on unsupported hardware
* Setting the brightness code to work on only applicable devices
* Added "function symbol" display to bottom right corner of screen. Now shows when mute is active or modifier key is pressed. Also fixed some other minor issues.
* commented out a log
* Reworked how modifier functions worked, added
I wasn’t happy with my previous implementation, and I think it would have caused issues with other devices. This should work on all devices.
* Added back the function I moved causing issue with versions
* Fixed the version conflicts, everything seems to work fine now
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
2024-05-08 08:37:50 -04:00
|
|
|
} else {
|
|
|
|
|
e.inputEvent = ANYKEY;
|
|
|
|
|
e.kbchar = c;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2022-10-06 16:00:33 +02:00
|
|
|
case 0x1b: // ESC
|
2023-01-21 18:22:19 +01:00
|
|
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_CANCEL;
|
2022-10-06 16:00:33 +02:00
|
|
|
break;
|
|
|
|
|
case 0x08: // Back
|
2023-01-21 18:22:19 +01:00
|
|
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_BACK;
|
2022-10-06 16:00:33 +02:00
|
|
|
e.kbchar = c;
|
|
|
|
|
break;
|
|
|
|
|
case 0xb5: // Up
|
2023-01-21 18:22:19 +01:00
|
|
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP;
|
2024-09-04 06:20:26 -04:00
|
|
|
e.kbchar = CANNED_MESSAGE_KEY_UP;
|
2022-10-06 16:00:33 +02:00
|
|
|
break;
|
|
|
|
|
case 0xb6: // Down
|
2023-01-21 18:22:19 +01:00
|
|
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_DOWN;
|
2024-09-04 06:20:26 -04:00
|
|
|
e.kbchar = CANNED_MESSAGE_KEY_DOWN;
|
2022-10-06 16:00:33 +02:00
|
|
|
break;
|
|
|
|
|
case 0xb4: // Left
|
2023-01-21 18:22:19 +01:00
|
|
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT;
|
2024-09-04 06:20:26 -04:00
|
|
|
e.kbchar = CANNED_MESSAGE_KEY_LEFT;
|
2022-10-06 16:00:33 +02:00
|
|
|
break;
|
|
|
|
|
case 0xb7: // Right
|
2023-01-21 18:22:19 +01:00
|
|
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT;
|
2024-09-04 06:20:26 -04:00
|
|
|
e.kbchar = CANNED_MESSAGE_KEY_RIGHT;
|
2022-10-06 16:00:33 +02:00
|
|
|
break;
|
Added modifier key combination to allow keyboard shortcuts on t-deck (#3668)
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Changed modifier key to alt+c
* Added screen brightness functionality
Use modifier key with o(+) to increase brightness or i(-) to decrease.
Currently there are 4 levels of brightness, (L, ML, MH, H). I would like to add a popup message to tell you the brightness.
* Added checks to disable screen brightness changes on unsupported hardware
* Setting the brightness code to work on only applicable devices
* Added "function symbol" display to bottom right corner of screen. Now shows when mute is active or modifier key is pressed. Also fixed some other minor issues.
* commented out a log
* Reworked how modifier functions worked, added
I wasn’t happy with my previous implementation, and I think it would have caused issues with other devices. This should work on all devices.
* Added back the function I moved causing issue with versions
* Fixed the version conflicts, everything seems to work fine now
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
2024-05-08 08:37:50 -04:00
|
|
|
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;
|
2024-09-04 06:20:26 -04:00
|
|
|
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
|
Added modifier key combination to allow keyboard shortcuts on t-deck (#3668)
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Changed modifier key to alt+c
* Added screen brightness functionality
Use modifier key with o(+) to increase brightness or i(-) to decrease.
Currently there are 4 levels of brightness, (L, ML, MH, H). I would like to add a popup message to tell you the brightness.
* Added checks to disable screen brightness changes on unsupported hardware
* Setting the brightness code to work on only applicable devices
* Added "function symbol" display to bottom right corner of screen. Now shows when mute is active or modifier key is pressed. Also fixed some other minor issues.
* commented out a log
* Reworked how modifier functions worked, added
I wasn’t happy with my previous implementation, and I think it would have caused issues with other devices. This should work on all devices.
* Added back the function I moved causing issue with versions
* Fixed the version conflicts, everything seems to work fine now
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
2024-05-08 08:37:50 -04:00
|
|
|
break;
|
2024-09-04 06:20:26 -04:00
|
|
|
case 0x90: // fn+r CANNED_MESSAGE_KEY_REBOOT
|
2024-04-07 02:12:57 +02:00
|
|
|
case 0x91: // fn+t
|
2024-09-04 06:20:26 -04:00
|
|
|
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
|
2024-03-24 19:41:45 +01:00
|
|
|
// just pass those unmodified
|
|
|
|
|
e.inputEvent = ANYKEY;
|
|
|
|
|
e.kbchar = c;
|
|
|
|
|
break;
|
2022-10-06 16:00:33 +02:00
|
|
|
case 0x0d: // Enter
|
2023-01-21 18:22:19 +01:00
|
|
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT;
|
2022-10-06 16:00:33 +02:00
|
|
|
break;
|
2023-01-21 14:34:29 +01:00
|
|
|
case 0x00: // nopress
|
2023-01-21 18:22:19 +01:00
|
|
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
|
2022-10-06 16:00:33 +02:00
|
|
|
break;
|
2024-01-12 02:00:31 -06:00
|
|
|
default: // all other keys
|
|
|
|
|
if (c > 127) { // bogus key value
|
|
|
|
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2022-10-06 16:00:33 +02:00
|
|
|
e.inputEvent = ANYKEY;
|
|
|
|
|
e.kbchar = c;
|
Added modifier key combination to allow keyboard shortcuts on t-deck (#3668)
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Changed modifier key to alt+c
* Added screen brightness functionality
Use modifier key with o(+) to increase brightness or i(-) to decrease.
Currently there are 4 levels of brightness, (L, ML, MH, H). I would like to add a popup message to tell you the brightness.
* Added checks to disable screen brightness changes on unsupported hardware
* Setting the brightness code to work on only applicable devices
* Added "function symbol" display to bottom right corner of screen. Now shows when mute is active or modifier key is pressed. Also fixed some other minor issues.
* commented out a log
* Reworked how modifier functions worked, added
I wasn’t happy with my previous implementation, and I think it would have caused issues with other devices. This should work on all devices.
* Added back the function I moved causing issue with versions
* Fixed the version conflicts, everything seems to work fine now
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
2024-05-08 08:37:50 -04:00
|
|
|
is_sym = false;
|
2022-10-06 16:00:33 +02:00
|
|
|
break;
|
|
|
|
|
}
|
2022-03-28 16:55:58 +02:00
|
|
|
|
2023-01-21 18:22:19 +01:00
|
|
|
if (e.inputEvent != meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE) {
|
2022-10-06 16:00:33 +02:00
|
|
|
this->notifyObservers(&e);
|
|
|
|
|
}
|
2022-09-20 14:28:42 +02:00
|
|
|
}
|
2023-08-19 15:37:42 +02:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
2023-07-30 14:51:26 +02:00
|
|
|
LOG_WARN("Unknown kb_model 0x%02x\n", kb_model);
|
2022-03-28 16:55:58 +02:00
|
|
|
}
|
2023-07-30 14:51:26 +02:00
|
|
|
return 300;
|
2024-01-12 02:00:31 -06:00
|
|
|
}
|