All Canned All the time

This commit is contained in:
Jonathan Bennett 2025-06-13 01:13:03 -05:00
parent 4317d477b9
commit c67a0103ab
3 changed files with 9 additions and 25 deletions

View File

@ -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;

View File

@ -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

View File

@ -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);
}