From 9e9ffc5c05ff05824e81b0652735ec3877d8ecfb Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 13 Aug 2023 06:43:07 -0500 Subject: [PATCH] Added new Detection module for easier detection of state changes --- meshtastic/admin.proto | 5 ++++ meshtastic/localonly.proto | 12 ++++++++- meshtastic/module_config.options | 5 +++- meshtastic/module_config.proto | 46 ++++++++++++++++++++++++++++++-- 4 files changed, 64 insertions(+), 4 deletions(-) diff --git a/meshtastic/admin.proto b/meshtastic/admin.proto index e629a87..e628757 100644 --- a/meshtastic/admin.proto +++ b/meshtastic/admin.proto @@ -119,6 +119,11 @@ message AdminMessage { * TODO: REPLACE */ AMBIENTLIGHTING_CONFIG = 10; + + /* + * TODO: REPLACE + */ + DETECTION_CONFIG = 11; } /* diff --git a/meshtastic/localonly.proto b/meshtastic/localonly.proto index 4b51795..fed0cbf 100644 --- a/meshtastic/localonly.proto +++ b/meshtastic/localonly.proto @@ -111,10 +111,20 @@ message LocalModuleConfig { */ ModuleConfig.NeighborInfoConfig neighbor_info = 11; + /* + * The part of the config that is specific to the Neighbor Info module + */ + ModuleConfig.AmbientLightingConfig ambient_lighting = 12; + + /* + * The part of the config that is specific to the Neighbor Info module + */ + ModuleConfig.DetectionConfig detection = 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; -} +} \ No newline at end of file diff --git a/meshtastic/module_config.options b/meshtastic/module_config.options index ed45932..558a209 100644 --- a/meshtastic/module_config.options +++ b/meshtastic/module_config.options @@ -22,4 +22,7 @@ *AmbientLightingConfig.current int_size:8 *AmbientLightingConfig.red int_size:8 *AmbientLightingConfig.green int_size:8 -*AmbientLightingConfig.blue int_size:8 \ No newline at end of file +*AmbientLightingConfig.blue int_size:8 + +*DetectionConfig.monitor_pin int_size:8 +*DetectionConfig.name max_size:20 \ No newline at end of file diff --git a/meshtastic/module_config.proto b/meshtastic/module_config.proto index 75fb96f..232bdb7 100644 --- a/meshtastic/module_config.proto +++ b/meshtastic/module_config.proto @@ -108,6 +108,45 @@ message ModuleConfig { uint32 update_interval = 2; } + /* + * Detection Module Config + */ + message DetectionConfig { + /* + * Whether the Module is enabled + */ + bool enabled = 1; + + /* + * Interval in seconds of how often we can send a message, if a state change is detected + */ + uint32 minumum_update_interval = 2; + + /* + * GPIO pin to monitor for state changes + */ + uint32 monitor_pin = 3; + + /* + * Whether or not the GPIO pin state detection is triggered on HIGH (1) + * Otherwise LOW (0) + */ + bool detection_triggered_high = 4; + + /* + * Send ASCII bell with alert message + * Useful for trigger ext. notification on bell + */ + bool send_bell = 5; + + /* + * 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 = 6; + } + /* * Audio Config for codec2 voice */ @@ -614,9 +653,12 @@ message ModuleConfig { * TODO: REPLACE */ AmbientLightingConfig ambient_lighting = 11; + + /* + * TODO: REPLACE + */ + DetectionConfig detection = 12; } - - } /*