Skip to content

Commit 75fd62e

Browse files
committed
Merge pull request arduino#8 from mysensors/RF24-fixes
Rf24 fixes - code looks good!
2 parents 01d06cd + 2e6eb42 commit 75fd62e

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

Diff for: 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

Diff for: libraries/RF24/RF24.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ uint8_t RF24::read_payload(void* buf, uint8_t len)
136136
while ( blank_len-- )
137137
SPI.transfer(0xff);
138138
csn(HIGH);
139-
139+
ce(HIGH); //? ADDED IN
140140
return status;
141141
}
142142

0 commit comments

Comments
 (0)