mirror of https://github.com/arendst/Tasmota.git
Refactor lib RadioLib fixing ESP8266 panic
This commit is contained in:
parent
7c52906a2e
commit
ae7bed5acf
|
@ -189,7 +189,8 @@ void inline ArduinoHal::noTone(uint32_t pin) {
|
||||||
|
|
||||||
void inline ArduinoHal::yield() {
|
void inline ArduinoHal::yield() {
|
||||||
#if !defined(RADIOLIB_YIELD_UNSUPPORTED)
|
#if !defined(RADIOLIB_YIELD_UNSUPPORTED)
|
||||||
::yield();
|
// ::yield();
|
||||||
|
::delay(0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -289,8 +289,7 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint
|
||||||
} else {
|
} else {
|
||||||
uint32_t start = this->hal->millis();
|
uint32_t start = this->hal->millis();
|
||||||
while(this->hal->digitalRead(this->gpioPin)) {
|
while(this->hal->digitalRead(this->gpioPin)) {
|
||||||
// this->hal->yield();
|
this->hal->yield();
|
||||||
this->hal->delay(0);
|
|
||||||
if(this->hal->millis() - start >= timeout) {
|
if(this->hal->millis() - start >= timeout) {
|
||||||
RADIOLIB_DEBUG_BASIC_PRINTLN("GPIO pre-transfer timeout, is it connected?");
|
RADIOLIB_DEBUG_BASIC_PRINTLN("GPIO pre-transfer timeout, is it connected?");
|
||||||
#if !RADIOLIB_STATIC_ONLY
|
#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);
|
this->hal->delayMicroseconds(1);
|
||||||
uint32_t start = this->hal->millis();
|
uint32_t start = this->hal->millis();
|
||||||
while(this->hal->digitalRead(this->gpioPin)) {
|
while(this->hal->digitalRead(this->gpioPin)) {
|
||||||
// this->hal->yield();
|
this->hal->yield();
|
||||||
this->hal->delay(0);
|
|
||||||
if(this->hal->millis() - start >= timeout) {
|
if(this->hal->millis() - start >= timeout) {
|
||||||
RADIOLIB_DEBUG_BASIC_PRINTLN("GPIO post-transfer timeout, is it connected?");
|
RADIOLIB_DEBUG_BASIC_PRINTLN("GPIO post-transfer timeout, is it connected?");
|
||||||
#if !RADIOLIB_STATIC_ONLY
|
#if !RADIOLIB_STATIC_ONLY
|
||||||
|
@ -391,13 +389,11 @@ void Module::waitForMicroseconds(uint32_t start, uint32_t len) {
|
||||||
}
|
}
|
||||||
this->TimerFlag = false;
|
this->TimerFlag = false;
|
||||||
while(!this->TimerFlag) {
|
while(!this->TimerFlag) {
|
||||||
// this->hal->yield();
|
this->hal->yield();
|
||||||
this->hal->delay(0);
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
while(this->hal->micros() - start < len) {
|
while(this->hal->micros() - start < len) {
|
||||||
// this->hal->yield();
|
this->hal->yield();
|
||||||
this->hal->delay(0);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,8 +256,7 @@ int16_t SX126x::transmit(uint8_t* data, size_t len, uint8_t addr) {
|
||||||
// wait for packet transmission or timeout
|
// wait for packet transmission or timeout
|
||||||
uint32_t start = this->mod->hal->micros();
|
uint32_t start = this->mod->hal->micros();
|
||||||
while(!this->mod->hal->digitalRead(this->mod->getIrq())) {
|
while(!this->mod->hal->digitalRead(this->mod->getIrq())) {
|
||||||
// this->mod->hal->yield();
|
this->mod->hal->yield();
|
||||||
this->mod->hal->delay(0);
|
|
||||||
if(this->mod->hal->micros() - start > timeout) {
|
if(this->mod->hal->micros() - start > timeout) {
|
||||||
finishTransmit();
|
finishTransmit();
|
||||||
return(RADIOLIB_ERR_TX_TIMEOUT);
|
return(RADIOLIB_ERR_TX_TIMEOUT);
|
||||||
|
@ -308,8 +307,7 @@ int16_t SX126x::receive(uint8_t* data, size_t len) {
|
||||||
bool softTimeout = false;
|
bool softTimeout = false;
|
||||||
uint32_t start = this->mod->hal->micros();
|
uint32_t start = this->mod->hal->micros();
|
||||||
while(!this->mod->hal->digitalRead(this->mod->getIrq())) {
|
while(!this->mod->hal->digitalRead(this->mod->getIrq())) {
|
||||||
// this->mod->hal->yield();
|
this->mod->hal->yield();
|
||||||
this->mod->hal->delay(0);
|
|
||||||
// safety check, the timeout should be done by the radio
|
// safety check, the timeout should be done by the radio
|
||||||
if(this->mod->hal->micros() - start > timeout) {
|
if(this->mod->hal->micros() - start > timeout) {
|
||||||
softTimeout = true;
|
softTimeout = true;
|
||||||
|
@ -442,8 +440,7 @@ int16_t SX126x::scanChannel(uint8_t symbolNum, uint8_t detPeak, uint8_t detMin)
|
||||||
|
|
||||||
// wait for channel activity detected or timeout
|
// wait for channel activity detected or timeout
|
||||||
while(!this->mod->hal->digitalRead(this->mod->getIrq())) {
|
while(!this->mod->hal->digitalRead(this->mod->getIrq())) {
|
||||||
// this->mod->hal->yield();
|
this->mod->hal->yield();
|
||||||
this->mod->hal->delay(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check CAD result
|
// check CAD result
|
||||||
|
@ -571,8 +568,7 @@ int16_t SX126x::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
|
||||||
|
|
||||||
// wait for BUSY to go low (= PA ramp up done)
|
// wait for BUSY to go low (= PA ramp up done)
|
||||||
while(this->mod->hal->digitalRead(this->mod->getGpio())) {
|
while(this->mod->hal->digitalRead(this->mod->getGpio())) {
|
||||||
// this->mod->hal->yield();
|
this->mod->hal->yield();
|
||||||
this->mod->hal->delay(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(state);
|
return(state);
|
||||||
|
@ -2119,8 +2115,7 @@ int16_t SX126x::config(uint8_t modem) {
|
||||||
// wait for calibration completion
|
// wait for calibration completion
|
||||||
this->mod->hal->delay(5);
|
this->mod->hal->delay(5);
|
||||||
while(this->mod->hal->digitalRead(this->mod->getGpio())) {
|
while(this->mod->hal->digitalRead(this->mod->getGpio())) {
|
||||||
// this->mod->hal->yield();
|
this->mod->hal->yield();
|
||||||
this->mod->hal->delay(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check calibration result
|
// check calibration result
|
||||||
|
|
|
@ -4,8 +4,13 @@ Action to take in case of new release of RadioLib
|
||||||
|
|
||||||
20240327
|
20240327
|
||||||
|
|
||||||
1 - Remove folder `RadioLib\examples\NonArduino` (Fixes Github vulnerability alerts)
|
1 - Remove folder `\lib\lib_rfRadioLib\examples\NonArduino` (Fixes Github vulnerability alerts)
|
||||||
2 - Change in file `RadioLib\src\modules\SX126x\SX126x.cpp` all occurences of ``this->mod->hal->yield();`` into ``this->mod->hal->delay(0);`` (Fixes ESP8266 Panic core_esp8266_main.cpp:133 __yield)
|
2 - Change in file `\lib\lib_rf\RadioLib\src\ArduinoHal.cpp` below function (Fixes ESP8266 Panic core_esp8266_main.cpp:133 __yield)
|
||||||
3 - Change in file `RadioLib\src\Module.cpp` all occurences of ``this->hal->yield();`` into ``this->hal->delay(0);`` (Fixes ESP8266 Panic core_esp8266_main.cpp:133 __yield)
|
```
|
||||||
|
void inline ArduinoHal::yield() {
|
||||||
|
#if !defined(RADIOLIB_YIELD_UNSUPPORTED)
|
||||||
|
// ::yield();
|
||||||
|
::delay(0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in New Issue