Skip to content

Commit 2e6eb42

Browse files
committed
Ack debug prints cleaned up.
1 parent 990bda5 commit 2e6eb42

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

libraries/MySensors/Sensor.cpp

+17-17
Original file line numberDiff line numberDiff line change
@@ -242,26 +242,26 @@ boolean Sensor::sendWrite(uint8_t dest, message_s message, int length) {
242242
ok = false;
243243
}
244244
}
245-
// Check payload size and content
246-
if ( !timeout && RF24::getDynamicPayloadSize()==sizeof(uint8_t)) {
247-
uint8_t idest;
248-
RF24::read( &idest, sizeof(uint8_t));
249-
if (dest != idest) {
250-
debug(PSTR("Ack: received ack from the wrong sensor\n"));
251-
ok = false;
252-
}
253-
} else {
254-
ok = false;
255-
debug(PSTR("Ack: received non ack msg.\n"));
245+
// Check payload size and content
246+
if (!timeout) {
247+
// Check payload size and content
248+
if (RF24::getDynamicPayloadSize()==sizeof(uint8_t)) {
249+
uint8_t idest;
250+
RF24::read( &idest, sizeof(uint8_t));
251+
if (dest != idest) {
252+
debug(PSTR("Ack: received ack from the wrong sensor\n"));
253+
ok = false;
254+
} else {
255+
debug(PSTR("Ack: received OK\n"));
256+
}
257+
} else {
258+
ok = false;
259+
debug(PSTR("Ack: received none ack msg.\n"));
260+
}
256261
}
257-
//--------------------
258262
}
259263

260-
if (ok) {
261-
debug(PSTR("Sent successfully\n"));
262-
} else {
263-
debug(PSTR("Send failed.\n"));
264-
}
264+
265265
return ok;
266266
}
267267

0 commit comments

Comments
 (0)