Skip to content

Commit

Permalink
Merge pull request #732 from mcci-catena/issue730
Browse files Browse the repository at this point in the history
Fix #730: uninitialized variable
  • Loading branch information
terrillmoore committed May 14, 2021
2 parents 9a3792d + 43fedd5 commit f35e6e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/lmic/lmic_as923.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ ostime_t LMICas923_nextTx(ostime_t now) {

// make a mask of candidates available for use
availMap = 0;
feasibleMap = 0;
for (u1_t chnl = 0; chnl < MAX_CHANNELS; ++chnl) {
u2_t chnlBit = 1 << chnl;

Expand All @@ -410,9 +411,10 @@ ostime_t LMICas923_nextTx(ostime_t now) {
if ((LMIC.channelDrMap[chnl] & (1 << (LMIC.datarate & 0xF))) == 0)
continue;

// not available yet?
// This channel is feasible. But might not be available.
feasibleMap |= chnlBit;

// not available yet?
u1_t const band = LMIC.channelFreq[chnl] & 0x3;
if ((s4_t)(LMIC.bands[band].avail - mintime) > 0)
continue;
Expand Down
6 changes: 4 additions & 2 deletions src/lmic/lmic_eu868.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,24 +285,26 @@ ostime_t LMICeu868_nextTx(ostime_t now) {

// make a mask of candidates available for use
availMap = 0;
feasibleMap = 0;
for (u1_t chnl = 0; chnl < MAX_CHANNELS; ++chnl) {
u2_t chnlBit = 1 << chnl;

// none at any higher numbers?
if (LMIC.channelMap < chnlBit)
break;

// not enabled?
// not enabled?
if ((LMIC.channelMap & chnlBit) == 0)
continue;

// not feasible?
if ((LMIC.channelDrMap[chnl] & (1 << (LMIC.datarate & 0xF))) == 0)
continue;

// not available yet?
// This channel is feasible. But might not be available.
feasibleMap |= chnlBit;

// not available yet?
u1_t const band = LMIC.channelFreq[chnl] & 0x3;
if ((s4_t)(LMIC.bands[band].avail - mintime) > 0)
continue;
Expand Down

0 comments on commit f35e6e3

Please sign in to comment.