Skip to content

Commit b1d79b5

Browse files
committed
Fix #446: AS923 don't report join failure till all ch scanned
1 parent ccfcc75 commit b1d79b5

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

src/lmic/lmic.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,7 +1597,7 @@ static bit_t processJoinAccept (void) {
15971597
ASSERT((LMIC.opmode & (OP_JOINING|OP_REJOIN))!=0);
15981598
//
15991599
// XXX(tmm@mcci.com) OP_REJOIN confuses me, and I'm not sure why we're
1600-
// adjusting DRs here. We've just recevied a join accept, and the
1600+
// adjusting DRs here. We've just received a join accept, and the
16011601
// datarate therefore shouldn't be in play. In effect, we set the
16021602
// initial data rate based on the number of times we tried to rejoin.
16031603
//
@@ -1672,18 +1672,10 @@ static bit_t processJoinAccept_nojoinframe(void) {
16721672
// claimed to return a delay but really returns 0 or 1.
16731673
// Once we update as923 to return failed after dr2, we
16741674
// can take out this #if.
1675-
#if CFG_region != LMIC_REGION_as923
16761675
os_setTimedCallback(&LMIC.osjob, os_getTime()+failed,
16771676
failed
16781677
? FUNC_ADDR(onJoinFailed) // one JOIN iteration done and failed
16791678
: FUNC_ADDR(runEngineUpdate)); // next step to be delayed
1680-
#else
1681-
// in the join of AS923 v1.1 older, only DR2 is used. Therefore,
1682-
// not much improvement when it handles two different behavior;
1683-
// onJoinFailed or runEngineUpdate.
1684-
os_setTimedCallback(&LMIC.osjob, os_getTime()+failed,
1685-
FUNC_ADDR(onJoinFailed));
1686-
#endif
16871679
// stop this join process.
16881680
return 1;
16891681
}

src/lmic/lmic_eu_like.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -174,24 +174,25 @@ ostime_t LMICeulike_nextJoinState(uint8_t nDefaultChannels) {
174174
if ((++LMIC.txCnt % nDefaultChannels) == 0) {
175175
// Lower DR every nth try (having all default channels with same DR)
176176
//
177-
// TODO(tmm@mcci.com) add new DR_REGIN_JOIN_MIN instead of LORAWAN_DR0;
177+
// TODO(tmm@mcci.com) add new DR_REGION_JOIN_MIN instead of LORAWAN_DR0;
178178
// then we can eliminate the LMIC_REGION_as923 below because we'll set
179179
// the failed flag here. This will cause the outer caller to take the
180180
// appropriate join path. Or add new LMICeulike_GetLowestJoinDR()
181181
//
182+
183+
// TODO(tmm@mcci.com) - see above; please remove regional dependency from this file.
184+
#if CFG_region == LMIC_REGION_as923
185+
// in the join of AS923 v1.1 or older, only DR2 is used.
186+
// no need to change the DR.
187+
LMIC.datarate = AS923_DR_SF10;
188+
failed = 1;
189+
#else
182190
if (LMIC.datarate == LORAWAN_DR0)
183191
failed = 1; // we have tried all DR - signal EV_JOIN_FAILED
184-
else
185-
{
186-
// TODO(tmm@mcci.com) - see above; please remove regional dependency from this file.
187-
#if CFG_region != LMIC_REGION_as923
192+
else {
188193
LMICcore_setDrJoin(DRCHG_NOJACC, decDR((dr_t)LMIC.datarate));
189-
#else
190-
// in the join of AS923 v1.1 or older, only DR2 is used.
191-
// no need to change the DR.
192-
LMIC.datarate = AS923_DR_SF10;
193-
#endif
194194
}
195+
#endif
195196
}
196197
// Clear NEXTCHNL because join state engine controls channel hopping
197198
LMIC.opmode &= ~OP_NEXTCHNL;

0 commit comments

Comments
 (0)