Skip to content

Commit

Permalink
Fix #446: AS923 don't report join failure till all ch scanned
Browse files Browse the repository at this point in the history
  • Loading branch information
terrillmoore committed Sep 10, 2019
1 parent ccfcc75 commit b1d79b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
10 changes: 1 addition & 9 deletions src/lmic/lmic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1597,7 +1597,7 @@ static bit_t processJoinAccept (void) {
ASSERT((LMIC.opmode & (OP_JOINING|OP_REJOIN))!=0);
//
// XXX([email protected]) OP_REJOIN confuses me, and I'm not sure why we're
// adjusting DRs here. We've just recevied a join accept, and the
// adjusting DRs here. We've just received a join accept, and the
// datarate therefore shouldn't be in play. In effect, we set the
// initial data rate based on the number of times we tried to rejoin.
//
Expand Down Expand Up @@ -1672,18 +1672,10 @@ static bit_t processJoinAccept_nojoinframe(void) {
// claimed to return a delay but really returns 0 or 1.
// Once we update as923 to return failed after dr2, we
// can take out this #if.
#if CFG_region != LMIC_REGION_as923
os_setTimedCallback(&LMIC.osjob, os_getTime()+failed,
failed
? FUNC_ADDR(onJoinFailed) // one JOIN iteration done and failed
: FUNC_ADDR(runEngineUpdate)); // next step to be delayed
#else
// in the join of AS923 v1.1 older, only DR2 is used. Therefore,
// not much improvement when it handles two different behavior;
// onJoinFailed or runEngineUpdate.
os_setTimedCallback(&LMIC.osjob, os_getTime()+failed,
FUNC_ADDR(onJoinFailed));
#endif
// stop this join process.
return 1;
}
Expand Down
21 changes: 11 additions & 10 deletions src/lmic/lmic_eu_like.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,24 +174,25 @@ ostime_t LMICeulike_nextJoinState(uint8_t nDefaultChannels) {
if ((++LMIC.txCnt % nDefaultChannels) == 0) {
// Lower DR every nth try (having all default channels with same DR)
//
// TODO([email protected]) add new DR_REGIN_JOIN_MIN instead of LORAWAN_DR0;
// TODO([email protected]) add new DR_REGION_JOIN_MIN instead of LORAWAN_DR0;
// then we can eliminate the LMIC_REGION_as923 below because we'll set
// the failed flag here. This will cause the outer caller to take the
// appropriate join path. Or add new LMICeulike_GetLowestJoinDR()
//

// TODO([email protected]) - see above; please remove regional dependency from this file.
#if CFG_region == LMIC_REGION_as923
// in the join of AS923 v1.1 or older, only DR2 is used.
// no need to change the DR.
LMIC.datarate = AS923_DR_SF10;
failed = 1;
#else
if (LMIC.datarate == LORAWAN_DR0)
failed = 1; // we have tried all DR - signal EV_JOIN_FAILED
else
{
// TODO([email protected]) - see above; please remove regional dependency from this file.
#if CFG_region != LMIC_REGION_as923
else {
LMICcore_setDrJoin(DRCHG_NOJACC, decDR((dr_t)LMIC.datarate));
#else
// in the join of AS923 v1.1 or older, only DR2 is used.
// no need to change the DR.
LMIC.datarate = AS923_DR_SF10;
#endif
}
#endif
}
// Clear NEXTCHNL because join state engine controls channel hopping
LMIC.opmode &= ~OP_NEXTCHNL;
Expand Down

0 comments on commit b1d79b5

Please sign in to comment.