# LMiC's TX\_COMPLETE event takes 20-30 seconds to fire

**URL:** <https://www.thethingsnetwork.org/forum/t/lmics-tx-complete-event-takes-20-30-seconds-to-fire/2639>\
**Category:** End Devices (Nodes)\
**Created:** [June 29, 2016, 9:08am UTC](https://www.thethingsnetwork.org/forum/t/lmics-tx-complete-event-takes-20-30-seconds-to-fire/2639 "2016-06-29T09:08:44Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [November 5, 2017, 4:36pm UTC](https://www.thethingsnetwork.org/forum/t/lmics-tx-complete-event-takes-20-30-seconds-to-fire/2639/11 "2017-11-05T16:36:27Z")

</div>

> [@telkamp](#):
>
> LMiC purposely delays the TX\_COMPLETE event to prevent the next transmission to collide with a downlink that the node did not receive, but the gateway is still busy sending (and therefor not in receive mode).
> 
> It uses a worst-case for that, at SF12 in the RX2 window, that is defined by DNW2\_SAFETY\_ZONE (in lmic.c) with a default of 3 seconds.

Only now I noticed that since February @matthijs’ LMiC port the event itself is no longer delayed. Nice!

> <https://github.com/matthijskooijman/arduino-lmic/commit/6e098863>
>
> Before, when no packet was received in RX2, there would be a 3-5 second
> delay (f…or EU868) before calling \`processDnData()\` and emitting
> EV\_TXCOMPLETE. This was the \`DNW2\_SAFETY\_ZONE\` to prevent a subsequent
> TX to collide with a downlink packet that was ongoing but not locked on
> to.
> 
> With this change, \`txDelay()\` is used to still delay the subsequent TX,
> without delaying the \`EV\_TXCOMPLETE\` event, which allows battery-powered
> devices that wait for this event before sleeping to get an extra 3-5
> seconds of sleep for each transmitted packet, improving battery life.
> 
> Closes: #16

---

_[View the full topic](https://www.thethingsnetwork.org/forum/t/lmics-tx-complete-event-takes-20-30-seconds-to-fire/2639)._
