Skip to content

Commit 2c2de61

Browse files
committed
Fix #819: don't reject all-off prematurely
1 parent 26326e4 commit 2c2de61

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/lmic/lmic_us_like.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,16 @@ bit_t LMICuslike_canMapChannels(u1_t chpage, u2_t chmap) {
117117
}
118118
} else if (chpage == MCMD_LinkADRReq_ChMaskCntl_USLIKE_125ON ||
119119
chpage == MCMD_LinkADRReq_ChMaskCntl_USLIKE_125OFF) {
120-
u1_t const en125 = chpage == MCMD_LinkADRReq_ChMaskCntl_USLIKE_125ON;
121-
122-
// if disabling all 125kHz chans, must have at least one 500kHz chan
123-
// don't allow reserved bits to be set in chmap.
124-
if ((! en125 && chmap == 0) || (chmap & 0xFF00) != 0)
120+
//
121+
// if disabling all 125kHz chans, you might think we must have
122+
// at least one 500kHz chan; but that's a local conclusion.
123+
// Some network servers will disable all (including 500kHz)
124+
// then turn things back on in the next LinkADRReq. So
125+
// we can't fail that here.
126+
//
127+
// But don't allow reserved bits to be set in chmap.
128+
//
129+
if ((chmap & 0xFF00) != 0)
125130
return 0;
126131
} else {
127132
return 0;

0 commit comments

Comments
 (0)