forked from things-nyc/arduino-lmic
-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #335 from mcci-catena/issue333
Fix #333: Emit EV_TXCOMPLETE earlier
- Loading branch information
Showing
1 changed file
with
9 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1465,23 +1465,20 @@ static void jreqDone (xref2osjob_t osjob) { | |
// Fwd decl. | ||
static bit_t processDnData(void); | ||
|
||
static void processRx2DnDataDelay (xref2osjob_t osjob) { | ||
LMIC_API_PARAMETER(osjob); | ||
|
||
processDnData(); | ||
} | ||
|
||
static void processRx2DnData (xref2osjob_t osjob) { | ||
LMIC_API_PARAMETER(osjob); | ||
|
||
if( LMIC.dataLen == 0 ) { | ||
initTxrxFlags(__func__, 0); // nothing in 1st/2nd DN slot | ||
// Delay callback processing to avoid up TX while gateway is txing our missed frame! | ||
// Since DNW2 uses SF12 by default we wait 3 secs. | ||
os_setTimedCallback(&LMIC.osjob, | ||
(os_getTime() + DNW2_SAFETY_ZONE + LMICcore_rndDelay(2)), | ||
FUNC_ADDR(processRx2DnDataDelay)); | ||
return; | ||
// It could be that the gateway *is* sending a reply, but we | ||
// just didn't pick it up. To avoid TX'ing again while the | ||
// gateay is not listening anyway, delay the next transmission | ||
// until DNW2_SAFETY_ZONE from now, and add up to 2 seconds of | ||
// extra randomization. | ||
// BUG([email protected]) this delay is not needed for some | ||
// regions, e.g. US915 and AU915, which have non-overlapping | ||
// uplink and downlink. | ||
txDelay(os_getTime() + DNW2_SAFETY_ZONE, 2); | ||
} | ||
processDnData(); | ||
} | ||
|