Skip to content

Commit fd48de0

Browse files
committed
Fix #405: zero the freq.band bits on entry to LMIC_setupChannel
1 parent 6d1a170 commit fd48de0

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

src/lmic/lmic_as923.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ bit_t LMIC_setupBand(u1_t bandidx, s1_t txpow, u2_t txcap) {
224224
}
225225

226226
bit_t LMIC_setupChannel(u1_t chidx, u4_t freq, u2_t drmap, s1_t band) {
227+
// zero the band bits in freq, just in case.
228+
freq &= ~3;
229+
227230
if (chidx < NUM_DEFAULT_CHANNELS) {
228231
// can't disable a default channel.
229232
if (freq == 0)

src/lmic/lmic_eu868.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ bit_t LMIC_setupBand(u1_t bandidx, s1_t txpow, u2_t txcap) {
138138
}
139139

140140
bit_t LMIC_setupChannel(u1_t chidx, u4_t freq, u2_t drmap, s1_t band) {
141+
// zero the band bits in freq, just in case.
142+
freq &= ~3;
143+
141144
if (chidx < NUM_DEFAULT_CHANNELS) {
142145
// can't disable a default channel.
143146
if (freq == 0)

src/lmic/lmic_in866.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ bit_t LMIC_setupBand(u1_t bandidx, s1_t txpow, u2_t txcap) {
133133
}
134134

135135
bit_t LMIC_setupChannel(u1_t chidx, u4_t freq, u2_t drmap, s1_t band) {
136+
// zero the band bits in freq, just in case.
137+
freq &= ~3;
138+
136139
if (chidx < NUM_DEFAULT_CHANNELS) {
137140
// can't disable a default channel.
138141
if (freq == 0)

src/lmic/lmic_kr920.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ bit_t LMIC_setupBand(u1_t bandidx, s1_t txpow, u2_t txcap) {
144144
}
145145

146146
bit_t LMIC_setupChannel(u1_t chidx, u4_t freq, u2_t drmap, s1_t band) {
147+
// zero the band bits in freq, just in case.
148+
freq &= ~3;
149+
147150
if (chidx < NUM_DEFAULT_CHANNELS) {
148151
// can't disable a default channel.
149152
if (freq == 0)

0 commit comments

Comments
 (0)