Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds option to disable N2N (#1439) #1475

Open
wants to merge 5 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Logparser/logparser.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ var match = [
{ re: "!TSF:RTE:FPAR ACTIVE", d: "Finding parent active, message not sent" },
{ re: "!TSF:RTE:(\\d+) UNKNOWN", d: "Routing for destination <b>$1</b> unknown, sending message to parent" },
{ re: "!TSF:RTE:N2N FAIL", d: "Direct node-to-node communication failed - handing over to parent" },
{ re: "TSF:RTE:N2N DIS", d: "Direct node-to-node communication disabled by configuration" },
{ re: "TSF:RRT:ROUTE N=(\\d+),R=(\\d+)", d: "Routing table, messages to node (<b>$1</b>) are routed via node (<b>$2</b>)"},
{ re: "!TSF:SND:TNR", d: "Transport not ready, message cannot be sent" },
{ re: "TSF:TDI:TSL", d: "Set transport to sleep" },
Expand Down
10 changes: 10 additions & 0 deletions MyConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,15 @@
#define MY_TRANSPORT_DISCOVERY_INTERVAL_MS (20*60*1000ul)
#endif

/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a small note on when this feature can/should be used? Maybe some sort of use case description?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mfalkvidd, my use case is a node that is located in a dead zone and can only be reached via a repeater.
When the node sends telegrams to other nodes or the gateway, I always get the error message !TSF:RTE:N2N FAIL in the log. This is a waste of node battery energy and in addition it pollutes the airwaves with traffic that interferes with the communication of other nodes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know what causes the node to try to sent to other nodes?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mfalkvidd, I am intentionally sending the message to another actuator node which unfortunately is not directly reachable via N2N.

*@def MY_TRANSPORT_N2N_FEATURE_DISABLED
*@brief If defined, disables the direct node to node transport send attempts
*
* Use this function together with the option @ref MY_PARENT_NODE_IS_STATIC
* to ensure that all telegrams sent are routed exclusively through the associated parent node.
*/
//#define MY_TRANSPORT_N2N_FEATURE_DISABLED

/**
*@def MY_TRANSPORT_UPLINK_CHECK_DISABLED
*@brief If defined, disables uplink check to GW during transport initialisation
Expand Down Expand Up @@ -2313,6 +2322,7 @@
// transport
#define MY_PARENT_NODE_IS_STATIC
#define MY_REGISTRATION_CONTROLLER
#define MY_TRANSPORT_N2N_FEATURE_DISABLED
#define MY_TRANSPORT_UPLINK_CHECK_DISABLED
#define MY_TRANSPORT_SANITY_CHECK
#define MY_NODE_LOCK_FEATURE
Expand Down
4 changes: 4 additions & 0 deletions core/MyTransport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ bool transportRouteMessage(MyMessage &message)
#endif
}
#else
#if !defined(MY_TRANSPORT_N2N_FEATURE_DISABLED)
if (destination > GATEWAY_ADDRESS && destination < BROADCAST_ADDRESS) {
// node2node traffic: assume node is in vincinity. If transmission fails, hand over to parent
if (transportSendWrite(destination, message)) {
Expand All @@ -553,6 +554,9 @@ bool transportRouteMessage(MyMessage &message)
}
TRANSPORT_DEBUG(PSTR("!TSF:RTE:N2N FAIL\n"));
}
#else
TRANSPORT_DEBUG(PSTR("TSF:RTE:N2N DIS\n"));
#endif
Copy link
Member

@mfalkvidd mfalkvidd Feb 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about adding an else clause here, with something like
TRANSPORT_DEBUG(PSTR("!TSF:RTE:N2N DIS\n")); so people who enable this feature and forget about it (or don’t fully realize what it does) can get some information on why their N2N messages disappear?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I will try it out and check how it works.

route = _transportConfig.parentNodeId; // not a repeater, all traffic routed via parent
#endif
}
Expand Down
1 change: 1 addition & 0 deletions core/MyTransport.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
* |!| TSF | RTE | FPAR ACTIVE | Finding parent active, message not sent
* |!| TSF | RTE | DST %%d UNKNOWN | Routing for destination (DST) unknown, send message to parent
* | | TSF | RTE | N2N OK | Node-to-node communication succeeded
* | | TSF | RTE | N2N DIS | Node-to-node communication disabled by configuration
* |!| TSF | RTE | N2N FAIL | Node-to-node communication failed, handing over to parent for re-routing
* | | TSF | RRT | ROUTE N=%%d,R=%%d | Routing table, messages to node (N) are routed via node (R)
* |!| TSF | SND | TNR | Transport not ready, message cannot be sent
Expand Down
1 change: 1 addition & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ MY_TRANSPORT_TIMEOUT_EXT_FAILURE_STATE_MS LITERAL1
MY_TRANSPORT_TIMEOUT_FAILURE_STATE_MS LITERAL1
MY_TRANSPORT_UPLINK_CHECK_DISABLED LITERAL1
MY_TRANSPORT_WAIT_READY_MS LITERAL1
MY_TRANSPORT_N2N_FEATURE_DISABLED LITERAL1

# debug
MY_DEBUG LITERAL1
Expand Down