From aae346aef74b72d5914a470d7f19f18bce2f0ec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Wed, 30 Oct 2024 23:02:59 +0100 Subject: [PATCH 01/26] Update stale_bot.yml --- .github/workflows/stale_bot.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/stale_bot.yml b/.github/workflows/stale_bot.yml index a1ece1d19..0fd2cd5c3 100644 --- a/.github/workflows/stale_bot.yml +++ b/.github/workflows/stale_bot.yml @@ -17,6 +17,5 @@ jobs: - name: Stale PR+Issues uses: actions/stale@v9.0.0 with: - debug-only: true exempt-issue-labels: pinned,3.0 exempt-pr-labels: pinned,3.0 From 462a0718cfc6c5c0bfa35c20cb644e09a8316639 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:46:00 +0100 Subject: [PATCH 02/26] Fix SerialModule getting packet from ourselves (#5206) --- src/modules/SerialModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/SerialModule.cpp b/src/modules/SerialModule.cpp index dc9c8aa85..1c45a1d40 100644 --- a/src/modules/SerialModule.cpp +++ b/src/modules/SerialModule.cpp @@ -315,7 +315,7 @@ ProcessMessage SerialModuleRadio::handleReceived(const meshtastic_MeshPacket &mp // LOG_DEBUG("Received text msg self=0x%0x, from=0x%0x, to=0x%0x, id=%d, msg=%.*s", // nodeDB->getNodeNum(), mp.from, mp.to, mp.id, p.payload.size, p.payload.bytes); - if (!isFromUs(&mp)) { + if (isFromUs(&mp)) { /* * If moduleConfig.serial.echo is true, then echo the packets that are sent out From 600208ab0bd002d95fc5681040598816db7fc4ac Mon Sep 17 00:00:00 2001 From: Alexander Begoon Date: Thu, 31 Oct 2024 21:07:59 +0100 Subject: [PATCH 03/26] Refactor getMacAddr function to retrieve MAC address as MAC-48 for IEEE 802.15.4 compatibility (#5208) --- src/platform/esp32/main-esp32.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/platform/esp32/main-esp32.cpp b/src/platform/esp32/main-esp32.cpp index 7b3493f95..b1185e283 100644 --- a/src/platform/esp32/main-esp32.cpp +++ b/src/platform/esp32/main-esp32.cpp @@ -51,7 +51,11 @@ void updateBatteryLevel(uint8_t level) {} void getMacAddr(uint8_t *dmac) { +#if defined(CONFIG_IDF_TARGET_ESP32C6) && defined(CONFIG_SOC_IEEE802154_SUPPORTED) + assert(esp_base_mac_addr_get(dmac) == ESP_OK); +#else assert(esp_efuse_mac_get_default(dmac) == ESP_OK); +#endif } #ifdef HAS_32768HZ From 7912c214c7a4a6673a4681082f84d37f3adb76b9 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 31 Oct 2024 15:09:27 -0500 Subject: [PATCH 04/26] Increase NimBLE stack size (#5202) --- arch/esp32/esp32.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/esp32/esp32.ini b/arch/esp32/esp32.ini index 36d8b9542..382975e9f 100644 --- a/arch/esp32/esp32.ini +++ b/arch/esp32/esp32.ini @@ -31,7 +31,7 @@ build_flags = -DCONFIG_BT_NIMBLE_ENABLED -DCONFIG_NIMBLE_CPP_LOG_LEVEL=2 -DCONFIG_BT_NIMBLE_MAX_CCCDS=20 - -DCONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE=5120 + -DCONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE=8192 -DESP_OPENSSL_SUPPRESS_LEGACY_WARNING -DSERIAL_BUFFER_SIZE=4096 -DLIBPAX_ARDUINO From 545ebf9b17a8bffe8b7a73a440ac01fe32870f0e Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Thu, 31 Oct 2024 19:44:02 -0500 Subject: [PATCH 05/26] Don't skip GPS serial speeds, and always land on GPS_BAUDRATE (#5195) * Don't skip GPS serial speeds, and always land on GPS_BAUDRATE * Update log message to match. * print the value instead --- src/gps/GPS.cpp | 4 ++-- src/gps/GPS.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index e81331760..1e9e21224 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -421,7 +421,7 @@ bool GPS::setup() if (tx_gpio && gnssModel == GNSS_MODEL_UNKNOWN) { // if GPS_BAUDRATE is specified in variant (i.e. not 9600), skip to the specified rate. - if (speedSelect == 0 && GPS_BAUDRATE != serialSpeeds[speedSelect]) { + if (speedSelect == 0 && probeTries == 2 && GPS_BAUDRATE != serialSpeeds[speedSelect]) { speedSelect = std::find(serialSpeeds, std::end(serialSpeeds), GPS_BAUDRATE) - serialSpeeds; } @@ -431,7 +431,7 @@ bool GPS::setup() if (++speedSelect == sizeof(serialSpeeds) / sizeof(int)) { speedSelect = 0; if (--probeTries == 0) { - LOG_WARN("Giving up on GPS probe and setting to 9600."); + LOG_WARN("Giving up on GPS probe and setting to %d", GPS_BAUDRATE); return true; } } diff --git a/src/gps/GPS.h b/src/gps/GPS.h index 533f6b525..240d087f2 100644 --- a/src/gps/GPS.h +++ b/src/gps/GPS.h @@ -76,7 +76,7 @@ class GPS : private concurrency::OSThread uint8_t fixType = 0; // fix type from GPGSA #endif private: - const int serialSpeeds[6] = {9600, 115200, 38400, 4800, 57600, 9600}; + const int serialSpeeds[6] = {9600, 115200, 38400, 4800, 57600, GPS_BAUDRATE}; uint32_t lastWakeStartMsec = 0, lastSleepStartMsec = 0, lastFixStartMsec = 0; uint32_t rx_gpio = 0; uint32_t tx_gpio = 0; From 732cf4832a9fc0d67f4bfb1b3f64426157ae9a13 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 1 Nov 2024 05:20:00 -0500 Subject: [PATCH 06/26] Bump version since I killed the PR --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index 58380fa5e..b9deaacb2 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 5 -build = 9 +build = 10 From 7e3c369e8768627e0a651eee96eda1be1a5f92be Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 1 Nov 2024 05:58:48 -0500 Subject: [PATCH 07/26] Trunk fmt on comment --- .github/workflows/trunk_format_pr.yml | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/trunk_format_pr.yml diff --git a/.github/workflows/trunk_format_pr.yml b/.github/workflows/trunk_format_pr.yml new file mode 100644 index 000000000..d9b584a12 --- /dev/null +++ b/.github/workflows/trunk_format_pr.yml @@ -0,0 +1,45 @@ +name: Run Trunk Fmt on PR Comment + +on: + issue_comment: + types: [created] + +jobs: + trunk-fmt: + if: github.event.issue.pull_request != null && contains(github.event.comment.body, 'trunk fmt') + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + token: ${{ secrets.ARTIFACTS_TOKEN }} + + - name: Set up Trunk + run: | + curl -fsSL https://get.trunk.io -o get-trunk.sh + sh get-trunk.sh -y + + - name: Run Trunk Fmt + run: trunk fmt + + - name: Commit and push changes + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add . + git commit -m "Add firmware version ${{ steps.version.outputs.version }}" + git push + + - name: Comment on PR + uses: actions/github-script@v5 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + github.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: '`trunk fmt` has been run on this PR.' + }) From 9c06c492d9d5f3e343dbf225a9850672c194fd12 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 1 Nov 2024 06:04:14 -0500 Subject: [PATCH 08/26] Use one from the other PR --- .github/workflows/trunk_format_pr.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/trunk_format_pr.yml b/.github/workflows/trunk_format_pr.yml index d9b584a12..267a5cc54 100644 --- a/.github/workflows/trunk_format_pr.yml +++ b/.github/workflows/trunk_format_pr.yml @@ -16,10 +16,8 @@ jobs: ref: ${{ github.event.pull_request.head.ref }} token: ${{ secrets.ARTIFACTS_TOKEN }} - - name: Set up Trunk - run: | - curl -fsSL https://get.trunk.io -o get-trunk.sh - sh get-trunk.sh -y + - name: Install trunk + run: curl https://get.trunk.io -fsSL | bash - name: Run Trunk Fmt run: trunk fmt From 10dd8af61485a139b25fe4185f5b453abd31c4e8 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 1 Nov 2024 06:10:42 -0500 Subject: [PATCH 09/26] Eh? --- .github/workflows/trunk_format_pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/trunk_format_pr.yml b/.github/workflows/trunk_format_pr.yml index 267a5cc54..a6e527c4f 100644 --- a/.github/workflows/trunk_format_pr.yml +++ b/.github/workflows/trunk_format_pr.yml @@ -13,8 +13,8 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.head.ref }} - token: ${{ secrets.ARTIFACTS_TOKEN }} + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} - name: Install trunk run: curl https://get.trunk.io -fsSL | bash From 8462d65f762ada36c38f813e43ba50b0a0946863 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 07:50:40 -0500 Subject: [PATCH 10/26] Bump actions/github-script from 5 to 7 in /.github/workflows (#5214) Bumps [actions/github-script](https://github.com/actions/github-script) from 5 to 7. - [Release notes](https://github.com/actions/github-script/releases) - [Commits](https://github.com/actions/github-script/compare/v5...v7) --- updated-dependencies: - dependency-name: actions/github-script dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/trunk_format_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/trunk_format_pr.yml b/.github/workflows/trunk_format_pr.yml index a6e527c4f..c5c20b465 100644 --- a/.github/workflows/trunk_format_pr.yml +++ b/.github/workflows/trunk_format_pr.yml @@ -31,7 +31,7 @@ jobs: git push - name: Comment on PR - uses: actions/github-script@v5 + uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | From a1ac358b0a8ae2078dd5094350ba07a5614f80e1 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 1 Nov 2024 13:20:11 -0500 Subject: [PATCH 11/26] Don't try to count non-lora transmissions into airtime (or attempt to decode) (#5215) * Don't try to count non-lora transmissions into airtime (or attempt to decode) * Don't need to check utilization anymore --- src/mesh/RadioLibInterface.cpp | 9 ++++++--- src/modules/NeighborInfoModule.cpp | 4 +--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index 9bf1f27ba..3b20cda14 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -278,11 +278,14 @@ void RadioLibInterface::onNotify(uint32_t notification) // Send any outgoing packets we have ready meshtastic_MeshPacket *txp = txQueue.dequeue(); assert(txp); + bool isLoraTx = txp->to != NODENUM_BROADCAST_NO_LORA; startSend(txp); - // Packet has been sent, count it toward our TX airtime utilization. - uint32_t xmitMsec = getPacketTime(txp); - airTime->logAirtime(TX_LOG, xmitMsec); + if (isLoraTx) { + // Packet has been sent, count it toward our TX airtime utilization. + uint32_t xmitMsec = getPacketTime(txp); + airTime->logAirtime(TX_LOG, xmitMsec); + } } } } else { diff --git a/src/modules/NeighborInfoModule.cpp b/src/modules/NeighborInfoModule.cpp index cbf63e9af..88d434070 100644 --- a/src/modules/NeighborInfoModule.cpp +++ b/src/modules/NeighborInfoModule.cpp @@ -121,9 +121,7 @@ Will be used for broadcast. */ int32_t NeighborInfoModule::runOnce() { - if (airTime->isTxAllowedChannelUtil(true) && airTime->isTxAllowedAirUtil()) { - sendNeighborInfo(NODENUM_BROADCAST_NO_LORA, false); - } + sendNeighborInfo(NODENUM_BROADCAST_NO_LORA, false); return Default::getConfiguredOrDefaultMs(moduleConfig.neighbor_info.update_interval, default_neighbor_info_broadcast_secs); } From 336cdc0efef552b0020606bcbf602f8822736874 Mon Sep 17 00:00:00 2001 From: "Aaron.Lee" <32860565+Heltec-Aaron-Lee@users.noreply.github.com> Date: Sat, 2 Nov 2024 04:12:41 +0800 Subject: [PATCH 12/26] Add Heltec V3 battery read pin detect function (#5196) --- src/Power.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Power.cpp b/src/Power.cpp index 02a07e620..96399f388 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -154,9 +154,16 @@ static void adcEnable() #ifdef ADC_CTRL // enable adc voltage divider when we need to read #ifdef ADC_USE_PULLUP pinMode(ADC_CTRL, INPUT_PULLUP); +#else +#ifdef HELTEC_V3 + pinMode(ADC_CTRL,INPUT); + uint8_t adc_ctl_enable_value=!(digitalRead(ADC_CTRL)); + pinMode(ADC_CTRL, OUTPUT); + digitalWrite(ADC_CTRL, adc_ctl_enable_value); #else pinMode(ADC_CTRL, OUTPUT); digitalWrite(ADC_CTRL, ADC_CTRL_ENABLED); +#endif #endif delay(10); #endif @@ -167,10 +174,14 @@ static void adcDisable() #ifdef ADC_CTRL // disable adc voltage divider when we need to read #ifdef ADC_USE_PULLUP pinMode(ADC_CTRL, INPUT_PULLDOWN); +#else +#ifdef HELTEC_V3 + pinMode(ADC_CTRL,ANALOG); #else digitalWrite(ADC_CTRL, !ADC_CTRL_ENABLED); #endif #endif +#endif } #endif From 701421b50a34d706f378d2d5ed075865f4d39a2d Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 1 Nov 2024 15:17:25 -0500 Subject: [PATCH 13/26] Trunk fmt --- .github/workflows/main_matrix.yml | 3 ++- src/Power.cpp | 6 +++--- variants/icarus/pins_arduino.h | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 0853df19f..efdbd2637 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -245,7 +245,8 @@ jobs: if: ${{ github.event_name == 'workflow_dispatch' }} outputs: upload_url: ${{ steps.create_release.outputs.upload_url }} - needs: [ + needs: + [ gather-artifacts, package-raspbian, package-raspbian-armv7l, diff --git a/src/Power.cpp b/src/Power.cpp index 96399f388..f8d2459bd 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -156,8 +156,8 @@ static void adcEnable() pinMode(ADC_CTRL, INPUT_PULLUP); #else #ifdef HELTEC_V3 - pinMode(ADC_CTRL,INPUT); - uint8_t adc_ctl_enable_value=!(digitalRead(ADC_CTRL)); + pinMode(ADC_CTRL, INPUT); + uint8_t adc_ctl_enable_value = !(digitalRead(ADC_CTRL)); pinMode(ADC_CTRL, OUTPUT); digitalWrite(ADC_CTRL, adc_ctl_enable_value); #else @@ -176,7 +176,7 @@ static void adcDisable() pinMode(ADC_CTRL, INPUT_PULLDOWN); #else #ifdef HELTEC_V3 - pinMode(ADC_CTRL,ANALOG); + pinMode(ADC_CTRL, ANALOG); #else digitalWrite(ADC_CTRL, !ADC_CTRL_ENABLED); #endif diff --git a/variants/icarus/pins_arduino.h b/variants/icarus/pins_arduino.h index 9837a3b34..12d72d6dd 100644 --- a/variants/icarus/pins_arduino.h +++ b/variants/icarus/pins_arduino.h @@ -19,4 +19,3 @@ static const uint8_t MOSI = 38; static const uint8_t SS = 17; #endif /* Pins_Arduino_h */ - \ No newline at end of file From cbe74009a9e5fc20048571b6259f8936c26236c0 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 1 Nov 2024 15:46:11 -0500 Subject: [PATCH 14/26] Comment out unused var to get rid of warning --- .trunk/trunk.yaml | 4 ++-- src/mesh/NodeDB.cpp | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 2fa237d31..7e77baa0b 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -8,10 +8,10 @@ plugins: uri: https://github.com/trunk-io/plugins lint: enabled: - - trufflehog@3.82.13 + - trufflehog@3.83.2 - yamllint@1.35.1 - bandit@1.7.10 - - checkov@3.2.269 + - checkov@3.2.276 - terrascan@1.19.9 - trivy@0.56.2 #- trufflehog@3.63.2-rc0 diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 6b2991958..247cbd254 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -137,11 +137,12 @@ NodeDB::NodeDB() memcpy(myNodeInfo.device_id.bytes, &device_id_start, sizeof(device_id_start)); memcpy(myNodeInfo.device_id.bytes + sizeof(device_id_start), &device_id_end, sizeof(device_id_end)); myNodeInfo.device_id.size = 16; - hasUniqueId = true; + // Uncomment below to print the device id + // hasUniqueId = true; #else // FIXME - implement for other platforms #endif - // Uncomment below to print the device id + // if (hasUniqueId) { // std::string deviceIdHex; // for (size_t i = 0; i < myNodeInfo.device_id.size; ++i) { From 2d4d36c60582641795136996f16696305e0a8638 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Fri, 1 Nov 2024 21:48:55 +0100 Subject: [PATCH 15/26] Drop oldest packet from radio when queue is full (#5212) And still notify Router Co-authored-by: Ben Meadors --- src/mesh/Router.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index d82268cc6..e1eb8eddf 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -81,14 +81,17 @@ int32_t Router::runOnce() */ void Router::enqueueReceivedMessage(meshtastic_MeshPacket *p) { - if (fromRadioQueue.enqueue(p, 0)) { // NOWAIT - fixme, if queue is full, delete older messages - - // Nasty hack because our threading is primitive. interfaces shouldn't need to know about routers FIXME - setReceivedMessage(); - } else { - printPacket("BUG! fromRadioQueue is full! Discarding!", p); - packetPool.release(p); + // Try enqueue until successful + while (!fromRadioQueue.enqueue(p, 0)) { + meshtastic_MeshPacket *old_p; + old_p = fromRadioQueue.dequeuePtr(0); // Dequeue and discard the oldest packet + if (old_p) { + printPacket("fromRadioQ full, drop oldest!", old_p); + packetPool.release(old_p); + } } + // Nasty hack because our threading is primitive. interfaces shouldn't need to know about routers FIXME + setReceivedMessage(); } /// Generate a unique packet id From ba2f25293b8280c85cfe8f9fb8c2833d9ebee8e3 Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Sat, 2 Nov 2024 23:36:40 +1300 Subject: [PATCH 16/26] Fix flipped logic after move to Throttle::isWithinTimespanMs (#5221) --- src/input/ScanAndSelect.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/input/ScanAndSelect.cpp b/src/input/ScanAndSelect.cpp index e1b39edf5..d8767fab8 100644 --- a/src/input/ScanAndSelect.cpp +++ b/src/input/ScanAndSelect.cpp @@ -59,7 +59,7 @@ int32_t ScanAndSelectInput::runOnce() // If: "no messages added" alert screen currently shown if (alertingNoMessage) { // Dismiss the alert screen several seconds after it appears - if (now > alertingSinceMs + durationAlertMs) { + if (!Throttle::isWithinTimespanMs(alertingSinceMs, durationAlertMs)) { alertingNoMessage = false; screen->endAlert(); } @@ -74,9 +74,9 @@ int32_t ScanAndSelectInput::runOnce() // Existing press else { - // Duration enough for long press + // Longer than shortpress window // Long press not yet fired (prevent repeat firing while held) - if (!longPressFired && Throttle::isWithinTimespanMs(downSinceMs, durationLongMs)) { + if (!longPressFired && !Throttle::isWithinTimespanMs(downSinceMs, durationLongMs)) { longPressFired = true; longPress(); } @@ -91,7 +91,9 @@ int32_t ScanAndSelectInput::runOnce() // Button newly released // Long press event didn't already fire if (held && !longPressFired) { - // Duration enough for short press + // Duration within shortpress window + // - longer than durationShortPress (debounce) + // - shorter than durationLongPress if (!Throttle::isWithinTimespanMs(downSinceMs, durationShortMs)) { shortPress(); } From cf476eb87cfe0dea20296fea1e4e719d6f497050 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sat, 2 Nov 2024 05:38:44 -0500 Subject: [PATCH 17/26] Remove assert in mesh-pb-constants.cpp (#5207) * Remove assert in mesh-pb-constants.cpp * Add raw packet output to portduino trace logging. --------- Co-authored-by: Ben Meadors --- src/mesh/RadioLibInterface.cpp | 9 +++++++++ src/mesh/mesh-pb-constants.cpp | 5 +---- src/meshUtils.cpp | 16 +++++++--------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index 3b20cda14..df72a289b 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -11,6 +11,10 @@ #include #include +#if ARCH_PORTDUINO +#include "PortduinoGlue.h" +#include "meshUtils.h" +#endif void LockingArduinoHal::spiBeginTransaction() { spiLock->lock(); @@ -393,6 +397,11 @@ void RadioLibInterface::handleReceiveInterrupt() #endif int state = iface->readData((uint8_t *)&radioBuffer, length); +#if ARCH_PORTDUINO + if (settingsMap[logoutputlevel] == level_trace) { + printBytes("Raw incoming packet: ", (uint8_t *)&radioBuffer, length); + } +#endif if (state != RADIOLIB_ERR_NONE) { LOG_ERROR("ignoring received packet due to error=%d", state); rxBad++; diff --git a/src/mesh/mesh-pb-constants.cpp b/src/mesh/mesh-pb-constants.cpp index a279cd991..deb93d0a6 100644 --- a/src/mesh/mesh-pb-constants.cpp +++ b/src/mesh/mesh-pb-constants.cpp @@ -3,7 +3,6 @@ #include "FSCommon.h" #include "mesh-pb-constants.h" #include -#include #include #include @@ -14,8 +13,6 @@ size_t pb_encode_to_bytes(uint8_t *destbuf, size_t destbufsize, const pb_msgdesc pb_ostream_t stream = pb_ostream_from_buffer(destbuf, destbufsize); if (!pb_encode(&stream, fields, src_struct)) { LOG_ERROR("Panic: can't encode protobuf reason='%s'", PB_GET_ERROR(&stream)); - assert( - 0); // If this assert fails it probably means you made a field too large for the max limits specified in mesh.options return 0; } else { return stream.bytes_written; @@ -71,4 +68,4 @@ bool is_in_helper(uint32_t n, const uint32_t *array, pb_size_t count) return true; return false; -} \ No newline at end of file +} diff --git a/src/meshUtils.cpp b/src/meshUtils.cpp index d211f2922..ea2ba641b 100644 --- a/src/meshUtils.cpp +++ b/src/meshUtils.cpp @@ -61,15 +61,13 @@ char *strnstr(const char *s, const char *find, size_t slen) void printBytes(const char *label, const uint8_t *p, size_t numbytes) { int labelSize = strlen(label); - if (labelSize < 100 && numbytes < 64) { - char *messageBuffer = new char[labelSize + (numbytes * 3) + 2]; - strncpy(messageBuffer, label, labelSize); - for (size_t i = 0; i < numbytes; i++) - snprintf(messageBuffer + labelSize + i * 3, 4, " %02x", p[i]); - strcpy(messageBuffer + labelSize + numbytes * 3, "\n"); - LOG_DEBUG(messageBuffer); - delete[] messageBuffer; - } + char *messageBuffer = new char[labelSize + (numbytes * 3) + 2]; + strncpy(messageBuffer, label, labelSize); + for (size_t i = 0; i < numbytes; i++) + snprintf(messageBuffer + labelSize + i * 3, 4, " %02x", p[i]); + strcpy(messageBuffer + labelSize + numbytes * 3, "\n"); + LOG_DEBUG(messageBuffer); + delete[] messageBuffer; } bool memfll(const uint8_t *mem, uint8_t find, size_t numbytes) From 8801bc5ce928187537ae60b9ec561cf169f7ecd8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 2 Nov 2024 05:58:06 -0500 Subject: [PATCH 18/26] [create-pull-request] automated change (#5223) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/mesh.pb.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/protobufs b/protobufs index 807236815..015202aea 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 807236815d61cc0ebd89472c2a2aa76758bc92ac +Subproject commit 015202aead5f6807d63537c58f4cb6525f19e56f diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index 17254354c..cbc8b00b4 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -408,7 +408,7 @@ typedef enum _meshtastic_LogRecord_Level { } meshtastic_LogRecord_Level; /* Struct definitions */ -/* a gps position */ +/* A GPS Position */ typedef struct _meshtastic_Position { /* The new preferred location encoding, multiply by 1e-7 to get degrees in floating point */ From b0c924f185923b0d87e7bb4dbb94ad8934e340c3 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Sat, 2 Nov 2024 20:51:12 +0800 Subject: [PATCH 19/26] Optimise GPS Baud Rate cycle (#5102) * Optimise GPS Baud Rate cycle Previously, our baud rate cycled through one list twice. There were some rarer baudrates in there, so this code separates out those into a dedicated list that is only run through if detection fails for common bauds. We also only run through each baud rate once. * Fix first time around bug Would have always reset GPS baudrate every time. * Add support for fixing GPS_BAUDRATE If GPS_BAUDRATE is set in variant.h, the deployer knows something we don't about the GPS. Used especially when the GPS is soldered to a board in a commercial product :) If we see that, we don't try other baud rates at all. * Don't print blank lines in GPS_DEBUG. * Try GPS_BAUDRATE first, not only. * Fix spelling mistakes in comments * Only use GPS_BAUDRATE if specified in variant.h * Modify RareSerial Speeds based on FIXED or not. --- src/configuration.h | 3 +++ src/gps/GPS.cpp | 65 ++++++++++++++++++++++++++++----------------- src/gps/GPS.h | 12 +++++++-- 3 files changed, 54 insertions(+), 26 deletions(-) diff --git a/src/configuration.h b/src/configuration.h index cb2326470..33f11bd76 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -207,6 +207,9 @@ along with this program. If not, see . #ifndef GPS_BAUDRATE #define GPS_BAUDRATE 9600 +#define GPS_BAUDRATE_FIXED 0 +#else +#define GPS_BAUDRATE_FIXED 1 #endif /* Step #2: follow with defines common to the architecture; diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 1e9e21224..60d9e8b24 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -413,30 +413,42 @@ int GPS::getACK(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t return 0; } +/** + * @brief Setup the GPS based on the model detected. + * We detect the GPS by cycling through a set of baud rates, first common then rare. + * For each baud rate, we run GPS::Probe to send commands and match the responses + * to known GPS responses. + * @retval Whether setup reached the end of its potential to configure the GPS. + */ bool GPS::setup() { if (!didSerialInit) { int msglen = 0; if (tx_gpio && gnssModel == GNSS_MODEL_UNKNOWN) { - - // if GPS_BAUDRATE is specified in variant (i.e. not 9600), skip to the specified rate. - if (speedSelect == 0 && probeTries == 2 && GPS_BAUDRATE != serialSpeeds[speedSelect]) { - speedSelect = std::find(serialSpeeds, std::end(serialSpeeds), GPS_BAUDRATE) - serialSpeeds; + if (probeTries < 2) { + LOG_DEBUG("Probing for GPS at %d", serialSpeeds[speedSelect]); + gnssModel = probe(serialSpeeds[speedSelect]); + if (gnssModel == GNSS_MODEL_UNKNOWN) { + if (++speedSelect == sizeof(serialSpeeds) / sizeof(int)) { + speedSelect = 0; + ++probeTries; + } + } } - - LOG_DEBUG("Probing for GPS at %d", serialSpeeds[speedSelect]); - gnssModel = probe(serialSpeeds[speedSelect]); - if (gnssModel == GNSS_MODEL_UNKNOWN) { - if (++speedSelect == sizeof(serialSpeeds) / sizeof(int)) { - speedSelect = 0; - if (--probeTries == 0) { + // Rare Serial Speeds + if (probeTries == 2) { + LOG_DEBUG("Probing for GPS at %d", rareSerialSpeeds[speedSelect]); + gnssModel = probe(rareSerialSpeeds[speedSelect]); + if (gnssModel == GNSS_MODEL_UNKNOWN) { + if (++speedSelect == sizeof(rareSerialSpeeds) / sizeof(int)) { LOG_WARN("Giving up on GPS probe and setting to %d", GPS_BAUDRATE); return true; } } - return false; } + return false; + } else { gnssModel = GNSS_MODEL_UNKNOWN; } @@ -675,7 +687,8 @@ bool GPS::setup() SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_DISABLE_SBAS_BBR, "disable SBAS M10 GPS BBR", 300); delay(750); // will cause a receiver restart so wait a bit - // Done with initialization, Now enable wanted NMEA messages in BBR layer so they will survive a periodic sleep. + // Done with initialization, Now enable wanted NMEA messages in BBR layer so they will survive a periodic + // sleep. SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_ENABLE_NMEA_BBR, "enable messages for M10 GPS BBR", 300); delay(750); // Next enable wanted NMEA messages in RAM layer @@ -937,10 +950,10 @@ void GPS::down() #endif if (softsleepSupported) { - // How long does gps_update_interval need to be, for GPS_HARDSLEEP to become more efficient than GPS_SOFTSLEEP? - // Heuristic equation. A compromise manually fitted to power observations from U-blox NEO-6M and M10050 - // https://www.desmos.com/calculator/6gvjghoumr - // This is not particularly accurate, but probably an impromevement over a single, fixed threshold + // How long does gps_update_interval need to be, for GPS_HARDSLEEP to become more efficient than + // GPS_SOFTSLEEP? Heuristic equation. A compromise manually fitted to power observations from U-blox NEO-6M + // and M10050 https://www.desmos.com/calculator/6gvjghoumr This is not particularly accurate, but probably an + // improvement over a single, fixed threshold uint32_t hardsleepThreshold = (2750 * pow(predictedSearchDuration / 1000, 1.22)); LOG_DEBUG("gps_update_interval >= %us needed to justify hardsleep", hardsleepThreshold / 1000); @@ -1293,10 +1306,12 @@ GPS *GPS::createGps() if (!GPS_EN_ACTIVE) { // Need to invert the pin before hardware new GpioNotTransformer( - virtPin, p); // We just leave this created object on the heap so it can stay watching virtPin and driving en_gpio + virtPin, + p); // We just leave this created object on the heap so it can stay watching virtPin and driving en_gpio } else { new GpioUnaryTransformer( - virtPin, p); // We just leave this created object on the heap so it can stay watching virtPin and driving en_gpio + virtPin, + p); // We just leave this created object on the heap so it can stay watching virtPin and driving en_gpio } } @@ -1404,8 +1419,8 @@ bool GPS::factoryReset() _serial_gps->write("$PMTK104*37\r\n"); // No PMTK_ACK for this command. delay(100); - // send the UBLOX Factory Reset Command regardless of detect state, something is very wrong, just assume it's UBLOX. - // Factory Reset + // send the UBLOX Factory Reset Command regardless of detect state, something is very wrong, just assume it's + // UBLOX. Factory Reset byte _message_reset[] = {0xB5, 0x62, 0x06, 0x09, 0x0D, 0x00, 0xFF, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x17, 0x2B, 0x7E}; _serial_gps->write(_message_reset, sizeof(_message_reset)); @@ -1444,8 +1459,8 @@ bool GPS::lookForTime() auto d = reader.date; if (ti.isValid() && d.isValid()) { // Note: we don't check for updated, because we'll only be called if needed /* Convert to unix time -The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 -(midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z). +The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, +1970 (midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z). */ struct tm t; t.tm_sec = ti.second() + round(ti.age() / 1000); @@ -1678,7 +1693,9 @@ bool GPS::whileActive() } } #ifdef GPS_DEBUG - LOG_DEBUG(debugmsg.c_str()); + if (debugmsg != "") { + LOG_DEBUG(debugmsg.c_str()); + } #endif return isValid; } diff --git a/src/gps/GPS.h b/src/gps/GPS.h index 240d087f2..cd61c5444 100644 --- a/src/gps/GPS.h +++ b/src/gps/GPS.h @@ -76,13 +76,21 @@ class GPS : private concurrency::OSThread uint8_t fixType = 0; // fix type from GPGSA #endif private: - const int serialSpeeds[6] = {9600, 115200, 38400, 4800, 57600, GPS_BAUDRATE}; +#if GPS_BAUDRATE_FIXED + // if GPS_BAUDRATE is specified in variant, only try that. + const int serialSpeeds[1] = {GPS_BAUDRATE}; + const int rareSerialSpeeds[1] = {GPS_BAUDRATE}; +#else + const int serialSpeeds[3] = {9600, 115200, 38400}; + const int rareSerialSpeeds[3] = {4800, 57600, GPS_BAUDRATE}; +#endif + uint32_t lastWakeStartMsec = 0, lastSleepStartMsec = 0, lastFixStartMsec = 0; uint32_t rx_gpio = 0; uint32_t tx_gpio = 0; int speedSelect = 0; - int probeTries = 2; + int probeTries = 0; /** * hasValidLocation - indicates that the position variables contain a complete From 0fc5c9b0d7ce80c8c693dcf20b182b5efb6ef1a5 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 2 Nov 2024 07:57:33 -0500 Subject: [PATCH 20/26] Create CODE_OF_CONDUCT.md (#5225) --- CODE_OF_CONDUCT.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..1e23cdf4d --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,4 @@ +# Contributor Covenant Code of Conduct + +The Meshtastic Firmware project is subject to the code of conduct for the parent project, which can be found here: +https://meshtastic.org/docs/legal/conduct/ From 93bc61c8558b234253b02fa647ee9ed49d87c29b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 2 Nov 2024 16:30:43 +0100 Subject: [PATCH 21/26] [create-pull-request] automated change (#5227) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index b9deaacb2..6664f69b9 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 5 -build = 10 +build = 11 From bee474ee5452a3c1c010feb56023f490cc269c61 Mon Sep 17 00:00:00 2001 From: Technologyman00 Date: Sat, 2 Nov 2024 20:25:05 -0500 Subject: [PATCH 22/26] Spell check all Code (#5228) * Spelling Fixes * More Spelling Errors * More Spelling Checks * fixed wording * Undo mesh\generated changes * Missed one file on readd * missed second file --- src/GpioLogic.cpp | 2 +- src/Power.cpp | 2 +- src/PowerFSM.cpp | 6 +++--- src/gps/GPSUpdateScheduling.cpp | 6 +++--- src/gps/ubx.h | 2 +- src/mesh/Channels.cpp | 2 +- src/mesh/RadioInterface.cpp | 2 +- src/mesh/RadioLibInterface.cpp | 2 +- src/mesh/ReliableRouter.cpp | 2 +- src/mesh/ReliableRouter.h | 2 +- src/mesh/Router.cpp | 2 +- src/mesh/Router.h | 4 ++-- src/mesh/SX126xInterface.cpp | 2 +- src/modules/NeighborInfoModule.cpp | 2 +- src/modules/RoutingModule.cpp | 2 +- src/modules/SerialModule.cpp | 2 +- src/modules/Telemetry/UnitConversions.cpp | 4 ++-- src/modules/Telemetry/UnitConversions.h | 2 +- src/motion/LSM6DS3Sensor.cpp | 2 +- src/sleep.cpp | 4 ++-- 20 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/GpioLogic.cpp b/src/GpioLogic.cpp index ba01d482d..e429df538 100644 --- a/src/GpioLogic.cpp +++ b/src/GpioLogic.cpp @@ -66,7 +66,7 @@ GpioBinaryTransformer::GpioBinaryTransformer(GpioVirtPin *inPin1, GpioVirtPin *i assert(!inPin2->dependentPin); // We only allow one dependent pin inPin2->dependentPin = this; - // Don't update at construction time, because various GpioPins might be global constructor based not yet initied because + // Don't update at construction time, because various GpioPins might be global constructor based not yet initiated because // order of operations for global constructors is not defined. // update(); } diff --git a/src/Power.cpp b/src/Power.cpp index f8d2459bd..8d094244a 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -640,7 +640,7 @@ void Power::readPowerStatus() batteryChargePercent = batteryLevel->getBatteryPercent(); } else { // If the AXP192 returns a percentage less than 0, the feature is either not supported or there is an error - // In that case, we compute an estimate of the charge percent based on open circuite voltage table defined + // In that case, we compute an estimate of the charge percent based on open circuit voltage table defined // in power.h batteryChargePercent = clamp((int)(((batteryVoltageMv - (OCV[NUM_OCV_POINTS - 1] * NUM_CELLS)) * 1e2) / ((OCV[0] * NUM_CELLS) - (OCV[NUM_OCV_POINTS - 1] * NUM_CELLS))), diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp index 35ef2624a..b94b11e0a 100644 --- a/src/PowerFSM.cpp +++ b/src/PowerFSM.cpp @@ -185,7 +185,7 @@ static void powerEnter() { // LOG_DEBUG("Enter state: POWER"); if (!isPowered()) { - // If we got here, we are in the wrong state - we should be in powered, let that state ahndle things + // If we got here, we are in the wrong state - we should be in powered, let that state handle things LOG_INFO("Loss of power in Powered"); powerFSM.trigger(EVENT_POWER_DISCONNECTED); } else { @@ -230,7 +230,7 @@ static void onEnter() static void onIdle() { if (isPowered()) { - // If we got here, we are in the wrong state - we should be in powered, let that state ahndle things + // If we got here, we are in the wrong state - we should be in powered, let that state handle things powerFSM.trigger(EVENT_POWER_CONNECTED); } } @@ -371,7 +371,7 @@ void PowerFSM_setup() // We never enter light-sleep or NB states on NRF52 (because the CPU uses so little power normally) #ifdef ARCH_ESP32 // See: https://github.com/meshtastic/firmware/issues/1071 - // Don't add power saving transitions if we are a power saving tracker or sensor. Sleep will be initiatiated through the + // Don't add power saving transitions if we are a power saving tracker or sensor. Sleep will be initiated through the // modules if ((isRouter || config.power.is_power_saving) && !isTrackerOrSensor) { powerFSM.add_timed_transition(&stateNB, &stateLS, diff --git a/src/gps/GPSUpdateScheduling.cpp b/src/gps/GPSUpdateScheduling.cpp index abcf6b196..09c92788e 100644 --- a/src/gps/GPSUpdateScheduling.cpp +++ b/src/gps/GPSUpdateScheduling.cpp @@ -49,7 +49,7 @@ uint32_t GPSUpdateScheduling::msUntilNextSearch() } // How long have we already been searching? -// Used to abort a search in progress, if it runs unnaceptably long +// Used to abort a search in progress, if it runs unacceptably long uint32_t GPSUpdateScheduling::elapsedSearchMs() { // If searching @@ -98,7 +98,7 @@ void GPSUpdateScheduling::updateLockTimePrediction() // Ignore the first lock-time: likely to be long, will skew data - // Second locktime: likely stable. Use to intialize the smoothing filter + // Second locktime: likely stable. Use to initialize the smoothing filter if (searchCount == 1) predictedMsToGetLock = lockTime; @@ -106,7 +106,7 @@ void GPSUpdateScheduling::updateLockTimePrediction() else if (searchCount > 1) predictedMsToGetLock = (lockTime * weighting) + (predictedMsToGetLock * (1 - weighting)); - searchCount++; // Only tracked so we can diregard initial lock-times + searchCount++; // Only tracked so we can disregard initial lock-times LOG_DEBUG("Predicting %us to get next lock", predictedMsToGetLock / 1000); } diff --git a/src/gps/ubx.h b/src/gps/ubx.h index 68cca00a3..551921384 100644 --- a/src/gps/ubx.h +++ b/src/gps/ubx.h @@ -462,7 +462,7 @@ the PM config. Lets try without it. PMREQ sort of works with SBAS, but the awake time is too short to re-acquire any SBAS sats. The defination of "Got Fix" doesn't seem to include SBAS. Much more too this... Even if it was, it can take minutes (up to 12.5), -even under good sat visability conditions to re-acquire the SBAS data. +even under good sat visibility conditions to re-acquire the SBAS data. Another effect fo the quick transition to sleep is that no other sats will be acquired so the sat count will tend to remain at what the initial fix was. diff --git a/src/mesh/Channels.cpp b/src/mesh/Channels.cpp index b9fe95678..a314a5498 100644 --- a/src/mesh/Channels.cpp +++ b/src/mesh/Channels.cpp @@ -398,7 +398,7 @@ bool Channels::decryptForHash(ChannelIndex chIndex, ChannelHash channelHash) * * This method is called before encoding outbound packets * - * @eturn the (0 to 255) hash for that channel - if no suitable channel could be found, return -1 + * @return the (0 to 255) hash for that channel - if no suitable channel could be found, return -1 */ int16_t Channels::setActiveByIndex(ChannelIndex channelIndex) { diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index e8f6d1c07..00dbafdaa 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -140,7 +140,7 @@ const RegionInfo regions[] = { Philippines 433 - 434.7 MHz <10 mW erp, NTC approved device required 868 - 869.4 MHz <25 mW erp, NTC approved device required - 915 - 918 MHz <250 mW EIRP, no external antennna allowed + 915 - 918 MHz <250 mW EIRP, no external antenna allowed https://github.com/meshtastic/firmware/issues/4948#issuecomment-2394926135 */ diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index df72a289b..6f6d52930 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -348,7 +348,7 @@ void RadioLibInterface::handleTransmitInterrupt() // ignore the transmit interrupt if (sendingPacket) completeSending(); - powerMon->clearState(meshtastic_PowerMon_State_Lora_TXOn); // But our transmitter is deffinitely off now + powerMon->clearState(meshtastic_PowerMon_State_Lora_TXOn); // But our transmitter is definitely off now } void RadioLibInterface::completeSending() diff --git a/src/mesh/ReliableRouter.cpp b/src/mesh/ReliableRouter.cpp index a2e09362d..a107a381e 100644 --- a/src/mesh/ReliableRouter.cpp +++ b/src/mesh/ReliableRouter.cpp @@ -224,7 +224,7 @@ int32_t ReliableRouter::doRetransmissions() bool stillValid = true; // assume we'll keep this record around - // FIXME, handle 51 day rolloever here!!! + // FIXME, handle 51 day rollover here!!! if (p.nextTxMsec <= now) { if (p.numRetransmissions == 0) { LOG_DEBUG("Reliable send failed, returning a nak for fr=0x%x,to=0x%x,id=0x%x", p.packet->from, p.packet->to, diff --git a/src/mesh/ReliableRouter.h b/src/mesh/ReliableRouter.h index 259da7249..ba9ab8c25 100644 --- a/src/mesh/ReliableRouter.h +++ b/src/mesh/ReliableRouter.h @@ -4,7 +4,7 @@ #include /** - * An identifier for a globalally unique message - a pair of the sending nodenum and the packet id assigned + * An identifier for a globally unique message - a pair of the sending nodenum and the packet id assigned * to that message */ struct GlobalPacketId { diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index e1eb8eddf..fbe111efd 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -426,7 +426,7 @@ bool perhapsDecode(meshtastic_MeshPacket *p) } } -/** Return 0 for success or a Routing_Errror code for failure +/** Return 0 for success or a Routing_Error code for failure */ meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p) { diff --git a/src/mesh/Router.h b/src/mesh/Router.h index 8ebc1a3e5..73e4db519 100644 --- a/src/mesh/Router.h +++ b/src/mesh/Router.h @@ -132,7 +132,7 @@ class Router : protected concurrency::OSThread */ void handleReceived(meshtastic_MeshPacket *p, RxSource src = RX_SRC_RADIO); - /** Frees the provided packet, and generates a NAK indicating the speicifed error while sending */ + /** Frees the provided packet, and generates a NAK indicating the specifed error while sending */ void abortSendAndNak(meshtastic_Routing_Error err, meshtastic_MeshPacket *p); }; @@ -143,7 +143,7 @@ class Router : protected concurrency::OSThread */ bool perhapsDecode(meshtastic_MeshPacket *p); -/** Return 0 for success or a Routing_Errror code for failure +/** Return 0 for success or a Routing_Error code for failure */ meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p); diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index c88ed39d9..a975195dc 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -94,7 +94,7 @@ template bool SX126xInterface::init() // Overriding current limit // (https://github.com/jgromes/RadioLib/blob/690a050ebb46e6097c5d00c371e961c1caa3b52e/src/modules/SX126x/SX126x.cpp#L85) using - // value in SX126xInterface.h (currently 140 mA) It may or may not be neccessary, depending on how RadioLib functions, from + // value in SX126xInterface.h (currently 140 mA) It may or may not be necessary, depending on how RadioLib functions, from // SX1261/2 datasheet: OCP after setting DeviceSel with SetPaConfig(): SX1261 - 60 mA, SX1262 - 140 mA For the SX1268 the IC // defaults to 140mA no matter the set power level, but RadioLib set it lower, this would need further checking Default values // are: SX1262, SX1268: 0x38 (140 mA), SX1261: 0x18 (60 mA) diff --git a/src/modules/NeighborInfoModule.cpp b/src/modules/NeighborInfoModule.cpp index 88d434070..7423c92e9 100644 --- a/src/modules/NeighborInfoModule.cpp +++ b/src/modules/NeighborInfoModule.cpp @@ -126,7 +126,7 @@ int32_t NeighborInfoModule::runOnce() } /* -Collect a recieved neighbor info packet from another node +Collect a received neighbor info packet from another node Pass it to an upper client; do not persist this data on the mesh */ bool NeighborInfoModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_NeighborInfo *np) diff --git a/src/modules/RoutingModule.cpp b/src/modules/RoutingModule.cpp index f11a9a542..d7cae41a6 100644 --- a/src/modules/RoutingModule.cpp +++ b/src/modules/RoutingModule.cpp @@ -78,7 +78,7 @@ RoutingModule::RoutingModule() : ProtobufModule("routing", meshtastic_PortNum_RO { isPromiscuous = true; - // moved the ReboradcastMode logic into handleReceivedProtobuf + // moved the RebroadcastMode logic into handleReceivedProtobuf // LocalOnly requires either the from or to to be a known node // knownOnly specifically requires the from to be a known node. encryptedOk = true; diff --git a/src/modules/SerialModule.cpp b/src/modules/SerialModule.cpp index 1c45a1d40..7057e6087 100644 --- a/src/modules/SerialModule.cpp +++ b/src/modules/SerialModule.cpp @@ -532,7 +532,7 @@ void SerialModule::processWXSerial() batVoltageF, capVoltageF, temperatureF); } if (gotwind && !Throttle::isWithinTimespanMs(lastAveraged, averageIntervalMillis)) { - // calulate averages and send to the mesh + // calculate averages and send to the mesh float velAvg = 1.0 * velSum / velCount; double avgSin = dir_sum_sin / dirCount; diff --git a/src/modules/Telemetry/UnitConversions.cpp b/src/modules/Telemetry/UnitConversions.cpp index 9f40de40f..fff1ee3d2 100644 --- a/src/modules/Telemetry/UnitConversions.cpp +++ b/src/modules/Telemetry/UnitConversions.cpp @@ -1,8 +1,8 @@ #include "UnitConversions.h" -float UnitConversions::CelsiusToFahrenheit(float celcius) +float UnitConversions::CelsiusToFahrenheit(float celsius) { - return (celcius * 9) / 5 + 32; + return (celsius * 9) / 5 + 32; } float UnitConversions::MetersPerSecondToKnots(float metersPerSecond) diff --git a/src/modules/Telemetry/UnitConversions.h b/src/modules/Telemetry/UnitConversions.h index 60f9b664a..638476315 100644 --- a/src/modules/Telemetry/UnitConversions.h +++ b/src/modules/Telemetry/UnitConversions.h @@ -3,7 +3,7 @@ class UnitConversions { public: - static float CelsiusToFahrenheit(float celcius); + static float CelsiusToFahrenheit(float celsius); static float MetersPerSecondToKnots(float metersPerSecond); static float MetersPerSecondToMilesPerHour(float metersPerSecond); static float HectoPascalToInchesOfMercury(float hectoPascal); diff --git a/src/motion/LSM6DS3Sensor.cpp b/src/motion/LSM6DS3Sensor.cpp index 3b25c3872..cd39fcb45 100755 --- a/src/motion/LSM6DS3Sensor.cpp +++ b/src/motion/LSM6DS3Sensor.cpp @@ -12,7 +12,7 @@ bool LSM6DS3Sensor::init() // Default threshold of 2G, less sensitive options are 4, 8 or 16G sensor.setAccelRange(LSM6DS_ACCEL_RANGE_2_G); - // Duration is number of occurances needed to trigger, higher threshold is less sensitive + // Duration is number of occurrences needed to trigger, higher threshold is less sensitive sensor.enableWakeup(config.display.wake_on_tap_or_motion, 1, LSM6DS3_WAKE_THRESH); LOG_DEBUG("LSM6DS3Sensor::init ok"); diff --git a/src/sleep.cpp b/src/sleep.cpp index 3bc1042bb..083d2a07e 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -287,7 +287,7 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false) // No need to turn this off if the power draw in sleep mode really is just 0.2uA and turning it off would // leave floating input for the IRQ line // If we want to leave the radio receiving in would be 11.5mA current draw, but most of the time it is just waiting - // in its sequencer (true?) so the average power draw should be much lower even if we were listinging for packets + // in its sequencer (true?) so the average power draw should be much lower even if we were listening for packets // all the time. PMU->setChargingLedMode(XPOWERS_CHG_LED_OFF); @@ -359,7 +359,7 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r // never tries to go to sleep if the user is using the API // gpio_wakeup_enable((gpio_num_t)SERIAL0_RX_GPIO, GPIO_INTR_LOW_LEVEL); - // doesn't help - I think the USB-UART chip losing power is pulling the signal llow + // doesn't help - I think the USB-UART chip losing power is pulling the signal low // gpio_pullup_en((gpio_num_t)SERIAL0_RX_GPIO); // alas - can only work if using the refclock, which is limited to about 9600 bps From 1bec23b6bbfc178c8cab8bb0c0682ff0fee40ac5 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Sun, 3 Nov 2024 20:19:15 +0800 Subject: [PATCH 23/26] Fix displays showing "GPS Not Present" until first lock (#5229) https://github.com/meshtastic/firmware/pull/5160 introduced a change which made first publication of GPS information take up to 15mins. For that initial period, displays would show "No GPS Present", even if one was detected. This change fixes that bug, triggering publication immediately after a GPS module is detected. --- src/gps/GPS.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 60d9e8b24..af3c8950e 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -447,10 +447,12 @@ bool GPS::setup() } } } - return false; + } + if (gnssModel != GNSS_MODEL_UNKNOWN) { + setConnected(); } else { - gnssModel = GNSS_MODEL_UNKNOWN; + return false; } if (gnssModel == GNSS_MODEL_MTK) { @@ -1009,6 +1011,7 @@ int32_t GPS::runOnce() } } GPSInitFinished = true; + publishUpdate(); } // Repeaters have no need for GPS From da7424a6044291ecc02562d56ce197f66387263e Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Sun, 3 Nov 2024 13:21:45 +0100 Subject: [PATCH 24/26] Improve ACK logic for responses and repeated packets (#5232) * Don't send ACKs to responses over multiple hops * Move repeated sending logic to `wasSeenRecently()` * Add exception for simulator for duplicate packets from PhoneAPI * Add short debug message --- src/mesh/MeshModule.cpp | 10 +++++----- src/mesh/MeshModule.h | 2 +- src/mesh/PacketHistory.cpp | 7 +++++++ src/mesh/PhoneAPI.cpp | 3 +++ src/mesh/ReliableRouter.cpp | 28 +++++++++++----------------- src/mesh/Router.cpp | 5 ++--- src/mesh/Router.h | 3 +-- src/modules/RoutingModule.cpp | 5 ++--- src/modules/RoutingModule.h | 5 ++--- 9 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/mesh/MeshModule.cpp b/src/mesh/MeshModule.cpp index a8de540eb..fc8199c65 100644 --- a/src/mesh/MeshModule.cpp +++ b/src/mesh/MeshModule.cpp @@ -33,7 +33,7 @@ MeshModule::~MeshModule() } meshtastic_MeshPacket *MeshModule::allocAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, - uint8_t hopStart, uint8_t hopLimit) + uint8_t hopLimit) { meshtastic_Routing c = meshtastic_Routing_init_default; @@ -50,7 +50,7 @@ meshtastic_MeshPacket *MeshModule::allocAckNak(meshtastic_Routing_Error err, Nod p->priority = meshtastic_MeshPacket_Priority_ACK; - p->hop_limit = routingModule->getHopLimitForResponse(hopStart, hopLimit); // Flood ACK back to original sender + p->hop_limit = hopLimit; // Flood ACK back to original sender p->to = to; p->decoded.request_id = idFrom; p->channel = chIndex; @@ -181,8 +181,8 @@ void MeshModule::callModules(meshtastic_MeshPacket &mp, RxSource src) // SECURITY NOTE! I considered sending back a different error code if we didn't find the psk (i.e. !isDecoded) // but opted NOT TO. Because it is not a good idea to let remote nodes 'probe' to find out which PSKs were "good" vs // bad. - routingModule->sendAckNak(meshtastic_Routing_Error_NO_RESPONSE, getFrom(&mp), mp.id, mp.channel, mp.hop_start, - mp.hop_limit); + routingModule->sendAckNak(meshtastic_Routing_Error_NO_RESPONSE, getFrom(&mp), mp.id, mp.channel, + routingModule->getHopLimitForResponse(mp.hop_start, mp.hop_limit)); } } @@ -295,4 +295,4 @@ bool MeshModule::isRequestingFocus() } else return false; } -#endif +#endif \ No newline at end of file diff --git a/src/mesh/MeshModule.h b/src/mesh/MeshModule.h index 7929ba972..d37de0d83 100644 --- a/src/mesh/MeshModule.h +++ b/src/mesh/MeshModule.h @@ -162,7 +162,7 @@ class MeshModule virtual Observable *getUIFrameObservable() { return NULL; } meshtastic_MeshPacket *allocAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, - uint8_t hopStart = 0, uint8_t hopLimit = 0); + uint8_t hopLimit = 0); /// Send an error response for the specified packet. meshtastic_MeshPacket *allocErrorResponse(meshtastic_Routing_Error err, const meshtastic_MeshPacket *p); diff --git a/src/mesh/PacketHistory.cpp b/src/mesh/PacketHistory.cpp index 8d49bce43..b31a357d2 100644 --- a/src/mesh/PacketHistory.cpp +++ b/src/mesh/PacketHistory.cpp @@ -38,6 +38,13 @@ bool PacketHistory::wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpd seenRecently = false; } + /* If the original transmitter is doing retransmissions (hopStart equals hopLimit) for a reliable transmission, e.g., when the + ACK got lost, we will handle the packet again to make sure it gets an ACK/response to its packet. */ + if (seenRecently && p->hop_start > 0 && p->hop_start == p->hop_limit) { + LOG_DEBUG("Repeated reliable tx"); + seenRecently = false; + } + if (seenRecently) { LOG_DEBUG("Found existing packet record for fr=0x%x,to=0x%x,id=0x%x", p->from, p->to, p->id); } diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 98db38c47..c94899bb8 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -596,10 +596,13 @@ bool PhoneAPI::handleToRadioPacket(meshtastic_MeshPacket &p) { printPacket("PACKET FROM PHONE", &p); +// For use with the simulator, we should not ignore duplicate packets +#if !(defined(ARCH_PORTDUINO) && !HAS_RADIO) if (p.id > 0 && wasSeenRecently(p.id)) { LOG_DEBUG("Ignoring packet from phone, already seen recently"); return false; } +#endif if (p.decoded.portnum == meshtastic_PortNum_TRACEROUTE_APP && lastPortNumToRadio[p.decoded.portnum] && Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], THIRTY_SECONDS_MS)) { diff --git a/src/mesh/ReliableRouter.cpp b/src/mesh/ReliableRouter.cpp index a107a381e..b08809638 100644 --- a/src/mesh/ReliableRouter.cpp +++ b/src/mesh/ReliableRouter.cpp @@ -1,10 +1,10 @@ #include "ReliableRouter.h" #include "Default.h" -#include "MeshModule.h" #include "MeshTypes.h" #include "configuration.h" #include "mesh-pb-constants.h" #include "modules/NodeInfoModule.h" +#include "modules/RoutingModule.h" // ReliableRouter::ReliableRouter() {} @@ -73,18 +73,6 @@ bool ReliableRouter::shouldFilterReceived(const meshtastic_MeshPacket *p) i->second.nextTxMsec += iface->getPacketTime(p); } - /* Resend implicit ACKs for repeated packets (hopStart equals hopLimit); - * this way if an implicit ACK is dropped and a packet is resent we'll rebroadcast again. - * Resending real ACKs is omitted, as you might receive a packet multiple times due to flooding and - * flooding this ACK back to the original sender already adds redundancy. */ - bool isRepeated = p->hop_start == 0 ? (p->hop_limit == HOP_RELIABLE) : (p->hop_start == p->hop_limit); - if (wasSeenRecently(p, false) && isRepeated && !MeshModule::currentReply && !isToUs(p)) { - LOG_DEBUG("Resending implicit ack for a repeated floodmsg"); - meshtastic_MeshPacket *tosend = packetPool.allocCopy(*p); - tosend->hop_limit--; // bump down the hop count - Router::send(tosend); - } - return FloodingRouter::shouldFilterReceived(p); } @@ -107,16 +95,22 @@ void ReliableRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas 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) { - sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, p->channel, p->hop_start, p->hop_limit); + // 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, + 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(), - p->hop_start, p->hop_limit); + 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(), p->hop_start, - p->hop_limit); + sendAckNak(meshtastic_Routing_Error_NO_CHANNEL, getFrom(p), p->id, channels.getPrimaryIndex(), + routingModule->getHopLimitForResponse(p->hop_start, p->hop_limit)); } } if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag && c && diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index fbe111efd..0cf5b127f 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -136,10 +136,9 @@ meshtastic_MeshPacket *Router::allocForSending() /** * Send an ack or a nak packet back towards whoever sent idFrom */ -void Router::sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, uint8_t hopStart, - uint8_t hopLimit) +void Router::sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, uint8_t hopLimit) { - routingModule->sendAckNak(err, to, idFrom, chIndex, hopStart, hopLimit); + routingModule->sendAckNak(err, to, idFrom, chIndex, hopLimit); } void Router::abortSendAndNak(meshtastic_Routing_Error err, meshtastic_MeshPacket *p) diff --git a/src/mesh/Router.h b/src/mesh/Router.h index 73e4db519..da44d67df 100644 --- a/src/mesh/Router.h +++ b/src/mesh/Router.h @@ -108,8 +108,7 @@ class Router : protected concurrency::OSThread /** * Send an ack or a nak packet back towards whoever sent idFrom */ - void sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, uint8_t hopStart = 0, - uint8_t hopLimit = 0); + void sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, uint8_t hopLimit = 0); private: /** diff --git a/src/modules/RoutingModule.cpp b/src/modules/RoutingModule.cpp index d7cae41a6..a501e319b 100644 --- a/src/modules/RoutingModule.cpp +++ b/src/modules/RoutingModule.cpp @@ -49,10 +49,9 @@ meshtastic_MeshPacket *RoutingModule::allocReply() return NULL; } -void RoutingModule::sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, uint8_t hopStart, - uint8_t hopLimit) +void RoutingModule::sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, uint8_t hopLimit) { - auto p = allocAckNak(err, to, idFrom, chIndex, hopStart, hopLimit); + auto p = allocAckNak(err, to, idFrom, chIndex, hopLimit); router->sendLocal(p); // we sometimes send directly to the local node } diff --git a/src/modules/RoutingModule.h b/src/modules/RoutingModule.h index f085b307b..7c34c5bc9 100644 --- a/src/modules/RoutingModule.h +++ b/src/modules/RoutingModule.h @@ -13,8 +13,7 @@ class RoutingModule : public ProtobufModule */ RoutingModule(); - void sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, uint8_t hopStart = 0, - uint8_t hopLimit = 0); + void sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, uint8_t hopLimit = 0); // Given the hopStart and hopLimit upon reception of a request, return the hop limit to use for the response uint8_t getHopLimitForResponse(uint8_t hopStart, uint8_t hopLimit); @@ -36,4 +35,4 @@ class RoutingModule : public ProtobufModule virtual bool wantPacket(const meshtastic_MeshPacket *p) override { return true; } }; -extern RoutingModule *routingModule; +extern RoutingModule *routingModule; \ No newline at end of file From 448c754882380bfc768ac47034a495a7bb237d89 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Sun, 3 Nov 2024 21:14:06 +0800 Subject: [PATCH 25/26] LR1110 - remove old comment referring to non-existent function. (#5233) It seems like there was no setrxgain function in RadioLib. Since we're unlikely to uncomment and enable this non-existent feature, remove this code. --- src/mesh/LR11x0Interface.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/mesh/LR11x0Interface.cpp b/src/mesh/LR11x0Interface.cpp index d0c1a1fbc..f82532352 100644 --- a/src/mesh/LR11x0Interface.cpp +++ b/src/mesh/LR11x0Interface.cpp @@ -161,11 +161,6 @@ template bool LR11x0Interface::reconfigure() if (err != RADIOLIB_ERR_NONE) RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING); - // Hmm - seems to lower SNR when the signal levels are high. Leaving off for now... - // TODO: Confirm gain registers are okay now - // err = lora.setRxGain(true); - // assert(err == RADIOLIB_ERR_NONE); - err = lora.setSyncWord(syncWord); assert(err == RADIOLIB_ERR_NONE); From 9415254dda61b44bb7a4aa7028d369b9693f5b24 Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 3 Nov 2024 08:24:04 -0500 Subject: [PATCH 26/26] musl compatibility (#5219) * musl compat * trunk fmt * Update platform-native, including musl fix https://github.com/meshtastic/platform-native/pull/5 --------- Co-authored-by: Ben Meadors --- arch/portduino/portduino.ini | 2 +- src/mesh/RadioLibInterface.h | 1 + src/modules/AdminModule.h | 2 ++ src/serialization/MeshPacketSerializer.cpp | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index 7eb563d77..976951b4f 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -1,6 +1,6 @@ ; The Portduino based sim environment on top of any host OS, all hardware will be simulated [portduino_base] -platform = https://github.com/meshtastic/platform-native.git#6b3796d697481c8f6e3f4aa5c111bd9979f29e64 +platform = https://github.com/meshtastic/platform-native.git#bcd02436cfca91f7d28ad0f7dab977c6aaa781af framework = arduino build_src_filter = diff --git a/src/mesh/RadioLibInterface.h b/src/mesh/RadioLibInterface.h index 353176a5b..1202c3bbc 100644 --- a/src/mesh/RadioLibInterface.h +++ b/src/mesh/RadioLibInterface.h @@ -5,6 +5,7 @@ #include "concurrency/NotifiedWorkerThread.h" #include +#include // ESP32 has special rules about ISR code #ifdef ARDUINO_ARCH_ESP32 diff --git a/src/modules/AdminModule.h b/src/modules/AdminModule.h index e54b89af1..b99e86707 100644 --- a/src/modules/AdminModule.h +++ b/src/modules/AdminModule.h @@ -1,3 +1,5 @@ +#include + #pragma once #include "ProtobufModule.h" #if HAS_WIFI diff --git a/src/serialization/MeshPacketSerializer.cpp b/src/serialization/MeshPacketSerializer.cpp index 21fb377b2..05a98f7a6 100644 --- a/src/serialization/MeshPacketSerializer.cpp +++ b/src/serialization/MeshPacketSerializer.cpp @@ -11,6 +11,7 @@ #include "../mesh/generated/meshtastic/paxcount.pb.h" #endif #include "mesh/generated/meshtastic/remote_hardware.pb.h" +#include std::string MeshPacketSerializer::JsonSerialize(const meshtastic_MeshPacket *mp, bool shouldLog) {