Skip to content

Commit

Permalink
#15: Use ESB address to match Broadcast packets
Browse files Browse the repository at this point in the history
  • Loading branch information
ataffanel committed Jan 23, 2017
1 parent c3861e8 commit 97f17af
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions interface/esb.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ typedef enum esbDatarate_e { esbDatarate250K=0,
#define RADIO_RATE_1M esbDatarate1M
#define RADIO_RATE_2M esbDatarate2M

#define ESB_UNICAST_ADDRESS_MATCH 0
#define ESB_MULTICAST_ADDRESS_MATCH 1

/* Initialize the radio for ESB */
void esbInit();

Expand Down
4 changes: 2 additions & 2 deletions src/esb.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void esbInterruptHandler()
}

// If this packet is a retry, send the same ACK again
if (pk->ack && isRetry(pk)) {
if ((pk->match == ESB_UNICAST_ADDRESS_MATCH) && isRetry(pk)) {
setupTx(true);
return;
}
Expand All @@ -227,7 +227,7 @@ void esbInterruptHandler()
curr_up = 1-curr_up;
}

if (pk->ack)
if ((pk->match == ESB_UNICAST_ADDRESS_MATCH))
{
if (!has_safelink || (pk->data[0]&0x04) != curr_down<<2) {
curr_down = 1-curr_down;
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void mainloop()
//Store RSSI here so that we can send it to STM later
rssi = packet->rssi;
// The received packet was a broadcast, if received on local address 1
broadcast = packet->match == 1;
broadcast = packet->match == ESB_MULTICAST_ADDRESS_MATCH;
memcpy(esbRxPacket.data, packet->data, packet->size);
esbRxPacket.size = packet->size;
esbReceived = true;
Expand Down

0 comments on commit 97f17af

Please sign in to comment.