arduino-LoRa icon indicating copy to clipboard operation
arduino-LoRa copied to clipboard

Freeze on beginPacket() call

Open Haismd03 opened this issue 3 years ago • 0 comments

Hello everyone I found an issue using this library. When you try to call LoRaClass::beginPacket() in your code and your LoRa device is disconnected, it freezes your device. When i call LoRaClass::begin(), it obviously report an error, but my program still continue.

I looked into library and (by my amateur eye) found, that in LoRaClass::begin() there is an read statement that terminates the method, if data cannot be read. I suppose that LoRaClass::beginPacket() freezes, because it tries to write registers without making sure that the device is there. And it's probably waiting for response that just cannost come.

I quick modified the method: int LoRaClass::beginPacket(int implicitHeader) and added uint8_t version = readRegister(REG_VERSION); if (version != 0x12) { return 0; } at the beginning and it seems like it solved the problem.

(working on RPI pico, using earlephilhower core, programming on Arduino IDE 1.8.19)

EDIT: It solves problem, when LoRa is completely gone, but program still gets stuck if SPI remain connected, but VCC is disconnected.

Help would be appreciated

Haismd03 avatar May 11 '22 14:05 Haismd03