Just putting back DELAYED_INTERVAL for reliability. Ran into problems

This commit is contained in:
Ben Meadors 2023-08-19 09:45:48 -05:00
parent 364364263b
commit f35c7be917

View File

@ -46,10 +46,7 @@ int32_t DetectionSensorModule::runOnce()
if ((millis() - lastSentToMesh) >= getConfiguredOrDefaultMs(moduleConfig.detection_sensor.minimum_broadcast_secs) && if ((millis() - lastSentToMesh) >= getConfiguredOrDefaultMs(moduleConfig.detection_sensor.minimum_broadcast_secs) &&
hasDetectionEvent()) { hasDetectionEvent()) {
sendDetectionMessage(); sendDetectionMessage();
return getConfiguredOrDefaultMs(moduleConfig.detection_sensor.minimum_broadcast_secs < return DELAYED_INTERVAL;
moduleConfig.detection_sensor.state_broadcast_secs
? moduleConfig.detection_sensor.minimum_broadcast_secs
: moduleConfig.detection_sensor.state_broadcast_secs);
} }
// Even if we haven't detected an event, broadcast our current state to the mesh on the scheduled interval as a sort // Even if we haven't detected an event, broadcast our current state to the mesh on the scheduled interval as a sort
// of heartbeat. We only do this if the minimum broadcast interval is greater than zero, otherwise we'll only broadcast state // of heartbeat. We only do this if the minimum broadcast interval is greater than zero, otherwise we'll only broadcast state
@ -57,10 +54,7 @@ int32_t DetectionSensorModule::runOnce()
else if (moduleConfig.detection_sensor.state_broadcast_secs > 0 && else if (moduleConfig.detection_sensor.state_broadcast_secs > 0 &&
(millis() - lastSentToMesh) >= getConfiguredOrDefaultMs(moduleConfig.detection_sensor.state_broadcast_secs)) { (millis() - lastSentToMesh) >= getConfiguredOrDefaultMs(moduleConfig.detection_sensor.state_broadcast_secs)) {
sendCurrentStateMessage(); sendCurrentStateMessage();
return getConfiguredOrDefaultMs(moduleConfig.detection_sensor.minimum_broadcast_secs < return DELAYED_INTERVAL;
moduleConfig.detection_sensor.state_broadcast_secs
? moduleConfig.detection_sensor.minimum_broadcast_secs
: moduleConfig.detection_sensor.state_broadcast_secs);
} }
return GPIO_POLLING_INTERVAL; return GPIO_POLLING_INTERVAL;
} }