Merge pull request #582 from augustozanellato/detsensor_broadcast_changes

Implement more flexible triggering in DetectionSensor
This commit is contained in:
Ben Meadors 2024-09-25 05:46:02 -05:00 committed by GitHub
commit 6ac91926c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 7 deletions

View file

@ -26,3 +26,4 @@
*DetectionSensorConfig.monitor_pin int_size:8
*DetectionSensorConfig.name max_size:20
*DetectionSensorConfig.detection_trigger_type max_size:8

View file

@ -137,20 +137,39 @@ message ModuleConfig {
* Detection Sensor Module Config
*/
message DetectionSensorConfig {
enum TriggerType {
// Event is triggered if pin is low
LOGIC_LOW = 0;
// Event is triggered if pin is high
LOGIC_HIGH = 1;
// Event is triggered when pin goes high to low
FALLING_EDGE = 2;
// Event is triggered when pin goes low to high
RISING_EDGE = 3;
// Event is triggered on every pin state change, low is considered to be
// "active"
EITHER_EDGE_ACTIVE_LOW = 4;
// Event is triggered on every pin state change, high is considered to be
// "active"
EITHER_EDGE_ACTIVE_HIGH = 5;
}
/*
* Whether the Module is enabled
*/
bool enabled = 1;
/*
* Interval in seconds of how often we can send a message to the mesh when a state change is detected
* Interval in seconds of how often we can send a message to the mesh when a
* trigger event is detected
*/
uint32 minimum_broadcast_secs = 2;
/*
* Interval in seconds of how often we should send a message to the mesh with the current state regardless of changes
* When set to 0, only state changes will be broadcasted
* Works as a sort of status heartbeat for peace of mind
* Interval in seconds of how often we should send a message to the mesh
* with the current state regardless of trigger events When set to 0, only
* trigger events will be broadcasted Works as a sort of status heartbeat
* for peace of mind
*/
uint32 state_broadcast_secs = 3;
@ -173,10 +192,9 @@ message ModuleConfig {
uint32 monitor_pin = 6;
/*
* Whether or not the GPIO pin state detection is triggered on HIGH (1)
* Otherwise LOW (0)
* The type of trigger event to be used
*/
bool detection_triggered_high = 7;
TriggerType detection_trigger_type = 7;
/*
* Whether or not use INPUT_PULLUP mode for GPIO pin