From ec86246da97b83451c060d210742cc7d8ecb5466 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sat, 5 Mar 2022 12:38:26 -0800 Subject: [PATCH 1/3] Update to flooding router --- src/mesh/FloodingRouter.cpp | 24 +++++++++++++++++++++--- src/mesh/FloodingRouter.h | 8 ++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/mesh/FloodingRouter.cpp b/src/mesh/FloodingRouter.cpp index 0a14552ab..a08edafec 100644 --- a/src/mesh/FloodingRouter.cpp +++ b/src/mesh/FloodingRouter.cpp @@ -48,6 +48,14 @@ bool FloodingRouter::inRangeOfRouter() return false; } +bool FloodingRouter::isPacketLocal(const MeshPacket *p) +{ + + // TODO: Figure out if a packet is from a local node + + return false; +} + void FloodingRouter::sniffReceived(const MeshPacket *p, const Routing *c) { bool rebroadcastPacket = true; @@ -55,10 +63,20 @@ void FloodingRouter::sniffReceived(const MeshPacket *p, const Routing *c) if (radioConfig.preferences.role == Role_Repeater || radioConfig.preferences.role == Role_Router) { rebroadcastPacket = true; - } else if ((radioConfig.preferences.role == Role_Default) && inRangeOfRouter()) { - DEBUG_MSG("Role_Default - rx_snr > 13\n"); + } else if ((radioConfig.preferences.role == Role_Default)) { - rebroadcastPacket = false; + + if (inRangeOfRouter()) { + // In Range of a router + rebroadcastPacket = false; + + } else if (!isPacketLocal(p)) { + // The packet did not come from a local source + rebroadcastPacket = false; + + } + + rebroadcastPacket = true; } if ((p->to == NODENUM_BROADCAST) && (p->hop_limit > 0) && (getFrom(p) != getNodeNum() && rebroadcastPacket)) { diff --git a/src/mesh/FloodingRouter.h b/src/mesh/FloodingRouter.h index 9b54008d0..299ad690e 100644 --- a/src/mesh/FloodingRouter.h +++ b/src/mesh/FloodingRouter.h @@ -60,6 +60,14 @@ class FloodingRouter : public Router, protected PacketHistory */ virtual bool inRangeOfRouter(); + /** + * Is the packet from a device that is physically near this node? + * + * Calculated based on the received SNR. + * @return true if the received packet is physically close to this node. + */ + virtual bool isPacketLocal(const MeshPacket *p); + /** * Look for broadcasts we need to rebroadcast */ From ca21e8b2bf1062cbd099f06d14dbad05859f0741 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 6 Mar 2022 08:50:42 -0600 Subject: [PATCH 2/3] New PR artifacts upload scheme --- .github/workflows/main_matrix.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index fcc33ca23..28a3ba5ba 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -341,5 +341,8 @@ jobs: with: commit: ${{ (github.event.pull_request_target || github.event.pull_request).head.sha }} repo-token: ${{ secrets.GITHUB_TOKEN }} - artifacts-branch: artifacts + artifacts-token: ${{ secrets.ARTIFACTS_TOKEN }} + artifacts-repo: meshtastic/artifacts + artifacts-branch: device + artifacts-dir: pr artifacts: ./firmware-${{ steps.version.outputs.version }}.zip From 2a2448e36737a61c74e8873dc5f6ed8c0e20be38 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sun, 6 Mar 2022 15:46:56 -0800 Subject: [PATCH 3/3] address tool-cppcheck error --- src/mesh/FloodingRouter.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/mesh/FloodingRouter.cpp b/src/mesh/FloodingRouter.cpp index a08edafec..ab7136237 100644 --- a/src/mesh/FloodingRouter.cpp +++ b/src/mesh/FloodingRouter.cpp @@ -75,8 +75,6 @@ void FloodingRouter::sniffReceived(const MeshPacket *p, const Routing *c) rebroadcastPacket = false; } - - rebroadcastPacket = true; } if ((p->to == NODENUM_BROADCAST) && (p->hop_limit > 0) && (getFrom(p) != getNodeNum() && rebroadcastPacket)) {