[RF69] Implement finishReceive

pull/1592/head
jgromes 2025-09-06 16:46:01 +01:00
rodzic 2481649e97
commit 290e201a3b
2 zmienionych plików z 12 dodań i 9 usunięć

Wyświetl plik

@ -122,9 +122,12 @@ int16_t RF69::transmit(const uint8_t* data, size_t len, uint8_t addr) {
return(finishTransmit());
}
int16_t RF69::receive(uint8_t* data, size_t len) {
// calculate timeout (500 ms + 400 full 64-byte packets at current bit rate)
RadioLibTime_t timeout = 500 + (1.0f/(this->bitRate))*(RADIOLIB_RF69_MAX_PACKET_LENGTH*400.0f);
int16_t RF69::receive(uint8_t* data, size_t len, RadioLibTime_t timeout) {
RadioLibTime_t timeoutInternal = timeout;
if(!timeoutInternal) {
// calculate timeout (500 ms + 400 full 64-byte packets at current bit rate)
timeoutInternal = 500 + (1.0f/(this->bitRate))*(RADIOLIB_RF69_MAX_PACKET_LENGTH*400.0f);
}
// start reception
int16_t state = startReceive();
@ -135,9 +138,7 @@ int16_t RF69::receive(uint8_t* data, size_t len) {
while(!this->mod->hal->digitalRead(this->mod->getIrq())) {
this->mod->hal->yield();
if(this->mod->hal->millis() - start > timeout) {
standby();
clearIRQFlags();
if(this->mod->hal->millis() - start > timeoutInternal) {
return(RADIOLIB_ERR_RX_TIMEOUT);
}
}

Wyświetl plik

@ -528,11 +528,13 @@ class RF69: public PhysicalLayer {
/*!
\brief Blocking binary receive method.
Overloads for string-based transmissions are implemented in PhysicalLayer.
\param data Binary data to be sent.
\param len Number of bytes to send.
\param data Pointer to array to save the received binary data.
\param len Number of bytes that will be received. Must be known in advance for binary transmissions.
\param timeout Reception timeout in milliseconds. If set to 0,
timeout period will be calculated automatically based on the radio configuration.
\returns \ref status_codes
*/
int16_t receive(uint8_t* data, size_t len) override;
int16_t receive(uint8_t* data, size_t len, RadioLibTime_t timeout = 0) override;
/*!
\brief Sets the module to sleep mode.