From 30ed0017f5479409510e7b37b864a08d7a0ade78 Mon Sep 17 00:00:00 2001 From: Terry Moore Date: Sat, 8 May 2021 13:08:39 -0400 Subject: [PATCH 1/2] Fix #730: uninitialized variable --- src/lmic/lmic_as923.c | 1 + src/lmic/lmic_eu868.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/lmic/lmic_as923.c b/src/lmic/lmic_as923.c index 5daa45e8..5da6a165 100644 --- a/src/lmic/lmic_as923.c +++ b/src/lmic/lmic_as923.c @@ -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; diff --git a/src/lmic/lmic_eu868.c b/src/lmic/lmic_eu868.c index bf4f2a14..7d780127 100644 --- a/src/lmic/lmic_eu868.c +++ b/src/lmic/lmic_eu868.c @@ -285,6 +285,7 @@ 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; From 43fedd56cf3db016e6aee6a8ef886fc636a38871 Mon Sep 17 00:00:00 2001 From: Terry Moore Date: Sat, 8 May 2021 13:09:30 -0400 Subject: [PATCH 2/2] Clean up comments a little --- src/lmic/lmic_as923.c | 3 ++- src/lmic/lmic_eu868.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lmic/lmic_as923.c b/src/lmic/lmic_as923.c index 5da6a165..5366d717 100644 --- a/src/lmic/lmic_as923.c +++ b/src/lmic/lmic_as923.c @@ -411,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; diff --git a/src/lmic/lmic_eu868.c b/src/lmic/lmic_eu868.c index 7d780127..c8653cba 100644 --- a/src/lmic/lmic_eu868.c +++ b/src/lmic/lmic_eu868.c @@ -293,7 +293,7 @@ ostime_t LMICeu868_nextTx(ostime_t now) { if (LMIC.channelMap < chnlBit) break; - // not enabled? + // not enabled? if ((LMIC.channelMap & chnlBit) == 0) continue; @@ -301,9 +301,10 @@ ostime_t LMICeu868_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;