Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #333: Emit EV_TXCOMPLETE earlier #335

Merged
merged 2 commits into from
Jul 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions src/lmic/lmic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down