From 05139e0db136700be1b4fe2b552d37822b6a8b5b Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 15 May 2023 08:03:42 -0500 Subject: [PATCH 01/13] Added remote hardware pins plumbing --- meshtastic/deviceonly.options | 2 ++ meshtastic/deviceonly.proto | 21 ++++++++++++++++++ meshtastic/mesh.options | 2 ++ meshtastic/mesh.proto | 38 ++++++++++++++++++++++++++++++++ meshtastic/module_config.options | 2 ++ meshtastic/module_config.proto | 10 +++++++++ 6 files changed, 75 insertions(+) diff --git a/meshtastic/deviceonly.options b/meshtastic/deviceonly.options index fe51ce9..1612592 100644 --- a/meshtastic/deviceonly.options +++ b/meshtastic/deviceonly.options @@ -12,3 +12,5 @@ *OEMStore.oem_text max_size:40 *OEMStore.oem_icon_bits max_size:2048 *OEMStore.oem_aes_key max_size:32 + +*NodeRemoteHardwarePins.node_remote_hardware_pins max_count:12 \ No newline at end of file diff --git a/meshtastic/deviceonly.proto b/meshtastic/deviceonly.proto index 4528608..fb3924e 100644 --- a/meshtastic/deviceonly.proto +++ b/meshtastic/deviceonly.proto @@ -72,6 +72,11 @@ message DeviceState { * Might be null */ MeshPacket rx_waypoint = 12; + + /* + * The mesh's nodes with their available gpio pins for RemoteHardware module + */ + repeated NodeRemoteHardwarePins node_remote_hardware_pins = 13; } /* @@ -158,4 +163,20 @@ message OEMStore { * A Preset LocalModuleConfig to apply during factory reset */ LocalModuleConfig oem_local_module_config = 8; +} + +/* + * RemoteHardwarePins associated with a node + */ +message NodeRemoteHardwarePin { + + /* + * The node_num exposing the available gpio pin + */ + uint32 node_num = 1; + + /* + * The the available gpio pin for usage with RemoteHardware module + */ + RemoteHardwarePin pin = 2; } \ No newline at end of file diff --git a/meshtastic/mesh.options b/meshtastic/mesh.options index c28b91c..55a9012 100644 --- a/meshtastic/mesh.options +++ b/meshtastic/mesh.options @@ -54,3 +54,5 @@ *NeighborInfo.neighbors max_count:10 *DeviceMetadata.firmware_version max_size:18 + +*RemoteHardwarePin.name max_size:15 diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index eadc0a6..28b563d 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -1469,3 +1469,41 @@ message Neighbor { */ HardwareModel hw_model = 9; } + +/* + * A GPIO pin definition for remote hardware module + */ +message RemoteHardwarePin { + /* + * GPIO Pin number (must match Arduino) + */ + uint32 gpio_pin = 1; + + /* + * Name for the GPIO pin (i.e. Front gate, mailbox, etc) + */ + string name = 2; + + /* + * Type of GPIO access available to consumers on the mesh + */ + RemoteHardwarePinType type = 3; +} + +enum RemoteHardwarePinType { + + /* + * Unset/unused (should never occur) + */ + UNSET = 0; + + /* + * GPIO pin can be read (if it is high / low) + */ + ANALOG_READ = 1; + + /* + * GPIO pin can be written to (high / low) + */ + ANALOG_WRITE = 2; +} diff --git a/meshtastic/module_config.options b/meshtastic/module_config.options index bcc8bd7..bae2bcd 100644 --- a/meshtastic/module_config.options +++ b/meshtastic/module_config.options @@ -14,3 +14,5 @@ *ExternalNotificationConfig.output_vibra int_size:8 *ExternalNotificationConfig.output_buzzer int_size:8 *ExternalNotificationConfig.nag_timeout int_size:16 + +*RemoteHardwareConfig:available_pins max_count:4 \ No newline at end of file diff --git a/meshtastic/module_config.proto b/meshtastic/module_config.proto index 40a8ef6..2d12149 100644 --- a/meshtastic/module_config.proto +++ b/meshtastic/module_config.proto @@ -78,6 +78,16 @@ message ModuleConfig { * Whether the Module is enabled */ bool enabled = 1; + + /* + * Whether the Module allows consumers to read / write to pins not defined in available_pins + */ + bool allow_undefined_pin_access = 2; + + /* + * Exposes the available pins to the mesh for reading and writing + */ + repeated RemoteHardwarePin available_pins = 3: } /* From 5a6fd96e4815ed60876b4db9b4c01950b1ae0e96 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 15 May 2023 08:09:52 -0500 Subject: [PATCH 02/13] Rename --- meshtastic/mesh.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index 28b563d..fa9dbd5 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -1500,10 +1500,10 @@ enum RemoteHardwarePinType { /* * GPIO pin can be read (if it is high / low) */ - ANALOG_READ = 1; + DIGITAL_READ = 1; /* * GPIO pin can be written to (high / low) */ - ANALOG_WRITE = 2; + DIGITAL_WRITE = 2; } From 47892ff9c48dfd62a2930a4460c4e1d68636b0a0 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 15 May 2023 10:54:52 -0500 Subject: [PATCH 03/13] Add to device metadata and remote hardware config --- meshtastic/mesh.options | 1 + meshtastic/mesh.proto | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/meshtastic/mesh.options b/meshtastic/mesh.options index 55a9012..4ad510a 100644 --- a/meshtastic/mesh.options +++ b/meshtastic/mesh.options @@ -54,5 +54,6 @@ *NeighborInfo.neighbors max_count:10 *DeviceMetadata.firmware_version max_size:18 +*DeviceMetadata:remote_hardware_pins max_count:4 *RemoteHardwarePin.name max_size:15 diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index fa9dbd5..fb34864 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -1468,6 +1468,11 @@ message Neighbor { * Device hardware model */ HardwareModel hw_model = 9; + + /* + * Available GPIO pins for RemoteHardware module + */ + repeated RemoteHardwarePin remote_hardware_pins = 10; } /* From b282f897919a5c78c2217995d6f4b45da65c8da1 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 15 May 2023 13:09:42 -0500 Subject: [PATCH 04/13] Remove remote hardware pins from metadata --- meshtastic/mesh.proto | 5 ----- 1 file changed, 5 deletions(-) diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index fb34864..fa9dbd5 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -1468,11 +1468,6 @@ message Neighbor { * Device hardware model */ HardwareModel hw_model = 9; - - /* - * Available GPIO pins for RemoteHardware module - */ - repeated RemoteHardwarePin remote_hardware_pins = 10; } /* From d4fb42818bce8e484eaf53442f8ef65b37e4b0b0 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 15 May 2023 13:17:15 -0500 Subject: [PATCH 05/13] Semi --- 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 2d12149..1a83da1 100644 --- a/meshtastic/module_config.proto +++ b/meshtastic/module_config.proto @@ -87,7 +87,7 @@ message ModuleConfig { /* * Exposes the available pins to the mesh for reading and writing */ - repeated RemoteHardwarePin available_pins = 3: + repeated RemoteHardwarePin available_pins = 3; } /* From 3970d1c54333bd1b83cc8f6ac44340c767a72198 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 15 May 2023 13:27:29 -0500 Subject: [PATCH 06/13] Move to module_config --- meshtastic/mesh.proto | 38 ---------------------------------- meshtastic/module_config.proto | 38 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index fa9dbd5..eadc0a6 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -1469,41 +1469,3 @@ message Neighbor { */ HardwareModel hw_model = 9; } - -/* - * A GPIO pin definition for remote hardware module - */ -message RemoteHardwarePin { - /* - * GPIO Pin number (must match Arduino) - */ - uint32 gpio_pin = 1; - - /* - * Name for the GPIO pin (i.e. Front gate, mailbox, etc) - */ - string name = 2; - - /* - * Type of GPIO access available to consumers on the mesh - */ - RemoteHardwarePinType type = 3; -} - -enum RemoteHardwarePinType { - - /* - * Unset/unused (should never occur) - */ - UNSET = 0; - - /* - * GPIO pin can be read (if it is high / low) - */ - DIGITAL_READ = 1; - - /* - * GPIO pin can be written to (high / low) - */ - DIGITAL_WRITE = 2; -} diff --git a/meshtastic/module_config.proto b/meshtastic/module_config.proto index 1a83da1..a15b92a 100644 --- a/meshtastic/module_config.proto +++ b/meshtastic/module_config.proto @@ -568,3 +568,41 @@ message ModuleConfig { } } + +/* + * A GPIO pin definition for remote hardware module + */ + message RemoteHardwarePin { + /* + * GPIO Pin number (must match Arduino) + */ + uint32 gpio_pin = 1; + + /* + * Name for the GPIO pin (i.e. Front gate, mailbox, etc) + */ + string name = 2; + + /* + * Type of GPIO access available to consumers on the mesh + */ + RemoteHardwarePinType type = 3; +} + +enum RemoteHardwarePinType { + + /* + * Unset/unused (should never occur) + */ + UNSET = 0; + + /* + * GPIO pin can be read (if it is high / low) + */ + DIGITAL_READ = 1; + + /* + * GPIO pin can be written to (high / low) + */ + DIGITAL_WRITE = 2; +} From 284f96a075982637668b4fb40a10b5f861a5e3bd Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 15 May 2023 14:00:29 -0500 Subject: [PATCH 07/13] Tweaks --- meshtastic/mesh.proto | 5 +++++ meshtastic/module_config.proto | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index eadc0a6..750c7d1 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -1468,4 +1468,9 @@ message Neighbor { * Device hardware model */ HardwareModel hw_model = 9; + + /* + * Has Remote Hardware enabled + */ + bool hasRemoteHardware = 10; } diff --git a/meshtastic/module_config.proto b/meshtastic/module_config.proto index a15b92a..33d6290 100644 --- a/meshtastic/module_config.proto +++ b/meshtastic/module_config.proto @@ -590,12 +590,6 @@ message ModuleConfig { } enum RemoteHardwarePinType { - - /* - * Unset/unused (should never occur) - */ - UNSET = 0; - /* * GPIO pin can be read (if it is high / low) */ From 63ae4f243feb4320dbb16143a8d37ec496503e3d Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 15 May 2023 14:17:25 -0500 Subject: [PATCH 08/13] Derp --- meshtastic/module_config.proto | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/meshtastic/module_config.proto b/meshtastic/module_config.proto index 33d6290..91eb4c6 100644 --- a/meshtastic/module_config.proto +++ b/meshtastic/module_config.proto @@ -590,6 +590,11 @@ message ModuleConfig { } enum RemoteHardwarePinType { + /* + * Unset/unused + */ + UNKNOWN = 0; + /* * GPIO pin can be read (if it is high / low) */ From a6bd218c85312728a2a1d109bdc6210983dfd0bd Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 15 May 2023 14:41:34 -0500 Subject: [PATCH 09/13] Move options --- meshtastic/deviceonly.proto | 1 + meshtastic/mesh.options | 5 ----- meshtastic/module_config.options | 3 ++- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/meshtastic/deviceonly.proto b/meshtastic/deviceonly.proto index fb3924e..d0baf68 100644 --- a/meshtastic/deviceonly.proto +++ b/meshtastic/deviceonly.proto @@ -11,6 +11,7 @@ option swift_prefix = ""; import "meshtastic/channel.proto"; import "meshtastic/localonly.proto"; import "meshtastic/mesh.proto"; +import "meshtastic/module_config.proto"; /* * This message is never sent over the wire, but it is used for serializing DB diff --git a/meshtastic/mesh.options b/meshtastic/mesh.options index 4ad510a..ec1f766 100644 --- a/meshtastic/mesh.options +++ b/meshtastic/mesh.options @@ -52,8 +52,3 @@ *Waypoint.description max_size:100 *NeighborInfo.neighbors max_count:10 - -*DeviceMetadata.firmware_version max_size:18 -*DeviceMetadata:remote_hardware_pins max_count:4 - -*RemoteHardwarePin.name max_size:15 diff --git a/meshtastic/module_config.options b/meshtastic/module_config.options index bae2bcd..6c38d34 100644 --- a/meshtastic/module_config.options +++ b/meshtastic/module_config.options @@ -15,4 +15,5 @@ *ExternalNotificationConfig.output_buzzer int_size:8 *ExternalNotificationConfig.nag_timeout int_size:16 -*RemoteHardwareConfig:available_pins max_count:4 \ No newline at end of file +*RemoteHardwareConfig:available_pins max_count:4 +*RemoteHardwarePin.name max_size:15 \ No newline at end of file From 7801f67ffd4ee13623baf09a584c432775abf37d Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 15 May 2023 14:43:05 -0500 Subject: [PATCH 10/13] DeviceState --- meshtastic/deviceonly.options | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshtastic/deviceonly.options b/meshtastic/deviceonly.options index 1612592..a4588a5 100644 --- a/meshtastic/deviceonly.options +++ b/meshtastic/deviceonly.options @@ -13,4 +13,4 @@ *OEMStore.oem_icon_bits max_size:2048 *OEMStore.oem_aes_key max_size:32 -*NodeRemoteHardwarePins.node_remote_hardware_pins max_count:12 \ No newline at end of file +*DeviceState.node_remote_hardware_pins max_count:12 \ No newline at end of file From f2d68f11ee06f3216908e5038357867d07262094 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 15 May 2023 14:53:28 -0500 Subject: [PATCH 11/13] Singular and ready to mingular? --- meshtastic/deviceonly.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshtastic/deviceonly.proto b/meshtastic/deviceonly.proto index d0baf68..b533321 100644 --- a/meshtastic/deviceonly.proto +++ b/meshtastic/deviceonly.proto @@ -77,7 +77,7 @@ message DeviceState { /* * The mesh's nodes with their available gpio pins for RemoteHardware module */ - repeated NodeRemoteHardwarePins node_remote_hardware_pins = 13; + repeated NodeRemoteHardwarePin node_remote_hardware_pins = 13; } /* From 1b3976d221743d3852194505beea9559748a11b2 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 15 May 2023 14:57:43 -0500 Subject: [PATCH 12/13] Size 8, hon --- meshtastic/module_config.options | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meshtastic/module_config.options b/meshtastic/module_config.options index 6c38d34..dcf6e89 100644 --- a/meshtastic/module_config.options +++ b/meshtastic/module_config.options @@ -16,4 +16,5 @@ *ExternalNotificationConfig.nag_timeout int_size:16 *RemoteHardwareConfig:available_pins max_count:4 -*RemoteHardwarePin.name max_size:15 \ No newline at end of file +*RemoteHardwarePin.name max_size:15 +*RemoteHardwarePin.gpio_pin int_size:8 \ No newline at end of file From 139f3f0ed039aa6bee086e9529c7fd79cb162ec1 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 15 May 2023 15:12:41 -0500 Subject: [PATCH 13/13] We can rebuild him --- meshtastic/mesh.options | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meshtastic/mesh.options b/meshtastic/mesh.options index ec1f766..35e4dc6 100644 --- a/meshtastic/mesh.options +++ b/meshtastic/mesh.options @@ -52,3 +52,5 @@ *Waypoint.description max_size:100 *NeighborInfo.neighbors max_count:10 + +*DeviceMetadata.firmware_version max_size:18 \ No newline at end of file