mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-02 10:50:40 +00:00
Add keymappings for several utility functions (#3536)
* - map fn+m to mute and unmute the external notification module - map fn+t to be an alternative for the TAB key * add whitelist to inputbroker * (maybe) sweet-talking t-deck into tabbing... * now for real - back in Kansas * More fancy mappings --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
parent
0e9f1beb40
commit
1baad2875a
@ -217,7 +217,11 @@ int32_t KbI2cBase::runOnce()
|
||||
e.kbchar = 0xb7;
|
||||
break;
|
||||
case 0x90: // fn+r
|
||||
case 0x91: // fn+t
|
||||
case 0x9b: // fn+s
|
||||
case 0xac: // fn+m
|
||||
case 0x9e: // fn+g
|
||||
case 0xaf: // fn+space
|
||||
// just pass those unmodified
|
||||
e.inputEvent = ANYKEY;
|
||||
e.kbchar = c;
|
||||
|
@ -12,7 +12,11 @@
|
||||
#include "detect/ScanI2C.h"
|
||||
#include "mesh/generated/meshtastic/cannedmessages.pb.h"
|
||||
|
||||
#include "main.h" // for cardkb_found
|
||||
#include "main.h" // for cardkb_found
|
||||
#include "modules/ExternalNotificationModule.h" // for buzzer control
|
||||
#if !MESHTASTIC_EXCLUDE_GPS
|
||||
#include "GPS.h"
|
||||
#endif
|
||||
|
||||
#ifndef INPUTBROKER_MATRIX_TYPE
|
||||
#define INPUTBROKER_MATRIX_TYPE 0
|
||||
@ -397,6 +401,7 @@ int32_t CannedMessageModule::runOnce()
|
||||
}
|
||||
break;
|
||||
case 0x09: // tab
|
||||
case 0x91: // alt+t for T-Deck that doesn't have a tab key
|
||||
if (this->destSelect == CANNED_MESSAGE_DESTINATION_TYPE_CHANNEL) {
|
||||
this->destSelect = CANNED_MESSAGE_DESTINATION_TYPE_NONE;
|
||||
} else if (this->destSelect == CANNED_MESSAGE_DESTINATION_TYPE_NODE) {
|
||||
@ -411,13 +416,44 @@ int32_t CannedMessageModule::runOnce()
|
||||
break;
|
||||
// handle fn+s for shutdown
|
||||
case 0x9b:
|
||||
screen->startShutdownScreen();
|
||||
if (screen)
|
||||
screen->startShutdownScreen();
|
||||
shutdownAtMsec = millis() + DEFAULT_SHUTDOWN_SECONDS * 1000;
|
||||
runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
|
||||
break;
|
||||
// and fn+r for reboot
|
||||
case 0x90:
|
||||
screen->startRebootScreen();
|
||||
if (screen)
|
||||
screen->startRebootScreen();
|
||||
rebootAtMsec = millis() + DEFAULT_REBOOT_SECONDS * 1000;
|
||||
runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
|
||||
break;
|
||||
case 0x9e: // toggle GPS like triple press does
|
||||
if (gps != nullptr) {
|
||||
gps->toggleGpsMode();
|
||||
}
|
||||
if (screen)
|
||||
screen->forceDisplay();
|
||||
runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
|
||||
break;
|
||||
|
||||
// mute (switch off/toggle) external notifications on fn+m
|
||||
case 0xac:
|
||||
if (moduleConfig.external_notification.enabled == true) {
|
||||
if (externalNotificationModule->getMute()) {
|
||||
externalNotificationModule->setMute(false);
|
||||
runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
|
||||
} else {
|
||||
externalNotificationModule->stopNow(); // this will turn off all GPIO and sounds and idle the loop
|
||||
externalNotificationModule->setMute(true);
|
||||
runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0xaf: // fn+space send network ping like double press does
|
||||
service.refreshLocalMeshNode();
|
||||
service.sendNetworkPing(NODENUM_BROADCAST, true);
|
||||
runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
|
||||
break;
|
||||
default:
|
||||
if (this->cursor == this->freetext.length()) {
|
||||
|
@ -336,7 +336,7 @@ ExternalNotificationModule::ExternalNotificationModule()
|
||||
|
||||
ProcessMessage ExternalNotificationModule::handleReceived(const meshtastic_MeshPacket &mp)
|
||||
{
|
||||
if (moduleConfig.external_notification.enabled) {
|
||||
if (moduleConfig.external_notification.enabled && !isMuted) {
|
||||
#ifdef T_WATCH_S3
|
||||
drv.setWaveform(0, 75);
|
||||
drv.setWaveform(1, 56);
|
||||
@ -445,7 +445,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const meshtastic_MeshP
|
||||
setIntervalFromNow(0); // run once so we know if we should do something
|
||||
}
|
||||
} else {
|
||||
LOG_INFO("External Notification Module Disabled\n");
|
||||
LOG_INFO("External Notification Module Disabled or muted\n");
|
||||
}
|
||||
|
||||
return ProcessMessage::CONTINUE; // Let others look at this message also if they want
|
||||
|
@ -38,6 +38,9 @@ class ExternalNotificationModule : public SinglePortModule, private concurrency:
|
||||
void setExternalOff(uint8_t index = 0);
|
||||
bool getExternal(uint8_t index = 0);
|
||||
|
||||
void setMute(bool mute) { isMuted = mute; }
|
||||
bool getMute() { return isMuted; }
|
||||
|
||||
void stopNow();
|
||||
|
||||
void handleGetRingtone(const meshtastic_MeshPacket &req, meshtastic_AdminMessage *response);
|
||||
@ -56,6 +59,8 @@ class ExternalNotificationModule : public SinglePortModule, private concurrency:
|
||||
|
||||
bool isNagging = false;
|
||||
|
||||
bool isMuted = false;
|
||||
|
||||
virtual AdminMessageHandleResult handleAdminMessageForModule(const meshtastic_MeshPacket &mp,
|
||||
meshtastic_AdminMessage *request,
|
||||
meshtastic_AdminMessage *response) override;
|
||||
|
Loading…
Reference in New Issue
Block a user