Skip to content

Commit

Permalink
Merge pull request #381 from meshtastic/detection-module
Browse files Browse the repository at this point in the history
New Detection Sensor module for messaging the mesh on detected state changes
  • Loading branch information
thebentern authored Aug 14, 2023
2 parents 6320d67 + 0486457 commit dc28ae3
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 6 deletions.
5 changes: 5 additions & 0 deletions meshtastic/admin.proto
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ message AdminMessage {
* TODO: REPLACE
*/
AMBIENTLIGHTING_CONFIG = 10;

/*
* TODO: REPLACE
*/
DETECTIONSENSOR_CONFIG = 11;
}

/*
Expand Down
2 changes: 1 addition & 1 deletion meshtastic/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ message Config {
uint32 broadcast_smart_minimum_distance = 10;

/*
* The minumum number of seconds (since the last send) before we can send a position to the mesh if position_broadcast_smart_enabled
* The minimum number of seconds (since the last send) before we can send a position to the mesh if position_broadcast_smart_enabled
*/
uint32 broadcast_smart_minimum_interval_secs = 11;
}
Expand Down
12 changes: 11 additions & 1 deletion meshtastic/localonly.proto
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,20 @@ message LocalModuleConfig {
*/
ModuleConfig.NeighborInfoConfig neighbor_info = 11;

/*
* The part of the config that is specific to the Ambient Lighting module
*/
ModuleConfig.AmbientLightingConfig ambient_lighting = 12;

/*
* The part of the config that is specific to the Detection Sensor module
*/
ModuleConfig.DetectionSensorConfig detection_sensor = 13;

/*
* A version integer used to invalidate old save files when we make
* incompatible changes This integer is set at build time and is private to
* NodeDB.cpp in the device code.
*/
uint32 version = 8;
}
}
2 changes: 1 addition & 1 deletion meshtastic/mesh.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ enum CriticalErrorCode {
TRANSMIT_FAILED = 8;

/*
* We detected that the main CPU voltage dropped below the minumum acceptable value
* We detected that the main CPU voltage dropped below the minimum acceptable value
*/
BROWNOUT = 9;

Expand Down
5 changes: 4 additions & 1 deletion meshtastic/module_config.options
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@
*AmbientLightingConfig.current int_size:8
*AmbientLightingConfig.red int_size:8
*AmbientLightingConfig.green int_size:8
*AmbientLightingConfig.blue int_size:8
*AmbientLightingConfig.blue int_size:8

*DetectionSensorConfig.monitor_pin int_size:8
*DetectionSensorConfig.name max_size:20
58 changes: 56 additions & 2 deletions meshtastic/module_config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,57 @@ message ModuleConfig {
uint32 update_interval = 2;
}

/*
* Detection Sensor Module Config
*/
message DetectionSensorConfig {
/*
* 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
*/
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
*/
uint32 state_broadcast_secs = 3;
/*
* Send ASCII bell with alert message
* Useful for triggering ext. notification on bell
*/
bool send_bell = 4;

/*
* Friendly name used to format message sent to mesh
* Example: A name "Motion" would result in a message "Motion detected"
* Maximum length of 20 characters
*/
string name = 5;

/*
* GPIO pin to monitor for state changes
*/
uint32 monitor_pin = 6;

/*
* Whether or not the GPIO pin state detection is triggered on HIGH (1)
* Otherwise LOW (0)
*/
bool detection_triggered_high = 7;

/*
* Whether or not use INPUT_PULLUP mode for GPIO pin
* Only applicable if the board uses pull-up resistors on the pin
*/
bool use_pullup = 8;
}

/*
* Audio Config for codec2 voice
*/
Expand Down Expand Up @@ -614,9 +665,12 @@ message ModuleConfig {
* TODO: REPLACE
*/
AmbientLightingConfig ambient_lighting = 11;
}


/*
* TODO: REPLACE
*/
DetectionSensorConfig detection_sensor = 12;
}
}

/*
Expand Down

0 comments on commit dc28ae3

Please sign in to comment.