From 6f56ccd283f4279af88a4f241cabc7e0c19392f8 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Fri, 19 Sep 2025 21:16:19 -0500 Subject: [PATCH 1/5] C6l fixes (#8047) --- src/gps/GPS.cpp | 2 ++ src/nimble/NimbleBluetooth.cpp | 7 +++++++ src/nimble/NimbleBluetooth.h | 1 + 3 files changed, 10 insertions(+) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index a4c7464b8..3bf2710fe 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -516,6 +516,7 @@ bool GPS::setup() } } // Rare Serial Speeds +#ifndef CONFIG_IDF_TARGET_ESP32C6 if (probeTries == GPS_PROBETRIES) { LOG_DEBUG("Probe for GPS at %d", rareSerialSpeeds[speedSelect]); gnssModel = probe(rareSerialSpeeds[speedSelect]); @@ -526,6 +527,7 @@ bool GPS::setup() } } } +#endif } if (gnssModel != GNSS_MODEL_UNKNOWN) { diff --git a/src/nimble/NimbleBluetooth.cpp b/src/nimble/NimbleBluetooth.cpp index 0eb8e9bdd..accf6c5dc 100644 --- a/src/nimble/NimbleBluetooth.cpp +++ b/src/nimble/NimbleBluetooth.cpp @@ -231,6 +231,10 @@ class NimbleBluetoothServerCallback : public NimBLEServerCallbacks { LOG_INFO("BLE disconnect"); #endif +#ifdef NIMBLE_TWO + if (ble->isDeInit) + return; +#endif meshtastic::BluetoothStatus newStatus(meshtastic::BluetoothStatus::ConnectionState::DISCONNECTED); bluetoothStatus->updateStatus(&newStatus); @@ -270,6 +274,7 @@ void NimbleBluetooth::deinit() { #ifdef ARCH_ESP32 LOG_INFO("Disable bluetooth until reboot"); + isDeInit = true; #ifdef BLE_LED #ifdef BLE_LED_INVERTED @@ -278,8 +283,10 @@ void NimbleBluetooth::deinit() digitalWrite(BLE_LED, LOW); #endif #endif +#ifndef NIMBLE_TWO NimBLEDevice::deinit(); #endif +#endif } // Has initial setup been completed diff --git a/src/nimble/NimbleBluetooth.h b/src/nimble/NimbleBluetooth.h index 899355b4d..458fa4a67 100644 --- a/src/nimble/NimbleBluetooth.h +++ b/src/nimble/NimbleBluetooth.h @@ -15,6 +15,7 @@ class NimbleBluetooth : BluetoothApi #if defined(NIMBLE_TWO) void startAdvertising(); #endif + bool isDeInit = false; private: void setupService(); From 44968415a5a71a7320bbed13c1534e3686aefd9f Mon Sep 17 00:00:00 2001 From: Markus <974709+Links2004@users.noreply.github.com> Date: Sat, 20 Sep 2025 13:33:41 +0200 Subject: [PATCH 2/5] fix build with HAS_TELEMETRY 0 (#8051) --- src/modules/Modules.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/Modules.cpp b/src/modules/Modules.cpp index 757753d45..b3c15e764 100644 --- a/src/modules/Modules.cpp +++ b/src/modules/Modules.cpp @@ -241,7 +241,7 @@ void setupModules() #if HAS_TELEMETRY new DeviceTelemetryModule(); #endif -#if HAS_SENSOR && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR +#if HAS_TELEMETRY && HAS_SENSOR && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR if (moduleConfig.has_telemetry && (moduleConfig.telemetry.environment_measurement_enabled || moduleConfig.telemetry.environment_screen_enabled)) { new EnvironmentTelemetryModule(); From 1d3c47c5fa813e6fe44627063fa041aa28735057 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Sat, 20 Sep 2025 13:37:40 +0200 Subject: [PATCH 3/5] Make sure to ACK ACKs/replies if next-hop routing is used (#8052) * Make sure to ACK ACKs/replies if next-hop routing is used To stop their retransmissions; hop limit of 0 is enough * Update src/mesh/ReliableRouter.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Ben Meadors Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/mesh/ReliableRouter.cpp | 45 +++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/src/mesh/ReliableRouter.cpp b/src/mesh/ReliableRouter.cpp index 6d098b669..cca838ff0 100644 --- a/src/mesh/ReliableRouter.cpp +++ b/src/mesh/ReliableRouter.cpp @@ -97,27 +97,34 @@ bool ReliableRouter::shouldFilterReceived(const meshtastic_MeshPacket *p) void ReliableRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Routing *c) { if (isToUs(p)) { // ignore ack/nak/want_ack packets that are not address to us (we only handle 0 hop reliability) - if (p->want_ack) { - if (MeshModule::currentReply) { - LOG_DEBUG("Another module replied to this message, no need for 2nd ack"); - } else if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) { - // A response may be set to want_ack for retransmissions, but we don't need to ACK a response if it received an - // implicit ACK already. If we received it directly, only ACK with a hop limit of 0 - if (!p->decoded.request_id) - sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, p->channel, + if (!MeshModule::currentReply) { + if (p->want_ack) { + if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) { + /* A response may be set to want_ack for retransmissions, but we don't need to ACK a response if it received + an implicit ACK already. If we received it directly or via NextHopRouter, only ACK with a hop limit of 0 to + make sure the other side stops retransmitting. */ + if (!p->decoded.request_id && !p->decoded.reply_id) { + sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, p->channel, + routingModule->getHopLimitForResponse(p->hop_start, p->hop_limit)); + } else if ((p->hop_start > 0 && p->hop_start == p->hop_limit) || p->next_hop != NO_NEXT_HOP_PREFERENCE) { + sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, p->channel, 0); + } + } else if (p->which_payload_variant == meshtastic_MeshPacket_encrypted_tag && p->channel == 0 && + (nodeDB->getMeshNode(p->from) == nullptr || nodeDB->getMeshNode(p->from)->user.public_key.size == 0)) { + LOG_INFO("PKI packet from unknown node, send PKI_UNKNOWN_PUBKEY"); + sendAckNak(meshtastic_Routing_Error_PKI_UNKNOWN_PUBKEY, getFrom(p), p->id, channels.getPrimaryIndex(), routingModule->getHopLimitForResponse(p->hop_start, p->hop_limit)); - else if (p->hop_start > 0 && p->hop_start == p->hop_limit) - sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, p->channel, 0); - } else if (p->which_payload_variant == meshtastic_MeshPacket_encrypted_tag && p->channel == 0 && - (nodeDB->getMeshNode(p->from) == nullptr || nodeDB->getMeshNode(p->from)->user.public_key.size == 0)) { - LOG_INFO("PKI packet from unknown node, send PKI_UNKNOWN_PUBKEY"); - sendAckNak(meshtastic_Routing_Error_PKI_UNKNOWN_PUBKEY, getFrom(p), p->id, channels.getPrimaryIndex(), - routingModule->getHopLimitForResponse(p->hop_start, p->hop_limit)); - } else { - // Send a 'NO_CHANNEL' error on the primary channel if want_ack packet destined for us cannot be decoded - sendAckNak(meshtastic_Routing_Error_NO_CHANNEL, getFrom(p), p->id, channels.getPrimaryIndex(), - routingModule->getHopLimitForResponse(p->hop_start, p->hop_limit)); + } else { + // Send a 'NO_CHANNEL' error on the primary channel if want_ack packet destined for us cannot be decoded + sendAckNak(meshtastic_Routing_Error_NO_CHANNEL, getFrom(p), p->id, channels.getPrimaryIndex(), + routingModule->getHopLimitForResponse(p->hop_start, p->hop_limit)); + } + } else if (p->next_hop == nodeDB->getLastByteOfNodeNum(getNodeNum()) && p->hop_limit > 0) { + // No wantAck, but we need to ACK with hop limit of 0 if we were the next hop to stop their retransmissions + sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, p->channel, 0); } + } else { + LOG_DEBUG("Another module replied to this message, no need for 2nd ack"); } if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag && c && c->error_reason == meshtastic_Routing_Error_PKI_UNKNOWN_PUBKEY) { From 9b6cf53730e7d04da4689c82f874bc752570a8f8 Mon Sep 17 00:00:00 2001 From: Markus <974709+Links2004@users.noreply.github.com> Date: Sat, 20 Sep 2025 19:15:41 +0200 Subject: [PATCH 4/5] move HTTP contentTypes to Flash - saves 768 Bytes of RAM (#8055) --- src/mesh/http/ContentHandler.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mesh/http/ContentHandler.cpp b/src/mesh/http/ContentHandler.cpp index fb66dae7c..f87c6e3b0 100644 --- a/src/mesh/http/ContentHandler.cpp +++ b/src/mesh/http/ContentHandler.cpp @@ -55,12 +55,12 @@ HTTPClient httpClient; // We need to specify some content-type mapping, so the resources get delivered with the // right content type and are displayed correctly in the browser -char contentTypes[][2][32] = {{".txt", "text/plain"}, {".html", "text/html"}, - {".js", "text/javascript"}, {".png", "image/png"}, - {".jpg", "image/jpg"}, {".gz", "application/gzip"}, - {".gif", "image/gif"}, {".json", "application/json"}, - {".css", "text/css"}, {".ico", "image/vnd.microsoft.icon"}, - {".svg", "image/svg+xml"}, {"", ""}}; +char const *contentTypes[][2] = {{".txt", "text/plain"}, {".html", "text/html"}, + {".js", "text/javascript"}, {".png", "image/png"}, + {".jpg", "image/jpg"}, {".gz", "application/gzip"}, + {".gif", "image/gif"}, {".json", "application/json"}, + {".css", "text/css"}, {".ico", "image/vnd.microsoft.icon"}, + {".svg", "image/svg+xml"}, {"", ""}}; // const char *certificate = NULL; // change this as needed, leave as is for no TLS check (yolo security) From 34c2191f6323b0518ceeec9e53933ca0de57a8c0 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Sat, 20 Sep 2025 19:17:14 +0200 Subject: [PATCH 5/5] Use `lora.use_preset` config to get name (#8057) --- src/mesh/Channels.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesh/Channels.cpp b/src/mesh/Channels.cpp index aec112a3e..4dcd94e3b 100644 --- a/src/mesh/Channels.cpp +++ b/src/mesh/Channels.cpp @@ -428,8 +428,8 @@ bool Channels::setDefaultPresetCryptoForHash(ChannelHash channelHash) // Iterate all known presets for (int preset = _meshtastic_Config_LoRaConfig_ModemPreset_MIN; preset <= _meshtastic_Config_LoRaConfig_ModemPreset_MAX; ++preset) { - const char *name = - DisplayFormatters::getModemPresetDisplayName((meshtastic_Config_LoRaConfig_ModemPreset)preset, false, false); + const char *name = DisplayFormatters::getModemPresetDisplayName((meshtastic_Config_LoRaConfig_ModemPreset)preset, false, + config.lora.use_preset); if (!name) continue; if (strcmp(name, "Invalid") == 0)