Refactor lib RadioLib fixing ESP8266 panic

This commit is contained in:
Theo Arends
2024-03-28 14:04:17 +01:00
parent 7c52906a2e
commit ae7bed5acf
4 changed files with 21 additions and 24 deletions

View File

@@ -289,8 +289,7 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint
} else {
uint32_t start = this->hal->millis();
while(this->hal->digitalRead(this->gpioPin)) {
// this->hal->yield();
this->hal->delay(0);
this->hal->yield();
if(this->hal->millis() - start >= timeout) {
RADIOLIB_DEBUG_BASIC_PRINTLN("GPIO pre-transfer timeout, is it connected?");
#if !RADIOLIB_STATIC_ONLY
@@ -317,8 +316,7 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint
this->hal->delayMicroseconds(1);
uint32_t start = this->hal->millis();
while(this->hal->digitalRead(this->gpioPin)) {
// this->hal->yield();
this->hal->delay(0);
this->hal->yield();
if(this->hal->millis() - start >= timeout) {
RADIOLIB_DEBUG_BASIC_PRINTLN("GPIO post-transfer timeout, is it connected?");
#if !RADIOLIB_STATIC_ONLY
@@ -391,13 +389,11 @@ void Module::waitForMicroseconds(uint32_t start, uint32_t len) {
}
this->TimerFlag = false;
while(!this->TimerFlag) {
// this->hal->yield();
this->hal->delay(0);
this->hal->yield();
}
#else
while(this->hal->micros() - start < len) {
// this->hal->yield();
this->hal->delay(0);
this->hal->yield();
}
#endif
}