Skip to content

Commit 25c7f38

Browse files
committed
Fixed problem with pipe 7 (trash messages) and double-sending of outgoning messages from gw.
1 parent d8f0551 commit 25c7f38

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

libraries/MySensors/Relay.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,13 @@ boolean Relay::sendData(uint8_t from, uint8_t to, uint8_t childId, uint8_t messa
3838
buildMsg(from, to, childId, messageType, type, data, length, binary);
3939
// Found node in route table
4040
ok = sendWrite(route, msg, length);
41-
} if (radioId == GATEWAY_ADDRESS) {
41+
} else if (radioId == GATEWAY_ADDRESS) {
4242
// If we're GW (no parent...). As a last resort try sending message directly to node.
43-
debug(PSTR("Target not found in routing table. \n"));
43+
debug(PSTR("No route... try sending direct.\n"));
4444
buildMsg(from, to, childId, messageType, type, data, length, binary);
4545
// Found node in route table
4646
ok = sendWrite(to, msg, length);
47-
4847
} else {
49-
debug(PSTR("Route message back to relay\n"));
5048
// We are probably a repeater node which should send message back to relay
5149
ok = Sensor::sendData(from, to, childId, messageType, type, data, length, binary);
5250
}
@@ -91,7 +89,7 @@ boolean Relay::messageAvailable() {
9189
debug(PSTR("Message available on pipe %d\n"),pipe);
9290
}
9391

94-
if (available) {
92+
if (available && pipe<7) {
9593
uint8_t len = RF24::getDynamicPayloadSize()-sizeof(msg.header);
9694
readMessage();
9795
boolean ok = validate() == VALIDATE_OK;

libraries/MySensors/Sensor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ boolean Sensor::messageAvailable() {
380380
}
381381

382382

383-
if (available) {
383+
if (available && pipe<7) {
384384
readMessage();
385385
boolean ok = validate() == VALIDATE_OK;
386386
debug(PSTR("Mess crc %s.\n"),ok?"ok":"error");

0 commit comments

Comments
 (0)