@@ -396,7 +396,9 @@ boolean MySensor::sendRoute(MyMessage &message) {
396
396
}
397
397
// After this point, only the 'last' member of the message structure is allowed to be altered if the message has been signed,
398
398
// or signature will become invalid and the message rejected by the receiver
399
- } else mSetSigned (message, 0 ); // Message is not supposed to be signed, make sure it is marked unsigned
399
+ } else if (nc.nodeId == message.sender ) {
400
+ mSetSigned (message, 0 ); // Message is not supposed to be signed, make sure it is marked unsigned
401
+ }
400
402
#endif
401
403
402
404
if (dest == GATEWAY_ADDRESS || !repeaterMode) {
@@ -588,11 +590,18 @@ boolean MySensor::process() {
588
590
}
589
591
#endif
590
592
591
- // Add string termination, good if we later would want to print it.
592
- msg.data [mGetLength (msg)] = ' \0 ' ;
593
- debug (PSTR (" read: %d-%d-%d s=%d,c=%d,t=%d,pt=%d,l=%d,sg=%d:%s\n " ),
593
+ if (msg.destination == nc.nodeId ) {
594
+ debug (PSTR (" read: %d-%d-%d s=%d,c=%d,t=%d,pt=%d,l=%d,sg=%d:%s\n " ),
595
+ msg.sender , msg.last , msg.destination , msg.sensor , mGetCommand (msg), msg.type , mGetPayloadType (msg), mGetLength (msg), mGetSigned (msg), msg.getString (convBuf));
596
+ } else {
597
+ if (repeaterMode && nc.nodeId != AUTO) {
598
+ debug (PSTR (" read and forward: %d-%d-%d s=%d,c=%d,t=%d,pt=%d,l=%d,sg=%d:%s\n " ),
599
+ msg.sender , msg.last , msg.destination , msg.sensor , mGetCommand (msg), msg.type , mGetPayloadType (msg), mGetLength (msg), mGetSigned (msg), msg.getString (convBuf));
600
+ } else {
601
+ debug (PSTR (" read and drop: %d-%d-%d s=%d,c=%d,t=%d,pt=%d,l=%d,sg=%d:%s\n " ),
594
602
msg.sender , msg.last , msg.destination , msg.sensor , mGetCommand (msg), msg.type , mGetPayloadType (msg), mGetLength (msg), mGetSigned (msg), msg.getString (convBuf));
595
- mSetSigned (msg,0 ); // Clear the sign-flag now as verification (and debug printing) is completed
603
+ }
604
+ }
596
605
597
606
if (!(mGetVersion (msg) == PROTOCOL_VERSION)) {
598
607
debug (PSTR (" ver mismatch\n " ));
@@ -610,6 +619,7 @@ boolean MySensor::process() {
610
619
611
620
if (destination == nc.nodeId ) {
612
621
// This message is addressed to this node
622
+ mSetSigned (msg,0 );
613
623
614
624
if (repeaterMode && last != nc.parentNodeId ) {
615
625
// Message is from one of the child nodes. Add it to routing table.
0 commit comments