RF24: Fix TX issue regarding PA+LNA modules (#1189)

This commit is contained in:
tekka
2018-08-26 14:46:16 +02:00
committed by Henrik Ekblad
parent 6ffe29cb5f
commit 46568ba14a

View File

@@ -314,14 +314,13 @@ LOCAL bool RF24_sendMessage(const uint8_t recipient, const void *buf, const uint
RF24_CMD_WRITE_TX_PAYLOAD, (uint8_t *)buf, len, false );
// go, TX starts after ~10us, CE high also enables PA+LNA on supported HW
RF24_ce(HIGH);
delayMicroseconds(10); // datasheet: Pulse CE at least 10us
RF24_ce(LOW);
// timeout counter to detect HW issues
uint16_t timeout = 0xFFFF;
do {
RF24_status = RF24_getStatus();
} while (!(RF24_status & ( _BV(RF24_MAX_RT) | _BV(RF24_TX_DS) )) && timeout--);
// timeout value after successful TX on 16Mhz AVR ~ 65500, i.e. msg is transmitted after ~36 loop cycles
RF24_ce(LOW);
// reset interrupts
RF24_setStatus(_BV(RF24_TX_DS) | _BV(RF24_MAX_RT) );
// Max retries exceeded