From c67a0103ab5e62ed3cd2402498f643206666a8e5 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Fri, 13 Jun 2025 01:13:03 -0500 Subject: [PATCH] All Canned All the time --- src/input/ExpressLRSFiveWay.cpp | 8 +------- src/mesh/NodeDB.cpp | 1 - src/modules/CannedMessageModule.cpp | 25 ++++++++----------------- 3 files changed, 9 insertions(+), 25 deletions(-) diff --git a/src/input/ExpressLRSFiveWay.cpp b/src/input/ExpressLRSFiveWay.cpp index dc5fa247c..1981a45d4 100644 --- a/src/input/ExpressLRSFiveWay.cpp +++ b/src/input/ExpressLRSFiveWay.cpp @@ -243,15 +243,9 @@ void ExpressLRSFiveWay::shutdown() shutdownAtMsec = millis() + 3000; } -// Emulate user button, or canned message SELECT -// This is necessary as canned message module doesn't translate SELECT to user button presses if the module is disabled -// Contained as one method for easier remapping of buttons by user void ExpressLRSFiveWay::click() { - if (!moduleConfig.canned_message.enabled) - powerFSM.trigger(EVENT_PRESS); - else - sendKey(INPUT_BROKER_SELECT); + sendKey(INPUT_BROKER_SELECT); } ExpressLRSFiveWay *expressLRSFiveWayInput = nullptr; diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 9de392ee6..bcefa23bd 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -793,7 +793,6 @@ void NodeDB::installDefaultModuleConfig() moduleConfig.external_notification.nag_timeout = 60; #endif moduleConfig.has_canned_message = true; - moduleConfig.canned_message.enabled = true; #if USERPREFS_MQTT_ENABLED && !MESHTASTIC_EXCLUDE_MQTT moduleConfig.mqtt.enabled = true; #endif diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index b5dc4909e..375a36e58 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -48,20 +48,15 @@ CannedMessageModule *cannedMessageModule; CannedMessageModule::CannedMessageModule() : SinglePortModule("canned", meshtastic_PortNum_TEXT_MESSAGE_APP), concurrency::OSThread("CannedMessage") { - if (moduleConfig.canned_message.enabled || CANNED_MESSAGE_MODULE_ENABLE) { - this->loadProtoForModule(); - if ((this->splitConfiguredMessages() <= 0) && (cardkb_found.address == 0x00) && !INPUTBROKER_MATRIX_TYPE && - !CANNED_MESSAGE_MODULE_ENABLE) { - LOG_INFO("CannedMessageModule: No messages are configured. Module is disabled"); - this->runState = CANNED_MESSAGE_RUN_STATE_DISABLED; - disable(); - } else { - LOG_INFO("CannedMessageModule is enabled"); - this->inputObserver.observe(inputBroker); - } - } else { + this->loadProtoForModule(); + if ((this->splitConfiguredMessages() <= 0) && (cardkb_found.address == 0x00) && !INPUTBROKER_MATRIX_TYPE && + !CANNED_MESSAGE_MODULE_ENABLE) { + LOG_INFO("CannedMessageModule: No messages are configured. Module is disabled"); this->runState = CANNED_MESSAGE_RUN_STATE_DISABLED; disable(); + } else { + LOG_INFO("CannedMessageModule is enabled"); + this->inputObserver.observe(inputBroker); } } static bool returnToCannedList = false; @@ -832,8 +827,7 @@ int32_t CannedMessageModule::runOnce() } // Normal module disable/idle handling - if (((!moduleConfig.canned_message.enabled) && !CANNED_MESSAGE_MODULE_ENABLE) || - (this->runState == CANNED_MESSAGE_RUN_STATE_DISABLED) || (this->runState == CANNED_MESSAGE_RUN_STATE_INACTIVE)) { + if ((this->runState == CANNED_MESSAGE_RUN_STATE_DISABLED) || (this->runState == CANNED_MESSAGE_RUN_STATE_INACTIVE)) { temporaryMessage = ""; return INT32_MAX; } @@ -1020,9 +1014,6 @@ const char *CannedMessageModule::getNodeName(NodeNum node) bool CannedMessageModule::shouldDraw() { - if (!moduleConfig.canned_message.enabled && !CANNED_MESSAGE_MODULE_ENABLE) { - return false; - } return (currentMessageIndex != -1) || (this->runState != CANNED_MESSAGE_RUN_STATE_INACTIVE); }