meetjestad / mjs_firmware

8 stars 4 forks source link

Improvement: Smart handling of tx, joinin and waiting for airtime #3

Open matthijskooijman opened 6 years ago

matthijskooijman commented 6 years ago

Currently, the sketch is really dumb: Every 15 minutes, it submits a packet to the LMIC library. Then it waits for a fixed amount of time for the packet to be transmitted. If not TXCOMPLETE event is received, it treats this as a timeout, cancels the packet and waits for another 15 minutes.

If If this is the first packet, this will automatically trigger a join. Normally, this join completes quickly and the packet can be sent quickly too. However, when the join does not complete, it will be retried. Because of the duty cycle limits (which are lower then normal for joining, at least in this version of LoRaWAN), most of the TX timeout will be spent on waiting for airtime to become available for retry join packets.

Things to improve:

One challenge here is that the LMIC radio library does note conveniently expose information about what it is waiting for and for how long. It even does not really know right now, since some of this information is implicitly encoded in the timing of the tasks. This might require some changes to LMIC to really implement properly.