From 4debcd5ccd59eae3741789ce77d4c77f0567b17b Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Thu, 21 Mar 2024 20:35:17 +0100 Subject: [PATCH 01/21] Set default position precision of mapReport to 14 (#3456) --- src/mqtt/MQTT.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mqtt/MQTT.h b/src/mqtt/MQTT.h index dbc0c77b3..41b1601e7 100644 --- a/src/mqtt/MQTT.h +++ b/src/mqtt/MQTT.h @@ -90,8 +90,8 @@ class MQTT : private concurrency::OSThread // For map reporting (only applies when enabled) uint32_t last_report_to_map = 0; - uint32_t map_position_precision = 32; // default to full precision - uint32_t map_publish_interval_secs = 60 * 15; // default to 15 minutes + uint32_t map_position_precision = 14; // defaults to max. offset of ~1459m + uint32_t map_publish_interval_secs = 60 * 15; // defaults to 15 minutes /** return true if we have a channel that wants uplink/downlink or map reporting is enabled */ From 0a7ddb7594d4a8c514ba29b592df3039079fb7cd Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Thu, 21 Mar 2024 20:42:53 +0100 Subject: [PATCH 02/21] Let NeighborInfo Module ignore packets coming from MQTT (#3457) --- src/modules/NeighborInfoModule.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/NeighborInfoModule.h b/src/modules/NeighborInfoModule.h index df5c2c948..820e2d0d4 100644 --- a/src/modules/NeighborInfoModule.h +++ b/src/modules/NeighborInfoModule.h @@ -75,8 +75,9 @@ class NeighborInfoModule : public ProtobufModule, priva /* Does our periodic broadcast */ int32_t runOnce() override; - // Override wantPacket to say we want to see all packets when enabled, not just those for our port number - virtual bool wantPacket(const meshtastic_MeshPacket *p) override { return enabled; } + /* Override wantPacket to say we want to see all packets when enabled, not just those for our port number. + Exception is when the packet came via MQTT */ + virtual bool wantPacket(const meshtastic_MeshPacket *p) override { return enabled && !p->via_mqtt; } /* These are for debugging only */ void printNeighborInfo(const char *header, const meshtastic_NeighborInfo *np); From 6dd337a651ffafd81f47a530a41ee23bfce286e1 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 21 Mar 2024 14:43:10 -0500 Subject: [PATCH 03/21] Clear local position on nodedb-reset (#3451) * Clear local position on nodedb-reset * NodeDB pointer now, yo --------- Co-authored-by: Jonathan Bennett --- src/mesh/NodeDB.cpp | 11 +++++++++++ src/mesh/NodeDB.h | 2 ++ src/modules/PositionModule.cpp | 14 ++------------ src/modules/PositionModule.h | 3 --- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 6db8fc50b..80b46a426 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -434,6 +434,7 @@ void NodeDB::resetNodes() { numMeshNodes = 1; std::fill(devicestate.node_db_lite.begin() + 1, devicestate.node_db_lite.end(), meshtastic_NodeInfoLite()); + clearLocalPosition(); saveDeviceStateToDisk(); if (neighborInfoModule && moduleConfig.neighbor_info.enabled) neighborInfoModule->resetNeighbors(); @@ -455,6 +456,16 @@ void NodeDB::removeNodeByNum(uint nodeNum) saveDeviceStateToDisk(); } +void NodeDB::clearLocalPosition() +{ + meshtastic_NodeInfoLite *node = getMeshNode(nodeDB->getNodeNum()); + node->position.latitude_i = 0; + node->position.longitude_i = 0; + node->position.altitude = 0; + node->position.time = 0; + setLocalPosition(meshtastic_Position_init_default); +} + void NodeDB::cleanupMeshDB() { int newPos = 0, removed = 0; diff --git a/src/mesh/NodeDB.h b/src/mesh/NodeDB.h index 23870db74..4d24d7225 100644 --- a/src/mesh/NodeDB.h +++ b/src/mesh/NodeDB.h @@ -131,6 +131,8 @@ class NodeDB meshtastic_NodeInfoLite *getMeshNode(NodeNum n); size_t getNumMeshNodes() { return numMeshNodes; } + void clearLocalPosition(); + void setLocalPosition(meshtastic_Position position, bool timeOnly = false) { if (timeOnly) { diff --git a/src/modules/PositionModule.cpp b/src/modules/PositionModule.cpp index 0bfc775da..d22c6b699 100644 --- a/src/modules/PositionModule.cpp +++ b/src/modules/PositionModule.cpp @@ -34,21 +34,11 @@ PositionModule::PositionModule() if ((config.device.role == meshtastic_Config_DeviceConfig_Role_TRACKER || config.device.role == meshtastic_Config_DeviceConfig_Role_TAK_TRACKER) && config.power.is_power_saving) { - clearPosition(); + LOG_DEBUG("Clearing position on startup for sleepy tracker (ー。ー) zzz\n"); + nodeDB->clearLocalPosition(); } } -void PositionModule::clearPosition() -{ - LOG_DEBUG("Clearing position on startup for sleepy tracker (ー。ー) zzz\n"); - meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum()); - node->position.latitude_i = 0; - node->position.longitude_i = 0; - node->position.altitude = 0; - node->position.time = 0; - nodeDB->setLocalPosition(meshtastic_Position_init_default); -} - bool PositionModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Position *pptr) { auto p = *pptr; diff --git a/src/modules/PositionModule.h b/src/modules/PositionModule.h index fddafef6f..68171ab0e 100644 --- a/src/modules/PositionModule.h +++ b/src/modules/PositionModule.h @@ -51,9 +51,6 @@ class PositionModule : public ProtobufModule, private concu struct SmartPosition getDistanceTraveledSinceLastSend(meshtastic_PositionLite currentPosition); meshtastic_MeshPacket *allocAtakPli(); uint32_t precision; - - /** Only used in power saving trackers for now */ - void clearPosition(); void sendLostAndFoundText(); }; From defeb8e52bab51eff5ab990119a0976f43730482 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Thu, 21 Mar 2024 15:24:57 -0500 Subject: [PATCH 04/21] Bump actions to node 20 (#3461) --- .github/actions/setup-base/action.yml | 6 +++--- .github/workflows/build_esp32.yml | 4 ++-- .github/workflows/build_esp32_c3.yml | 4 ++-- .github/workflows/build_esp32_s3.yml | 4 ++-- .github/workflows/build_nrf52.yml | 4 ++-- .github/workflows/build_raspbian.yml | 4 ++-- .github/workflows/build_rpi2040.yml | 4 ++-- .github/workflows/main_matrix.yml | 18 +++++++++--------- .github/workflows/nightly.yml | 2 +- .github/workflows/package_raspbian.yml | 4 ++-- .github/workflows/sec_sast_flawfinder.yml | 4 ++-- .github/workflows/sec_sast_semgrep_cron.yml | 4 ++-- .github/workflows/sec_sast_semgrep_pull.yml | 2 +- .github/workflows/trunk-check.yml | 2 +- .github/workflows/update_protobufs.yml | 2 +- 15 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/actions/setup-base/action.yml b/.github/actions/setup-base/action.yml index 7b97e1753..7e57f6a31 100644 --- a/.github/actions/setup-base/action.yml +++ b/.github/actions/setup-base/action.yml @@ -5,7 +5,7 @@ runs: using: "composite" steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: "recursive" ref: ${{github.event.pull_request.head.ref}} @@ -30,12 +30,12 @@ runs: sudo apt-get install -y libyaml-cpp-dev - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.x - name: Cache python libs - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache-pip # needed in if test with: path: ~/.cache/pip diff --git a/.github/workflows/build_esp32.yml b/.github/workflows/build_esp32.yml index 31f0dd5a0..1a07d5f28 100644 --- a/.github/workflows/build_esp32.yml +++ b/.github/workflows/build_esp32.yml @@ -11,7 +11,7 @@ jobs: build-esp32: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build base id: base uses: ./.github/actions/setup-base @@ -54,7 +54,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/build_esp32_c3.yml b/.github/workflows/build_esp32_c3.yml index a30cf33f1..cdb8427c1 100644 --- a/.github/workflows/build_esp32_c3.yml +++ b/.github/workflows/build_esp32_c3.yml @@ -13,7 +13,7 @@ jobs: build-esp32-c3: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build base id: base uses: ./.github/actions/setup-base @@ -54,7 +54,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/build_esp32_s3.yml b/.github/workflows/build_esp32_s3.yml index f603a6a31..502a319c5 100644 --- a/.github/workflows/build_esp32_s3.yml +++ b/.github/workflows/build_esp32_s3.yml @@ -11,7 +11,7 @@ jobs: build-esp32-s3: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build base id: base uses: ./.github/actions/setup-base @@ -52,7 +52,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/build_nrf52.yml b/.github/workflows/build_nrf52.yml index 33ee4d00c..a37547973 100644 --- a/.github/workflows/build_nrf52.yml +++ b/.github/workflows/build_nrf52.yml @@ -11,7 +11,7 @@ jobs: build-nrf52: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build base id: base uses: ./.github/actions/setup-base @@ -24,7 +24,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/build_raspbian.yml b/.github/workflows/build_raspbian.yml index 7a25892bc..04aa2340b 100644 --- a/.github/workflows/build_raspbian.yml +++ b/.github/workflows/build_raspbian.yml @@ -11,7 +11,7 @@ jobs: runs-on: [self-hosted, linux, ARM64] steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive ref: ${{github.event.pull_request.head.ref}} @@ -37,7 +37,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firmware-raspbian-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/build_rpi2040.yml b/.github/workflows/build_rpi2040.yml index 76ca2c20e..aac70610f 100644 --- a/.github/workflows/build_rpi2040.yml +++ b/.github/workflows/build_rpi2040.yml @@ -11,7 +11,7 @@ jobs: build-rpi2040: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build base id: base uses: ./.github/actions/setup-base @@ -24,7 +24,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 03d47f18e..d1c01a366 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build base id: base uses: ./.github/actions/setup-base @@ -157,7 +157,7 @@ jobs: build-native: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build base id: base uses: ./.github/actions/setup-base @@ -180,7 +180,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firmware-native-${{ steps.version.outputs.version }}.zip path: | @@ -221,7 +221,7 @@ jobs: needs: [check] steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} @@ -244,7 +244,7 @@ jobs: ] steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} @@ -264,7 +264,7 @@ jobs: run: mv -b -t ./ ./*tbeam-2*/littlefs*.bin ./*tbeam-2*/bleota.bin ./*tbeam-s3*/bleota-s3.bin ./*esp32c3*/bleota-c3.bin ./**/firmware*.bin ./*t-echo*/Meshtastic_nRF52_factory_erase_v2.uf2 ./**/firmware-*.uf2 ./**/firmware-*-ota.zip ./**/*.elf ./*native*/*device-*.sh ./*native*/*device-*.bat ./firmware-raspbian-*/release/meshtasticd_linux_aarch64 ./firmware-raspbian-*/bin/config-dist.yaml - name: Repackage in single firmware zip - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firmware-${{ steps.version.outputs.version }} path: | @@ -295,7 +295,7 @@ jobs: run: zip -j -9 -r ./firmware-${{ steps.version.outputs.version }}.zip ./output - name: Repackage in single elfs zip - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: debug-elfs-${{ steps.version.outputs.version }}.zip path: ./*.elf @@ -319,10 +319,10 @@ jobs: needs: [gather-artifacts, after-checks] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.x diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index da59bc0fd..e249823a7 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Trunk Check uses: trunk-io/trunk-action@782e83f803ca6e369f035d64c6ba2768174ba61b diff --git a/.github/workflows/package_raspbian.yml b/.github/workflows/package_raspbian.yml index 377074e95..6c1ae5d60 100644 --- a/.github/workflows/package_raspbian.yml +++ b/.github/workflows/package_raspbian.yml @@ -17,7 +17,7 @@ jobs: needs: build-raspbian steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive ref: ${{github.event.pull_request.head.ref}} @@ -66,7 +66,7 @@ jobs: depends: libyaml-cpp0.7, openssl desc: Native Linux Meshtastic binary. - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: artifact-deb path: | diff --git a/.github/workflows/sec_sast_flawfinder.yml b/.github/workflows/sec_sast_flawfinder.yml index 2c7e751af..59ff994ca 100644 --- a/.github/workflows/sec_sast_flawfinder.yml +++ b/.github/workflows/sec_sast_flawfinder.yml @@ -16,7 +16,7 @@ jobs: steps: # step 1 - name: clone application source code - uses: actions/checkout@v3 + uses: actions/checkout@v4 # step 2 - name: flawfinder_scan @@ -27,7 +27,7 @@ jobs: # step 3 - name: save report as pipeline artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: flawfinder_report.sarif path: flawfinder_report.sarif diff --git a/.github/workflows/sec_sast_semgrep_cron.yml b/.github/workflows/sec_sast_semgrep_cron.yml index cdd2c3c37..a29e6ca02 100644 --- a/.github/workflows/sec_sast_semgrep_cron.yml +++ b/.github/workflows/sec_sast_semgrep_cron.yml @@ -17,7 +17,7 @@ jobs: steps: # step 1 - name: clone application source code - uses: actions/checkout@v3 + uses: actions/checkout@v4 # step 2 - name: full scan @@ -29,7 +29,7 @@ jobs: # step 3 - name: save report as pipeline artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: report.sarif path: report.sarif diff --git a/.github/workflows/sec_sast_semgrep_pull.yml b/.github/workflows/sec_sast_semgrep_pull.yml index 1697ffb1b..b6c288494 100644 --- a/.github/workflows/sec_sast_semgrep_pull.yml +++ b/.github/workflows/sec_sast_semgrep_pull.yml @@ -11,7 +11,7 @@ jobs: steps: # step 1 - name: clone application source code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.github/workflows/trunk-check.yml b/.github/workflows/trunk-check.yml index e35b91cb9..6ed905bc8 100644 --- a/.github/workflows/trunk-check.yml +++ b/.github/workflows/trunk-check.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Trunk Check uses: trunk-io/trunk-action@v1 diff --git a/.github/workflows/update_protobufs.yml b/.github/workflows/update_protobufs.yml index 6944d827e..4c51c35c7 100644 --- a/.github/workflows/update_protobufs.yml +++ b/.github/workflows/update_protobufs.yml @@ -7,7 +7,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: true From 9c88906acc1e910e49402bd474c7390be157a9f4 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Thu, 21 Mar 2024 16:14:45 -0500 Subject: [PATCH 05/21] Remove double run of build-raspbian --- .github/workflows/main_matrix.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index d1c01a366..c145feca2 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -145,11 +145,11 @@ jobs: with: board: ${{ matrix.board }} - build-raspbian: - strategy: - fail-fast: false - max-parallel: 1 - uses: ./.github/workflows/build_raspbian.yml + #build-raspbian: + # strategy: + # fail-fast: false + # max-parallel: 1 + # uses: ./.github/workflows/build_raspbian.yml package-raspbian: uses: ./.github/workflows/package_raspbian.yml From 907d075917209291338de769dedb667cfa6faf9e Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Thu, 21 Mar 2024 16:17:13 -0500 Subject: [PATCH 06/21] Revert previous attempt --- .github/workflows/main_matrix.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index c145feca2..d1c01a366 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -145,11 +145,11 @@ jobs: with: board: ${{ matrix.board }} - #build-raspbian: - # strategy: - # fail-fast: false - # max-parallel: 1 - # uses: ./.github/workflows/build_raspbian.yml + build-raspbian: + strategy: + fail-fast: false + max-parallel: 1 + uses: ./.github/workflows/build_raspbian.yml package-raspbian: uses: ./.github/workflows/package_raspbian.yml From 155df45d92fd23d86926d8ae46876b102b8b4b23 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:20:20 +0100 Subject: [PATCH 07/21] Add sanity check for map report interval and position precision (#3459) * Add sanity check for map report interval and position precision * Use new `Default::` methods --- src/mqtt/MQTT.cpp | 8 +++++--- src/mqtt/MQTT.h | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index e29786dcb..390d0e206 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -195,8 +195,10 @@ MQTT::MQTT() : concurrency::OSThread("mqtt"), mqttQueue(MAX_MQTT_QUEUE) } if (moduleConfig.mqtt.map_reporting_enabled && moduleConfig.mqtt.has_map_report_settings) { - map_position_precision = moduleConfig.mqtt.map_report_settings.position_precision; - map_publish_interval_secs = moduleConfig.mqtt.map_report_settings.publish_interval_secs; + map_position_precision = Default::getConfiguredOrDefault(moduleConfig.mqtt.map_report_settings.position_precision, + default_map_position_precision); + map_publish_interval_msecs = Default::getConfiguredOrDefaultMs( + moduleConfig.mqtt.map_report_settings.publish_interval_secs, default_map_publish_interval_secs); } #ifdef HAS_NETWORKING @@ -540,7 +542,7 @@ void MQTT::perhapsReportToMap() if (!moduleConfig.mqtt.map_reporting_enabled || !(moduleConfig.mqtt.proxy_to_client_enabled || isConnectedDirectly())) return; - if (millis() - last_report_to_map < map_publish_interval_secs * 1000) { + if (millis() - last_report_to_map < map_publish_interval_msecs) { return; } else { if (map_position_precision == 0 || (localPosition.latitude_i == 0 && localPosition.longitude_i == 0)) { diff --git a/src/mqtt/MQTT.h b/src/mqtt/MQTT.h index 41b1601e7..f2eb6b120 100644 --- a/src/mqtt/MQTT.h +++ b/src/mqtt/MQTT.h @@ -89,9 +89,11 @@ class MQTT : private concurrency::OSThread std::string mapTopic = "/2/map/"; // For protobuf-encoded MapReport messages // For map reporting (only applies when enabled) + const uint32_t default_map_position_precision = 14; // defaults to max. offset of ~1459m + const uint32_t default_map_publish_interval_secs = 60 * 15; // defaults to 15 minutes uint32_t last_report_to_map = 0; - uint32_t map_position_precision = 14; // defaults to max. offset of ~1459m - uint32_t map_publish_interval_secs = 60 * 15; // defaults to 15 minutes + uint32_t map_position_precision = default_map_position_precision; + uint32_t map_publish_interval_msecs = default_map_publish_interval_secs * 1000; /** return true if we have a channel that wants uplink/downlink or map reporting is enabled */ From 79cfb1e8769bfd258f91dd9193c42d424e8c450e Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Thu, 21 Mar 2024 16:50:44 -0500 Subject: [PATCH 08/21] Revert "Bump actions to node 20 (#3461)" (#3462) This reverts commit defeb8e52bab51eff5ab990119a0976f43730482. As per https://github.com/actions/upload-artifact/issues/478 the new version of upload-artifact includes a breaking change. --- .github/actions/setup-base/action.yml | 6 +++--- .github/workflows/build_esp32.yml | 4 ++-- .github/workflows/build_esp32_c3.yml | 4 ++-- .github/workflows/build_esp32_s3.yml | 4 ++-- .github/workflows/build_nrf52.yml | 4 ++-- .github/workflows/build_raspbian.yml | 4 ++-- .github/workflows/build_rpi2040.yml | 4 ++-- .github/workflows/main_matrix.yml | 18 +++++++++--------- .github/workflows/nightly.yml | 2 +- .github/workflows/package_raspbian.yml | 4 ++-- .github/workflows/sec_sast_flawfinder.yml | 4 ++-- .github/workflows/sec_sast_semgrep_cron.yml | 4 ++-- .github/workflows/sec_sast_semgrep_pull.yml | 2 +- .github/workflows/trunk-check.yml | 2 +- .github/workflows/update_protobufs.yml | 2 +- 15 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/actions/setup-base/action.yml b/.github/actions/setup-base/action.yml index 7e57f6a31..7b97e1753 100644 --- a/.github/actions/setup-base/action.yml +++ b/.github/actions/setup-base/action.yml @@ -5,7 +5,7 @@ runs: using: "composite" steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: submodules: "recursive" ref: ${{github.event.pull_request.head.ref}} @@ -30,12 +30,12 @@ runs: sudo apt-get install -y libyaml-cpp-dev - name: Setup Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v4 with: python-version: 3.x - name: Cache python libs - uses: actions/cache@v4 + uses: actions/cache@v3 id: cache-pip # needed in if test with: path: ~/.cache/pip diff --git a/.github/workflows/build_esp32.yml b/.github/workflows/build_esp32.yml index 1a07d5f28..31f0dd5a0 100644 --- a/.github/workflows/build_esp32.yml +++ b/.github/workflows/build_esp32.yml @@ -11,7 +11,7 @@ jobs: build-esp32: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - name: Build base id: base uses: ./.github/actions/setup-base @@ -54,7 +54,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/build_esp32_c3.yml b/.github/workflows/build_esp32_c3.yml index cdb8427c1..a30cf33f1 100644 --- a/.github/workflows/build_esp32_c3.yml +++ b/.github/workflows/build_esp32_c3.yml @@ -13,7 +13,7 @@ jobs: build-esp32-c3: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - name: Build base id: base uses: ./.github/actions/setup-base @@ -54,7 +54,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/build_esp32_s3.yml b/.github/workflows/build_esp32_s3.yml index 502a319c5..f603a6a31 100644 --- a/.github/workflows/build_esp32_s3.yml +++ b/.github/workflows/build_esp32_s3.yml @@ -11,7 +11,7 @@ jobs: build-esp32-s3: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - name: Build base id: base uses: ./.github/actions/setup-base @@ -52,7 +52,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/build_nrf52.yml b/.github/workflows/build_nrf52.yml index a37547973..33ee4d00c 100644 --- a/.github/workflows/build_nrf52.yml +++ b/.github/workflows/build_nrf52.yml @@ -11,7 +11,7 @@ jobs: build-nrf52: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - name: Build base id: base uses: ./.github/actions/setup-base @@ -24,7 +24,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/build_raspbian.yml b/.github/workflows/build_raspbian.yml index 04aa2340b..7a25892bc 100644 --- a/.github/workflows/build_raspbian.yml +++ b/.github/workflows/build_raspbian.yml @@ -11,7 +11,7 @@ jobs: runs-on: [self-hosted, linux, ARM64] steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: submodules: recursive ref: ${{github.event.pull_request.head.ref}} @@ -37,7 +37,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: firmware-raspbian-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/build_rpi2040.yml b/.github/workflows/build_rpi2040.yml index aac70610f..76ca2c20e 100644 --- a/.github/workflows/build_rpi2040.yml +++ b/.github/workflows/build_rpi2040.yml @@ -11,7 +11,7 @@ jobs: build-rpi2040: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - name: Build base id: base uses: ./.github/actions/setup-base @@ -24,7 +24,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index d1c01a366..03d47f18e 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - name: Build base id: base uses: ./.github/actions/setup-base @@ -157,7 +157,7 @@ jobs: build-native: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - name: Build base id: base uses: ./.github/actions/setup-base @@ -180,7 +180,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: firmware-native-${{ steps.version.outputs.version }}.zip path: | @@ -221,7 +221,7 @@ jobs: needs: [check] steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} @@ -244,7 +244,7 @@ jobs: ] steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} @@ -264,7 +264,7 @@ jobs: run: mv -b -t ./ ./*tbeam-2*/littlefs*.bin ./*tbeam-2*/bleota.bin ./*tbeam-s3*/bleota-s3.bin ./*esp32c3*/bleota-c3.bin ./**/firmware*.bin ./*t-echo*/Meshtastic_nRF52_factory_erase_v2.uf2 ./**/firmware-*.uf2 ./**/firmware-*-ota.zip ./**/*.elf ./*native*/*device-*.sh ./*native*/*device-*.bat ./firmware-raspbian-*/release/meshtasticd_linux_aarch64 ./firmware-raspbian-*/bin/config-dist.yaml - name: Repackage in single firmware zip - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: firmware-${{ steps.version.outputs.version }} path: | @@ -295,7 +295,7 @@ jobs: run: zip -j -9 -r ./firmware-${{ steps.version.outputs.version }}.zip ./output - name: Repackage in single elfs zip - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: debug-elfs-${{ steps.version.outputs.version }}.zip path: ./*.elf @@ -319,10 +319,10 @@ jobs: needs: [gather-artifacts, after-checks] steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v3 - name: Setup Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v4 with: python-version: 3.x diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index e249823a7..da59bc0fd 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v3 - name: Trunk Check uses: trunk-io/trunk-action@782e83f803ca6e369f035d64c6ba2768174ba61b diff --git a/.github/workflows/package_raspbian.yml b/.github/workflows/package_raspbian.yml index 6c1ae5d60..377074e95 100644 --- a/.github/workflows/package_raspbian.yml +++ b/.github/workflows/package_raspbian.yml @@ -17,7 +17,7 @@ jobs: needs: build-raspbian steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: submodules: recursive ref: ${{github.event.pull_request.head.ref}} @@ -66,7 +66,7 @@ jobs: depends: libyaml-cpp0.7, openssl desc: Native Linux Meshtastic binary. - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v3 with: name: artifact-deb path: | diff --git a/.github/workflows/sec_sast_flawfinder.yml b/.github/workflows/sec_sast_flawfinder.yml index 59ff994ca..2c7e751af 100644 --- a/.github/workflows/sec_sast_flawfinder.yml +++ b/.github/workflows/sec_sast_flawfinder.yml @@ -16,7 +16,7 @@ jobs: steps: # step 1 - name: clone application source code - uses: actions/checkout@v4 + uses: actions/checkout@v3 # step 2 - name: flawfinder_scan @@ -27,7 +27,7 @@ jobs: # step 3 - name: save report as pipeline artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: flawfinder_report.sarif path: flawfinder_report.sarif diff --git a/.github/workflows/sec_sast_semgrep_cron.yml b/.github/workflows/sec_sast_semgrep_cron.yml index a29e6ca02..cdd2c3c37 100644 --- a/.github/workflows/sec_sast_semgrep_cron.yml +++ b/.github/workflows/sec_sast_semgrep_cron.yml @@ -17,7 +17,7 @@ jobs: steps: # step 1 - name: clone application source code - uses: actions/checkout@v4 + uses: actions/checkout@v3 # step 2 - name: full scan @@ -29,7 +29,7 @@ jobs: # step 3 - name: save report as pipeline artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: report.sarif path: report.sarif diff --git a/.github/workflows/sec_sast_semgrep_pull.yml b/.github/workflows/sec_sast_semgrep_pull.yml index b6c288494..1697ffb1b 100644 --- a/.github/workflows/sec_sast_semgrep_pull.yml +++ b/.github/workflows/sec_sast_semgrep_pull.yml @@ -11,7 +11,7 @@ jobs: steps: # step 1 - name: clone application source code - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/.github/workflows/trunk-check.yml b/.github/workflows/trunk-check.yml index 6ed905bc8..e35b91cb9 100644 --- a/.github/workflows/trunk-check.yml +++ b/.github/workflows/trunk-check.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v3 - name: Trunk Check uses: trunk-io/trunk-action@v1 diff --git a/.github/workflows/update_protobufs.yml b/.github/workflows/update_protobufs.yml index 4c51c35c7..6944d827e 100644 --- a/.github/workflows/update_protobufs.yml +++ b/.github/workflows/update_protobufs.yml @@ -7,7 +7,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: submodules: true From 35754d661d01ade60a0f27031891264d676078f8 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Thu, 21 Mar 2024 18:26:37 -0500 Subject: [PATCH 09/21] Make MAX_NUM_NODES configurable in variant.h (#3453) Co-authored-by: Ben Meadors --- src/mesh/mesh-pb-constants.h | 4 +--- variants/portduino/variant.h | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mesh/mesh-pb-constants.h b/src/mesh/mesh-pb-constants.h index 9e747db1d..b8ef236c9 100644 --- a/src/mesh/mesh-pb-constants.h +++ b/src/mesh/mesh-pb-constants.h @@ -17,9 +17,7 @@ #define MAX_RX_TOPHONE 32 /// max number of nodes allowed in the mesh -#if ARCH_PORTDUINO -#define MAX_NUM_NODES settingsMap[maxnodes] -#else +#ifndef MAX_NUM_NODES #define MAX_NUM_NODES 100 #endif diff --git a/variants/portduino/variant.h b/variants/portduino/variant.h index f47b58afc..5aad8dbfc 100644 --- a/variants/portduino/variant.h +++ b/variants/portduino/variant.h @@ -1,3 +1,4 @@ #define HAS_SCREEN 1 #define CANNED_MESSAGE_MODULE_ENABLE 1 #define HAS_GPS 1 +#define MAX_NUM_NODES settingsMap[maxnodes] From a57f7730eacc5fbe42315c638c550b724684a507 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 21 Mar 2024 18:55:50 -0500 Subject: [PATCH 10/21] [create-pull-request] automated change (#3463) Co-authored-by: thebentern --- protobufs | 2 +- src/mesh/generated/meshtastic/deviceonly.pb.h | 13 +++++++++---- src/mesh/generated/meshtastic/mesh.pb.h | 13 +++++++++---- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/protobufs b/protobufs index 556e49ba6..bcfb49c49 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 556e49ba619e2f4d8fa3c2dee2a94129a43d5f08 +Subproject commit bcfb49c4988b1539fc35e568a58b9f2f5b60738a diff --git a/src/mesh/generated/meshtastic/deviceonly.pb.h b/src/mesh/generated/meshtastic/deviceonly.pb.h index c286bd471..c65a5764f 100644 --- a/src/mesh/generated/meshtastic/deviceonly.pb.h +++ b/src/mesh/generated/meshtastic/deviceonly.pb.h @@ -70,6 +70,9 @@ typedef struct _meshtastic_NodeInfoLite { bool via_mqtt; /* Number of hops away from us this node is (0 if adjacent) */ uint8_t hops_away; + /* True if node is in our favorites list + Persists between NodeDB internal clean ups */ + bool is_favorite; } meshtastic_NodeInfoLite; /* The on-disk saved channels */ @@ -180,13 +183,13 @@ extern "C" { /* Initializer values for message structs */ #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}, {{NULL}, NULL}} -#define meshtastic_NodeInfoLite_init_default {0, false, meshtastic_User_init_default, false, meshtastic_PositionLite_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default, 0, 0, 0} +#define meshtastic_NodeInfoLite_init_default {0, false, meshtastic_User_init_default, false, meshtastic_PositionLite_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default, 0, 0, 0, 0} #define meshtastic_PositionLite_init_default {0, 0, 0, 0, _meshtastic_Position_LocSource_MIN} #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_OEMStore_init_default {0, 0, {0, {0}}, _meshtastic_ScreenFonts_MIN, "", {0, {0}}, false, meshtastic_LocalConfig_init_default, false, meshtastic_LocalModuleConfig_init_default} #define meshtastic_NodeRemoteHardwarePin_init_default {0, false, meshtastic_RemoteHardwarePin_init_default} #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}, {{NULL}, NULL}} -#define meshtastic_NodeInfoLite_init_zero {0, false, meshtastic_User_init_zero, false, meshtastic_PositionLite_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero, 0, 0, 0} +#define meshtastic_NodeInfoLite_init_zero {0, false, meshtastic_User_init_zero, false, meshtastic_PositionLite_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero, 0, 0, 0, 0} #define meshtastic_PositionLite_init_zero {0, 0, 0, 0, _meshtastic_Position_LocSource_MIN} #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} #define meshtastic_OEMStore_init_zero {0, 0, {0, {0}}, _meshtastic_ScreenFonts_MIN, "", {0, {0}}, false, meshtastic_LocalConfig_init_zero, false, meshtastic_LocalModuleConfig_init_zero} @@ -207,6 +210,7 @@ extern "C" { #define meshtastic_NodeInfoLite_channel_tag 7 #define meshtastic_NodeInfoLite_via_mqtt_tag 8 #define meshtastic_NodeInfoLite_hops_away_tag 9 +#define meshtastic_NodeInfoLite_is_favorite_tag 10 #define meshtastic_ChannelFile_channels_tag 1 #define meshtastic_ChannelFile_version_tag 2 #define meshtastic_OEMStore_oem_icon_width_tag 1 @@ -262,7 +266,8 @@ X(a, STATIC, SINGULAR, FIXED32, last_heard, 5) \ X(a, STATIC, OPTIONAL, MESSAGE, device_metrics, 6) \ X(a, STATIC, SINGULAR, UINT32, channel, 7) \ X(a, STATIC, SINGULAR, BOOL, via_mqtt, 8) \ -X(a, STATIC, SINGULAR, UINT32, hops_away, 9) +X(a, STATIC, SINGULAR, UINT32, hops_away, 9) \ +X(a, STATIC, SINGULAR, BOOL, is_favorite, 10) #define meshtastic_NodeInfoLite_CALLBACK NULL #define meshtastic_NodeInfoLite_DEFAULT NULL #define meshtastic_NodeInfoLite_user_MSGTYPE meshtastic_User @@ -324,7 +329,7 @@ extern const pb_msgdesc_t meshtastic_NodeRemoteHardwarePin_msg; /* Maximum encoded size of messages (where known) */ /* meshtastic_DeviceState_size depends on runtime parameters */ #define meshtastic_ChannelFile_size 702 -#define meshtastic_NodeInfoLite_size 158 +#define meshtastic_NodeInfoLite_size 160 #define meshtastic_NodeRemoteHardwarePin_size 29 #define meshtastic_OEMStore_size 3278 #define meshtastic_PositionLite_size 28 diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index 2f57f1ae2..5804dd42a 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -638,6 +638,9 @@ typedef struct _meshtastic_NodeInfo { bool via_mqtt; /* Number of hops away from us this node is (0 if adjacent) */ uint8_t hops_away; + /* True if node is in our favorites list + Persists between NodeDB internal clean ups */ + bool is_favorite; } meshtastic_NodeInfo; /* Unique local debugging info for this node @@ -906,7 +909,7 @@ extern "C" { #define meshtastic_Waypoint_init_default {0, 0, 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} -#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, 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, 0, 0} #define meshtastic_MyNodeInfo_init_default {0, 0, 0} #define meshtastic_LogRecord_init_default {"", 0, "", _meshtastic_LogRecord_Level_MIN} #define meshtastic_QueueStatus_init_default {0, 0, 0, 0} @@ -925,7 +928,7 @@ extern "C" { #define meshtastic_Waypoint_init_zero {0, 0, 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} -#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, 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, 0, 0} #define meshtastic_MyNodeInfo_init_zero {0, 0, 0} #define meshtastic_LogRecord_init_zero {"", 0, "", _meshtastic_LogRecord_Level_MIN} #define meshtastic_QueueStatus_init_zero {0, 0, 0, 0} @@ -1016,6 +1019,7 @@ extern "C" { #define meshtastic_NodeInfo_channel_tag 7 #define meshtastic_NodeInfo_via_mqtt_tag 8 #define meshtastic_NodeInfo_hops_away_tag 9 +#define meshtastic_NodeInfo_is_favorite_tag 10 #define meshtastic_MyNodeInfo_my_node_num_tag 1 #define meshtastic_MyNodeInfo_reboot_count_tag 8 #define meshtastic_MyNodeInfo_min_app_version_tag 11 @@ -1182,7 +1186,8 @@ X(a, STATIC, SINGULAR, FIXED32, last_heard, 5) \ X(a, STATIC, OPTIONAL, MESSAGE, device_metrics, 6) \ X(a, STATIC, SINGULAR, UINT32, channel, 7) \ X(a, STATIC, SINGULAR, BOOL, via_mqtt, 8) \ -X(a, STATIC, SINGULAR, UINT32, hops_away, 9) +X(a, STATIC, SINGULAR, UINT32, hops_away, 9) \ +X(a, STATIC, SINGULAR, BOOL, is_favorite, 10) #define meshtastic_NodeInfo_CALLBACK NULL #define meshtastic_NodeInfo_DEFAULT NULL #define meshtastic_NodeInfo_user_MSGTYPE meshtastic_User @@ -1350,7 +1355,7 @@ extern const pb_msgdesc_t meshtastic_Heartbeat_msg; #define meshtastic_MyNodeInfo_size 18 #define meshtastic_NeighborInfo_size 258 #define meshtastic_Neighbor_size 22 -#define meshtastic_NodeInfo_size 275 +#define meshtastic_NodeInfo_size 277 #define meshtastic_Position_size 144 #define meshtastic_QueueStatus_size 23 #define meshtastic_RouteDiscovery_size 40 From 7aa013a716aa0ed89d3fdac7eecc310ca437330f Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 21 Mar 2024 19:51:02 -0500 Subject: [PATCH 11/21] Skip favorite nodes when clearing out oldest in NodeDB (#3464) * Skip favorite nodes when clearing out oldest in NodeDB * We should actually map between the types --- src/mesh/NodeDB.cpp | 2 +- src/mesh/TypeConversions.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 80b46a426..f65fe0da3 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -939,7 +939,7 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n) uint32_t oldest = UINT32_MAX; int oldestIndex = -1; for (int i = 1; i < numMeshNodes; i++) { - if (meshNodes->at(i).last_heard < oldest) { + if (!meshNodes->at(i).is_favorite && meshNodes->at(i).last_heard < oldest) { oldest = meshNodes->at(i).last_heard; oldestIndex = i; } diff --git a/src/mesh/TypeConversions.cpp b/src/mesh/TypeConversions.cpp index 20b1cb31e..bcd600f24 100644 --- a/src/mesh/TypeConversions.cpp +++ b/src/mesh/TypeConversions.cpp @@ -12,6 +12,7 @@ meshtastic_NodeInfo TypeConversions::ConvertToNodeInfo(const meshtastic_NodeInfo info.channel = lite->channel; info.via_mqtt = lite->via_mqtt; info.hops_away = lite->hops_away; + info.is_favorite = lite->is_favorite; if (lite->has_position) { info.has_position = true; From 794e99c2f992919e1dea57e3c9cf936ca4648aed Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 21 Mar 2024 20:45:48 -0500 Subject: [PATCH 12/21] Log warning cleanup and truth (#3466) --- src/gps/GPS.cpp | 2 +- src/main.cpp | 2 +- src/mesh/MeshService.cpp | 2 +- src/mesh/NodeDB.cpp | 6 +++--- src/mesh/RF95Interface.cpp | 2 +- src/mesh/SX126xInterface.cpp | 2 +- src/mesh/SX128xInterface.cpp | 2 +- src/platform/esp32/SimpleAllocator.cpp | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 7d4f41a55..df1d40fdf 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -1278,7 +1278,7 @@ bool GPS::lookForLocation() #ifndef TINYGPS_OPTION_NO_STATISTICS if (reader.failedChecksum() > lastChecksumFailCount) { - LOG_WARN("Warning, %u new GPS checksum failures, for a total of %u.\n", reader.failedChecksum() - lastChecksumFailCount, + LOG_WARN("%u new GPS checksum failures, for a total of %u.\n", reader.failedChecksum() - lastChecksumFailCount, reader.failedChecksum()); lastChecksumFailCount = reader.failedChecksum(); } diff --git a/src/main.cpp b/src/main.cpp index 5f746f12a..f7d1a4bc0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -631,7 +631,7 @@ void setup() #else // ESP32 SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); - LOG_WARN("SPI.begin(SCK=%d, MISO=%d, MOSI=%d, NSS=%d)\n", LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); + LOG_DEBUG("SPI.begin(SCK=%d, MISO=%d, MOSI=%d, NSS=%d)\n", LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); SPI.setFrequency(4000000); #endif diff --git a/src/mesh/MeshService.cpp b/src/mesh/MeshService.cpp index 31eb082ec..2df5d5797 100644 --- a/src/mesh/MeshService.cpp +++ b/src/mesh/MeshService.cpp @@ -359,7 +359,7 @@ int MeshService::onGPSChanged(const meshtastic::GPSStatus *newStatus) LOG_DEBUG("onGPSchanged() - lost validLocation\n"); #endif } - // Used fixed position if configured regalrdless of GPS lock + // Used fixed position if configured regardless of GPS lock if (config.position.fixed_position) { LOG_WARN("Using fixed position\n"); pos = TypeConversions::ConvertToPosition(node->position); diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index f65fe0da3..3734309be 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -195,7 +195,7 @@ bool NodeDB::factoryReset() // first, remove the "/prefs" (this removes most prefs) rmDir("/prefs"); if (FSCom.exists("/static/rangetest.csv") && !FSCom.remove("/static/rangetest.csv")) { - LOG_WARN("Could not remove rangetest.csv file\n"); + LOG_ERROR("Could not remove rangetest.csv file\n"); } // second, install default state (this will deal with the duplicate mac address issue) installDefaultDeviceState(); @@ -527,7 +527,7 @@ void NodeDB::pickNewNodeNum() LOG_WARN("NOTE! Our desired nodenum 0x%x is invalid or in use, so trying for 0x%x\n", nodeNum, candidate); nodeNum = candidate; } - LOG_WARN("Using nodenum 0x%x \n", nodeNum); + LOG_DEBUG("Using nodenum 0x%x \n", nodeNum); myNodeInfo.my_node_num = nodeNum; } @@ -934,7 +934,7 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n) if ((numMeshNodes >= MAX_NUM_NODES) || (memGet.getFreeHeap() < meshtastic_NodeInfoLite_size * 3)) { if (screen) screen->print("Warn: node database full!\nErasing oldest entry\n"); - LOG_INFO("Warn: node database full!\nErasing oldest entry\n"); + LOG_WARN("Node database full! Erasing oldest entry\n"); // look for oldest node and erase it uint32_t oldest = UINT32_MAX; int oldestIndex = -1; diff --git a/src/mesh/RF95Interface.cpp b/src/mesh/RF95Interface.cpp index 72e0f823f..adc512ae2 100644 --- a/src/mesh/RF95Interface.cpp +++ b/src/mesh/RF95Interface.cpp @@ -19,7 +19,7 @@ RF95Interface::RF95Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIO RADIOLIB_PIN_TYPE busy) : RadioLibInterface(hal, cs, irq, rst, busy) { - LOG_WARN("RF95Interface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy); + LOG_DEBUG("RF95Interface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy); } /** Some boards require GPIO control of tx vs rx paths */ diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index 7220dd3e5..104d0a5ed 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -17,7 +17,7 @@ SX126xInterface::SX126xInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs RADIOLIB_PIN_TYPE busy) : RadioLibInterface(hal, cs, irq, rst, busy, &lora), lora(&module) { - LOG_WARN("SX126xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy); + LOG_DEBUG("SX126xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy); } /// Initialise the Driver transport hardware and software. diff --git a/src/mesh/SX128xInterface.cpp b/src/mesh/SX128xInterface.cpp index f2220dbcf..45325f339 100644 --- a/src/mesh/SX128xInterface.cpp +++ b/src/mesh/SX128xInterface.cpp @@ -17,7 +17,7 @@ SX128xInterface::SX128xInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs RADIOLIB_PIN_TYPE busy) : RadioLibInterface(hal, cs, irq, rst, busy, &lora), lora(&module) { - LOG_WARN("SX128xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy); + LOG_DEBUG("SX128xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy); } /// Initialise the Driver transport hardware and software. diff --git a/src/platform/esp32/SimpleAllocator.cpp b/src/platform/esp32/SimpleAllocator.cpp index ed44722c5..63f3b02de 100644 --- a/src/platform/esp32/SimpleAllocator.cpp +++ b/src/platform/esp32/SimpleAllocator.cpp @@ -58,7 +58,7 @@ void *operator new(size_t sz) throw(std::bad_alloc) void operator delete(void *ptr) throw() { if (activeAllocator) - LOG_DEBUG("Warning: leaking an active allocator object\n"); // We don't properly handle this yet + LOG_WARN("Leaking an active allocator object\n"); // We don't properly handle this yet else free(ptr); } From c77c58d656e3c42ee69a793881e1670de92a79b2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 22 Mar 2024 07:24:10 -0500 Subject: [PATCH 13/21] [create-pull-request] automated change (#3470) Co-authored-by: thebentern --- protobufs | 2 +- src/mesh/generated/meshtastic/admin.pb.h | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/protobufs b/protobufs index bcfb49c49..0fe69d73e 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit bcfb49c4988b1539fc35e568a58b9f2f5b60738a +Subproject commit 0fe69d73e639372128d9480ec8cf65b182d36d30 diff --git a/src/mesh/generated/meshtastic/admin.pb.h b/src/mesh/generated/meshtastic/admin.pb.h index 28bda429d..d2f40c7f0 100644 --- a/src/mesh/generated/meshtastic/admin.pb.h +++ b/src/mesh/generated/meshtastic/admin.pb.h @@ -154,6 +154,10 @@ typedef struct _meshtastic_AdminMessage { char set_ringtone_message[231]; /* Remove the node by the specified node-num from the NodeDB on the device */ uint32_t remove_by_nodenum; + /* Set specified node-num to be favorited on the NodeDB on the device */ + uint32_t set_favorite_node; + /* Set specified node-num to be un-favorited on the NodeDB on the device */ + uint32_t remove_favorite_node; /* Begins an edit transaction for config, module config, owner, and channel settings changes This will delay the standard *implicit* save to the file system and subsequent reboot behavior until committed (commit_edit_settings) */ bool begin_edit_settings; @@ -238,6 +242,8 @@ extern "C" { #define meshtastic_AdminMessage_set_canned_message_module_messages_tag 36 #define meshtastic_AdminMessage_set_ringtone_message_tag 37 #define meshtastic_AdminMessage_remove_by_nodenum_tag 38 +#define meshtastic_AdminMessage_set_favorite_node_tag 39 +#define meshtastic_AdminMessage_remove_favorite_node_tag 40 #define meshtastic_AdminMessage_begin_edit_settings_tag 64 #define meshtastic_AdminMessage_commit_edit_settings_tag 65 #define meshtastic_AdminMessage_reboot_ota_seconds_tag 95 @@ -277,6 +283,8 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_module_config,set_module X(a, STATIC, ONEOF, STRING, (payload_variant,set_canned_message_module_messages,set_canned_message_module_messages), 36) \ X(a, STATIC, ONEOF, STRING, (payload_variant,set_ringtone_message,set_ringtone_message), 37) \ X(a, STATIC, ONEOF, UINT32, (payload_variant,remove_by_nodenum,remove_by_nodenum), 38) \ +X(a, STATIC, ONEOF, UINT32, (payload_variant,set_favorite_node,set_favorite_node), 39) \ +X(a, STATIC, ONEOF, UINT32, (payload_variant,remove_favorite_node,remove_favorite_node), 40) \ X(a, STATIC, ONEOF, BOOL, (payload_variant,begin_edit_settings,begin_edit_settings), 64) \ X(a, STATIC, ONEOF, BOOL, (payload_variant,commit_edit_settings,commit_edit_settings), 65) \ X(a, STATIC, ONEOF, INT32, (payload_variant,reboot_ota_seconds,reboot_ota_seconds), 95) \ From 54818b5f8d2d289fb031e4a5054e81dd4203e73a Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 22 Mar 2024 07:25:00 -0500 Subject: [PATCH 14/21] Enforce consistent polite channel utilization limits except for Sensor role (#3467) --- src/modules/Telemetry/AirQualityTelemetry.cpp | 1 + src/modules/Telemetry/DeviceTelemetry.cpp | 4 ++-- src/modules/Telemetry/EnvironmentTelemetry.cpp | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/Telemetry/AirQualityTelemetry.cpp b/src/modules/Telemetry/AirQualityTelemetry.cpp index 3e9b069c4..a51a7cea9 100644 --- a/src/modules/Telemetry/AirQualityTelemetry.cpp +++ b/src/modules/Telemetry/AirQualityTelemetry.cpp @@ -45,6 +45,7 @@ int32_t AirQualityTelemetryModule::runOnce() uint32_t now = millis(); if (((lastSentToMesh == 0) || ((now - lastSentToMesh) >= Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.air_quality_interval))) && + airTime->isTxAllowedChannelUtil(config.device.role != meshtastic_Config_DeviceConfig_Role_SENSOR) && airTime->isTxAllowedAirUtil()) { sendTelemetry(); lastSentToMesh = now; diff --git a/src/modules/Telemetry/DeviceTelemetry.cpp b/src/modules/Telemetry/DeviceTelemetry.cpp index 7c02b57b4..2ae904b89 100644 --- a/src/modules/Telemetry/DeviceTelemetry.cpp +++ b/src/modules/Telemetry/DeviceTelemetry.cpp @@ -18,8 +18,8 @@ int32_t DeviceTelemetryModule::runOnce() uint32_t now = millis(); if (((lastSentToMesh == 0) || ((now - lastSentToMesh) >= Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.device_update_interval))) && - airTime->isTxAllowedChannelUtil() && airTime->isTxAllowedAirUtil() && - config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER && + airTime->isTxAllowedChannelUtil(config.device.role != meshtastic_Config_DeviceConfig_Role_SENSOR) && + airTime->isTxAllowedAirUtil() && config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER && config.device.role != meshtastic_Config_DeviceConfig_Role_CLIENT_HIDDEN) { sendTelemetry(); lastSentToMesh = now; diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index 203b632a7..908062a5b 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -104,6 +104,7 @@ int32_t EnvironmentTelemetryModule::runOnce() uint32_t now = millis(); if (((lastSentToMesh == 0) || ((now - lastSentToMesh) >= Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.environment_update_interval))) && + airTime->isTxAllowedChannelUtil(config.device.role != meshtastic_Config_DeviceConfig_Role_SENSOR) && airTime->isTxAllowedAirUtil()) { sendTelemetry(); lastSentToMesh = now; From 94e4301f2f5f224e0d1dc828aeca2846714d9e35 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 22 Mar 2024 10:53:18 -0500 Subject: [PATCH 15/21] Add set and remove favorite nodes admin commands (#3471) --- src/modules/AdminModule.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 6d420ddb8..ae0dac9ff 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -189,6 +189,22 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta nodeDB->removeNodeByNum(r->remove_by_nodenum); break; } + case meshtastic_AdminMessage_set_favorite_node_tag: { + LOG_INFO("Client is receiving a set_favorite_node command.\n"); + meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->set_favorite_node); + if (node != NULL) { + node->is_favorite = true; + } + break; + } + case meshtastic_AdminMessage_remove_favorite_node_tag: { + LOG_INFO("Client is receiving a remove_favorite_node command.\n"); + meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->remove_favorite_node); + if (node != NULL) { + node->is_favorite = false; + } + break; + } case meshtastic_AdminMessage_enter_dfu_mode_request_tag: { LOG_INFO("Client is requesting to enter DFU mode.\n"); #if defined(ARCH_NRF52) || defined(ARCH_RP2040) From d30d6bd3eba7f0db00146449391a7c89f17df5fe Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Sat, 23 Mar 2024 13:31:58 +0100 Subject: [PATCH 16/21] Fix #3452: only alter received packet if port number matches (#3474) * Use `alterReceivedProtobuf()` for NeighborInfo and Traceroute `alterReceived()` should never return NULL Traceroute should be promiscuous * Remove extensive logging from NeighborInfo module --- src/mesh/FloodingRouter.cpp | 9 ---- src/mesh/FloodingRouter.h | 2 - src/mesh/ProtobufModule.h | 4 +- src/modules/NeighborInfoModule.cpp | 72 +++--------------------------- src/modules/NeighborInfoModule.h | 9 +--- src/modules/TraceRouteModule.cpp | 24 ++++------ src/modules/TraceRouteModule.h | 7 +-- 7 files changed, 22 insertions(+), 105 deletions(-) diff --git a/src/mesh/FloodingRouter.cpp b/src/mesh/FloodingRouter.cpp index db3f3f35e..4cfe982d8 100644 --- a/src/mesh/FloodingRouter.cpp +++ b/src/mesh/FloodingRouter.cpp @@ -49,15 +49,6 @@ void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas tosend->hop_limit--; // bump down the hop count - if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) { - // If it is a traceRoute request, update the route that it went via me - if (traceRouteModule && traceRouteModule->wantPacket(p)) - traceRouteModule->updateRoute(tosend); - // If it is a neighborInfo packet, update last_sent_by_id - if (neighborInfoModule && neighborInfoModule->wantPacket(p)) - neighborInfoModule->updateLastSentById(tosend); - } - LOG_INFO("Rebroadcasting received floodmsg to neighbors\n"); // Note: we are careful to resend using the original senders node id // We are careful not to call our hooked version of send() - because we don't want to check this again diff --git a/src/mesh/FloodingRouter.h b/src/mesh/FloodingRouter.h index 309035cb3..a3adfe70c 100644 --- a/src/mesh/FloodingRouter.h +++ b/src/mesh/FloodingRouter.h @@ -2,8 +2,6 @@ #include "PacketHistory.h" #include "Router.h" -#include "modules/NeighborInfoModule.h" -#include "modules/TraceRouteModule.h" /** * This is a mixin that extends Router with the ability to do Naive Flooding (in the standard mesh protocol sense) diff --git a/src/mesh/ProtobufModule.h b/src/mesh/ProtobufModule.h index 1067ee01e..a2e89e98a 100644 --- a/src/mesh/ProtobufModule.h +++ b/src/mesh/ProtobufModule.h @@ -108,8 +108,8 @@ template class ProtobufModule : protected SinglePortModule // if we can't decode it, nobody can process it! return; } - } - return alterReceivedProtobuf(mp, decoded); + return alterReceivedProtobuf(mp, decoded); + } } }; \ No newline at end of file diff --git a/src/modules/NeighborInfoModule.cpp b/src/modules/NeighborInfoModule.cpp index 4d68b4a16..1e9652469 100644 --- a/src/modules/NeighborInfoModule.cpp +++ b/src/modules/NeighborInfoModule.cpp @@ -18,73 +18,24 @@ void NeighborInfoModule::printNeighborInfo(const char *header, const meshtastic_ { LOG_DEBUG("%s NEIGHBORINFO PACKET from Node 0x%x to Node 0x%x (last sent by 0x%x)\n", header, np->node_id, nodeDB->getNodeNum(), np->last_sent_by_id); - LOG_DEBUG("----------------\n"); LOG_DEBUG("Packet contains %d neighbors\n", np->neighbors_count); for (int i = 0; i < np->neighbors_count; i++) { LOG_DEBUG("Neighbor %d: node_id=0x%x, snr=%.2f\n", i, np->neighbors[i].node_id, np->neighbors[i].snr); } - LOG_DEBUG("----------------\n"); -} -/* -Prints the nodeDB nodes so we can see whose nodeInfo we have -NOTE: for debugging only -*/ -void NeighborInfoModule::printNodeDBNodes(const char *header) -{ - int num_nodes = nodeDB->getNumMeshNodes(); - LOG_DEBUG("%s NODEDB SELECTION from Node 0x%x:\n", header, nodeDB->getNodeNum()); - LOG_DEBUG("----------------\n"); - LOG_DEBUG("DB contains %d nodes\n", num_nodes); - for (int i = 0; i < num_nodes; i++) { - const meshtastic_NodeInfoLite *dbEntry = nodeDB->getMeshNodeByIndex(i); - LOG_DEBUG(" Node %d: node_id=0x%x, snr=%.2f\n", i, dbEntry->num, dbEntry->snr); - } - LOG_DEBUG("----------------\n"); } /* Prints the nodeDB neighbors NOTE: for debugging only */ -void NeighborInfoModule::printNodeDBNeighbors(const char *header) +void NeighborInfoModule::printNodeDBNeighbors() { int num_neighbors = getNumNeighbors(); - LOG_DEBUG("%s NODEDB SELECTION from Node 0x%x:\n", header, nodeDB->getNodeNum()); - LOG_DEBUG("----------------\n"); - LOG_DEBUG("DB contains %d neighbors\n", num_neighbors); + LOG_DEBUG("Our NodeDB contains %d neighbors\n", num_neighbors); for (int i = 0; i < num_neighbors; i++) { const meshtastic_Neighbor *dbEntry = getNeighborByIndex(i); LOG_DEBUG(" Node %d: node_id=0x%x, snr=%.2f\n", i, dbEntry->node_id, dbEntry->snr); } - LOG_DEBUG("----------------\n"); -} - -/* -Prints the nodeDB with selectors for the neighbors we've chosen to send (inefficiently) -Uses LOG_DEBUG, which equates to Console.log -NOTE: For debugging only -*/ -void NeighborInfoModule::printNodeDBSelection(const char *header, const meshtastic_NeighborInfo *np) -{ - int num_neighbors = getNumNeighbors(); - LOG_DEBUG("%s NODEDB SELECTION from Node 0x%x:\n", header, nodeDB->getNodeNum()); - LOG_DEBUG("----------------\n"); - LOG_DEBUG("Selected %d neighbors of %d DB neighbors\n", np->neighbors_count, num_neighbors); - for (int i = 0; i < num_neighbors; i++) { - meshtastic_Neighbor *dbEntry = getNeighborByIndex(i); - bool chosen = false; - for (int j = 0; j < np->neighbors_count; j++) { - if (np->neighbors[j].node_id == dbEntry->node_id) { - chosen = true; - } - } - if (!chosen) { - LOG_DEBUG(" Node %d: neighbor=0x%x, snr=%.2f\n", i, dbEntry->node_id, dbEntry->snr); - } else { - LOG_DEBUG("---> Node %d: neighbor=0x%x, snr=%.2f\n", i, dbEntry->node_id, dbEntry->snr); - } - } - LOG_DEBUG("----------------\n"); } /* Send our initial owner announcement 35 seconds after we start (to give network time to setup) */ @@ -129,9 +80,7 @@ uint32_t NeighborInfoModule::collectNeighborInfo(meshtastic_NeighborInfo *neighb neighborInfo->neighbors_count++; } } - printNodeDBNodes("DBSTATE"); - printNodeDBNeighbors("NEIGHBORS"); - printNodeDBSelection("COLLECTED", neighborInfo); + printNodeDBNeighbors(); return neighborInfo->neighbors_count; } @@ -218,20 +167,13 @@ bool NeighborInfoModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, /* Copy the content of a current NeighborInfo packet into a new one and update the last_sent_by_id to our NodeNum */ -void NeighborInfoModule::updateLastSentById(meshtastic_MeshPacket *p) +void NeighborInfoModule::alterReceivedProtobuf(meshtastic_MeshPacket &p, meshtastic_NeighborInfo *n) { - auto &incoming = p->decoded; - meshtastic_NeighborInfo scratch; - meshtastic_NeighborInfo *updated = NULL; - memset(&scratch, 0, sizeof(scratch)); - pb_decode_from_bytes(incoming.payload.bytes, incoming.payload.size, &meshtastic_NeighborInfo_msg, &scratch); - updated = &scratch; - - updated->last_sent_by_id = nodeDB->getNodeNum(); + n->last_sent_by_id = nodeDB->getNodeNum(); // Set updated last_sent_by_id to the payload of the to be flooded packet - p->decoded.payload.size = - pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &meshtastic_NeighborInfo_msg, updated); + p.decoded.payload.size = + pb_encode_to_bytes(p.decoded.payload.bytes, sizeof(p.decoded.payload.bytes), &meshtastic_NeighborInfo_msg, n); } void NeighborInfoModule::resetNeighbors() diff --git a/src/modules/NeighborInfoModule.h b/src/modules/NeighborInfoModule.h index 820e2d0d4..b4acb0f66 100644 --- a/src/modules/NeighborInfoModule.h +++ b/src/modules/NeighborInfoModule.h @@ -20,9 +20,6 @@ class NeighborInfoModule : public ProtobufModule, priva bool saveProtoForModule(); - // Let FloodingRouter call updateLastSentById upon rebroadcasting a NeighborInfo packet - friend class FloodingRouter; - protected: // Note: this holds our local info. meshtastic_NeighborInfo neighborState; @@ -68,7 +65,7 @@ class NeighborInfoModule : public ProtobufModule, priva void updateNeighbors(const meshtastic_MeshPacket &mp, const meshtastic_NeighborInfo *np); /* update a NeighborInfo packet with our NodeNum as last_sent_by_id */ - void updateLastSentById(meshtastic_MeshPacket *p); + void alterReceivedProtobuf(meshtastic_MeshPacket &p, meshtastic_NeighborInfo *n) override; void loadProtoForModule(); @@ -81,8 +78,6 @@ class NeighborInfoModule : public ProtobufModule, priva /* These are for debugging only */ void printNeighborInfo(const char *header, const meshtastic_NeighborInfo *np); - void printNodeDBNodes(const char *header); - void printNodeDBNeighbors(const char *header); - void printNodeDBSelection(const char *header, const meshtastic_NeighborInfo *np); + void printNodeDBNeighbors(); }; extern NeighborInfoModule *neighborInfoModule; \ No newline at end of file diff --git a/src/modules/TraceRouteModule.cpp b/src/modules/TraceRouteModule.cpp index 311e211f3..aa0b6a1eb 100644 --- a/src/modules/TraceRouteModule.cpp +++ b/src/modules/TraceRouteModule.cpp @@ -1,5 +1,4 @@ #include "TraceRouteModule.h" -#include "FloodingRouter.h" #include "MeshService.h" TraceRouteModule *traceRouteModule; @@ -14,23 +13,17 @@ bool TraceRouteModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, m return false; // let it be handled by RoutingModule } -void TraceRouteModule::updateRoute(meshtastic_MeshPacket *p) +void TraceRouteModule::alterReceivedProtobuf(meshtastic_MeshPacket &p, meshtastic_RouteDiscovery *r) { - auto &incoming = p->decoded; - // Only append an ID for the request (one way) - if (!incoming.request_id) { - meshtastic_RouteDiscovery scratch; - meshtastic_RouteDiscovery *updated = NULL; - memset(&scratch, 0, sizeof(scratch)); - pb_decode_from_bytes(incoming.payload.bytes, incoming.payload.size, &meshtastic_RouteDiscovery_msg, &scratch); - updated = &scratch; - - appendMyID(updated); - printRoute(updated, p->from, NODENUM_BROADCAST); + auto &incoming = p.decoded; + // Only append an ID for the request (one way) and if we are not the destination (the reply will have our NodeNum already) + if (!incoming.request_id && p.to != nodeDB->getNodeNum()) { + appendMyID(r); + printRoute(r, p.from, NODENUM_BROADCAST); // Set updated route to the payload of the to be flooded packet - p->decoded.payload.size = pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), - &meshtastic_RouteDiscovery_msg, updated); + p.decoded.payload.size = + pb_encode_to_bytes(p.decoded.payload.bytes, sizeof(p.decoded.payload.bytes), &meshtastic_RouteDiscovery_msg, r); } } @@ -85,4 +78,5 @@ TraceRouteModule::TraceRouteModule() : ProtobufModule("traceroute", meshtastic_PortNum_TRACEROUTE_APP, &meshtastic_RouteDiscovery_msg) { ourPortNum = meshtastic_PortNum_TRACEROUTE_APP; + isPromiscuous = true; // We need to update the route even if it is not destined to us } \ No newline at end of file diff --git a/src/modules/TraceRouteModule.h b/src/modules/TraceRouteModule.h index 674846ef1..15e01debd 100644 --- a/src/modules/TraceRouteModule.h +++ b/src/modules/TraceRouteModule.h @@ -9,17 +9,14 @@ class TraceRouteModule : public ProtobufModule public: TraceRouteModule(); - // Let FloodingRouter call updateRoute upon rebroadcasting a TraceRoute request - friend class FloodingRouter; - protected: bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_RouteDiscovery *r) override; virtual meshtastic_MeshPacket *allocReply() override; - /* Call before rebroadcasting a RouteDiscovery payload in order to update + /* Called before rebroadcasting a RouteDiscovery payload in order to update the route array containing the IDs of nodes this packet went through */ - void updateRoute(meshtastic_MeshPacket *p); + void alterReceivedProtobuf(meshtastic_MeshPacket &p, meshtastic_RouteDiscovery *r) override; private: // Call to add your ID to the route array of a RouteDiscovery message From 9e8860d1888332b3fd8588e3aaf9f3867ced3415 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sat, 23 Mar 2024 12:29:05 -0500 Subject: [PATCH 17/21] Crash fix and remove hard-coded path from PiWebServer (#3478) * Remove hard-coded path from PiWebServer * Bump portduino to pick up crash fix * Remove PiWebServer non-ASCII debug output * Trunk formatting --- arch/portduino/portduino.ini | 2 +- src/mesh/raspihttp/PiWebServer.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index 368fb5d0e..ef8711f8a 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#a28dd5a9ccd5c48a9bede46037855ff83915d74b +platform = https://github.com/meshtastic/platform-native.git#1b8a32c60ab7495026033858d53c737f7d1cb34a framework = arduino build_src_filter = diff --git a/src/mesh/raspihttp/PiWebServer.cpp b/src/mesh/raspihttp/PiWebServer.cpp index 41f6727a4..bffd6c340 100644 --- a/src/mesh/raspihttp/PiWebServer.cpp +++ b/src/mesh/raspihttp/PiWebServer.cpp @@ -244,7 +244,7 @@ int handleAPIv1ToRadio(const struct _u_request *req, struct _u_response *res, vo // FIXME* Problem with portdunio loosing mountpoint maybe because of running in a real sep. thread - portduinoVFS->mountpoint("/home/marc/.portduino/default"); + portduinoVFS->mountpoint(configWeb.rootPath); LOG_DEBUG("Received %d bytes from PUT request\n", s); webAPI.handleToRadio(buffer, s); @@ -279,8 +279,8 @@ int handleAPIv1FromRadio(const struct _u_request *req, struct _u_response *res, const char *tmpa = (const char *)txBuf; ulfius_set_string_body_response(res, 200, tmpa); // LOG_DEBUG("\n----webAPI response all:----\n"); - LOG_DEBUG(tmpa); - LOG_DEBUG("\n"); + // LOG_DEBUG(tmpa); + // LOG_DEBUG("\n"); } // Otherwise, just return one protobuf } else { @@ -288,8 +288,8 @@ int handleAPIv1FromRadio(const struct _u_request *req, struct _u_response *res, const char *tmpa = (const char *)txBuf; ulfius_set_binary_body_response(res, 200, tmpa, len); // LOG_DEBUG("\n----webAPI response:\n"); - LOG_DEBUG(tmpa); - LOG_DEBUG("\n"); + // LOG_DEBUG(tmpa); + // LOG_DEBUG("\n"); } // LOG_DEBUG("end radio->web\n", len); @@ -508,7 +508,7 @@ PiWebServerThread::PiWebServerThread() LOG_INFO("Web Server framework started on port: %i \n", webservport); LOG_INFO("Web Server root %s\n", (char *)webrootpath.c_str()); } else { - LOG_ERROR("Error starting Web Server framework\n"); + LOG_ERROR("Error starting Web Server framework, error number: %d\n", retssl); } } } From 4cce4c7c93a5c44cb7de5ce509f63a1db0587dbf Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Sat, 23 Mar 2024 18:38:29 +0100 Subject: [PATCH 18/21] Set unused header bytes to zero for future use (#3479) --- src/mesh/RadioInterface.cpp | 2 ++ src/mesh/RadioInterface.h | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index 859e7bea4..3aac9dfce 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -564,6 +564,8 @@ size_t RadioInterface::beginSending(meshtastic_MeshPacket *p) h->to = p->to; h->id = p->id; h->channel = p->channel; + h->next_hop = 0; // *** For future use *** + h->relay_node = 0; // *** For future use *** if (p->hop_limit > HOP_MAX) { LOG_WARN("hop limit %d is too high, setting to %d\n", p->hop_limit, HOP_RELIABLE); p->hop_limit = HOP_RELIABLE; diff --git a/src/mesh/RadioInterface.h b/src/mesh/RadioInterface.h index ee4726d74..b965328e4 100644 --- a/src/mesh/RadioInterface.h +++ b/src/mesh/RadioInterface.h @@ -34,6 +34,12 @@ typedef struct { /** The channel hash - used as a hint for the decoder to limit which channels we consider */ uint8_t channel; + + // ***For future use*** Last byte of the NodeNum of the next-hop for this packet + uint8_t next_hop; + + // ***For future use*** Last byte of the NodeNum of the node that will relay/relayed this packet + uint8_t relay_node; } PacketHeader; /** From 71ca6f768f6cd1e06ff2aa8bc1ba7e53c00e50d4 Mon Sep 17 00:00:00 2001 From: GUVWAF Date: Sat, 23 Mar 2024 19:35:12 +0100 Subject: [PATCH 19/21] Actually update last_report_to_map --- src/mqtt/MQTT.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 390d0e206..8e7c8f2cc 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -546,6 +546,7 @@ void MQTT::perhapsReportToMap() return; } else { if (map_position_precision == 0 || (localPosition.latitude_i == 0 && localPosition.longitude_i == 0)) { + last_report_to_map = millis(); LOG_WARN("MQTT Map reporting is enabled, but precision is 0 or no position available.\n"); return; } From c87fdfece73ce3a242a77e02218fd535299371c9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 23 Mar 2024 19:47:43 -0500 Subject: [PATCH 20/21] [create-pull-request] automated change (#3483) Co-authored-by: thebentern --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index 12603eda7..58a6c19d7 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 3 -build = 2 +build = 3 From 63df972d42b4aed34f7faea25174368a9a7f14cf Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 24 Mar 2024 08:11:47 -0500 Subject: [PATCH 21/21] Revert "[create-pull-request] automated change (#3483)" (#3484) This reverts commit c87fdfece73ce3a242a77e02218fd535299371c9. --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index 58a6c19d7..12603eda7 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 3 -build = 3 +build = 2