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
524 stars 116 forks source link

Optionally Synchronous sendFDRS() #214

Closed timmbogner closed 5 months ago

timmbogner commented 5 months 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 5 months 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.