From 918b509be8c2730489feac888981187facb694c9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 3 Apr 2023 10:45:37 -0500 Subject: [PATCH 1/3] [create-pull-request] automated change (#2408) Co-authored-by: thebentern --- protobufs | 2 +- src/mesh/generated/meshtastic/deviceonly.pb.h | 2 +- src/mesh/generated/meshtastic/localonly.pb.h | 2 +- src/mesh/generated/meshtastic/module_config.pb.h | 14 +++++++++----- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/protobufs b/protobufs index ef83ba1d9..641d7c3a4 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit ef83ba1d913941e8cb9a5a5973009c37765c46fa +Subproject commit 641d7c3a460de9cc580bc2b8a0812e8b9d417b05 diff --git a/src/mesh/generated/meshtastic/deviceonly.pb.h b/src/mesh/generated/meshtastic/deviceonly.pb.h index 40523a07a..6788bd426 100644 --- a/src/mesh/generated/meshtastic/deviceonly.pb.h +++ b/src/mesh/generated/meshtastic/deviceonly.pb.h @@ -188,7 +188,7 @@ extern const pb_msgdesc_t meshtastic_OEMStore_msg; /* Maximum encoded size of messages (where known) */ #define meshtastic_ChannelFile_size 638 #define meshtastic_DeviceState_size 22040 -#define meshtastic_OEMStore_size 3022 +#define meshtastic_OEMStore_size 3024 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/localonly.pb.h b/src/mesh/generated/meshtastic/localonly.pb.h index cf97544e0..23865f47d 100644 --- a/src/mesh/generated/meshtastic/localonly.pb.h +++ b/src/mesh/generated/meshtastic/localonly.pb.h @@ -157,7 +157,7 @@ extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg; /* Maximum encoded size of messages (where known) */ #define meshtastic_LocalConfig_size 456 -#define meshtastic_LocalModuleConfig_size 420 +#define meshtastic_LocalModuleConfig_size 422 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/module_config.pb.h b/src/mesh/generated/meshtastic/module_config.pb.h index 82d8e8d04..f94114e15 100644 --- a/src/mesh/generated/meshtastic/module_config.pb.h +++ b/src/mesh/generated/meshtastic/module_config.pb.h @@ -96,6 +96,8 @@ typedef struct _meshtastic_ModuleConfig_MQTTConfig { bool encryption_enabled; /* Whether to send / consume json packets on MQTT */ bool json_enabled; + /* If true, we attempt to establish a secure connection using TLS */ + bool tls_enabled; } meshtastic_ModuleConfig_MQTTConfig; /* RemoteHardwareModule Config */ @@ -323,7 +325,7 @@ extern "C" { /* Initializer values for message structs */ #define meshtastic_ModuleConfig_init_default {0, {meshtastic_ModuleConfig_MQTTConfig_init_default}} -#define meshtastic_ModuleConfig_MQTTConfig_init_default {0, "", "", "", 0, 0} +#define meshtastic_ModuleConfig_MQTTConfig_init_default {0, "", "", "", 0, 0, 0} #define meshtastic_ModuleConfig_RemoteHardwareConfig_init_default {0} #define meshtastic_ModuleConfig_AudioConfig_init_default {0, 0, _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MIN, 0, 0, 0, 0} #define meshtastic_ModuleConfig_SerialConfig_init_default {0, 0, 0, 0, _meshtastic_ModuleConfig_SerialConfig_Serial_Baud_MIN, 0, _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MIN} @@ -333,7 +335,7 @@ extern "C" { #define meshtastic_ModuleConfig_TelemetryConfig_init_default {0, 0, 0, 0, 0, 0, 0} #define meshtastic_ModuleConfig_CannedMessageConfig_init_default {0, 0, 0, 0, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0} #define meshtastic_ModuleConfig_init_zero {0, {meshtastic_ModuleConfig_MQTTConfig_init_zero}} -#define meshtastic_ModuleConfig_MQTTConfig_init_zero {0, "", "", "", 0, 0} +#define meshtastic_ModuleConfig_MQTTConfig_init_zero {0, "", "", "", 0, 0, 0} #define meshtastic_ModuleConfig_RemoteHardwareConfig_init_zero {0} #define meshtastic_ModuleConfig_AudioConfig_init_zero {0, 0, _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MIN, 0, 0, 0, 0} #define meshtastic_ModuleConfig_SerialConfig_init_zero {0, 0, 0, 0, _meshtastic_ModuleConfig_SerialConfig_Serial_Baud_MIN, 0, _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MIN} @@ -350,6 +352,7 @@ extern "C" { #define meshtastic_ModuleConfig_MQTTConfig_password_tag 4 #define meshtastic_ModuleConfig_MQTTConfig_encryption_enabled_tag 5 #define meshtastic_ModuleConfig_MQTTConfig_json_enabled_tag 6 +#define meshtastic_ModuleConfig_MQTTConfig_tls_enabled_tag 7 #define meshtastic_ModuleConfig_RemoteHardwareConfig_enabled_tag 1 #define meshtastic_ModuleConfig_AudioConfig_codec2_enabled_tag 1 #define meshtastic_ModuleConfig_AudioConfig_ptt_pin_tag 2 @@ -444,7 +447,8 @@ X(a, STATIC, SINGULAR, STRING, address, 2) \ X(a, STATIC, SINGULAR, STRING, username, 3) \ X(a, STATIC, SINGULAR, STRING, password, 4) \ X(a, STATIC, SINGULAR, BOOL, encryption_enabled, 5) \ -X(a, STATIC, SINGULAR, BOOL, json_enabled, 6) +X(a, STATIC, SINGULAR, BOOL, json_enabled, 6) \ +X(a, STATIC, SINGULAR, BOOL, tls_enabled, 7) #define meshtastic_ModuleConfig_MQTTConfig_CALLBACK NULL #define meshtastic_ModuleConfig_MQTTConfig_DEFAULT NULL @@ -562,13 +566,13 @@ extern const pb_msgdesc_t meshtastic_ModuleConfig_CannedMessageConfig_msg; #define meshtastic_ModuleConfig_AudioConfig_size 19 #define meshtastic_ModuleConfig_CannedMessageConfig_size 49 #define meshtastic_ModuleConfig_ExternalNotificationConfig_size 40 -#define meshtastic_ModuleConfig_MQTTConfig_size 201 +#define meshtastic_ModuleConfig_MQTTConfig_size 203 #define meshtastic_ModuleConfig_RangeTestConfig_size 10 #define meshtastic_ModuleConfig_RemoteHardwareConfig_size 2 #define meshtastic_ModuleConfig_SerialConfig_size 26 #define meshtastic_ModuleConfig_StoreForwardConfig_size 22 #define meshtastic_ModuleConfig_TelemetryConfig_size 26 -#define meshtastic_ModuleConfig_size 204 +#define meshtastic_ModuleConfig_size 206 #ifdef __cplusplus } /* extern "C" */ From 038ff0f6cb7ef0816de363f396ef5dff9f3bb88a Mon Sep 17 00:00:00 2001 From: Manuel Verch Date: Sun, 2 Apr 2023 21:28:12 +0200 Subject: [PATCH 2/3] Fix for device display issues --- src/PowerFSM.cpp | 19 ++++++++++++++++--- src/graphics/Screen.cpp | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp index 518c94d92..48a94444b 100644 --- a/src/PowerFSM.cpp +++ b/src/PowerFSM.cpp @@ -172,7 +172,13 @@ static void powerEnter() } else { screen->setOn(true); setBluetoothEnable(true); - screen->print("Powered...\n"); + // within enter() the function getState() returns the state we came from + if (strcmp(powerFSM.getState()->name, "BOOT") != 0 && + strcmp(powerFSM.getState()->name, "POWER") != 0 && + strcmp(powerFSM.getState()->name, "DARK") != 0) + { + screen->print("Powered...\n"); + } } } @@ -189,7 +195,8 @@ static void powerExit() { screen->setOn(true); setBluetoothEnable(true); - screen->print("Unpowered...\n"); + if (!isPowered()) + screen->print("Unpowered...\n"); } static void onEnter() @@ -249,7 +256,7 @@ void PowerFSM_setup() // Handle press events - note: we ignore button presses when in API mode powerFSM.add_transition(&stateLS, &stateON, EVENT_PRESS, NULL, "Press"); powerFSM.add_transition(&stateNB, &stateON, EVENT_PRESS, NULL, "Press"); - powerFSM.add_transition(&stateDARK, &stateON, EVENT_PRESS, NULL, "Press"); + powerFSM.add_transition(&stateDARK, isPowered() ? &statePOWER : &stateON, EVENT_PRESS, NULL, "Press"); powerFSM.add_transition(&statePOWER, &statePOWER, EVENT_PRESS, screenPress, "Press"); powerFSM.add_transition(&stateON, &stateON, EVENT_PRESS, screenPress, "Press"); // reenter On to restart our timers powerFSM.add_transition(&stateSERIAL, &stateSERIAL, EVENT_PRESS, screenPress, @@ -322,6 +329,12 @@ void PowerFSM_setup() powerFSM.add_timed_transition(&stateON, &stateDARK, getConfiguredOrDefaultMs(config.display.screen_on_secs, default_screen_on_secs), NULL, "Screen-on timeout"); + powerFSM.add_timed_transition(&statePOWER, &stateDARK, + getConfiguredOrDefaultMs(config.display.screen_on_secs, default_screen_on_secs), NULL, + "Screen-on timeout"); + powerFSM.add_timed_transition(&stateDARK, &stateDARK, + getConfiguredOrDefaultMs(config.display.screen_on_secs, default_screen_on_secs), NULL, + "Screen-on timeout"); #ifdef ARCH_ESP32 State *lowPowerState = &stateLS; diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index b5a74b386..482e76450 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -1206,7 +1206,7 @@ void Screen::setFrames() LOG_DEBUG("Total frame count: %d\n", totalFrameCount); // We don't show the node info our our node (if we have it yet - we should) - size_t numnodes = nodeStatus->getNumTotal(); + size_t numnodes = nodeDB.getNumNodes(); if (numnodes > 0) numnodes--; From 9a42861766f9db7f0ffc863e700b8e775a81385a Mon Sep 17 00:00:00 2001 From: Manuel Verch Date: Mon, 3 Apr 2023 08:52:21 +0200 Subject: [PATCH 3/3] make trunk happy --- src/PowerFSM.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp index 48a94444b..1c3441769 100644 --- a/src/PowerFSM.cpp +++ b/src/PowerFSM.cpp @@ -173,10 +173,8 @@ static void powerEnter() screen->setOn(true); setBluetoothEnable(true); // within enter() the function getState() returns the state we came from - if (strcmp(powerFSM.getState()->name, "BOOT") != 0 && - strcmp(powerFSM.getState()->name, "POWER") != 0 && - strcmp(powerFSM.getState()->name, "DARK") != 0) - { + if (strcmp(powerFSM.getState()->name, "BOOT") != 0 && strcmp(powerFSM.getState()->name, "POWER") != 0 && + strcmp(powerFSM.getState()->name, "DARK") != 0) { screen->print("Powered...\n"); } }