mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-26 18:09:04 +00:00
Gather canned message magic numbers into header defines.
This commit is contained in:
parent
55292f8a84
commit
8e0a342f06
@ -1,6 +1,7 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#if ARCH_PORTDUINO
|
#if ARCH_PORTDUINO
|
||||||
#include "LinuxInput.h"
|
#include "LinuxInput.h"
|
||||||
|
#include "modules/CannedMessageModule.h"
|
||||||
#include "platform/portduino/PortduinoGlue.h"
|
#include "platform/portduino/PortduinoGlue.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -147,11 +148,11 @@ int32_t LinuxInput::runOnce()
|
|||||||
case KEY_LEFT: // Left
|
case KEY_LEFT: // Left
|
||||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT;
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT;
|
||||||
break;
|
break;
|
||||||
e.kbchar = 0xb4;
|
e.kbchar = CANNED_MESSAGE_KEY_LEFT;
|
||||||
case KEY_RIGHT: // Right
|
case KEY_RIGHT: // Right
|
||||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT;
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT;
|
||||||
break;
|
break;
|
||||||
e.kbchar = 0xb7;
|
e.kbchar = CANNED_MESSAGE_KEY_RIGHT;
|
||||||
case KEY_ENTER: // Enter
|
case KEY_ENTER: // Enter
|
||||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT;
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT;
|
||||||
break;
|
break;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "SerialKeyboard.h"
|
#include "SerialKeyboard.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
#include "modules/CannedMessageModule.h"
|
||||||
|
|
||||||
#ifdef INPUTBROKER_SERIAL_TYPE
|
#ifdef INPUTBROKER_SERIAL_TYPE
|
||||||
#define CANNED_MESSAGE_MODULE_ENABLE 1 // in case it's not set in the variant file
|
#define CANNED_MESSAGE_MODULE_ENABLE 1 // in case it's not set in the variant file
|
||||||
@ -87,7 +88,7 @@ int32_t SerialKeyboard::runOnce()
|
|||||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP;
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP;
|
||||||
} else if (!(shiftRegister2 & (1 << 2))) {
|
} else if (!(shiftRegister2 & (1 << 2))) {
|
||||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT;
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT;
|
||||||
e.kbchar = 0xb7;
|
e.kbchar = CANNED_MESSAGE_KEY_RIGHT;
|
||||||
} else if (!(shiftRegister2 & (1 << 1))) {
|
} else if (!(shiftRegister2 & (1 << 1))) {
|
||||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT;
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT;
|
||||||
} else if (!(shiftRegister2 & (1 << 0))) {
|
} else if (!(shiftRegister2 & (1 << 0))) {
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "detect/ScanI2C.h"
|
#include "detect/ScanI2C.h"
|
||||||
#include "detect/ScanI2CTwoWire.h"
|
#include "detect/ScanI2CTwoWire.h"
|
||||||
|
#include "modules/CannedMessageModule.h"
|
||||||
|
|
||||||
extern ScanI2C::DeviceAddress cardkb_found;
|
extern ScanI2C::DeviceAddress cardkb_found;
|
||||||
extern uint8_t kb_model;
|
extern uint8_t kb_model;
|
||||||
@ -94,7 +95,7 @@ int32_t KbI2cBase::runOnce()
|
|||||||
case 'e': // sym e
|
case 'e': // sym e
|
||||||
if (is_sym) {
|
if (is_sym) {
|
||||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP;
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP;
|
||||||
e.kbchar = 0xb5;
|
e.kbchar = CANNED_MESSAGE_KEY_UP;
|
||||||
is_sym = false; // reset sym state after second keypress
|
is_sym = false; // reset sym state after second keypress
|
||||||
} else {
|
} else {
|
||||||
e.inputEvent = ANYKEY;
|
e.inputEvent = ANYKEY;
|
||||||
@ -104,7 +105,7 @@ int32_t KbI2cBase::runOnce()
|
|||||||
case 'x': // sym x
|
case 'x': // sym x
|
||||||
if (is_sym) {
|
if (is_sym) {
|
||||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_DOWN;
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_DOWN;
|
||||||
e.kbchar = 0xb6;
|
e.kbchar = CANNED_MESSAGE_KEY_DOWN;
|
||||||
is_sym = false; // reset sym state after second keypress
|
is_sym = false; // reset sym state after second keypress
|
||||||
} else {
|
} else {
|
||||||
e.inputEvent = ANYKEY;
|
e.inputEvent = ANYKEY;
|
||||||
@ -134,8 +135,8 @@ int32_t KbI2cBase::runOnce()
|
|||||||
case 0x13: // Code scanner says the SYM key is 0x13
|
case 0x13: // Code scanner says the SYM key is 0x13
|
||||||
is_sym = !is_sym;
|
is_sym = !is_sym;
|
||||||
e.inputEvent = ANYKEY;
|
e.inputEvent = ANYKEY;
|
||||||
e.kbchar =
|
e.kbchar = is_sym ? CANNED_MESSAGE_KEY_FN_SYMBOL_ON // send 0xf1 to tell CannedMessages to display that
|
||||||
is_sym ? 0xf1 : 0xf2; // send 0xf1 to tell CannedMessages to display that the modifier key is active
|
: CANNED_MESSAGE_KEY_FN_SYMBOL_OFF; // the modifier key is active
|
||||||
break;
|
break;
|
||||||
case 0x0a: // apparently Enter on Q10 is a line feed instead of carriage return
|
case 0x0a: // apparently Enter on Q10 is a line feed instead of carriage return
|
||||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT;
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT;
|
||||||
@ -214,7 +215,7 @@ int32_t KbI2cBase::runOnce()
|
|||||||
if (is_sym) {
|
if (is_sym) {
|
||||||
is_sym = false;
|
is_sym = false;
|
||||||
e.inputEvent = ANYKEY;
|
e.inputEvent = ANYKEY;
|
||||||
e.kbchar = 0xac; // mute notifications
|
e.kbchar = CANNED_MESSAGE_KEY_MUTE_TOGGLE; // mute notifications
|
||||||
} else {
|
} else {
|
||||||
e.inputEvent = ANYKEY;
|
e.inputEvent = ANYKEY;
|
||||||
e.kbchar = c;
|
e.kbchar = c;
|
||||||
@ -224,7 +225,7 @@ int32_t KbI2cBase::runOnce()
|
|||||||
if (is_sym) {
|
if (is_sym) {
|
||||||
is_sym = false;
|
is_sym = false;
|
||||||
e.inputEvent = ANYKEY;
|
e.inputEvent = ANYKEY;
|
||||||
e.kbchar = 0x11; // Increase Brightness code
|
e.kbchar = CANNED_MESSAGE_KEY_BRIGHTNESS_UP; // Increase Brightness code
|
||||||
} else {
|
} else {
|
||||||
e.inputEvent = ANYKEY;
|
e.inputEvent = ANYKEY;
|
||||||
e.kbchar = c;
|
e.kbchar = c;
|
||||||
@ -234,7 +235,7 @@ int32_t KbI2cBase::runOnce()
|
|||||||
if (is_sym) {
|
if (is_sym) {
|
||||||
is_sym = false;
|
is_sym = false;
|
||||||
e.inputEvent = ANYKEY;
|
e.inputEvent = ANYKEY;
|
||||||
e.kbchar = 0x12; // Decrease Brightness code
|
e.kbchar = CANNED_MESSAGE_KEY_BRIGHTNESS_DOWN; // Decrease Brightness code
|
||||||
} else {
|
} else {
|
||||||
e.inputEvent = ANYKEY;
|
e.inputEvent = ANYKEY;
|
||||||
e.kbchar = c;
|
e.kbchar = c;
|
||||||
@ -244,7 +245,7 @@ int32_t KbI2cBase::runOnce()
|
|||||||
if (is_sym) {
|
if (is_sym) {
|
||||||
is_sym = false;
|
is_sym = false;
|
||||||
e.inputEvent = ANYKEY;
|
e.inputEvent = ANYKEY;
|
||||||
e.kbchar = 0xaf; // (fn + space)
|
e.kbchar = CANNED_MESSAGE_KEY_SEND_PING; // (fn + space)
|
||||||
} else {
|
} else {
|
||||||
e.inputEvent = ANYKEY;
|
e.inputEvent = ANYKEY;
|
||||||
e.kbchar = c;
|
e.kbchar = c;
|
||||||
@ -254,7 +255,7 @@ int32_t KbI2cBase::runOnce()
|
|||||||
if (is_sym) {
|
if (is_sym) {
|
||||||
is_sym = false;
|
is_sym = false;
|
||||||
e.inputEvent = ANYKEY;
|
e.inputEvent = ANYKEY;
|
||||||
e.kbchar = 0x9e;
|
e.kbchar = CANNED_MESSAGE_KEY_GPS_TOGGLE;
|
||||||
} else {
|
} else {
|
||||||
e.inputEvent = ANYKEY;
|
e.inputEvent = ANYKEY;
|
||||||
e.kbchar = c;
|
e.kbchar = c;
|
||||||
@ -269,32 +270,33 @@ int32_t KbI2cBase::runOnce()
|
|||||||
break;
|
break;
|
||||||
case 0xb5: // Up
|
case 0xb5: // Up
|
||||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP;
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP;
|
||||||
e.kbchar = 0xb5;
|
e.kbchar = CANNED_MESSAGE_KEY_UP;
|
||||||
break;
|
break;
|
||||||
case 0xb6: // Down
|
case 0xb6: // Down
|
||||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_DOWN;
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_DOWN;
|
||||||
e.kbchar = 0xb6;
|
e.kbchar = CANNED_MESSAGE_KEY_DOWN;
|
||||||
break;
|
break;
|
||||||
case 0xb4: // Left
|
case 0xb4: // Left
|
||||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT;
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT;
|
||||||
e.kbchar = 0xb4;
|
e.kbchar = CANNED_MESSAGE_KEY_LEFT;
|
||||||
break;
|
break;
|
||||||
case 0xb7: // Right
|
case 0xb7: // Right
|
||||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT;
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT;
|
||||||
e.kbchar = 0xb7;
|
e.kbchar = CANNED_MESSAGE_KEY_RIGHT;
|
||||||
break;
|
break;
|
||||||
case 0xc: // Modifier key: 0xc is alt+c (Other options could be: 0xea = shift+mic button or 0x4 shift+$(speaker))
|
case 0xc: // Modifier key: 0xc is alt+c (Other options could be: 0xea = shift+mic button or 0x4 shift+$(speaker))
|
||||||
// toggle moddifiers button.
|
// toggle moddifiers button.
|
||||||
is_sym = !is_sym;
|
is_sym = !is_sym;
|
||||||
e.inputEvent = ANYKEY;
|
e.inputEvent = ANYKEY;
|
||||||
e.kbchar = is_sym ? 0xf1 : 0xf2; // send 0xf1 to tell CannedMessages to display that the modifier key is active
|
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
|
||||||
break;
|
break;
|
||||||
case 0x90: // fn+r
|
case 0x90: // fn+r CANNED_MESSAGE_KEY_REBOOT
|
||||||
case 0x91: // fn+t
|
case 0x91: // fn+t
|
||||||
case 0x9b: // fn+s
|
case 0x9b: // fn+s CANNED_MESSAGE_KEY_SHUTDOWN
|
||||||
case 0xac: // fn+m
|
case 0xac: // fn+m CANNED_MESSAGE_KEY_MUTE_TOGGLE
|
||||||
case 0x9e: // fn+g
|
case 0x9e: // fn+g CANNED_MESSAGE_KEY_GPS_TOGGLE
|
||||||
case 0xaf: // fn+space
|
case 0xaf: // fn+space CANNED_MESSAGE_KEY_SEND_PING
|
||||||
// just pass those unmodified
|
// just pass those unmodified
|
||||||
e.inputEvent = ANYKEY;
|
e.inputEvent = ANYKEY;
|
||||||
e.kbchar = c;
|
e.kbchar = c;
|
||||||
|
@ -190,17 +190,17 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
|
|||||||
|
|
||||||
#if defined(T_WATCH_S3) || defined(RAK14014)
|
#if defined(T_WATCH_S3) || defined(RAK14014)
|
||||||
if (event->inputEvent == static_cast<char>(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT)) {
|
if (event->inputEvent == static_cast<char>(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT)) {
|
||||||
this->payload = 0xb4;
|
this->payload = CANNED_MESSAGE_KEY_LEFT;
|
||||||
} else if (event->inputEvent == static_cast<char>(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT)) {
|
} else if (event->inputEvent == static_cast<char>(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT)) {
|
||||||
this->payload = 0xb7;
|
this->payload = CANNED_MESSAGE_KEY_RIGHT;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// tweak for left/right events generated via trackball/touch with empty kbchar
|
// tweak for left/right events generated via trackball/touch with empty kbchar
|
||||||
if (!event->kbchar) {
|
if (!event->kbchar) {
|
||||||
if (event->inputEvent == static_cast<char>(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT)) {
|
if (event->inputEvent == static_cast<char>(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT)) {
|
||||||
this->payload = 0xb4;
|
this->payload = CANNED_MESSAGE_KEY_LEFT;
|
||||||
} else if (event->inputEvent == static_cast<char>(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT)) {
|
} else if (event->inputEvent == static_cast<char>(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT)) {
|
||||||
this->payload = 0xb7;
|
this->payload = CANNED_MESSAGE_KEY_RIGHT;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// pass the pressed key
|
// pass the pressed key
|
||||||
@ -222,26 +222,26 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
|
|||||||
|
|
||||||
// Run modifier key code below, (doesnt inturrupt typing or reset to start screen page)
|
// Run modifier key code below, (doesnt inturrupt typing or reset to start screen page)
|
||||||
switch (event->kbchar) {
|
switch (event->kbchar) {
|
||||||
case 0x11: // make screen brighter
|
case CANNED_MESSAGE_KEY_BRIGHTNESS_UP: // make screen brighter
|
||||||
if (screen)
|
if (screen)
|
||||||
screen->increaseBrightness();
|
screen->increaseBrightness();
|
||||||
LOG_DEBUG("increasing Screen Brightness\n");
|
LOG_DEBUG("increasing Screen Brightness\n");
|
||||||
break;
|
break;
|
||||||
case 0x12: // make screen dimmer
|
case CANNED_MESSAGE_KEY_BRIGHTNESS_DOWN: // make screen dimmer
|
||||||
if (screen)
|
if (screen)
|
||||||
screen->decreaseBrightness();
|
screen->decreaseBrightness();
|
||||||
LOG_DEBUG("Decreasing Screen Brightness\n");
|
LOG_DEBUG("Decreasing Screen Brightness\n");
|
||||||
break;
|
break;
|
||||||
case 0xf1: // draw modifier (function) symbal
|
case CANNED_MESSAGE_KEY_FN_SYMBOL_ON: // draw modifier (function) symbal
|
||||||
if (screen)
|
if (screen)
|
||||||
screen->setFunctionSymbal("Fn");
|
screen->setFunctionSymbal("Fn");
|
||||||
break;
|
break;
|
||||||
case 0xf2: // remove modifier (function) symbal
|
case CANNED_MESSAGE_KEY_FN_SYMBOL_OFF: // remove modifier (function) symbal
|
||||||
if (screen)
|
if (screen)
|
||||||
screen->removeFunctionSymbal("Fn");
|
screen->removeFunctionSymbal("Fn");
|
||||||
break;
|
break;
|
||||||
// mute (switch off/toggle) external notifications on fn+m
|
// mute (switch off/toggle) external notifications on fn+m
|
||||||
case 0xac:
|
case CANNED_MESSAGE_KEY_MUTE_TOGGLE:
|
||||||
if (moduleConfig.external_notification.enabled == true) {
|
if (moduleConfig.external_notification.enabled == true) {
|
||||||
if (externalNotificationModule->getMute()) {
|
if (externalNotificationModule->getMute()) {
|
||||||
externalNotificationModule->setMute(false);
|
externalNotificationModule->setMute(false);
|
||||||
@ -257,7 +257,7 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x9e: // toggle GPS like triple press does
|
case CANNED_MESSAGE_KEY_GPS_TOGGLE: // toggle GPS like triple press does
|
||||||
#if !MESHTASTIC_EXCLUDE_GPS
|
#if !MESHTASTIC_EXCLUDE_GPS
|
||||||
if (gps != nullptr) {
|
if (gps != nullptr) {
|
||||||
gps->toggleGpsMode();
|
gps->toggleGpsMode();
|
||||||
@ -267,7 +267,7 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
|
|||||||
showTemporaryMessage("GPS Toggled");
|
showTemporaryMessage("GPS Toggled");
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 0xaf: // fn+space send network ping like double press does
|
case CANNED_MESSAGE_KEY_SEND_PING: // fn+space send network ping like double press does
|
||||||
service->refreshLocalMeshNode();
|
service->refreshLocalMeshNode();
|
||||||
if (service->trySendPosition(NODENUM_BROADCAST, true)) {
|
if (service->trySendPosition(NODENUM_BROADCAST, true)) {
|
||||||
showTemporaryMessage("Position \nUpdate Sent");
|
showTemporaryMessage("Position \nUpdate Sent");
|
||||||
@ -283,7 +283,7 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
|
|||||||
validEvent = true;
|
validEvent = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (screen && (event->kbchar != 0xf1)) {
|
if (screen && (event->kbchar != CANNED_MESSAGE_KEY_FN_SYMBOL_ON)) {
|
||||||
screen->removeFunctionSymbal("Fn"); // remove modifier (function) symbal
|
screen->removeFunctionSymbal("Fn"); // remove modifier (function) symbal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -505,7 +505,7 @@ int32_t CannedMessageModule::runOnce()
|
|||||||
}
|
}
|
||||||
} else if (this->runState == CANNED_MESSAGE_RUN_STATE_FREETEXT || this->runState == CANNED_MESSAGE_RUN_STATE_ACTIVE) {
|
} else if (this->runState == CANNED_MESSAGE_RUN_STATE_FREETEXT || this->runState == CANNED_MESSAGE_RUN_STATE_ACTIVE) {
|
||||||
switch (this->payload) {
|
switch (this->payload) {
|
||||||
case 0xb4: // left
|
case CANNED_MESSAGE_KEY_LEFT:
|
||||||
if (this->destSelect == CANNED_MESSAGE_DESTINATION_TYPE_NODE) {
|
if (this->destSelect == CANNED_MESSAGE_DESTINATION_TYPE_NODE) {
|
||||||
size_t numMeshNodes = nodeDB->getNumMeshNodes();
|
size_t numMeshNodes = nodeDB->getNumMeshNodes();
|
||||||
if (this->dest == NODENUM_BROADCAST) {
|
if (this->dest == NODENUM_BROADCAST) {
|
||||||
@ -540,7 +540,7 @@ int32_t CannedMessageModule::runOnce()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0xb7: // right
|
case CANNED_MESSAGE_KEY_RIGHT:
|
||||||
if (this->destSelect == CANNED_MESSAGE_DESTINATION_TYPE_NODE) {
|
if (this->destSelect == CANNED_MESSAGE_DESTINATION_TYPE_NODE) {
|
||||||
size_t numMeshNodes = nodeDB->getNumMeshNodes();
|
size_t numMeshNodes = nodeDB->getNumMeshNodes();
|
||||||
if (this->dest == NODENUM_BROADCAST) {
|
if (this->dest == NODENUM_BROADCAST) {
|
||||||
@ -602,19 +602,19 @@ int32_t CannedMessageModule::runOnce()
|
|||||||
this->destSelect = CANNED_MESSAGE_DESTINATION_TYPE_NODE;
|
this->destSelect = CANNED_MESSAGE_DESTINATION_TYPE_NODE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0xb4: // left
|
case CANNED_MESSAGE_KEY_LEFT:
|
||||||
case 0xb7: // right
|
case CANNED_MESSAGE_KEY_RIGHT:
|
||||||
// already handled above
|
// already handled above
|
||||||
break;
|
break;
|
||||||
// handle fn+s for shutdown
|
// handle fn+s for shutdown
|
||||||
case 0x9b:
|
case CANNED_MESSAGE_KEY_SHUTDOWN:
|
||||||
if (screen)
|
if (screen)
|
||||||
screen->startAlert("Shutting down...");
|
screen->startAlert("Shutting down...");
|
||||||
shutdownAtMsec = millis() + DEFAULT_SHUTDOWN_SECONDS * 1000;
|
shutdownAtMsec = millis() + DEFAULT_SHUTDOWN_SECONDS * 1000;
|
||||||
runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
|
runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
|
||||||
break;
|
break;
|
||||||
// and fn+r for reboot
|
// and fn+r for reboot
|
||||||
case 0x90:
|
case CANNED_MESSAGE_KEY_REBOOT:
|
||||||
if (screen)
|
if (screen)
|
||||||
screen->startAlert("Rebooting...");
|
screen->startAlert("Rebooting...");
|
||||||
rebootAtMsec = millis() + DEFAULT_REBOOT_SECONDS * 1000;
|
rebootAtMsec = millis() + DEFAULT_REBOOT_SECONDS * 1000;
|
||||||
|
@ -43,6 +43,20 @@ struct Letter {
|
|||||||
#define CANNED_MESSAGE_MODULE_ENABLE 0
|
#define CANNED_MESSAGE_MODULE_ENABLE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define CANNED_MESSAGE_KEY_BRIGHTNESS_UP 0x11
|
||||||
|
#define CANNED_MESSAGE_KEY_BRIGHTNESS_DOWN 0x12
|
||||||
|
#define CANNED_MESSAGE_KEY_REBOOT 0x90
|
||||||
|
#define CANNED_MESSAGE_KEY_SHUTDOWN 0x9b
|
||||||
|
#define CANNED_MESSAGE_KEY_GPS_TOGGLE 0x9e
|
||||||
|
#define CANNED_MESSAGE_KEY_MUTE_TOGGLE 0xac
|
||||||
|
#define CANNED_MESSAGE_KEY_SEND_PING 0xaf
|
||||||
|
#define CANNED_MESSAGE_KEY_LEFT 0xb4
|
||||||
|
#define CANNED_MESSAGE_KEY_UP 0xb5
|
||||||
|
#define CANNED_MESSAGE_KEY_DOWN 0xb6
|
||||||
|
#define CANNED_MESSAGE_KEY_RIGHT 0xb7
|
||||||
|
#define CANNED_MESSAGE_KEY_FN_SYMBOL_ON 0xf1
|
||||||
|
#define CANNED_MESSAGE_KEY_FN_SYMBOL_OFF 0xf2
|
||||||
|
|
||||||
class CannedMessageModule : public SinglePortModule, public Observable<const UIFrameEvent *>, private concurrency::OSThread
|
class CannedMessageModule : public SinglePortModule, public Observable<const UIFrameEvent *>, private concurrency::OSThread
|
||||||
{
|
{
|
||||||
CallbackObserver<CannedMessageModule, const InputEvent *> inputObserver =
|
CallbackObserver<CannedMessageModule, const InputEvent *> inputObserver =
|
||||||
|
Loading…
Reference in New Issue
Block a user