mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-27 18:31:37 +00:00
Update to flooding router
This commit is contained in:
parent
97c76cde3c
commit
ec86246da9
@ -48,6 +48,14 @@ bool FloodingRouter::inRangeOfRouter()
|
|||||||
return false;
|
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)
|
void FloodingRouter::sniffReceived(const MeshPacket *p, const Routing *c)
|
||||||
{
|
{
|
||||||
bool rebroadcastPacket = true;
|
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) {
|
if (radioConfig.preferences.role == Role_Repeater || radioConfig.preferences.role == Role_Router) {
|
||||||
rebroadcastPacket = true;
|
rebroadcastPacket = true;
|
||||||
|
|
||||||
} else if ((radioConfig.preferences.role == Role_Default) && inRangeOfRouter()) {
|
} else if ((radioConfig.preferences.role == Role_Default)) {
|
||||||
DEBUG_MSG("Role_Default - rx_snr > 13\n");
|
|
||||||
|
|
||||||
|
|
||||||
|
if (inRangeOfRouter()) {
|
||||||
|
// In Range of a router
|
||||||
rebroadcastPacket = false;
|
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)) {
|
if ((p->to == NODENUM_BROADCAST) && (p->hop_limit > 0) && (getFrom(p) != getNodeNum() && rebroadcastPacket)) {
|
||||||
|
@ -60,6 +60,14 @@ class FloodingRouter : public Router, protected PacketHistory
|
|||||||
*/
|
*/
|
||||||
virtual bool inRangeOfRouter();
|
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
|
* Look for broadcasts we need to rebroadcast
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user