From 19af44f7dcfad2fbe0c2c4a93b3d61968ada8d79 Mon Sep 17 00:00:00 2001 From: Charles Miller Date: Wed, 26 Nov 2025 16:05:04 +0000 Subject: [PATCH 1/2] Move nRFSenseSleep logic to header section for NRF52 Relocates the conditional setting of nRFSenseSleep for NRF52 architecture from runOnce() to the header section, ensuring it is set earlier in the module lifecycle. This change means that the sleep lib is only imported on supported platforms, reducing binary size on other platforms --- src/modules/DetectionSensorModule.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/modules/DetectionSensorModule.cpp b/src/modules/DetectionSensorModule.cpp index dd79ad22d17..722a21f54d3 100644 --- a/src/modules/DetectionSensorModule.cpp +++ b/src/modules/DetectionSensorModule.cpp @@ -5,8 +5,14 @@ #include "PowerFSM.h" #include "configuration.h" #include "main.h" -#include "sleep.h" #include +#ifdef ARCH_NRF52 + #include "sleep.h" + if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) { + nRFSenseSleep = true; + } +#endif + DetectionSensorModule *detectionSensorModule; #define GPIO_POLLING_INTERVAL 100 @@ -64,12 +70,6 @@ int32_t DetectionSensorModule::runOnce() if (moduleConfig.detection_sensor.enabled == false) return disable(); - -#ifdef ARCH_NRF52 - if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) { - nRFSenseSleep = true; - } -#endif if (firstTime) { From 6b5c323c800c7e8050ac6c084d8cdccdcecf1d37 Mon Sep 17 00:00:00 2001 From: Charles Miller Date: Wed, 26 Nov 2025 16:05:59 +0000 Subject: [PATCH 2/2] Remove background priority assignment for non-sensor devices Eliminated the explicit setting of BACKGROUND priority for non-sensor devices in sendCurrentStateMessage. This would otherwise affect all nodes using the DetectionSensor module in roles other than Sensor. --- src/modules/DetectionSensorModule.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/modules/DetectionSensorModule.cpp b/src/modules/DetectionSensorModule.cpp index 722a21f54d3..c66e58adc29 100644 --- a/src/modules/DetectionSensorModule.cpp +++ b/src/modules/DetectionSensorModule.cpp @@ -202,8 +202,6 @@ void DetectionSensorModule::sendCurrentStateMessage(bool state) p->decoded.payload.size = strlen(message); if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR) p->priority = meshtastic_MeshPacket_Priority_RELIABLE; - else - p->priority = meshtastic_MeshPacket_Priority_BACKGROUND; memcpy(p->decoded.payload.bytes, message, p->decoded.payload.size); lastSentToMesh = millis();