timmbogner / Farm-Data-Relay-System

A system that uses ESP-NOW, LoRa, and other protocols to transport sensor data in remote areas without relying on WiFi.
MIT License
485 stars 108 forks source link

Optionally Synchronous sendFDRS() #214

Closed timmbogner closed 2 weeks ago

timmbogner commented 2 weeks ago

With this change, the system sends all buffered LoRa transmissions before leaving sendFDRS(). This emulates a synchronous send routine, despite our background operations now occuring asynchronously. If a user is sending and receiving data at the same time, they can use the asynchronous sendFDRS(true), which only sends the data to the buffer.

This still needs:

aviateur17 commented 2 weeks ago

I don't think this gonna quite work. This makes sure the Async Queue is empty but doesn't make sure that the transmit is complete. The Async queue (circular buffer) transfers into a temporary buffer (linear buffer) and then sends out. If ACKs are enabled then we need to wait for them to come back from the gateway and may potentially need to wait for a couple of them. So in an ideal situation this may work but I'd like to take another crack at it. I hope that's okay. I'm thinking about bringing back old transmitLoRa function code that was synchronous and then we can default sendFDRS to use that synchronous transmitLoRa function.