Sending asynchrously uplink data

I an building a cartracking node using the Arduino LMIC Library.

In the examples the transmission of uplink data is periodically scheduled with the const unsigned TX_INTERVAL value and considering the airtime limits.

If the car is stopped and the gps position is not changed (that much) or the speed is below 5kmh, I don’t want to send data at al.

I noticed suspending the LMIC_setTxData2 in the TTN-APB Example stops the sending of data at all.

What is the right way to suspend the transmission of data?

That depends on your sketch. Generally speaking it would be to stop queuing packets for transmission by not calling do_send.

Thx for the swift respons.

I am using the ABP Example as base code. I see that do_send is only called once, at the end of setup().

This triggers apperently the periodic sending of data.

Can you gave me an example how to suspend this?

do_send ends with a comment that the next transmission is scheduled after TX_COMPLETE event. So may-be take a look there? If you do you might notice a line

os_setTimedCallback(&sendjob, os_getTime()+sec2osticks(TX_INTERVAL), do_send);

which causes do_send to be called again after some ( TX_INTERVAL ) time.
Remove it, add do_send with an appropriate interval to loop and you are done.

1 Like

Thanxs for your help. It is apperantly a timer construction. Don’t have any expercience with that, but I going to follow-up your advice.

Change the code as you advised.

Works as a charm. Thnx of your support.