Permalink
Browse files

Huge receiving bug fixed - (#24)

  • Loading branch information...
gioblu committed Feb 2, 2016
1 parent 8caa6fe commit 2548e3cc50d2368f107b5db1cc4c6666ad26bb2b
Showing with 4 additions and 3 deletions.
  1. +4 −3 PJON.cpp
@@ -385,13 +385,14 @@ uint8_t PJON::read_byte() {
/* Try to receive a packet from the pin: */
int PJON::receive() {
int state;
int package_length = PACKET_MAX_LENGTH;
uint8_t CRC = 0;
for(uint8_t i = 0; i <= package_length; i++) {
data[i] = this->receive_byte();
for(uint8_t i = 0; i < package_length; i++) {
data[i] = state = this->receive_byte();
if(data[i] == FAIL) return FAIL;
if(state == FAIL) return FAIL;
if(i == 0 && data[i] != _device_id && data[i] != BROADCAST)
return BUSY;

0 comments on commit 2548e3c

Please sign in to comment.