diff --git a/src/modules/CC1101/CC1101.cpp b/src/modules/CC1101/CC1101.cpp index d15dead4..ea3f3977 100644 --- a/src/modules/CC1101/CC1101.cpp +++ b/src/modules/CC1101/CC1101.cpp @@ -240,7 +240,7 @@ int16_t CC1101::startTransmit(const uint8_t* data, size_t len, uint8_t addr) { SPIsendCommand(RADIOLIB_CC1101_CMD_FSTXON); // Check MARCSTATE and wait until ready to tx - // 724us is the longest time for callibrate per datasheet + // 724us is the longest time for calibrate per datasheet RadioLibTime_t start = this->mod->hal->micros(); while(SPIgetRegValue(RADIOLIB_CC1101_REG_MARCSTATE, 4, 0) != 0x12) { if(this->mod->hal->micros() - start > 724) { @@ -249,9 +249,12 @@ int16_t CC1101::startTransmit(const uint8_t* data, size_t len, uint8_t addr) { } } - // set GDO0 mapping - int16_t state = SPIsetRegValue(RADIOLIB_CC1101_REG_IOCFG2, RADIOLIB_CC1101_GDOX_SYNC_WORD_SENT_OR_PKT_RECEIVED, 5, 0); - RADIOLIB_ASSERT(state); + // set GDO0 mapping only if we aren't refilling the FIFO + int16_t state + if (len <= RADIOLIB_CC1101_FIFO_SIZE) { + state = SPIsetRegValue(RADIOLIB_CC1101_REG_IOCFG2, RADIOLIB_CC1101_GDOX_SYNC_WORD_SENT_OR_PKT_RECEIVED, 5, 0); + RADIOLIB_ASSERT(state); + } // data put on FIFO uint8_t dataSent = 0; @@ -307,7 +310,7 @@ int16_t CC1101::startTransmit(const uint8_t* data, size_t len, uint8_t addr) { int16_t CC1101::finishTransmit() { // set mode to standby to disable transmitter/RF switch - // Check MARCSTATE for Idle + // Check MARCSTATE for Idle to let anything in the FIFO empty // Timeout is 2x FIFO transmit time RadioLibTime_t timeout = (1.0f/(this->bitRate))*(RADIOLIB_CC1101_FIFO_SIZE*2.0f); RadioLibTime_t start = this->mod->hal->millis();