From b0a6c8929ce80ec8479bfb7fedbea58db5c5d035 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Mon, 6 Dec 2021 21:01:18 -0800 Subject: [PATCH 01/13] Save partial work for S&F --- src/plugins/esp32/StoreForwardPlugin.cpp | 13 ++++--------- src/plugins/esp32/StoreForwardPlugin.h | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/plugins/esp32/StoreForwardPlugin.cpp b/src/plugins/esp32/StoreForwardPlugin.cpp index 95f5be2e..39ad5014 100644 --- a/src/plugins/esp32/StoreForwardPlugin.cpp +++ b/src/plugins/esp32/StoreForwardPlugin.cpp @@ -38,9 +38,8 @@ int32_t StoreForwardPlugin::runOnce() this->packetHistoryTXQueue_index++; } } + DEBUG_MSG("SF myNodeInfo.bitrate = %f bytes / sec\n", myNodeInfo.bitrate); - // TODO: Dynamicly adjust the time this returns in the loop based on the size of the packets being actually - // transmitted. return (this->packetTimeMax); } else { DEBUG_MSG("Store & Forward Plugin - Disabled (is_router = false)\n"); @@ -408,13 +407,9 @@ StoreForwardPlugin::StoreForwardPlugin() // Popupate PSRAM with our data structures. this->populatePSRAM(); - // Calculate the packet time. - // this->packetTimeMax = RadioLibInterface::instance->getPacketTime(Constants_DATA_PAYLOAD_LEN); - // RadioLibInterface::instance->getPacketTime(Constants_DATA_PAYLOAD_LEN); - // RadioLibInterface::instance->getPacketTime(Constants_DATA_PAYLOAD_LEN); - // RadioInterface::getPacketTime(500)l - - this->packetTimeMax = 2000; + + //this->packetTimeMax = 2000; + //DEBUG_MSG("SF Time to Transmit maxPacketSize (%d bytes) %d ms\n", maxPacketSize, this->packetTimeMax); } else { DEBUG_MSG("Device has less than 1M of PSRAM free. Aborting startup.\n"); diff --git a/src/plugins/esp32/StoreForwardPlugin.h b/src/plugins/esp32/StoreForwardPlugin.h index 1f164171..65b4f189 100644 --- a/src/plugins/esp32/StoreForwardPlugin.h +++ b/src/plugins/esp32/StoreForwardPlugin.h @@ -33,7 +33,7 @@ class StoreForwardPlugin : public SinglePortPlugin, private concurrency::OSThrea uint32_t packetHistoryTXQueue_size; uint32_t packetHistoryTXQueue_index = 0; - uint32_t packetTimeMax = 0; + uint32_t packetTimeMax = 2000; public: StoreForwardPlugin(); From 55da39823b656b79e5fdc82a7fe99f1dc90532ef Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Wed, 8 Dec 2021 17:22:02 -0800 Subject: [PATCH 02/13] Update S&F protobuf --- src/mesh/generated/storeforward.pb.c | 3 ++ src/mesh/generated/storeforward.pb.h | 47 +++++++++++++++++++++------- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/src/mesh/generated/storeforward.pb.c b/src/mesh/generated/storeforward.pb.c index 5cca6d04..51f7c3b9 100644 --- a/src/mesh/generated/storeforward.pb.c +++ b/src/mesh/generated/storeforward.pb.c @@ -15,5 +15,8 @@ PB_BIND(StoreAndForward_Statistics, StoreAndForward_Statistics, AUTO) PB_BIND(StoreAndForward_History, StoreAndForward_History, AUTO) +PB_BIND(StoreAndForward_Heartbeat, StoreAndForward_Heartbeat, AUTO) + + diff --git a/src/mesh/generated/storeforward.pb.h b/src/mesh/generated/storeforward.pb.h index 76ca4187..950c05e8 100644 --- a/src/mesh/generated/storeforward.pb.h +++ b/src/mesh/generated/storeforward.pb.h @@ -17,17 +17,24 @@ typedef enum _StoreAndForward_RequestResponse { StoreAndForward_RequestResponse_ROUTER_PING = 3, StoreAndForward_RequestResponse_ROUTER_PONG = 4, StoreAndForward_RequestResponse_ROUTER_BUSY = 5, + StoreAndForward_RequestResponse_ROUTER_HISTORY = 6, StoreAndForward_RequestResponse_CLIENT_ERROR = 101, StoreAndForward_RequestResponse_CLIENT_HISTORY = 102, StoreAndForward_RequestResponse_CLIENT_STATS = 103, StoreAndForward_RequestResponse_CLIENT_PING = 104, - StoreAndForward_RequestResponse_CLIENT_PONG = 105 + StoreAndForward_RequestResponse_CLIENT_PONG = 105, + StoreAndForward_RequestResponse_CLIENT_ABORT = 106 } StoreAndForward_RequestResponse; /* Struct definitions */ +typedef struct _StoreAndForward_Heartbeat { + uint32_t heartbeatPeriod; +} StoreAndForward_Heartbeat; + typedef struct _StoreAndForward_History { uint32_t HistoryMessages; uint32_t Window; + uint32_t LastRequest; } StoreAndForward_History; typedef struct _StoreAndForward_Statistics { @@ -48,13 +55,15 @@ typedef struct _StoreAndForward { StoreAndForward_Statistics stats; bool has_history; StoreAndForward_History history; + bool has_heartbeat; + StoreAndForward_Heartbeat heartbeat; } StoreAndForward; /* Helper constants for enums */ #define _StoreAndForward_RequestResponse_MIN StoreAndForward_RequestResponse_UNSET -#define _StoreAndForward_RequestResponse_MAX StoreAndForward_RequestResponse_CLIENT_PONG -#define _StoreAndForward_RequestResponse_ARRAYSIZE ((StoreAndForward_RequestResponse)(StoreAndForward_RequestResponse_CLIENT_PONG+1)) +#define _StoreAndForward_RequestResponse_MAX StoreAndForward_RequestResponse_CLIENT_ABORT +#define _StoreAndForward_RequestResponse_ARRAYSIZE ((StoreAndForward_RequestResponse)(StoreAndForward_RequestResponse_CLIENT_ABORT+1)) #ifdef __cplusplus @@ -62,16 +71,20 @@ extern "C" { #endif /* Initializer values for message structs */ -#define StoreAndForward_init_default {_StoreAndForward_RequestResponse_MIN, false, StoreAndForward_Statistics_init_default, false, StoreAndForward_History_init_default} +#define StoreAndForward_init_default {_StoreAndForward_RequestResponse_MIN, false, StoreAndForward_Statistics_init_default, false, StoreAndForward_History_init_default, false, StoreAndForward_Heartbeat_init_default} #define StoreAndForward_Statistics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0} -#define StoreAndForward_History_init_default {0, 0} -#define StoreAndForward_init_zero {_StoreAndForward_RequestResponse_MIN, false, StoreAndForward_Statistics_init_zero, false, StoreAndForward_History_init_zero} +#define StoreAndForward_History_init_default {0, 0, 0} +#define StoreAndForward_Heartbeat_init_default {0} +#define StoreAndForward_init_zero {_StoreAndForward_RequestResponse_MIN, false, StoreAndForward_Statistics_init_zero, false, StoreAndForward_History_init_zero, false, StoreAndForward_Heartbeat_init_zero} #define StoreAndForward_Statistics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0} -#define StoreAndForward_History_init_zero {0, 0} +#define StoreAndForward_History_init_zero {0, 0, 0} +#define StoreAndForward_Heartbeat_init_zero {0} /* Field tags (for use in manual encoding/decoding) */ +#define StoreAndForward_Heartbeat_heartbeatPeriod_tag 1 #define StoreAndForward_History_HistoryMessages_tag 1 #define StoreAndForward_History_Window_tag 2 +#define StoreAndForward_History_LastRequest_tag 3 #define StoreAndForward_Statistics_MessagesTotal_tag 1 #define StoreAndForward_Statistics_MessagesSaved_tag 2 #define StoreAndForward_Statistics_MessagesMax_tag 3 @@ -84,16 +97,19 @@ extern "C" { #define StoreAndForward_rr_tag 1 #define StoreAndForward_stats_tag 2 #define StoreAndForward_history_tag 3 +#define StoreAndForward_heartbeat_tag 4 /* Struct field encoding specification for nanopb */ #define StoreAndForward_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UENUM, rr, 1) \ X(a, STATIC, OPTIONAL, MESSAGE, stats, 2) \ -X(a, STATIC, OPTIONAL, MESSAGE, history, 3) +X(a, STATIC, OPTIONAL, MESSAGE, history, 3) \ +X(a, STATIC, OPTIONAL, MESSAGE, heartbeat, 4) #define StoreAndForward_CALLBACK NULL #define StoreAndForward_DEFAULT NULL #define StoreAndForward_stats_MSGTYPE StoreAndForward_Statistics #define StoreAndForward_history_MSGTYPE StoreAndForward_History +#define StoreAndForward_heartbeat_MSGTYPE StoreAndForward_Heartbeat #define StoreAndForward_Statistics_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, MessagesTotal, 1) \ @@ -110,23 +126,32 @@ X(a, STATIC, SINGULAR, UINT32, ReturnWindow, 9) #define StoreAndForward_History_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, HistoryMessages, 1) \ -X(a, STATIC, SINGULAR, UINT32, Window, 2) +X(a, STATIC, SINGULAR, UINT32, Window, 2) \ +X(a, STATIC, SINGULAR, UINT32, LastRequest, 3) #define StoreAndForward_History_CALLBACK NULL #define StoreAndForward_History_DEFAULT NULL +#define StoreAndForward_Heartbeat_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, UINT32, heartbeatPeriod, 1) +#define StoreAndForward_Heartbeat_CALLBACK NULL +#define StoreAndForward_Heartbeat_DEFAULT NULL + extern const pb_msgdesc_t StoreAndForward_msg; extern const pb_msgdesc_t StoreAndForward_Statistics_msg; extern const pb_msgdesc_t StoreAndForward_History_msg; +extern const pb_msgdesc_t StoreAndForward_Heartbeat_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ #define StoreAndForward_fields &StoreAndForward_msg #define StoreAndForward_Statistics_fields &StoreAndForward_Statistics_msg #define StoreAndForward_History_fields &StoreAndForward_History_msg +#define StoreAndForward_Heartbeat_fields &StoreAndForward_Heartbeat_msg /* Maximum encoded size of messages (where known) */ -#define StoreAndForward_size 68 +#define StoreAndForward_size 82 #define StoreAndForward_Statistics_size 50 -#define StoreAndForward_History_size 12 +#define StoreAndForward_History_size 18 +#define StoreAndForward_Heartbeat_size 6 #ifdef __cplusplus } /* extern "C" */ From 0475cc93ab1477a47f60685cc1b8cafa02a23878 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Wed, 8 Dec 2021 23:56:38 -0800 Subject: [PATCH 03/13] Update storeforward.pb.h --- src/mesh/generated/storeforward.pb.h | 89 ++++++++++++++-------------- 1 file changed, 46 insertions(+), 43 deletions(-) diff --git a/src/mesh/generated/storeforward.pb.h b/src/mesh/generated/storeforward.pb.h index 950c05e8..9c346cd9 100644 --- a/src/mesh/generated/storeforward.pb.h +++ b/src/mesh/generated/storeforward.pb.h @@ -28,25 +28,26 @@ typedef enum _StoreAndForward_RequestResponse { /* Struct definitions */ typedef struct _StoreAndForward_Heartbeat { - uint32_t heartbeatPeriod; + uint32_t period; + uint32_t secondary; } StoreAndForward_Heartbeat; typedef struct _StoreAndForward_History { - uint32_t HistoryMessages; - uint32_t Window; - uint32_t LastRequest; + uint32_t history_messages; + uint32_t window; + uint32_t last_request; } StoreAndForward_History; typedef struct _StoreAndForward_Statistics { - uint32_t MessagesTotal; - uint32_t MessagesSaved; - uint32_t MessagesMax; - uint32_t UpTime; - uint32_t Requests; - uint32_t RequestsHistory; - bool Heartbeat; - uint32_t ReturnMax; - uint32_t ReturnWindow; + uint32_t messages_total; + uint32_t messages_saved; + uint32_t messages_max; + uint32_t up_time; + uint32_t requests; + uint32_t requests_history; + bool heartbeat; + uint32_t return_max; + uint32_t return_window; } StoreAndForward_Statistics; typedef struct _StoreAndForward { @@ -74,26 +75,27 @@ extern "C" { #define StoreAndForward_init_default {_StoreAndForward_RequestResponse_MIN, false, StoreAndForward_Statistics_init_default, false, StoreAndForward_History_init_default, false, StoreAndForward_Heartbeat_init_default} #define StoreAndForward_Statistics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0} #define StoreAndForward_History_init_default {0, 0, 0} -#define StoreAndForward_Heartbeat_init_default {0} +#define StoreAndForward_Heartbeat_init_default {0, 0} #define StoreAndForward_init_zero {_StoreAndForward_RequestResponse_MIN, false, StoreAndForward_Statistics_init_zero, false, StoreAndForward_History_init_zero, false, StoreAndForward_Heartbeat_init_zero} #define StoreAndForward_Statistics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0} #define StoreAndForward_History_init_zero {0, 0, 0} -#define StoreAndForward_Heartbeat_init_zero {0} +#define StoreAndForward_Heartbeat_init_zero {0, 0} /* Field tags (for use in manual encoding/decoding) */ -#define StoreAndForward_Heartbeat_heartbeatPeriod_tag 1 -#define StoreAndForward_History_HistoryMessages_tag 1 -#define StoreAndForward_History_Window_tag 2 -#define StoreAndForward_History_LastRequest_tag 3 -#define StoreAndForward_Statistics_MessagesTotal_tag 1 -#define StoreAndForward_Statistics_MessagesSaved_tag 2 -#define StoreAndForward_Statistics_MessagesMax_tag 3 -#define StoreAndForward_Statistics_UpTime_tag 4 -#define StoreAndForward_Statistics_Requests_tag 5 -#define StoreAndForward_Statistics_RequestsHistory_tag 6 -#define StoreAndForward_Statistics_Heartbeat_tag 7 -#define StoreAndForward_Statistics_ReturnMax_tag 8 -#define StoreAndForward_Statistics_ReturnWindow_tag 9 +#define StoreAndForward_Heartbeat_period_tag 1 +#define StoreAndForward_Heartbeat_secondary_tag 2 +#define StoreAndForward_History_history_messages_tag 1 +#define StoreAndForward_History_window_tag 2 +#define StoreAndForward_History_last_request_tag 3 +#define StoreAndForward_Statistics_messages_total_tag 1 +#define StoreAndForward_Statistics_messages_saved_tag 2 +#define StoreAndForward_Statistics_messages_max_tag 3 +#define StoreAndForward_Statistics_up_time_tag 4 +#define StoreAndForward_Statistics_requests_tag 5 +#define StoreAndForward_Statistics_requests_history_tag 6 +#define StoreAndForward_Statistics_heartbeat_tag 7 +#define StoreAndForward_Statistics_return_max_tag 8 +#define StoreAndForward_Statistics_return_window_tag 9 #define StoreAndForward_rr_tag 1 #define StoreAndForward_stats_tag 2 #define StoreAndForward_history_tag 3 @@ -112,27 +114,28 @@ X(a, STATIC, OPTIONAL, MESSAGE, heartbeat, 4) #define StoreAndForward_heartbeat_MSGTYPE StoreAndForward_Heartbeat #define StoreAndForward_Statistics_FIELDLIST(X, a) \ -X(a, STATIC, SINGULAR, UINT32, MessagesTotal, 1) \ -X(a, STATIC, SINGULAR, UINT32, MessagesSaved, 2) \ -X(a, STATIC, SINGULAR, UINT32, MessagesMax, 3) \ -X(a, STATIC, SINGULAR, UINT32, UpTime, 4) \ -X(a, STATIC, SINGULAR, UINT32, Requests, 5) \ -X(a, STATIC, SINGULAR, UINT32, RequestsHistory, 6) \ -X(a, STATIC, SINGULAR, BOOL, Heartbeat, 7) \ -X(a, STATIC, SINGULAR, UINT32, ReturnMax, 8) \ -X(a, STATIC, SINGULAR, UINT32, ReturnWindow, 9) +X(a, STATIC, SINGULAR, UINT32, messages_total, 1) \ +X(a, STATIC, SINGULAR, UINT32, messages_saved, 2) \ +X(a, STATIC, SINGULAR, UINT32, messages_max, 3) \ +X(a, STATIC, SINGULAR, UINT32, up_time, 4) \ +X(a, STATIC, SINGULAR, UINT32, requests, 5) \ +X(a, STATIC, SINGULAR, UINT32, requests_history, 6) \ +X(a, STATIC, SINGULAR, BOOL, heartbeat, 7) \ +X(a, STATIC, SINGULAR, UINT32, return_max, 8) \ +X(a, STATIC, SINGULAR, UINT32, return_window, 9) #define StoreAndForward_Statistics_CALLBACK NULL #define StoreAndForward_Statistics_DEFAULT NULL #define StoreAndForward_History_FIELDLIST(X, a) \ -X(a, STATIC, SINGULAR, UINT32, HistoryMessages, 1) \ -X(a, STATIC, SINGULAR, UINT32, Window, 2) \ -X(a, STATIC, SINGULAR, UINT32, LastRequest, 3) +X(a, STATIC, SINGULAR, UINT32, history_messages, 1) \ +X(a, STATIC, SINGULAR, UINT32, window, 2) \ +X(a, STATIC, SINGULAR, UINT32, last_request, 3) #define StoreAndForward_History_CALLBACK NULL #define StoreAndForward_History_DEFAULT NULL #define StoreAndForward_Heartbeat_FIELDLIST(X, a) \ -X(a, STATIC, SINGULAR, UINT32, heartbeatPeriod, 1) +X(a, STATIC, SINGULAR, UINT32, period, 1) \ +X(a, STATIC, SINGULAR, UINT32, secondary, 2) #define StoreAndForward_Heartbeat_CALLBACK NULL #define StoreAndForward_Heartbeat_DEFAULT NULL @@ -148,10 +151,10 @@ extern const pb_msgdesc_t StoreAndForward_Heartbeat_msg; #define StoreAndForward_Heartbeat_fields &StoreAndForward_Heartbeat_msg /* Maximum encoded size of messages (where known) */ -#define StoreAndForward_size 82 +#define StoreAndForward_size 88 #define StoreAndForward_Statistics_size 50 #define StoreAndForward_History_size 18 -#define StoreAndForward_Heartbeat_size 6 +#define StoreAndForward_Heartbeat_size 12 #ifdef __cplusplus } /* extern "C" */ From f119555c12c57d725f940bb310d7da9d1cccf9b1 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 11 Dec 2021 21:26:03 -0600 Subject: [PATCH 04/13] Convert to NimBLE Arduino (#985) --- .vscode/settings.json | 3 ++- platformio.ini | 6 +++++- src/nimble/BluetoothUtil.cpp | 1 - src/nimble/BluetoothUtil.h | 1 - src/nimble/NimbleBluetoothAPI.cpp | 1 - src/nimble/NimbleDefs.h | 1 - 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 455d58ff..4a61ccd2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -50,7 +50,8 @@ "cassert": "cpp", "iterator": "cpp", "shared_mutex": "cpp", - "iostream": "cpp" + "iostream": "cpp", + "esp_nimble_hci.h": "c" }, "cSpell.words": [ "Blox", diff --git a/platformio.ini b/platformio.ini index 4c223d65..8d9b0297 100644 --- a/platformio.ini +++ b/platformio.ini @@ -113,9 +113,13 @@ lib_deps = adafruit/Adafruit Unified Sensor@^1.1.4 paulstoffregen/OneWire@^2.3.5 robtillaart/DS18B20@^0.1.11 + h2zero/NimBLE-Arduino@^1.3.1 # Hmm - this doesn't work yet # board_build.ldscript = linker/esp32.extram.bss.ld -lib_ignore = segger_rtt +lib_ignore = + segger_rtt + ESP32 BLE Arduino + platform_packages = framework-arduinoespressif32@https://github.com/meshtastic/arduino-esp32.git#4cde0f5d412d2695184f32e8a47e9bea57b45276 diff --git a/src/nimble/BluetoothUtil.cpp b/src/nimble/BluetoothUtil.cpp index 2c69b0bc..eae2a6db 100644 --- a/src/nimble/BluetoothUtil.cpp +++ b/src/nimble/BluetoothUtil.cpp @@ -11,7 +11,6 @@ #include "services/gap/ble_svc_gap.h" #include "services/gatt/ble_svc_gatt.h" #include "sleep.h" -#include #include #ifndef NO_ESP32 diff --git a/src/nimble/BluetoothUtil.h b/src/nimble/BluetoothUtil.h index fe6d0e67..4e423769 100644 --- a/src/nimble/BluetoothUtil.h +++ b/src/nimble/BluetoothUtil.h @@ -1,6 +1,5 @@ #pragma once -#include #include /// We only allow one BLE connection at a time diff --git a/src/nimble/NimbleBluetoothAPI.cpp b/src/nimble/NimbleBluetoothAPI.cpp index da2f80ea..6b44e44d 100644 --- a/src/nimble/NimbleBluetoothAPI.cpp +++ b/src/nimble/NimbleBluetoothAPI.cpp @@ -3,7 +3,6 @@ #include "configuration.h" #include "nimble/BluetoothUtil.h" #include "nimble/NimbleDefs.h" -#include // This scratch buffer is used for various bluetooth reads/writes - but it is safe because only one bt operation can be in // proccess at once diff --git a/src/nimble/NimbleDefs.h b/src/nimble/NimbleDefs.h index 6b1db22e..7a2b0b46 100644 --- a/src/nimble/NimbleDefs.h +++ b/src/nimble/NimbleDefs.h @@ -11,7 +11,6 @@ #include "host/ble_uuid.h" #include "nimble/nimble_port.h" #include "nimble/nimble_port_freertos.h" -#include #ifdef __cplusplus extern "C" { From 1f4a3085ef6080c2fd016be59e5f851c467c9a2d Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 12 Dec 2021 07:54:29 -0600 Subject: [PATCH 05/13] Peg to specific version of NimBLE Arduino --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 8d9b0297..8d4f3a88 100644 --- a/platformio.ini +++ b/platformio.ini @@ -113,7 +113,7 @@ lib_deps = adafruit/Adafruit Unified Sensor@^1.1.4 paulstoffregen/OneWire@^2.3.5 robtillaart/DS18B20@^0.1.11 - h2zero/NimBLE-Arduino@^1.3.1 + h2zero/NimBLE-Arduino@1.3.1 # Hmm - this doesn't work yet # board_build.ldscript = linker/esp32.extram.bss.ld lib_ignore = From 0e5a783c5aba82063e62b2064ecb283a30ec3755 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sat, 18 Dec 2021 15:20:17 -0500 Subject: [PATCH 06/13] Show fixed position indicator on screen #866 Show fixed position indicator on screen #866 --- src/graphics/Screen.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index dc3f73d3..702708c8 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -428,7 +428,10 @@ static void drawGPScoordinates(OLEDDisplay *display, int16_t x, int16_t y, const auto gpsFormat = radioConfig.preferences.gps_format; String displayLine = ""; - if (!gps->getIsConnected() && !radioConfig.preferences.fixed_position) { + if (radioConfig.preferences.fixed_position) { + displayLine = "Fixed GPS"; + display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(displayLine))) / 2, y, displayLine); + } else if (!gps->getIsConnected() && !radioConfig.preferences.fixed_position) { displayLine = "No GPS Module"; display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(displayLine))) / 2, y, displayLine); } else if (!gps->getHasLock() && !radioConfig.preferences.fixed_position) { From 4fcd82d6f575f9108d963573296318e3e9b85071 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sat, 18 Dec 2021 15:51:44 -0500 Subject: [PATCH 07/13] updating proto submodule to latest --- proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto b/proto index 10e6857b..26389cfa 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit 10e6857b1bd4a03ec16ec5cbaadf4f28293ab9a5 +Subproject commit 26389cfa05f4980f318cc5c4ddbe3770a7865251 From d7a1b9fd62c93c5994adcdedb2ee37728afa6745 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sat, 18 Dec 2021 16:21:12 -0500 Subject: [PATCH 08/13] Allow hop_limit to be configured https://github.com/meshtastic/Meshtastic-device/issues/1007 --- src/mesh/ReliableRouter.cpp | 9 +++++++-- src/mesh/Router.cpp | 6 +++++- src/mesh/generated/admin.pb.h | 2 +- src/mesh/generated/radioconfig.pb.h | 13 ++++++++----- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/mesh/ReliableRouter.cpp b/src/mesh/ReliableRouter.cpp index dd2fd9b2..96aca502 100644 --- a/src/mesh/ReliableRouter.cpp +++ b/src/mesh/ReliableRouter.cpp @@ -16,8 +16,13 @@ ErrorCode ReliableRouter::send(MeshPacket *p) // If someone asks for acks on broadcast, we need the hop limit to be at least one, so that first node that receives our // message will rebroadcast. But asking for hop_limit 0 in that context means the client app has no preference on hop counts // and we want this message to get through the whole mesh, so use the default. - if (p->to == NODENUM_BROADCAST && p->hop_limit == 0) - p->hop_limit = HOP_RELIABLE; + if (p->to == NODENUM_BROADCAST && p->hop_limit == 0) { + if (radioConfig.preferences.hop_limit && radioConfig.preferences.hop_limit <= HOP_MAX) { + p->hop_limit = (radioConfig.preferences.hop_limit >= HOP_MAX) ? HOP_MAX : radioConfig.preferences.hop_limit; + } else { + p->hop_limit = HOP_RELIABLE; + } + } auto copy = packetPool.allocCopy(*p); startRetransmission(copy); diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index 053f3629..5c62b87a 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -115,7 +115,11 @@ MeshPacket *Router::allocForSending() p->which_payloadVariant = MeshPacket_decoded_tag; // Assume payload is decoded at start. p->from = nodeDB.getNodeNum(); p->to = NODENUM_BROADCAST; - p->hop_limit = HOP_RELIABLE; + if (radioConfig.preferences.hop_limit && radioConfig.preferences.hop_limit <= HOP_MAX) { + p->hop_limit = (radioConfig.preferences.hop_limit >= HOP_MAX) ? HOP_MAX : radioConfig.preferences.hop_limit; + } else { + p->hop_limit = HOP_RELIABLE; + } p->id = generatePacketId(); p->rx_time = getValidTime(RTCQualityFromNet); // Just in case we process the packet locally - make sure it has a valid timestamp diff --git a/src/mesh/generated/admin.pb.h b/src/mesh/generated/admin.pb.h index 670978a0..08c647ae 100644 --- a/src/mesh/generated/admin.pb.h +++ b/src/mesh/generated/admin.pb.h @@ -86,7 +86,7 @@ extern const pb_msgdesc_t AdminMessage_msg; #define AdminMessage_fields &AdminMessage_msg /* Maximum encoded size of messages (where known) */ -#define AdminMessage_size 454 +#define AdminMessage_size 461 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/radioconfig.pb.h b/src/mesh/generated/radioconfig.pb.h index ae13b867..8fb70d39 100644 --- a/src/mesh/generated/radioconfig.pb.h +++ b/src/mesh/generated/radioconfig.pb.h @@ -152,6 +152,7 @@ typedef struct _RadioConfig_UserPreferences { bool is_always_powered; uint32_t auto_screen_carousel_secs; uint32_t on_battery_shutdown_after_secs; + uint32_t hop_limit; } RadioConfig_UserPreferences; typedef struct _RadioConfig { @@ -196,9 +197,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} +#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} #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} +#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} /* Field tags (for use in manual encoding/decoding) */ #define RadioConfig_UserPreferences_position_broadcast_secs_tag 1 @@ -266,6 +267,7 @@ extern "C" { #define RadioConfig_UserPreferences_is_always_powered_tag 151 #define RadioConfig_UserPreferences_auto_screen_carousel_secs_tag 152 #define RadioConfig_UserPreferences_on_battery_shutdown_after_secs_tag 153 +#define RadioConfig_UserPreferences_hop_limit_tag 154 #define RadioConfig_preferences_tag 1 /* Struct field encoding specification for nanopb */ @@ -340,7 +342,8 @@ X(a, STATIC, SINGULAR, BOOL, store_forward_plugin_heartbeat, 149) \ X(a, STATIC, SINGULAR, UINT32, position_flags, 150) \ X(a, STATIC, SINGULAR, BOOL, is_always_powered, 151) \ X(a, STATIC, SINGULAR, UINT32, auto_screen_carousel_secs, 152) \ -X(a, STATIC, SINGULAR, UINT32, on_battery_shutdown_after_secs, 153) +X(a, STATIC, SINGULAR, UINT32, on_battery_shutdown_after_secs, 153) \ +X(a, STATIC, SINGULAR, UINT32, hop_limit, 154) #define RadioConfig_UserPreferences_CALLBACK NULL #define RadioConfig_UserPreferences_DEFAULT NULL @@ -352,8 +355,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 451 -#define RadioConfig_UserPreferences_size 448 +#define RadioConfig_size 458 +#define RadioConfig_UserPreferences_size 455 #ifdef __cplusplus } /* extern "C" */ From 3adb79bd187bc148773e458fec02845e45aa7015 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sun, 19 Dec 2021 13:54:51 -0500 Subject: [PATCH 09/13] updating proto submodule to latest --- proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto b/proto index 26389cfa..c52c8ef9 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit 26389cfa05f4980f318cc5c4ddbe3770a7865251 +Subproject commit c52c8ef99ead88a5edb73891b33247c54d37cb28 From d1d096d52ae43f7d69990b5fac177b55be727ad5 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sun, 19 Dec 2021 13:58:01 -0500 Subject: [PATCH 10/13] S&F - Describe if the message is real time or delayed in MeshPacket --- src/mesh/generated/admin.pb.h | 9 ++++++++- src/mesh/generated/deviceonly.pb.h | 2 +- src/mesh/generated/mesh.pb.h | 13 ++++++++----- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/mesh/generated/admin.pb.h b/src/mesh/generated/admin.pb.h index 550a00b9..670978a0 100644 --- a/src/mesh/generated/admin.pb.h +++ b/src/mesh/generated/admin.pb.h @@ -5,8 +5,8 @@ #define PB_ADMIN_PB_H_INCLUDED #include #include "channel.pb.h" -#include "mesh.pb.h" #include "radioconfig.pb.h" +#include "mesh.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. @@ -23,6 +23,8 @@ typedef struct _AdminMessage { RadioConfig get_radio_response; uint32_t get_channel_request; Channel get_channel_response; + bool get_owner_request; + User get_owner_response; bool confirm_set_channel; bool confirm_set_radio; bool exit_simulator; @@ -47,6 +49,8 @@ extern "C" { #define AdminMessage_get_radio_response_tag 5 #define AdminMessage_get_channel_request_tag 6 #define AdminMessage_get_channel_response_tag 7 +#define AdminMessage_get_owner_request_tag 8 +#define AdminMessage_get_owner_response_tag 9 #define AdminMessage_confirm_set_channel_tag 32 #define AdminMessage_confirm_set_radio_tag 33 #define AdminMessage_exit_simulator_tag 34 @@ -61,6 +65,8 @@ X(a, STATIC, ONEOF, BOOL, (variant,get_radio_request,get_radio_request) X(a, STATIC, ONEOF, MESSAGE, (variant,get_radio_response,get_radio_response), 5) \ X(a, STATIC, ONEOF, UINT32, (variant,get_channel_request,get_channel_request), 6) \ X(a, STATIC, ONEOF, MESSAGE, (variant,get_channel_response,get_channel_response), 7) \ +X(a, STATIC, ONEOF, BOOL, (variant,get_owner_request,get_owner_request), 8) \ +X(a, STATIC, ONEOF, MESSAGE, (variant,get_owner_response,get_owner_response), 9) \ X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_channel,confirm_set_channel), 32) \ X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_radio,confirm_set_radio), 33) \ X(a, STATIC, ONEOF, BOOL, (variant,exit_simulator,exit_simulator), 34) \ @@ -72,6 +78,7 @@ X(a, STATIC, ONEOF, INT32, (variant,reboot_seconds,reboot_seconds), 35) #define AdminMessage_variant_set_channel_MSGTYPE Channel #define AdminMessage_variant_get_radio_response_MSGTYPE RadioConfig #define AdminMessage_variant_get_channel_response_MSGTYPE Channel +#define AdminMessage_variant_get_owner_response_MSGTYPE User extern const pb_msgdesc_t AdminMessage_msg; diff --git a/src/mesh/generated/deviceonly.pb.h b/src/mesh/generated/deviceonly.pb.h index 46fdcac7..c87d9d81 100644 --- a/src/mesh/generated/deviceonly.pb.h +++ b/src/mesh/generated/deviceonly.pb.h @@ -125,7 +125,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 9936 +#define DeviceState_size 9939 #define ChannelFile_size 832 #ifdef __cplusplus diff --git a/src/mesh/generated/mesh.pb.h b/src/mesh/generated/mesh.pb.h index 8defe625..21be09fd 100644 --- a/src/mesh/generated/mesh.pb.h +++ b/src/mesh/generated/mesh.pb.h @@ -157,6 +157,7 @@ typedef struct _MyNodeInfo { uint32_t air_period_tx[24]; pb_size_t air_period_rx_count; uint32_t air_period_rx[24]; + bool has_wifi; } MyNodeInfo; typedef struct _Position { @@ -320,7 +321,7 @@ extern "C" { #define Data_init_default {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0} #define MeshPacket_init_default {0, 0, 0, 0, {Data_init_default}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0} #define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0} -#define MyNodeInfo_init_default {0, 0, 0, "", "", "", _CriticalErrorCode_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}, 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}} +#define MyNodeInfo_init_default {0, 0, 0, "", "", "", _CriticalErrorCode_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}, 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} #define LogRecord_init_default {"", 0, "", _LogRecord_Level_MIN} #define FromRadio_init_default {0, 0, {MyNodeInfo_init_default}} #define ToRadio_init_default {0, {MeshPacket_init_default}} @@ -332,7 +333,7 @@ extern "C" { #define Data_init_zero {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0} #define MeshPacket_init_zero {0, 0, 0, 0, {Data_init_zero}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0} #define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0} -#define MyNodeInfo_init_zero {0, 0, 0, "", "", "", _CriticalErrorCode_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}, 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}} +#define MyNodeInfo_init_zero {0, 0, 0, "", "", "", _CriticalErrorCode_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}, 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} #define LogRecord_init_zero {"", 0, "", _LogRecord_Level_MIN} #define FromRadio_init_zero {0, 0, {MyNodeInfo_init_zero}} #define ToRadio_init_zero {0, {MeshPacket_init_zero}} @@ -365,6 +366,7 @@ extern "C" { #define MyNodeInfo_max_channels_tag 15 #define MyNodeInfo_air_period_tx_tag 16 #define MyNodeInfo_air_period_rx_tag 17 +#define MyNodeInfo_has_wifi_tag 18 #define Position_latitude_i_tag 1 #define Position_longitude_i_tag 2 #define Position_altitude_tag 3 @@ -543,7 +545,8 @@ X(a, STATIC, SINGULAR, UINT32, message_timeout_msec, 13) \ X(a, STATIC, SINGULAR, UINT32, min_app_version, 14) \ X(a, STATIC, SINGULAR, UINT32, max_channels, 15) \ X(a, STATIC, REPEATED, UINT32, air_period_tx, 16) \ -X(a, STATIC, REPEATED, UINT32, air_period_rx, 17) +X(a, STATIC, REPEATED, UINT32, air_period_rx, 17) \ +X(a, STATIC, SINGULAR, BOOL, has_wifi, 18) #define MyNodeInfo_CALLBACK NULL #define MyNodeInfo_DEFAULT NULL @@ -621,9 +624,9 @@ extern const pb_msgdesc_t ToRadio_PeerInfo_msg; #define Data_size 260 #define MeshPacket_size 309 #define NodeInfo_size 270 -#define MyNodeInfo_size 442 +#define MyNodeInfo_size 445 #define LogRecord_size 81 -#define FromRadio_size 451 +#define FromRadio_size 454 #define ToRadio_size 312 #define ToRadio_PeerInfo_size 8 From 7af4a31329df8345f08419d6c8ea3911da55c770 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sun, 19 Dec 2021 14:02:36 -0500 Subject: [PATCH 11/13] Adding MeshPacket_Delayed --- src/mesh/generated/deviceonly.pb.h | 2 +- src/mesh/generated/mesh.pb.c | 1 + src/mesh/generated/mesh.pb.h | 23 ++++++++++++++++++----- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/mesh/generated/deviceonly.pb.h b/src/mesh/generated/deviceonly.pb.h index c87d9d81..2d4e53f0 100644 --- a/src/mesh/generated/deviceonly.pb.h +++ b/src/mesh/generated/deviceonly.pb.h @@ -125,7 +125,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 9939 +#define DeviceState_size 9943 #define ChannelFile_size 832 #ifdef __cplusplus diff --git a/src/mesh/generated/mesh.pb.c b/src/mesh/generated/mesh.pb.c index 5113bbdb..6846dc54 100644 --- a/src/mesh/generated/mesh.pb.c +++ b/src/mesh/generated/mesh.pb.c @@ -52,3 +52,4 @@ PB_BIND(ToRadio_PeerInfo, ToRadio_PeerInfo, AUTO) + diff --git a/src/mesh/generated/mesh.pb.h b/src/mesh/generated/mesh.pb.h index 21be09fd..8f4a7ffb 100644 --- a/src/mesh/generated/mesh.pb.h +++ b/src/mesh/generated/mesh.pb.h @@ -110,6 +110,12 @@ typedef enum _MeshPacket_Priority { MeshPacket_Priority_MAX = 127 } MeshPacket_Priority; +typedef enum _MeshPacket_Delayed { + MeshPacket_Delayed_NO_DELAY = 0, + MeshPacket_Delayed_DELAYED_BROADCAST = 1, + MeshPacket_Delayed_DELAYED_DIRECT = 2 +} MeshPacket_Delayed; + typedef enum _LogRecord_Level { LogRecord_Level_UNSET = 0, LogRecord_Level_CRITICAL = 50, @@ -226,6 +232,7 @@ typedef struct _MeshPacket { bool want_ack; MeshPacket_Priority priority; int32_t rx_rssi; + MeshPacket_Delayed delayed; } MeshPacket; typedef struct _NodeInfo { @@ -304,6 +311,10 @@ typedef struct _ToRadio { #define _MeshPacket_Priority_MAX MeshPacket_Priority_MAX #define _MeshPacket_Priority_ARRAYSIZE ((MeshPacket_Priority)(MeshPacket_Priority_MAX+1)) +#define _MeshPacket_Delayed_MIN MeshPacket_Delayed_NO_DELAY +#define _MeshPacket_Delayed_MAX MeshPacket_Delayed_DELAYED_DIRECT +#define _MeshPacket_Delayed_ARRAYSIZE ((MeshPacket_Delayed)(MeshPacket_Delayed_DELAYED_DIRECT+1)) + #define _LogRecord_Level_MIN LogRecord_Level_UNSET #define _LogRecord_Level_MAX LogRecord_Level_CRITICAL #define _LogRecord_Level_ARRAYSIZE ((LogRecord_Level)(LogRecord_Level_CRITICAL+1)) @@ -319,7 +330,7 @@ extern "C" { #define RouteDiscovery_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}} #define Routing_init_default {0, {RouteDiscovery_init_default}} #define Data_init_default {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0} -#define MeshPacket_init_default {0, 0, 0, 0, {Data_init_default}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0} +#define MeshPacket_init_default {0, 0, 0, 0, {Data_init_default}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0, _MeshPacket_Delayed_MIN} #define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0} #define MyNodeInfo_init_default {0, 0, 0, "", "", "", _CriticalErrorCode_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}, 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} #define LogRecord_init_default {"", 0, "", _LogRecord_Level_MIN} @@ -331,7 +342,7 @@ extern "C" { #define RouteDiscovery_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}} #define Routing_init_zero {0, {RouteDiscovery_init_zero}} #define Data_init_zero {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0} -#define MeshPacket_init_zero {0, 0, 0, 0, {Data_init_zero}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0} +#define MeshPacket_init_zero {0, 0, 0, 0, {Data_init_zero}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0, _MeshPacket_Delayed_MIN} #define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0} #define MyNodeInfo_init_zero {0, 0, 0, "", "", "", _CriticalErrorCode_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}, 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} #define LogRecord_init_zero {"", 0, "", _LogRecord_Level_MIN} @@ -415,6 +426,7 @@ extern "C" { #define MeshPacket_want_ack_tag 11 #define MeshPacket_priority_tag 12 #define MeshPacket_rx_rssi_tag 13 +#define MeshPacket_delayed_tag 15 #define NodeInfo_num_tag 1 #define NodeInfo_user_tag 2 #define NodeInfo_position_tag 3 @@ -513,7 +525,8 @@ X(a, STATIC, SINGULAR, FLOAT, rx_snr, 8) \ X(a, STATIC, SINGULAR, UINT32, hop_limit, 10) \ X(a, STATIC, SINGULAR, BOOL, want_ack, 11) \ X(a, STATIC, SINGULAR, UENUM, priority, 12) \ -X(a, STATIC, SINGULAR, INT32, rx_rssi, 13) +X(a, STATIC, SINGULAR, INT32, rx_rssi, 13) \ +X(a, STATIC, SINGULAR, UENUM, delayed, 15) #define MeshPacket_CALLBACK NULL #define MeshPacket_DEFAULT NULL #define MeshPacket_payloadVariant_decoded_MSGTYPE Data @@ -622,12 +635,12 @@ extern const pb_msgdesc_t ToRadio_PeerInfo_msg; #define RouteDiscovery_size 40 #define Routing_size 42 #define Data_size 260 -#define MeshPacket_size 309 +#define MeshPacket_size 311 #define NodeInfo_size 270 #define MyNodeInfo_size 445 #define LogRecord_size 81 #define FromRadio_size 454 -#define ToRadio_size 312 +#define ToRadio_size 314 #define ToRadio_PeerInfo_size 8 #ifdef __cplusplus From 8d8fece89db069af6673cbd27250d509224f12cb Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sun, 19 Dec 2021 14:27:49 -0500 Subject: [PATCH 12/13] Update to show fixed gps alternating with location info. --- src/graphics/Screen.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 702708c8..b9f8083f 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -428,16 +428,14 @@ static void drawGPScoordinates(OLEDDisplay *display, int16_t x, int16_t y, const auto gpsFormat = radioConfig.preferences.gps_format; String displayLine = ""; - if (radioConfig.preferences.fixed_position) { - displayLine = "Fixed GPS"; - display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(displayLine))) / 2, y, displayLine); - } else if (!gps->getIsConnected() && !radioConfig.preferences.fixed_position) { + if (!gps->getIsConnected() && !radioConfig.preferences.fixed_position) { displayLine = "No GPS Module"; display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(displayLine))) / 2, y, displayLine); } else if (!gps->getHasLock() && !radioConfig.preferences.fixed_position) { displayLine = "No GPS Lock"; display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(displayLine))) / 2, y, displayLine); } else { + if (gpsFormat != GpsCoordinateFormat_GpsFormatDMS) { char coordinateLine[22]; geoCoord.updateCoords(int32_t(gps->getLatitude()), int32_t(gps->getLongitude()), int32_t(gps->getAltitude())); @@ -459,7 +457,17 @@ static void drawGPScoordinates(OLEDDisplay *display, int16_t x, int16_t y, const geoCoord.getOSGREasting(), geoCoord.getOSGRNorthing()); } - display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(coordinateLine))) / 2, y, coordinateLine); + // If fixed position, display text "Fixed GPS" alternating with the coordinates. + if (radioConfig.preferences.fixed_position) { + if ((millis() / 10000) % 2) { + display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(displayLine))) / 2, y, displayLine); + } else { + displayLine = "Fixed GPS"; + } + } else { + display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(coordinateLine))) / 2, y, coordinateLine); + } + } else { char latLine[22]; char lonLine[22]; From 9f63a8c33091db8d1e5766715e8cd7b43acc4817 Mon Sep 17 00:00:00 2001 From: Sam <35611307+syund@users.noreply.github.com> Date: Sun, 19 Dec 2021 14:55:57 -0500 Subject: [PATCH 13/13] Fix coordinates not displaying when fixed --- src/graphics/Screen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index b9f8083f..f0221e74 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -460,9 +460,9 @@ static void drawGPScoordinates(OLEDDisplay *display, int16_t x, int16_t y, const // If fixed position, display text "Fixed GPS" alternating with the coordinates. if (radioConfig.preferences.fixed_position) { if ((millis() / 10000) % 2) { - display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(displayLine))) / 2, y, displayLine); + display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(coordinateLine))) / 2, y, coordinateLine); } else { - displayLine = "Fixed GPS"; + display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth("Fixed GPS"))) / 2, y, "Fixed GPS"); } } else { display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(coordinateLine))) / 2, y, coordinateLine);