From 9e9ffc5c05ff05824e81b0652735ec3877d8ecfb Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 13 Aug 2023 06:43:07 -0500 Subject: [PATCH 1/8] 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 e629a877..e6287579 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 4b517950..fed0cbf5 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 ed459324..558a2090 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 75fb96f6..232bdb7b 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; + } } /* From 3c5c9acf923197fcb28867bfb5710d9367d45816 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 13 Aug 2023 06:47:58 -0500 Subject: [PATCH 2/8] Words --- meshtastic/module_config.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshtastic/module_config.proto b/meshtastic/module_config.proto index 232bdb7b..e9ee0926 100644 --- a/meshtastic/module_config.proto +++ b/meshtastic/module_config.proto @@ -118,7 +118,7 @@ message ModuleConfig { bool enabled = 1; /* - * Interval in seconds of how often we can send a message, if a state change is detected + * Interval in seconds of how often we can send a message to the mesh when a state change is detected */ uint32 minumum_update_interval = 2; From a726d6242e2e48ebac6efd7e5d0a37e3a38209f8 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 13 Aug 2023 08:10:24 -0500 Subject: [PATCH 3/8] Renamed to Detection Sensor --- meshtastic/admin.proto | 2 +- meshtastic/localonly.proto | 4 ++-- meshtastic/module_config.options | 4 ++-- meshtastic/module_config.proto | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/meshtastic/admin.proto b/meshtastic/admin.proto index e6287579..1fcd78d1 100644 --- a/meshtastic/admin.proto +++ b/meshtastic/admin.proto @@ -123,7 +123,7 @@ message AdminMessage { /* * TODO: REPLACE */ - DETECTION_CONFIG = 11; + DETECTIONSENSOR_CONFIG = 11; } /* diff --git a/meshtastic/localonly.proto b/meshtastic/localonly.proto index fed0cbf5..bc46b1cb 100644 --- a/meshtastic/localonly.proto +++ b/meshtastic/localonly.proto @@ -117,9 +117,9 @@ message LocalModuleConfig { ModuleConfig.AmbientLightingConfig ambient_lighting = 12; /* - * The part of the config that is specific to the Neighbor Info module + * The part of the config that is specific to the Detection Sensor module */ - ModuleConfig.DetectionConfig detection = 13; + ModuleConfig.DetectionSensorConfig detection_sensor = 13; /* * A version integer used to invalidate old save files when we make diff --git a/meshtastic/module_config.options b/meshtastic/module_config.options index 558a2090..fdc46d5f 100644 --- a/meshtastic/module_config.options +++ b/meshtastic/module_config.options @@ -24,5 +24,5 @@ *AmbientLightingConfig.green int_size:8 *AmbientLightingConfig.blue int_size:8 -*DetectionConfig.monitor_pin int_size:8 -*DetectionConfig.name max_size:20 \ No newline at end of file +*DetectionSensorConfig.monitor_pin int_size:8 +*DetectionSensorConfig.name max_size:20 \ No newline at end of file diff --git a/meshtastic/module_config.proto b/meshtastic/module_config.proto index e9ee0926..3491ca66 100644 --- a/meshtastic/module_config.proto +++ b/meshtastic/module_config.proto @@ -109,9 +109,9 @@ message ModuleConfig { } /* - * Detection Module Config + * Detection Sensor Module Config */ - message DetectionConfig { + message DetectionSensorConfig { /* * Whether the Module is enabled */ @@ -657,7 +657,7 @@ message ModuleConfig { /* * TODO: REPLACE */ - DetectionConfig detection = 12; + DetectionSensorConfig detection_sensor = 12; } } From e94a5f16645507f6961582ea1613f132b4a19366 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 13 Aug 2023 08:11:21 -0500 Subject: [PATCH 4/8] Spelling --- meshtastic/module_config.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshtastic/module_config.proto b/meshtastic/module_config.proto index 3491ca66..e6a1b347 100644 --- a/meshtastic/module_config.proto +++ b/meshtastic/module_config.proto @@ -120,7 +120,7 @@ message ModuleConfig { /* * Interval in seconds of how often we can send a message to the mesh when a state change is detected */ - uint32 minumum_update_interval = 2; + uint32 minimum_update_interval = 2; /* * GPIO pin to monitor for state changes From e6a12394c2b996d1c1bb6d92e956c49dea58e01c Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 13 Aug 2023 08:12:14 -0500 Subject: [PATCH 5/8] More minumums! --- meshtastic/config.proto | 2 +- meshtastic/mesh.proto | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/meshtastic/config.proto b/meshtastic/config.proto index e72c39c7..5da460f8 100644 --- a/meshtastic/config.proto +++ b/meshtastic/config.proto @@ -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; } diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index 2e93e3dc..4d0ec0f7 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -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; From 56f62b29377e1f43be49e6beb55a17c8aca1b4c5 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 13 Aug 2023 14:10:38 -0500 Subject: [PATCH 6/8] Added state_broadcast_secs --- meshtastic/module_config.proto | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/meshtastic/module_config.proto b/meshtastic/module_config.proto index e6a1b347..9fabbf87 100644 --- a/meshtastic/module_config.proto +++ b/meshtastic/module_config.proto @@ -120,31 +120,38 @@ message ModuleConfig { /* * Interval in seconds of how often we can send a message to the mesh when a state change is detected */ - uint32 minimum_update_interval = 2; + 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; /* * GPIO pin to monitor for state changes */ - uint32 monitor_pin = 3; + uint32 monitor_pin = 43; /* * Whether or not the GPIO pin state detection is triggered on HIGH (1) * Otherwise LOW (0) */ - bool detection_triggered_high = 4; + bool detection_triggered_high = 5; /* * Send ASCII bell with alert message - * Useful for trigger ext. notification on bell + * Useful for triggering ext. notification on bell */ - bool send_bell = 5; + bool send_bell = 6; /* * 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; + string name = 7; } /* From 9993a1df74e02c18e9c586c494904103c50c7f5d Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 13 Aug 2023 19:02:39 -0500 Subject: [PATCH 7/8] Fixed copy pasta and index --- meshtastic/localonly.proto | 2 +- meshtastic/module_config.proto | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/meshtastic/localonly.proto b/meshtastic/localonly.proto index bc46b1cb..5f46f9ae 100644 --- a/meshtastic/localonly.proto +++ b/meshtastic/localonly.proto @@ -112,7 +112,7 @@ message LocalModuleConfig { ModuleConfig.NeighborInfoConfig neighbor_info = 11; /* - * The part of the config that is specific to the Neighbor Info module + * The part of the config that is specific to the Ambient Lighting module */ ModuleConfig.AmbientLightingConfig ambient_lighting = 12; diff --git a/meshtastic/module_config.proto b/meshtastic/module_config.proto index 9fabbf87..89b053aa 100644 --- a/meshtastic/module_config.proto +++ b/meshtastic/module_config.proto @@ -132,7 +132,7 @@ message ModuleConfig { /* * GPIO pin to monitor for state changes */ - uint32 monitor_pin = 43; + uint32 monitor_pin = 4; /* * Whether or not the GPIO pin state detection is triggered on HIGH (1) From 04864570c561212ba6f66cbb113abcd3c292ac24 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 14 Aug 2023 06:34:35 -0500 Subject: [PATCH 8/8] use_pullup --- meshtastic/module_config.proto | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/meshtastic/module_config.proto b/meshtastic/module_config.proto index 89b053aa..649a343f 100644 --- a/meshtastic/module_config.proto +++ b/meshtastic/module_config.proto @@ -128,30 +128,35 @@ message ModuleConfig { * 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; /* - * GPIO pin to monitor for state changes + * 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 */ - uint32 monitor_pin = 4; + string name = 5; /* - * Whether or not the GPIO pin state detection is triggered on HIGH (1) - * Otherwise LOW (0) + * GPIO pin to monitor for state changes */ - bool detection_triggered_high = 5; + uint32 monitor_pin = 6; /* - * Send ASCII bell with alert message - * Useful for triggering ext. notification on bell + * Whether or not the GPIO pin state detection is triggered on HIGH (1) + * Otherwise LOW (0) */ - bool send_bell = 6; + bool detection_triggered_high = 7; /* - * 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 + * Whether or not use INPUT_PULLUP mode for GPIO pin + * Only applicable if the board uses pull-up resistors on the pin */ - string name = 7; + bool use_pullup = 8; } /*