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.
Fix #446: AS923 don't report join failure till all ch scanned
- Loading branch information
1 parent
ccfcc75
commit b1d79b5
Showing
2 changed files
with
12 additions
and
19 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 |
---|---|---|
|
@@ -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. | ||
// | ||
|
@@ -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; | ||
} | ||
|
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 |
---|---|---|
|
@@ -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; | ||
|