[SX128x] Merge pull request #1590 from MarusGradinaru/SX128x.receive()-timeout-bug

Fixing SX128x.receive() timeout bug
pull/1603/head
Jan Gromeš 2025-09-05 15:23:14 +02:00 zatwierdzone przez GitHub
commit 6c38520393
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -363,7 +363,7 @@ int16_t SX128x::receive(uint8_t* data, size_t len) {
// calculate timeout (1000% of expected time-on-air)
RadioLibTime_t timeout = getTimeOnAir(len) * 10;
RADIOLIB_DEBUG_BASIC_PRINTLN("Timeout in %lu ms", timeout);
RADIOLIB_DEBUG_BASIC_PRINTLN("Timeout in %lu ms", (uint32_t)((timeout + 999) / 1000));
// start reception
uint32_t timeoutValue = (uint32_t)((float)timeout / 15.625f);
@ -372,11 +372,11 @@ int16_t SX128x::receive(uint8_t* data, size_t len) {
// wait for packet reception or timeout
bool softTimeout = false;
RadioLibTime_t start = this->mod->hal->millis();
RadioLibTime_t start = this->mod->hal->micros();
while(!this->mod->hal->digitalRead(this->mod->getIrq())) {
this->mod->hal->yield();
// safety check, the timeout should be done by the radio
if(this->mod->hal->millis() - start > timeout) {
if(this->mod->hal->micros() - start > timeout) {
softTimeout = true;
break;
}