beegee-tokyo / SX126x-Arduino

Arduino library to use Semtech SX126x LoRa chips and modules to communicate
MIT License
236 stars 64 forks source link

Cant send after Deep Sleep and using Radio.Re-Init #113

Closed Hootie81 closed 7 months ago

Hootie81 commented 11 months ago

Hi,

Thanks for a great library and all the examples, certainly makes it easier to get started.

I had issues and days of troubleshooting when combining the deep sleep example and the sensor gateway deep sleep. in the sensor example when it wakes from deep sleep it does a full Init and can send ok, however when waking from deep sleep and only performing the Radio.ReInit it receives ok but it always fails to transmit. I'm sure its related to putting the radio in receive only low power mode before sleeping, or perhaps due to the timer because it instantly returns TX timeout. once the send fails it can no longer receive too.

My current work around is to perform the Radio.ReInit, handle the onreceivedone event, then when it returns perform the Radio.Init, set the channel and TX RX configs again. Basically its as simple as removing the 'else' on line 207 of deepsleep.ino and removing the curly brackets for it. i don't need to do the hardware init, just the radio init.

It works for my current project because my packets are only 20bytes, I'm not sure if it will work for larger packets because the micro will get woken on preamble, and the onrxdone event may not have fired at the time of setup meaning the radio will get initialized while receiving, I guess another option would be to perform the full Radio.Init just before transmitting.

hopefully this helps someone

Any idea's why this happens? or the most optimal way to re-init after deepsleep so we can TX?

Device I'm using is a Heltec Wireless Stick Lite V3 (SX1262 + ESP32-S3FN8). https://heltec.org/project/wireless-stick-lite-v2/

beegee-tokyo commented 11 months ago

Hi,

Not sure what's happening. I was not using the ESP32 or the deep sleep code for a long time.