From e8e209be25dbb2260997798cf00a8cd5ae464d3a Mon Sep 17 00:00:00 2001 From: Mike Kinney Date: Fri, 28 Jan 2022 00:11:16 +0000 Subject: [PATCH 1/4] gpio read and write work as expected --- src/plugins/RemoteHardwarePlugin.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/RemoteHardwarePlugin.cpp b/src/plugins/RemoteHardwarePlugin.cpp index 55f22ccba..9da7ae218 100644 --- a/src/plugins/RemoteHardwarePlugin.cpp +++ b/src/plugins/RemoteHardwarePlugin.cpp @@ -17,7 +17,7 @@ /// Set pin modes for every set bit in a mask static void pinModes(uint64_t mask, uint8_t mode) { - for (uint8_t i = 0; i < NUM_GPIOS; i++) { + for (uint64_t i = 0; i < NUM_GPIOS; i++) { if (mask & (1 << i)) { pinMode(i, mode); } @@ -29,13 +29,17 @@ static uint64_t digitalReads(uint64_t mask) { uint64_t res = 0; - pinModes(mask, INPUT_PULLUP); + // The Arduino docs show to run pinMode(). But, when testing, found it is best not to. + // If the line below is uncommented, read will flip the pin to the default of the second + // argument in pinModes(), which will make the read turn the PIN "on". + //pinModes(mask, INPUT_PULLUP); - for (uint8_t i = 0; i < NUM_GPIOS; i++) { + for (uint64_t i = 0; i < NUM_GPIOS; i++) { uint64_t m = 1 << i; if (mask & m) { - if (digitalRead(i)) + if (digitalRead(i)) { res |= m; + } } } @@ -79,6 +83,7 @@ bool RemoteHardwarePlugin::handleReceivedProtobuf(const MeshPacket &req, Hardwar HardwareMessage r = HardwareMessage_init_default; r.typ = HardwareMessage_Type_READ_GPIOS_REPLY; r.gpio_value = res; + r.gpio_mask = p.gpio_mask; MeshPacket *p2 = allocDataProtobuf(r); setReplyTo(p2, req); myReply = p2; From 56fb141ed0afe6536bfe574216a7db7d5772187d Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Thu, 27 Jan 2022 17:40:00 -0800 Subject: [PATCH 2/4] updating proto submodule to latest --- proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto b/proto index a9bba331e..07ed86d8b 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit a9bba331e69b16ba7cd9b35d19b11732eff8d1b5 +Subproject commit 07ed86d8b44f53091fafd007f729a67f4785e270 From 266d6ad205508c8e86739e790c1cb2de567572f6 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Thu, 27 Jan 2022 17:52:03 -0800 Subject: [PATCH 3/4] Proto regen for .53 --- src/mesh/generated/admin.pb.h | 2 +- src/mesh/generated/deviceonly.pb.h | 2 +- src/mesh/generated/mesh.pb.h | 11 ++++++----- src/mesh/generated/radioconfig.pb.h | 13 ++++++++----- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/mesh/generated/admin.pb.h b/src/mesh/generated/admin.pb.h index bf9bde18b..6c754e097 100644 --- a/src/mesh/generated/admin.pb.h +++ b/src/mesh/generated/admin.pb.h @@ -145,7 +145,7 @@ extern const pb_msgdesc_t AdminMessage_msg; #define AdminMessage_fields &AdminMessage_msg /* Maximum encoded size of messages (where known) */ -#define AdminMessage_size 795 +#define AdminMessage_size 798 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/deviceonly.pb.h b/src/mesh/generated/deviceonly.pb.h index 39362ba1d..22a7c95f3 100644 --- a/src/mesh/generated/deviceonly.pb.h +++ b/src/mesh/generated/deviceonly.pb.h @@ -140,7 +140,7 @@ extern const pb_msgdesc_t ChannelFile_msg; /* Maximum encoded size of messages (where known) */ #define LegacyRadioConfig_size 4 #define LegacyRadioConfig_LegacyPreferences_size 2 -#define DeviceState_size 10981 +#define DeviceState_size 11014 #define ChannelFile_size 832 #ifdef __cplusplus diff --git a/src/mesh/generated/mesh.pb.h b/src/mesh/generated/mesh.pb.h index 246cfd823..ffdad870f 100644 --- a/src/mesh/generated/mesh.pb.h +++ b/src/mesh/generated/mesh.pb.h @@ -32,7 +32,8 @@ typedef enum _HardwareModel { HardwareModel_PORTDUINO = 37, HardwareModel_ANDROID_SIM = 38, HardwareModel_DIY_V1 = 39, - HardwareModel_RAK11200 = 40 + HardwareModel_RAK11200 = 40, + HardwareModel_PRIVATE_HW = 255 } HardwareModel; typedef enum _Team { @@ -286,8 +287,8 @@ typedef struct _ToRadio { /* Helper constants for enums */ #define _HardwareModel_MIN HardwareModel_UNSET -#define _HardwareModel_MAX HardwareModel_RAK11200 -#define _HardwareModel_ARRAYSIZE ((HardwareModel)(HardwareModel_RAK11200+1)) +#define _HardwareModel_MAX HardwareModel_PRIVATE_HW +#define _HardwareModel_ARRAYSIZE ((HardwareModel)(HardwareModel_PRIVATE_HW+1)) #define _Team_MIN Team_CLEAR #define _Team_MAX Team_BROWN @@ -645,12 +646,12 @@ extern const pb_msgdesc_t ToRadio_PeerInfo_msg; /* Maximum encoded size of messages (where known) */ #define Position_size 153 -#define User_size 96 +#define User_size 97 #define RouteDiscovery_size 40 #define Routing_size 42 #define Data_size 267 #define MeshPacket_size 318 -#define NodeInfo_size 270 +#define NodeInfo_size 271 #define MyNodeInfo_size 457 #define LogRecord_size 81 #define FromRadio_size 466 diff --git a/src/mesh/generated/radioconfig.pb.h b/src/mesh/generated/radioconfig.pb.h index 3b71a7629..6c37e695d 100644 --- a/src/mesh/generated/radioconfig.pb.h +++ b/src/mesh/generated/radioconfig.pb.h @@ -184,6 +184,7 @@ typedef struct _RadioConfig_UserPreferences { char canned_message_plugin_allow_input_source[16]; char canned_message_plugin_messages[200]; bool canned_message_plugin_send_bell; + bool mqtt_encryption_enabled; } RadioConfig_UserPreferences; typedef struct _RadioConfig { @@ -232,9 +233,9 @@ extern "C" { /* Initializer values for message structs */ #define RadioConfig_init_default {false, RadioConfig_UserPreferences_init_default} -#define RadioConfig_UserPreferences_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, 0, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, "", 0, _GpsCoordinateFormat_MIN, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType_MIN, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, 0, 0, 0, 0, 0, _InputEventChar_MIN, _InputEventChar_MIN, _InputEventChar_MIN, 0, "", "", 0} +#define RadioConfig_UserPreferences_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, 0, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, "", 0, _GpsCoordinateFormat_MIN, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType_MIN, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, 0, 0, 0, 0, 0, _InputEventChar_MIN, _InputEventChar_MIN, _InputEventChar_MIN, 0, "", "", 0, 0} #define RadioConfig_init_zero {false, RadioConfig_UserPreferences_init_zero} -#define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, 0, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, "", 0, _GpsCoordinateFormat_MIN, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType_MIN, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, 0, 0, 0, 0, 0, _InputEventChar_MIN, _InputEventChar_MIN, _InputEventChar_MIN, 0, "", "", 0} +#define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, 0, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, "", 0, _GpsCoordinateFormat_MIN, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType_MIN, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, 0, 0, 0, 0, 0, _InputEventChar_MIN, _InputEventChar_MIN, _InputEventChar_MIN, 0, "", "", 0, 0} /* Field tags (for use in manual encoding/decoding) */ #define RadioConfig_UserPreferences_position_broadcast_secs_tag 1 @@ -318,6 +319,7 @@ extern "C" { #define RadioConfig_UserPreferences_canned_message_plugin_allow_input_source_tag 171 #define RadioConfig_UserPreferences_canned_message_plugin_messages_tag 172 #define RadioConfig_UserPreferences_canned_message_plugin_send_bell_tag 173 +#define RadioConfig_UserPreferences_mqtt_encryption_enabled_tag 174 #define RadioConfig_preferences_tag 1 /* Struct field encoding specification for nanopb */ @@ -408,7 +410,8 @@ X(a, STATIC, SINGULAR, UENUM, rotary1_event_press, 166) \ X(a, STATIC, SINGULAR, BOOL, canned_message_plugin_enabled, 170) \ X(a, STATIC, SINGULAR, STRING, canned_message_plugin_allow_input_source, 171) \ X(a, STATIC, SINGULAR, STRING, canned_message_plugin_messages, 172) \ -X(a, STATIC, SINGULAR, BOOL, canned_message_plugin_send_bell, 173) +X(a, STATIC, SINGULAR, BOOL, canned_message_plugin_send_bell, 173) \ +X(a, STATIC, SINGULAR, BOOL, mqtt_encryption_enabled, 174) #define RadioConfig_UserPreferences_CALLBACK NULL #define RadioConfig_UserPreferences_DEFAULT NULL @@ -420,8 +423,8 @@ extern const pb_msgdesc_t RadioConfig_UserPreferences_msg; #define RadioConfig_UserPreferences_fields &RadioConfig_UserPreferences_msg /* Maximum encoded size of messages (where known) */ -#define RadioConfig_size 792 -#define RadioConfig_UserPreferences_size 789 +#define RadioConfig_size 795 +#define RadioConfig_UserPreferences_size 792 #ifdef __cplusplus } /* extern "C" */ From 19c1f9fa59fa5b4909e4caa0384bdb6e027f2606 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Thu, 27 Jan 2022 18:41:29 -0800 Subject: [PATCH 4/4] Bump to 1.2.53 --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index 5b1bdaf4d..3ac8c36b5 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 1 minor = 2 -build = 52 +build = 53