Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement more flexible triggering in DetectionSensor #582

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions meshtastic/module_config.options
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@

*DetectionSensorConfig.monitor_pin int_size:8
*DetectionSensorConfig.name max_size:20
*DetectionSensorConfig.detection_trigger_type max_size:8
32 changes: 25 additions & 7 deletions meshtastic/module_config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
augustozanellato marked this conversation as resolved.
Show resolved Hide resolved

/*
* Whether or not use INPUT_PULLUP mode for GPIO pin
Expand Down