From df1f66a6b94b11537accc5527431c05a5af5428e Mon Sep 17 00:00:00 2001 From: "Daniel.Cao" <144674500+DanielCao0@users.noreply.github.com> Date: Tue, 19 Nov 2024 19:42:29 +0800 Subject: [PATCH 01/16] Anable trace route function on wismeshtap platform (#5389) --- variants/rak_wismeshtap/platformio.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/variants/rak_wismeshtap/platformio.ini b/variants/rak_wismeshtap/platformio.ini index 461696d297..277fdbe24c 100644 --- a/variants/rak_wismeshtap/platformio.ini +++ b/variants/rak_wismeshtap/platformio.ini @@ -9,7 +9,6 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/rak_wismeshtap -D RAK_4631 -DEINK_WIDTH=250 -DEINK_HEIGHT=122 -DMESHTASTIC_EXCLUDE_WIFI=1 - -DMESHTASTIC_EXCLUDE_WAYPOINT=1 -DMESHTASTIC_EXCLUDE_DETECTIONSENSOR=1 -DMESHTASTIC_EXCLUDE_STOREFORWARD=1 -DMESHTASTIC_EXCLUDE_POWER_TELEMETRY=1 From b947b123fc80926689332e1ac3fd9d41ef675d5f Mon Sep 17 00:00:00 2001 From: jcyrio <50239349+jcyrio@users.noreply.github.com> Date: Tue, 19 Nov 2024 05:52:20 -0700 Subject: [PATCH 02/16] fix 'symbal' typo (#5395) --- src/graphics/Screen.cpp | 32 ++++++++++++++--------------- src/graphics/Screen.h | 10 ++++----- src/modules/CannedMessageModule.cpp | 16 +++++++-------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index fb7edcbfd9..9a41bf298d 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -101,9 +101,9 @@ std::vector moduleFrames; static char ourId[5]; // vector where symbols (string) are displayed in bottom corner of display. -std::vector functionSymbals; -// string displayed in bottom right corner of display. Created from elements in functionSymbals vector -std::string functionSymbalString = ""; +std::vector functionSymbol; +// string displayed in bottom right corner of display. Created from elements in functionSymbol vector +std::string functionSymbolString = ""; #if HAS_GPS // GeoCoord object for the screen @@ -243,10 +243,10 @@ static void drawWelcomeScreen(OLEDDisplay *display, OLEDDisplayUiState *state, i static void drawFunctionOverlay(OLEDDisplay *display, OLEDDisplayUiState *state) { // LOG_DEBUG("Draw function overlay"); - if (functionSymbals.begin() != functionSymbals.end()) { + if (functionSymbol.begin() != functionSymbol.end()) { char buf[64]; display->setFont(FONT_SMALL); - snprintf(buf, sizeof(buf), "%s", functionSymbalString.c_str()); + snprintf(buf, sizeof(buf), "%s", functionSymbolString.c_str()); display->drawString(SCREEN_WIDTH - display->getStringWidth(buf), SCREEN_HEIGHT - FONT_HEIGHT_SMALL, buf); } } @@ -2252,24 +2252,24 @@ void Screen::decreaseBrightness() /* TO DO: add little popup in center of screen saying what brightness level it is set to*/ } -void Screen::setFunctionSymbal(std::string sym) +void Screen::setFunctionSymbol(std::string sym) { - if (std::find(functionSymbals.begin(), functionSymbals.end(), sym) == functionSymbals.end()) { - functionSymbals.push_back(sym); - functionSymbalString = ""; - for (auto symbol : functionSymbals) { - functionSymbalString = symbol + " " + functionSymbalString; + if (std::find(functionSymbol.begin(), functionSymbol.end(), sym) == functionSymbol.end()) { + functionSymbol.push_back(sym); + functionSymbolString = ""; + for (auto symbol : functionSymbol) { + functionSymbolString = symbol + " " + functionSymbolString; } setFastFramerate(); } } -void Screen::removeFunctionSymbal(std::string sym) +void Screen::removeFunctionSymbol(std::string sym) { - functionSymbals.erase(std::remove(functionSymbals.begin(), functionSymbals.end(), sym), functionSymbals.end()); - functionSymbalString = ""; - for (auto symbol : functionSymbals) { - functionSymbalString = symbol + " " + functionSymbalString; + functionSymbol.erase(std::remove(functionSymbol.begin(), functionSymbol.end(), sym), functionSymbol.end()); + functionSymbolString = ""; + for (auto symbol : functionSymbol) { + functionSymbolString = symbol + " " + functionSymbolString; } setFastFramerate(); } diff --git a/src/graphics/Screen.h b/src/graphics/Screen.h index 3066c0c171..ee8de69f05 100644 --- a/src/graphics/Screen.h +++ b/src/graphics/Screen.h @@ -24,8 +24,8 @@ class Screen void startFirmwareUpdateScreen() {} void increaseBrightness() {} void decreaseBrightness() {} - void setFunctionSymbal(std::string) {} - void removeFunctionSymbal(std::string) {} + void setFunctionSymbol(std::string) {} + void removeFunctionSymbol(std::string) {} void startAlert(const char *) {} void endAlert() {} }; @@ -282,8 +282,8 @@ class Screen : public concurrency::OSThread void increaseBrightness(); void decreaseBrightness(); - void setFunctionSymbal(std::string sym); - void removeFunctionSymbal(std::string sym); + void setFunctionSymbol(std::string sym); + void removeFunctionSymbol(std::string sym); /// Stops showing the boot screen. void stopBootScreen() { enqueueCmd(ScreenCmd{.cmd = Cmd::STOP_BOOT_SCREEN}); } @@ -605,4 +605,4 @@ class Screen : public concurrency::OSThread } // namespace graphics -#endif \ No newline at end of file +#endif diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index 37409b43be..6d1bfdc5c2 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -234,13 +234,13 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event) screen->decreaseBrightness(); LOG_DEBUG("Decrease Screen Brightness"); break; - case INPUT_BROKER_MSG_FN_SYMBOL_ON: // draw modifier (function) symbal + case INPUT_BROKER_MSG_FN_SYMBOL_ON: // draw modifier (function) symbol if (screen) - screen->setFunctionSymbal("Fn"); + screen->setFunctionSymbol("Fn"); break; - case INPUT_BROKER_MSG_FN_SYMBOL_OFF: // remove modifier (function) symbal + case INPUT_BROKER_MSG_FN_SYMBOL_OFF: // remove modifier (function) symbol if (screen) - screen->removeFunctionSymbal("Fn"); + screen->removeFunctionSymbol("Fn"); break; // mute (switch off/toggle) external notifications on fn+m case INPUT_BROKER_MSG_MUTE_TOGGLE: @@ -249,13 +249,13 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event) externalNotificationModule->setMute(false); showTemporaryMessage("Notifications \nEnabled"); if (screen) - screen->removeFunctionSymbal("M"); // remove the mute symbol from the bottom right corner + screen->removeFunctionSymbol("M"); // remove the mute symbol from the bottom right corner } else { externalNotificationModule->stopNow(); // this will turn off all GPIO and sounds and idle the loop externalNotificationModule->setMute(true); showTemporaryMessage("Notifications \nDisabled"); if (screen) - screen->setFunctionSymbal("M"); // add the mute symbol to the bottom right corner + screen->setFunctionSymbol("M"); // add the mute symbol to the bottom right corner } } break; @@ -308,7 +308,7 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event) break; } if (screen && (event->kbchar != INPUT_BROKER_MSG_FN_SYMBOL_ON)) { - screen->removeFunctionSymbal("Fn"); // remove modifier (function) symbal + screen->removeFunctionSymbol("Fn"); // remove modifier (function) symbol } } @@ -672,7 +672,7 @@ int32_t CannedMessageModule::runOnce() break; } if (screen) - screen->removeFunctionSymbal("Fn"); + screen->removeFunctionSymbol("Fn"); } this->lastTouchMillis = millis(); From c641bfd53c5948479d07883c7e2a30aa113e58fe Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 12:53:54 -0600 Subject: [PATCH 03/16] [create-pull-request] automated change (#5399) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/deviceonly.pb.h | 12 +++++++---- src/mesh/generated/meshtastic/mesh.pb.h | 21 +++++++++++++++---- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/protobufs b/protobufs index 52688fdccb..af7521c3a7 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 52688fdccb8a40c23101cada3736b3b22c2b229e +Subproject commit af7521c3a77d56eb7a64efae5637a311ac33f76d diff --git a/src/mesh/generated/meshtastic/deviceonly.pb.h b/src/mesh/generated/meshtastic/deviceonly.pb.h index d9e291175e..e52a914e02 100644 --- a/src/mesh/generated/meshtastic/deviceonly.pb.h +++ b/src/mesh/generated/meshtastic/deviceonly.pb.h @@ -90,6 +90,8 @@ typedef struct _meshtastic_NodeInfoLite { /* True if node is in our ignored list Persists between NodeDB internal clean ups */ bool is_ignored; + /* Last byte of the node number of the node that should be used as the next hop to reach this node. */ + uint8_t next_hop; } meshtastic_NodeInfoLite; /* This message is never sent over the wire, but it is used for serializing DB @@ -153,12 +155,12 @@ extern "C" { /* Initializer values for message structs */ #define meshtastic_PositionLite_init_default {0, 0, 0, 0, _meshtastic_Position_LocSource_MIN} #define meshtastic_UserLite_init_default {{0}, "", "", _meshtastic_HardwareModel_MIN, 0, _meshtastic_Config_DeviceConfig_Role_MIN, {0, {0}}} -#define meshtastic_NodeInfoLite_init_default {0, false, meshtastic_UserLite_init_default, false, meshtastic_PositionLite_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default, 0, 0, false, 0, 0, 0} +#define meshtastic_NodeInfoLite_init_default {0, false, meshtastic_UserLite_init_default, false, meshtastic_PositionLite_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default, 0, 0, false, 0, 0, 0, 0} #define meshtastic_DeviceState_init_default {false, meshtastic_MyNodeInfo_init_default, false, meshtastic_User_init_default, 0, {meshtastic_MeshPacket_init_default}, false, meshtastic_MeshPacket_init_default, 0, 0, 0, false, meshtastic_MeshPacket_init_default, 0, {meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default}, {0}} #define meshtastic_ChannelFile_init_default {0, {meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default}, 0} #define meshtastic_PositionLite_init_zero {0, 0, 0, 0, _meshtastic_Position_LocSource_MIN} #define meshtastic_UserLite_init_zero {{0}, "", "", _meshtastic_HardwareModel_MIN, 0, _meshtastic_Config_DeviceConfig_Role_MIN, {0, {0}}} -#define meshtastic_NodeInfoLite_init_zero {0, false, meshtastic_UserLite_init_zero, false, meshtastic_PositionLite_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero, 0, 0, false, 0, 0, 0} +#define meshtastic_NodeInfoLite_init_zero {0, false, meshtastic_UserLite_init_zero, false, meshtastic_PositionLite_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero, 0, 0, false, 0, 0, 0, 0} #define meshtastic_DeviceState_init_zero {false, meshtastic_MyNodeInfo_init_zero, false, meshtastic_User_init_zero, 0, {meshtastic_MeshPacket_init_zero}, false, meshtastic_MeshPacket_init_zero, 0, 0, 0, false, meshtastic_MeshPacket_init_zero, 0, {meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero}, {0}} #define meshtastic_ChannelFile_init_zero {0, {meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero}, 0} @@ -186,6 +188,7 @@ extern "C" { #define meshtastic_NodeInfoLite_hops_away_tag 9 #define meshtastic_NodeInfoLite_is_favorite_tag 10 #define meshtastic_NodeInfoLite_is_ignored_tag 11 +#define meshtastic_NodeInfoLite_next_hop_tag 12 #define meshtastic_DeviceState_my_node_tag 2 #define meshtastic_DeviceState_owner_tag 3 #define meshtastic_DeviceState_receive_queue_tag 5 @@ -231,7 +234,8 @@ X(a, STATIC, SINGULAR, UINT32, channel, 7) \ X(a, STATIC, SINGULAR, BOOL, via_mqtt, 8) \ X(a, STATIC, OPTIONAL, UINT32, hops_away, 9) \ X(a, STATIC, SINGULAR, BOOL, is_favorite, 10) \ -X(a, STATIC, SINGULAR, BOOL, is_ignored, 11) +X(a, STATIC, SINGULAR, BOOL, is_ignored, 11) \ +X(a, STATIC, SINGULAR, UINT32, next_hop, 12) #define meshtastic_NodeInfoLite_CALLBACK NULL #define meshtastic_NodeInfoLite_DEFAULT NULL #define meshtastic_NodeInfoLite_user_MSGTYPE meshtastic_UserLite @@ -284,7 +288,7 @@ extern const pb_msgdesc_t meshtastic_ChannelFile_msg; /* meshtastic_DeviceState_size depends on runtime parameters */ #define MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_MAX_SIZE meshtastic_ChannelFile_size #define meshtastic_ChannelFile_size 718 -#define meshtastic_NodeInfoLite_size 185 +#define meshtastic_NodeInfoLite_size 188 #define meshtastic_PositionLite_size 28 #define meshtastic_UserLite_size 96 diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index 0d37efd546..3e195e7f57 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -212,6 +212,9 @@ typedef enum _meshtastic_HardwareModel { meshtastic_HardwareModel_MS24SF1 = 82, /* Lilygo TLora-C6 with the new ESP32-C6 MCU */ meshtastic_HardwareModel_TLORA_C6 = 83, + /* WisMesh Tap + RAK-4631 w/ TFT in injection modled case */ + meshtastic_HardwareModel_WISMESH_TAP = 84, /* ------------------------------------------------------------------------------------------------------------------------------------------ Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. ------------------------------------------------------------------------------------------------------------------------------------------ */ @@ -751,6 +754,12 @@ typedef struct _meshtastic_MeshPacket { meshtastic_MeshPacket_public_key_t public_key; /* Indicates whether the packet was en/decrypted using PKI */ bool pki_encrypted; + /* Last byte of the node number of the node that should be used as the next hop in routing. + Set by the firmware internally, clients are not supposed to set this. */ + uint8_t next_hop; + /* Last byte of the node number of the node that will relay/relayed this packet. + Set by the firmware internally, clients are not supposed to set this. */ + uint8_t relay_node; } meshtastic_MeshPacket; /* The bluetooth to device link: @@ -1159,7 +1168,7 @@ extern "C" { #define meshtastic_Data_init_default {_meshtastic_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, 0} #define meshtastic_Waypoint_init_default {0, false, 0, false, 0, 0, 0, "", "", 0} #define meshtastic_MqttClientProxyMessage_init_default {"", 0, {{0, {0}}}, 0} -#define meshtastic_MeshPacket_init_default {0, 0, 0, 0, {meshtastic_Data_init_default}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN, 0, 0, {0, {0}}, 0} +#define meshtastic_MeshPacket_init_default {0, 0, 0, 0, {meshtastic_Data_init_default}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN, 0, 0, {0, {0}}, 0, 0, 0} #define meshtastic_NodeInfo_init_default {0, false, meshtastic_User_init_default, false, meshtastic_Position_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default, 0, 0, false, 0, 0, 0} #define meshtastic_MyNodeInfo_init_default {0, 0, 0, {0, {0}}, ""} #define meshtastic_LogRecord_init_default {"", 0, "", _meshtastic_LogRecord_Level_MIN} @@ -1184,7 +1193,7 @@ extern "C" { #define meshtastic_Data_init_zero {_meshtastic_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, 0} #define meshtastic_Waypoint_init_zero {0, false, 0, false, 0, 0, 0, "", "", 0} #define meshtastic_MqttClientProxyMessage_init_zero {"", 0, {{0, {0}}}, 0} -#define meshtastic_MeshPacket_init_zero {0, 0, 0, 0, {meshtastic_Data_init_zero}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN, 0, 0, {0, {0}}, 0} +#define meshtastic_MeshPacket_init_zero {0, 0, 0, 0, {meshtastic_Data_init_zero}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN, 0, 0, {0, {0}}, 0, 0, 0} #define meshtastic_NodeInfo_init_zero {0, false, meshtastic_User_init_zero, false, meshtastic_Position_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero, 0, 0, false, 0, 0, 0} #define meshtastic_MyNodeInfo_init_zero {0, 0, 0, {0, {0}}, ""} #define meshtastic_LogRecord_init_zero {"", 0, "", _meshtastic_LogRecord_Level_MIN} @@ -1280,6 +1289,8 @@ extern "C" { #define meshtastic_MeshPacket_hop_start_tag 15 #define meshtastic_MeshPacket_public_key_tag 16 #define meshtastic_MeshPacket_pki_encrypted_tag 17 +#define meshtastic_MeshPacket_next_hop_tag 18 +#define meshtastic_MeshPacket_relay_node_tag 19 #define meshtastic_NodeInfo_num_tag 1 #define meshtastic_NodeInfo_user_tag 2 #define meshtastic_NodeInfo_position_tag 3 @@ -1474,7 +1485,9 @@ X(a, STATIC, SINGULAR, UENUM, delayed, 13) \ X(a, STATIC, SINGULAR, BOOL, via_mqtt, 14) \ X(a, STATIC, SINGULAR, UINT32, hop_start, 15) \ X(a, STATIC, SINGULAR, BYTES, public_key, 16) \ -X(a, STATIC, SINGULAR, BOOL, pki_encrypted, 17) +X(a, STATIC, SINGULAR, BOOL, pki_encrypted, 17) \ +X(a, STATIC, SINGULAR, UINT32, next_hop, 18) \ +X(a, STATIC, SINGULAR, UINT32, relay_node, 19) #define meshtastic_MeshPacket_CALLBACK NULL #define meshtastic_MeshPacket_DEFAULT NULL #define meshtastic_MeshPacket_payload_variant_decoded_MSGTYPE meshtastic_Data @@ -1724,7 +1737,7 @@ extern const pb_msgdesc_t meshtastic_ChunkedPayloadResponse_msg; #define meshtastic_FromRadio_size 510 #define meshtastic_Heartbeat_size 0 #define meshtastic_LogRecord_size 426 -#define meshtastic_MeshPacket_size 367 +#define meshtastic_MeshPacket_size 375 #define meshtastic_MqttClientProxyMessage_size 501 #define meshtastic_MyNodeInfo_size 77 #define meshtastic_NeighborInfo_size 258 From d65dc497f221e41d67b4f6977d154a00f8a9f34e Mon Sep 17 00:00:00 2001 From: Catalin Patulea Date: Tue, 19 Nov 2024 15:33:44 -0500 Subject: [PATCH 04/16] /api/v1/fromradio: add OPTIONS handler for CORS. (#5386) This avoids hitting the 404 Not Found handler, which breaks connection keep-alive, so this change fixes a big performance regression for Web Client in Chrome: https://github.com/meshtastic/firmware/issues/5385 Tested on Heltec V3. Co-authored-by: Ben Meadors --- src/mesh/http/ContentHandler.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mesh/http/ContentHandler.cpp b/src/mesh/http/ContentHandler.cpp index efa8164385..64f7164c99 100644 --- a/src/mesh/http/ContentHandler.cpp +++ b/src/mesh/http/ContentHandler.cpp @@ -74,6 +74,7 @@ void registerHandlers(HTTPServer *insecureServer, HTTPSServer *secureServer) ResourceNode *nodeAPIv1ToRadioOptions = new ResourceNode("/api/v1/toradio", "OPTIONS", &handleAPIv1ToRadio); ResourceNode *nodeAPIv1ToRadio = new ResourceNode("/api/v1/toradio", "PUT", &handleAPIv1ToRadio); + ResourceNode *nodeAPIv1FromRadioOptions = new ResourceNode("/api/v1/fromradio", "OPTIONS", &handleAPIv1FromRadio); ResourceNode *nodeAPIv1FromRadio = new ResourceNode("/api/v1/fromradio", "GET", &handleAPIv1FromRadio); // ResourceNode *nodeHotspotApple = new ResourceNode("/hotspot-detect.html", "GET", &handleHotspot); @@ -100,6 +101,7 @@ void registerHandlers(HTTPServer *insecureServer, HTTPSServer *secureServer) // Secure nodes secureServer->registerNode(nodeAPIv1ToRadioOptions); secureServer->registerNode(nodeAPIv1ToRadio); + secureServer->registerNode(nodeAPIv1FromRadioOptions); secureServer->registerNode(nodeAPIv1FromRadio); // secureServer->registerNode(nodeHotspotApple); // secureServer->registerNode(nodeHotspotAndroid); @@ -121,6 +123,7 @@ void registerHandlers(HTTPServer *insecureServer, HTTPSServer *secureServer) // Insecure nodes insecureServer->registerNode(nodeAPIv1ToRadioOptions); insecureServer->registerNode(nodeAPIv1ToRadio); + insecureServer->registerNode(nodeAPIv1FromRadioOptions); insecureServer->registerNode(nodeAPIv1FromRadio); // insecureServer->registerNode(nodeHotspotApple); // insecureServer->registerNode(nodeHotspotAndroid); @@ -163,6 +166,12 @@ void handleAPIv1FromRadio(HTTPRequest *req, HTTPResponse *res) res->setHeader("Access-Control-Allow-Methods", "GET"); res->setHeader("X-Protobuf-Schema", "https://raw.githubusercontent.com/meshtastic/protobufs/master/meshtastic/mesh.proto"); + if (req->getMethod() == "OPTIONS") { + res->setStatusCode(204); // Success with no content + // res->print(""); @todo remove + return; + } + uint8_t txBuf[MAX_STREAM_BUF_SIZE]; uint32_t len = 1; From a255da3cf531a34c9f9bbfe8931576168ef8cacb Mon Sep 17 00:00:00 2001 From: jcyrio <50239349+jcyrio@users.noreply.github.com> Date: Tue, 19 Nov 2024 20:31:46 -0700 Subject: [PATCH 05/16] Make heart emoji usable (#5403) --- src/graphics/Screen.cpp | 44 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 9a41bf298d..f18baf276f 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -958,65 +958,65 @@ static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state display->setColor(WHITE); #ifndef EXCLUDE_EMOJI - if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\U0001F44D") == 0) { + const char *msg = reinterpret_cast(mp.decoded.payload.bytes); + if (strcmp(msg, "\U0001F44D") == 0) { display->drawXbm(x + (SCREEN_WIDTH - thumbs_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - thumbs_height) / 2 + 2 + 5, thumbs_width, thumbs_height, thumbup); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\U0001F44E") == 0) { + } else if (strcmp(msg, "\U0001F44E") == 0) { display->drawXbm(x + (SCREEN_WIDTH - thumbs_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - thumbs_height) / 2 + 2 + 5, thumbs_width, thumbs_height, thumbdown); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\U0001F60A") == 0 || - strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\U0001F600") == 0 || - strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\U0001F642") == 0 || - strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\U0001F609") == 0 || - strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\U0001F601") == - 0) { // matches 5 different common smileys, so that the phone user doesn't have to remember which one is - // compatible + } else if (strcmp(msg, "\U0001F60A") == 0 || strcmp(msg, "\U0001F600") == 0 || strcmp(msg, "\U0001F642") == 0 || + strcmp(msg, "\U0001F609") == 0 || + strcmp(msg, "\U0001F601") == 0) { // matches 5 different common smileys, so that the phone user doesn't have to + // remember which one is compatible display->drawXbm(x + (SCREEN_WIDTH - smiley_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - smiley_height) / 2 + 2 + 5, smiley_width, smiley_height, smiley); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "❓") == 0) { + } else if (strcmp(msg, "❓") == 0) { display->drawXbm(x + (SCREEN_WIDTH - question_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - question_height) / 2 + 2 + 5, question_width, question_height, question); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "‼️") == 0) { + } else if (strcmp(msg, "‼️") == 0) { display->drawXbm(x + (SCREEN_WIDTH - bang_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - bang_height) / 2 + 2 + 5, bang_width, bang_height, bang); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\U0001F4A9") == 0) { + } else if (strcmp(msg, "\U0001F4A9") == 0) { display->drawXbm(x + (SCREEN_WIDTH - poo_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - poo_height) / 2 + 2 + 5, poo_width, poo_height, poo); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\xf0\x9f\xa4\xa3") == 0) { + } else if (strcmp(msg, "\U0001F923") == 0) { display->drawXbm(x + (SCREEN_WIDTH - haha_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - haha_height) / 2 + 2 + 5, haha_width, haha_height, haha); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\U0001F44B") == 0) { + } else if (strcmp(msg, "\U0001F44B") == 0) { display->drawXbm(x + (SCREEN_WIDTH - wave_icon_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - wave_icon_height) / 2 + 2 + 5, wave_icon_width, wave_icon_height, wave_icon); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\U0001F920") == 0) { + } else if (strcmp(msg, "\U0001F920") == 0) { display->drawXbm(x + (SCREEN_WIDTH - cowboy_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - cowboy_height) / 2 + 2 + 5, cowboy_width, cowboy_height, cowboy); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\U0001F42D") == 0) { + } else if (strcmp(msg, "\U0001F42D") == 0) { display->drawXbm(x + (SCREEN_WIDTH - deadmau5_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - deadmau5_height) / 2 + 2 + 5, deadmau5_width, deadmau5_height, deadmau5); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\xE2\x98\x80\xEF\xB8\x8F") == 0) { + } else if (strcmp(msg, "\xE2\x98\x80\xEF\xB8\x8F") == 0) { display->drawXbm(x + (SCREEN_WIDTH - sun_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - sun_height) / 2 + 2 + 5, sun_width, sun_height, sun); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\u2614") == 0) { + } else if (strcmp(msg, "\u2614") == 0) { display->drawXbm(x + (SCREEN_WIDTH - rain_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - rain_height) / 2 + 2 + 10, rain_width, rain_height, rain); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "☁️") == 0) { + } else if (strcmp(msg, "☁️") == 0) { display->drawXbm(x + (SCREEN_WIDTH - cloud_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - cloud_height) / 2 + 2 + 5, cloud_width, cloud_height, cloud); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "🌫️") == 0) { + } else if (strcmp(msg, "🌫️") == 0) { display->drawXbm(x + (SCREEN_WIDTH - fog_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - fog_height) / 2 + 2 + 5, fog_width, fog_height, fog); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\xf0\x9f\x98\x88") == 0) { + } else if (strcmp(msg, "\U0001F608") == 0) { display->drawXbm(x + (SCREEN_WIDTH - devil_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - devil_height) / 2 + 2 + 5, devil_width, devil_height, devil); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "♥️") == 0) { + } else if (strcmp(msg, "♥️") == 0 || strcmp(msg, "\U0001F9E1") == 0 || strcmp(msg, "\U00002763") == 0 || + strcmp(msg, "\U00002764") == 0 || strcmp(msg, "\U0001F495") == 0 || strcmp(msg, "\U0001F496") == 0 || + strcmp(msg, "\U0001F497") == 0 || strcmp(msg, "\U0001F496") == 0) { display->drawXbm(x + (SCREEN_WIDTH - heart_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - heart_height) / 2 + 2 + 5, heart_width, heart_height, heart); } else { From 485c371de488773796d022e3df6099680c11cdd5 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Tue, 19 Nov 2024 22:57:46 -0600 Subject: [PATCH 06/16] Create a specific hw_model for WisMesh Tap (#5400) * Create a specific hw_model for WisMesh Tap * Trunk * HAS_ETHERNET * Remove it altogether * Don't need these either --- src/gps/GPS.cpp | 3 ++- src/platform/nrf52/architecture.h | 2 ++ variants/rak_wismeshtap/platformio.ini | 2 +- variants/rak_wismeshtap/variant.h | 5 ----- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 099a21f829..a6db859505 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -788,7 +788,8 @@ void GPS::setPowerState(GPSPowerState newState, uint32_t sleepTime) void GPS::writePinEN(bool on) { // Abort: if conflict with Canned Messages when using Wisblock(?) - if (HW_VENDOR == meshtastic_HardwareModel_RAK4631 && (rotaryEncoderInterruptImpl1 || upDownInterruptImpl1)) + if ((HW_VENDOR == meshtastic_HardwareModel_RAK4631 || HW_VENDOR == meshtastic_HardwareModel_WISMESH_TAP) && + (rotaryEncoderInterruptImpl1 || upDownInterruptImpl1)) return; // Write and log diff --git a/src/platform/nrf52/architecture.h b/src/platform/nrf52/architecture.h index b2b7b5a20e..ce99244baf 100644 --- a/src/platform/nrf52/architecture.h +++ b/src/platform/nrf52/architecture.h @@ -47,6 +47,8 @@ #define HW_VENDOR meshtastic_HardwareModel_PPR #elif defined(RAK2560) #define HW_VENDOR meshtastic_HardwareModel_RAK2560 +#elif defined(WISMESH_TAP) +#define HW_VENDOR meshtastic_HardwareModel_WISMESH_TAP #elif defined(RAK4630) #define HW_VENDOR meshtastic_HardwareModel_RAK4631 #elif defined(TTGO_T_ECHO) diff --git a/variants/rak_wismeshtap/platformio.ini b/variants/rak_wismeshtap/platformio.ini index 277fdbe24c..bcf46b90df 100644 --- a/variants/rak_wismeshtap/platformio.ini +++ b/variants/rak_wismeshtap/platformio.ini @@ -2,7 +2,7 @@ [env:rak_wismeshtap] extends = nrf52840_base board = wiscore_rak4631 -build_flags = ${nrf52840_base.build_flags} -Ivariants/rak_wismeshtap -D RAK_4631 +build_flags = ${nrf52840_base.build_flags} -Ivariants/rak_wismeshtap -DWISMESH_TAP -DRAK_4631 -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. -DEINK_DISPLAY_MODEL=GxEPD2_213_BN diff --git a/variants/rak_wismeshtap/variant.h b/variants/rak_wismeshtap/variant.h index 19eb841fe5..134a202275 100644 --- a/variants/rak_wismeshtap/variant.h +++ b/variants/rak_wismeshtap/variant.h @@ -271,13 +271,8 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG #define HAS_RTC 1 -#define HAS_ETHERNET 1 - #define RAK_4631 1 -#define PIN_ETHERNET_RESET 21 -#define PIN_ETHERNET_SS PIN_EINK_CS -#define ETH_SPI_PORT SPI1 #define AQ_SET_PIN 10 #ifdef __cplusplus From 2ca3cdf837ddf522522667402d94aa2796e5e4f2 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 20 Nov 2024 07:52:39 -0600 Subject: [PATCH 07/16] Fix RTC time injection and consolidate position logic (#5396) * Fix RTC time injection and consolidate position logic * Comment out unused var warning * Backerds --- src/mesh/NodeDB.cpp | 2 +- src/modules/PositionModule.cpp | 38 ++++++++++++++++++++-------------- src/modules/PositionModule.h | 1 + 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 55b8c0b4da..841a50d658 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -114,7 +114,7 @@ NodeDB::NodeDB() uint32_t channelFileCRC = crc32Buffer(&channelFile, sizeof(channelFile)); int saveWhat = 0; - bool hasUniqueId = false; + // bool hasUniqueId = false; // Get device unique id #if defined(ARCH_ESP32) && defined(ESP_EFUSE_OPTIONAL_UNIQUE_ID) uint32_t unique_id[4]; diff --git a/src/modules/PositionModule.cpp b/src/modules/PositionModule.cpp index fc15aabb62..d977cfdeca 100644 --- a/src/modules/PositionModule.cpp +++ b/src/modules/PositionModule.cpp @@ -146,11 +146,20 @@ bool PositionModule::hasQualityTimesource() #if MESHTASTIC_EXCLUDE_GPS bool hasGpsOrRtc = (rtc_found.address != ScanI2C::ADDRESS_NONE.address); #else - bool hasGpsOrRtc = (gps && gps->isConnected()) || (rtc_found.address != ScanI2C::ADDRESS_NONE.address); + bool hasGpsOrRtc = hasGPS() || (rtc_found.address != ScanI2C::ADDRESS_NONE.address); #endif return hasGpsOrRtc || setFromPhoneOrNtpToday; } +bool PositionModule::hasGPS() +{ +#if MESHTASTIC_EXCLUDE_GPS + return false; +#else + return gps && gps->isConnected(); +#endif +} + meshtastic_MeshPacket *PositionModule::allocReply() { if (precision == 0) { @@ -194,10 +203,21 @@ meshtastic_MeshPacket *PositionModule::allocReply() p.precision_bits = precision; p.has_latitude_i = true; p.has_longitude_i = true; - p.time = getValidTime(RTCQualityNTP) > 0 ? getValidTime(RTCQualityNTP) : localPosition.time; + // Always use NTP / GPS time if available + if (getValidTime(RTCQualityNTP) > 0) { + p.time = getValidTime(RTCQualityNTP); + } else if (rtc_found.address != ScanI2C::ADDRESS_NONE.address) { + LOG_INFO("Use RTC time for position"); + p.time = getValidTime(RTCQualityDevice); + } else if (getRTCQuality() < RTCQualityNTP) { + LOG_INFO("Strip low RTCQuality (%d) time from position", getRTCQuality()); + p.time = 0; + } if (config.position.fixed_position) { p.location_source = meshtastic_Position_LocSource_LOC_MANUAL; + } else { + p.location_source = localPosition.location_source; } if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE) { @@ -242,20 +262,6 @@ meshtastic_MeshPacket *PositionModule::allocReply() p.has_ground_speed = true; } - // Strip out any time information before sending packets to other nodes - to keep the wire size small (and because other - // nodes shouldn't trust it anyways) Note: we allow a device with a local GPS or NTP to include the time, so that devices - // without can get time. - if (getRTCQuality() < RTCQualityNTP) { - LOG_INFO("Strip time %u from position", p.time); - p.time = 0; - } else if (rtc_found.address != ScanI2C::ADDRESS_NONE.address) { - LOG_INFO("Use RTC time %u for position", p.time); - p.time = getValidTime(RTCQualityDevice); - } else { - p.time = getValidTime(RTCQualityNTP); - LOG_INFO("Provide time to mesh %u", p.time); - } - LOG_INFO("Position reply: time=%i lat=%i lon=%i", p.time, p.latitude_i, p.longitude_i); // TAK Tracker devices should send their position in a TAK packet over the ATAK port diff --git a/src/modules/PositionModule.h b/src/modules/PositionModule.h index 41b86b7951..1e4aa5d293 100644 --- a/src/modules/PositionModule.h +++ b/src/modules/PositionModule.h @@ -61,6 +61,7 @@ class PositionModule : public ProtobufModule, private concu uint32_t precision; void sendLostAndFoundText(); bool hasQualityTimesource(); + bool hasGPS(); const uint32_t minimumTimeThreshold = Default::getConfiguredOrDefaultMs(config.position.broadcast_smart_minimum_interval_secs, 30); From 154864dfbff306d93337435d74503f1ad59967e3 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Wed, 20 Nov 2024 20:18:27 +0100 Subject: [PATCH 08/16] Update arduino-pico core to fix sporadic hangs (#5406) --- arch/rp2xx0/rp2040.ini | 4 ++-- arch/rp2xx0/rp2350.ini | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/rp2xx0/rp2040.ini b/arch/rp2xx0/rp2040.ini index 57e5d7bc2f..031a4848fe 100644 --- a/arch/rp2xx0/rp2040.ini +++ b/arch/rp2xx0/rp2040.ini @@ -2,7 +2,7 @@ [rp2040_base] platform = https://github.com/maxgerhardt/platform-raspberrypi.git#a606be683748c73e9a0d46baf70163478d298f0f ; For arduino-pico 4.2.0 extends = arduino_base -platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#4.2.1 +platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#996c3bfab9758f12c07aa20cc6d352e630c16987 ; 4.2.1 with fix for sporadic hangs board_build.core = earlephilhower board_build.filesystem_size = 0.5m @@ -23,4 +23,4 @@ lib_deps = ${arduino_base.lib_deps} ${environmental_base.lib_deps} ${radiolib_base.lib_deps} - rweather/Crypto + rweather/Crypto \ No newline at end of file diff --git a/arch/rp2xx0/rp2350.ini b/arch/rp2xx0/rp2350.ini index 58c5e5554c..0ae184d00b 100644 --- a/arch/rp2xx0/rp2350.ini +++ b/arch/rp2xx0/rp2350.ini @@ -2,7 +2,7 @@ [rp2350_base] platform = https://github.com/maxgerhardt/platform-raspberrypi.git#a606be683748c73e9a0d46baf70163478d298f0f ; For arduino-pico 4.2.0 extends = arduino_base -platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#4.2.1 +platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#96c3bfab9758f12c07aa20cc6d352e630c16987 ; 4.2.1 with fix for sporadic hangs board_build.core = earlephilhower board_build.filesystem_size = 0.5m @@ -22,4 +22,4 @@ lib_deps = ${arduino_base.lib_deps} ${environmental_base.lib_deps} ${radiolib_base.lib_deps} - rweather/Crypto + rweather/Crypto \ No newline at end of file From 364dead3aa4a1679dc9c80d599454aa739975557 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:53:36 +0100 Subject: [PATCH 09/16] Update platform-raspberrypi also (#5407) * Update arduino-pico core to fix sporadic hangs * Update platform-raspberrypi also --- arch/rp2xx0/rp2040.ini | 2 +- arch/rp2xx0/rp2350.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/rp2xx0/rp2040.ini b/arch/rp2xx0/rp2040.ini index 031a4848fe..85efa583c1 100644 --- a/arch/rp2xx0/rp2040.ini +++ b/arch/rp2xx0/rp2040.ini @@ -1,6 +1,6 @@ ; Common settings for rp2040 Processor based targets [rp2040_base] -platform = https://github.com/maxgerhardt/platform-raspberrypi.git#a606be683748c73e9a0d46baf70163478d298f0f ; For arduino-pico 4.2.0 +platform = https://github.com/maxgerhardt/platform-raspberrypi.git#19e30129fb1428b823be585c787dcb4ac0d9014c ; For arduino-pico 4.2.1 extends = arduino_base platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#996c3bfab9758f12c07aa20cc6d352e630c16987 ; 4.2.1 with fix for sporadic hangs diff --git a/arch/rp2xx0/rp2350.ini b/arch/rp2xx0/rp2350.ini index 0ae184d00b..6daf59bdfe 100644 --- a/arch/rp2xx0/rp2350.ini +++ b/arch/rp2xx0/rp2350.ini @@ -1,6 +1,6 @@ ; Common settings for rp2040 Processor based targets [rp2350_base] -platform = https://github.com/maxgerhardt/platform-raspberrypi.git#a606be683748c73e9a0d46baf70163478d298f0f ; For arduino-pico 4.2.0 +platform = https://github.com/maxgerhardt/platform-raspberrypi.git#19e30129fb1428b823be585c787dcb4ac0d9014c ; For arduino-pico 4.2.1 extends = arduino_base platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#96c3bfab9758f12c07aa20cc6d352e630c16987 ; 4.2.1 with fix for sporadic hangs From 1752caaf19ca9ab65b0df8a192af4c50c344a4c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gjels=C3=B8?= <36234524+gjelsoe@users.noreply.github.com> Date: Thu, 21 Nov 2024 00:21:06 +0100 Subject: [PATCH 10/16] --web added to device-install(.sh/.bat) (#5405) * Add --web * Update device-install.bat Forgot a "-" a few places. --------- Co-authored-by: Ben Meadors --- bin/device-install.bat | 15 ++++++++++++--- bin/device-install.sh | 19 +++++++++++++++++-- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/bin/device-install.bat b/bin/device-install.bat index f8ca9e4086..5e0f1c8479 100755 --- a/bin/device-install.bat +++ b/bin/device-install.bat @@ -1,6 +1,7 @@ @ECHO OFF set PYTHON=python +set WEB_APP=0 :: Determine the correct esptool command to use where esptool >nul 2>&1 @@ -12,13 +13,14 @@ if %ERRORLEVEL% EQU 0 ( goto GETOPTS :HELP -echo Usage: %~nx0 [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME^|FILENAME] +echo Usage: %~nx0 [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME^|FILENAME] [--web] echo Flash image file to device, but first erasing and writing system information echo. echo -h Display this help and exit echo -p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerrous). echo -P PYTHON Specify alternate python interpreter to use to invoke esptool. (Default: %PYTHON%) echo -f FILENAME The .bin file to flash. Custom to your device type and region. +echo --web Flash WEB APP. goto EOF :GETOPTS @@ -27,6 +29,7 @@ if /I "%1"=="--help" goto HELP if /I "%1"=="-F" set "FILENAME=%2" & SHIFT if /I "%1"=="-p" set ESPTOOL_PORT=%2 & SHIFT if /I "%1"=="-P" set PYTHON=%2 & SHIFT +if /I "%1"=="--web" set WEB_APP=1 & SHIFT SHIFT IF NOT "__%1__"=="____" goto GETOPTS @@ -49,8 +52,14 @@ IF EXIST %FILENAME% IF x%FILENAME:update=%==x%FILENAME% ( ) else ( %ESPTOOL_CMD% --baud 115200 write_flash 0x260000 bleota-s3.bin ) - for %%f in (littlefs-*.bin) do ( - %ESPTOOL_CMD% --baud 115200 write_flash 0x300000 %%f + IF %WEB_APP%==1 ( + for %%f in (littlefsweb-*.bin) do ( + %ESPTOOL_CMD% --baud 115200 write_flash 0x300000 %%f + ) + ) else ( + for %%f in (littlefs-*.bin) do ( + %ESPTOOL_CMD% --baud 115200 write_flash 0x300000 %%f + ) ) ) else ( echo "Invalid file: %FILENAME%" diff --git a/bin/device-install.sh b/bin/device-install.sh index b2a5684eef..9cdf635d76 100755 --- a/bin/device-install.sh +++ b/bin/device-install.sh @@ -1,6 +1,7 @@ #!/bin/sh PYTHON=${PYTHON:-$(which python3 python | head -n 1)} +WEB_APP=false # Determine the correct esptool command to use if "$PYTHON" -m esptool version >/dev/null 2>&1; then @@ -19,16 +20,26 @@ set -e # Usage info show_help() { cat < Date: Thu, 21 Nov 2024 19:14:35 +0800 Subject: [PATCH 11/16] add GPS in indicator board (#5411) --- variants/seeed-sensecap-indicator/variant.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/variants/seeed-sensecap-indicator/variant.h b/variants/seeed-sensecap-indicator/variant.h index d7ed329eb9..ab305422fe 100644 --- a/variants/seeed-sensecap-indicator/variant.h +++ b/variants/seeed-sensecap-indicator/variant.h @@ -36,12 +36,13 @@ #define TOUCH_I2C_PORT 0 #define TOUCH_SLAVE_ADDRESS 0x48 -// Buzzer -#define PIN_BUZZER 19 +// in future, we may want to add a buzzer and add all sensors to the indicator via a data protocol for now only GPS is supported +// // Buzzer +// #define PIN_BUZZER 19 -#define HAS_GPS 0 -#undef GPS_RX_PIN -#undef GPS_TX_PIN +#define GPS_RX_PIN 20 +#define GPS_TX_PIN 19 +#define HAS_GPS 1 #define USE_SX1262 #define USE_SX1268 From fd98e9f55310a93160464cd350c0637b9fee1df6 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 21 Nov 2024 06:13:30 -0600 Subject: [PATCH 12/16] Fixed NMEA sentence issue in CalTopo as well as bug with no printing all of the nodes (#5412) --- src/gps/NMEAWPL.cpp | 2 +- src/modules/SerialModule.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gps/NMEAWPL.cpp b/src/gps/NMEAWPL.cpp index f528c4607c..f4249ca623 100644 --- a/src/gps/NMEAWPL.cpp +++ b/src/gps/NMEAWPL.cpp @@ -23,7 +23,7 @@ uint32_t printWPL(char *buf, size_t bufsz, const meshtastic_PositionLite &pos, c { GeoCoord geoCoord(pos.latitude_i, pos.longitude_i, pos.altitude); char type = isCaltopoMode ? 'P' : 'N'; - uint32_t len = snprintf(buf, bufsz, "$G%cWPL,%02d%07.4f,%c,%03d%07.4f,%c,%s", type, geoCoord.getDMSLatDeg(), + uint32_t len = snprintf(buf, bufsz, "\r\n$G%cWPL,%02d%07.4f,%c,%03d%07.4f,%c,%s", type, geoCoord.getDMSLatDeg(), (abs(geoCoord.getLatitude()) - geoCoord.getDMSLatDeg() * 1e+7) * 6e-6, geoCoord.getDMSLatCP(), geoCoord.getDMSLonDeg(), (abs(geoCoord.getLongitude()) - geoCoord.getDMSLonDeg() * 1e+7) * 6e-6, geoCoord.getDMSLonCP(), name); diff --git a/src/modules/SerialModule.cpp b/src/modules/SerialModule.cpp index 32f9d9bc68..531be274e9 100644 --- a/src/modules/SerialModule.cpp +++ b/src/modules/SerialModule.cpp @@ -204,9 +204,11 @@ int32_t SerialModule::runOnce() lastNmeaTime = millis(); uint32_t readIndex = 0; const meshtastic_NodeInfoLite *tempNodeInfo = nodeDB->readNextMeshNode(readIndex); - while (tempNodeInfo != NULL && tempNodeInfo->has_user && hasValidPosition(tempNodeInfo)) { - printWPL(outbuf, sizeof(outbuf), tempNodeInfo->position, tempNodeInfo->user.long_name, true); - serialPrint->printf("%s", outbuf); + while (tempNodeInfo != NULL) { + if (tempNodeInfo->has_user && hasValidPosition(tempNodeInfo)) { + printWPL(outbuf, sizeof(outbuf), tempNodeInfo->position, tempNodeInfo->user.long_name, true); + serialPrint->printf("%s", outbuf); + } tempNodeInfo = nodeDB->readNextMeshNode(readIndex); } } From 1089469f82f1f4ea39590c54f2b978844b938586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gjels=C3=B8?= <36234524+gjelsoe@users.noreply.github.com> Date: Thu, 21 Nov 2024 20:27:26 +0100 Subject: [PATCH 13/16] --web littlefswebui-* typo fix (#5416) * Add --web * Update device-install.bat Forgot a "-" a few places. * Typo fix. * Typo fix --------- Co-authored-by: Ben Meadors Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com> --- bin/device-install.bat | 2 +- bin/device-install.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/device-install.bat b/bin/device-install.bat index 5e0f1c8479..c18be89a8d 100755 --- a/bin/device-install.bat +++ b/bin/device-install.bat @@ -53,7 +53,7 @@ IF EXIST %FILENAME% IF x%FILENAME:update=%==x%FILENAME% ( %ESPTOOL_CMD% --baud 115200 write_flash 0x260000 bleota-s3.bin ) IF %WEB_APP%==1 ( - for %%f in (littlefsweb-*.bin) do ( + for %%f in (littlefswebui-*.bin) do ( %ESPTOOL_CMD% --baud 115200 write_flash 0x300000 %%f ) ) else ( diff --git a/bin/device-install.sh b/bin/device-install.sh index 9cdf635d76..e09c61ba6b 100755 --- a/bin/device-install.sh +++ b/bin/device-install.sh @@ -85,7 +85,7 @@ if [ -f "${FILENAME}" ] && [ -n "${FILENAME##*"update"*}" ]; then $ESPTOOL_CMD write_flash 0x260000 bleota-s3.bin fi if [ "$WEB_APP" = true ]; then - $ESPTOOL_CMD write_flash 0x300000 littlefsweb-*.bin + $ESPTOOL_CMD write_flash 0x300000 littlefswebui-*.bin else $ESPTOOL_CMD write_flash 0x300000 littlefs-*.bin fi From dbc5ec27f77cae59d465c60100506ffd092a3060 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Thu, 21 Nov 2024 21:11:50 +0100 Subject: [PATCH 14/16] Temporarily disable MDNS when MQTT is enabled (#5418) Leads to a panic --- src/mesh/wifi/WiFiAPClient.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index 911a47093e..779576d64b 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -62,7 +62,11 @@ static void onNetworkConnected() LOG_INFO("Start WiFi network services"); // start mdns - if (!MDNS.begin("Meshtastic")) { + if ( +#ifdef ARCH_RP2040 + !moduleConfig.mqtt.enabled && // MDNS is not supported when MQTT is enabled on ARCH_RP2040 +#endif + !MDNS.begin("Meshtastic")) { LOG_ERROR("Error setting up MDNS responder!"); } else { LOG_INFO("mDNS Host: Meshtastic.local"); From f5058a9cbb76ad1a784f571666e6302d95565775 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 21 Nov 2024 14:52:54 -0600 Subject: [PATCH 15/16] Check for OkToMqtt flag presence before uplinking to MQTT (#5413) * Check for oktomqtt flag presence before uplinking to MQTT * Move to mqtt->onSend --- src/mqtt/MQTT.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 0e2710940f..3d59489764 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -545,9 +545,11 @@ void MQTT::onSend(const meshtastic_MeshPacket &mp_encrypted, const meshtastic_Me // mp_decoded will not be decoded when it's PKI encrypted and not directed to us if (mp_decoded.which_payload_variant == meshtastic_MeshPacket_decoded_tag) { + // For uplinking other's packets, check if it's not OK to MQTT or if it's an older packet without the bitfield + bool dontUplink = !mp_decoded.decoded.has_bitfield || + (mp_decoded.decoded.has_bitfield && !(mp_decoded.decoded.bitfield & BITFIELD_OK_TO_MQTT_MASK)); // check for the lowest bit of the data bitfield set false, and the use of one of the default keys. - if (!isFromUs(&mp_decoded) && !isMqttServerAddressPrivate && mp_decoded.decoded.has_bitfield && - !(mp_decoded.decoded.bitfield & BITFIELD_OK_TO_MQTT_MASK) && + if (!isFromUs(&mp_decoded) && !isMqttServerAddressPrivate && dontUplink && (ch.settings.psk.size < 2 || (ch.settings.psk.size == 16 && memcmp(ch.settings.psk.bytes, defaultpsk, 16)) || (ch.settings.psk.size == 32 && memcmp(ch.settings.psk.bytes, eventpsk, 32)))) { LOG_INFO("MQTT onSend - Not forwarding packet due to DontMqttMeBro flag"); From d5bb32ff93d319d7add76e4b9f44c70bdbb88c39 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 21 Nov 2024 15:11:19 -0600 Subject: [PATCH 16/16] Temetry can respond to want-response for LocalStats variant (#5414) --- src/modules/Telemetry/DeviceTelemetry.cpp | 16 +++++++++++----- src/modules/Telemetry/DeviceTelemetry.h | 2 ++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/modules/Telemetry/DeviceTelemetry.cpp b/src/modules/Telemetry/DeviceTelemetry.cpp index 1f479d6f10..4989b88e22 100644 --- a/src/modules/Telemetry/DeviceTelemetry.cpp +++ b/src/modules/Telemetry/DeviceTelemetry.cpp @@ -77,9 +77,10 @@ meshtastic_MeshPacket *DeviceTelemetryModule::allocReply() // Check for a request for device metrics if (decoded->which_variant == meshtastic_Telemetry_device_metrics_tag) { LOG_INFO("Device telemetry reply to request"); - - meshtastic_Telemetry telemetry = getDeviceTelemetry(); - return allocDataProtobuf(telemetry); + return allocDataProtobuf(getDeviceTelemetry()); + } else if (decoded->which_variant == meshtastic_Telemetry_local_stats_tag) { + LOG_INFO("Device telemetry reply w/ LocalStats to request"); + return allocDataProtobuf(getLocalStatsTelemetry()); } } return NULL; @@ -112,7 +113,7 @@ meshtastic_Telemetry DeviceTelemetryModule::getDeviceTelemetry() return t; } -void DeviceTelemetryModule::sendLocalStatsToPhone() +meshtastic_Telemetry DeviceTelemetryModule::getLocalStatsTelemetry() { meshtastic_Telemetry telemetry = meshtastic_Telemetry_init_zero; telemetry.which_variant = meshtastic_Telemetry_local_stats_tag; @@ -142,7 +143,12 @@ void DeviceTelemetryModule::sendLocalStatsToPhone() LOG_INFO("num_packets_tx=%i, num_packets_rx=%i, num_packets_rx_bad=%i", telemetry.variant.local_stats.num_packets_tx, telemetry.variant.local_stats.num_packets_rx, telemetry.variant.local_stats.num_packets_rx_bad); - meshtastic_MeshPacket *p = allocDataProtobuf(telemetry); + return telemetry; +} + +void DeviceTelemetryModule::sendLocalStatsToPhone() +{ + meshtastic_MeshPacket *p = allocDataProtobuf(getLocalStatsTelemetry()); p->to = NODENUM_BROADCAST; p->decoded.want_response = false; p->priority = meshtastic_MeshPacket_Priority_BACKGROUND; diff --git a/src/modules/Telemetry/DeviceTelemetry.h b/src/modules/Telemetry/DeviceTelemetry.h index 29818d4eb7..19b7d5b014 100644 --- a/src/modules/Telemetry/DeviceTelemetry.h +++ b/src/modules/Telemetry/DeviceTelemetry.h @@ -42,6 +42,8 @@ class DeviceTelemetryModule : private concurrency::OSThread, public ProtobufModu private: meshtastic_Telemetry getDeviceTelemetry(); + meshtastic_Telemetry getLocalStatsTelemetry(); + void sendLocalStatsToPhone(); uint32_t sendToPhoneIntervalMs = SECONDS_IN_MINUTE * 1000; // Send to phone every minute uint32_t sendStatsToPhoneIntervalMs = 15 * SECONDS_IN_MINUTE * 1000; // Send stats to phone every 15 minutes