diff --git a/src/protocols/LoRaWAN/LoRaWAN.cpp b/src/protocols/LoRaWAN/LoRaWAN.cpp index 02ff3f9d..80ecde7c 100644 --- a/src/protocols/LoRaWAN/LoRaWAN.cpp +++ b/src/protocols/LoRaWAN/LoRaWAN.cpp @@ -797,7 +797,7 @@ int16_t LoRaWANNode::uplink(uint8_t* data, size_t len, uint8_t port, bool isConf uint8_t* foptsPtr = foptsBuff; // append all MAC replies into fopts buffer - size_t i = 0; + int16_t i = 0; for (; i < this->commandsUp.numCommands; i++) { LoRaWANMacCommand_t cmd = this->commandsUp.commands[i]; memcpy(foptsPtr, &cmd, 1 + cmd.len); @@ -813,9 +813,6 @@ int16_t LoRaWANNode::uplink(uint8_t* data, size_t len, uint8_t port, bool isConf } else { deleteMacCommand(this->commandsUp.commands[i].cid, &this->commandsUp); } - if(i == 0) { - break; - } } uplinkMsgLen = RADIOLIB_LORAWAN_FRAME_LEN(len, foptsLen); @@ -1206,7 +1203,7 @@ int16_t LoRaWANNode::downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event) uint8_t foptsBuff[foptsBufSize]; uint8_t* foptsPtr = foptsBuff; // append all MAC replies into fopts buffer - size_t i = 0; + int16_t i = 0; for (; i < this->commandsUp.numCommands; i++) { LoRaWANMacCommand_t cmd = this->commandsUp.commands[i]; memcpy(foptsPtr, &cmd, 1 + cmd.len); @@ -1222,9 +1219,6 @@ int16_t LoRaWANNode::downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event) } else { deleteMacCommand(this->commandsUp.commands[i].cid, &this->commandsUp); } - if(i == 0) { - break; - } } this->isMACPayload = true; diff --git a/src/protocols/LoRaWAN/LoRaWAN.h b/src/protocols/LoRaWAN/LoRaWAN.h index 54351a03..da1a4356 100644 --- a/src/protocols/LoRaWAN/LoRaWAN.h +++ b/src/protocols/LoRaWAN/LoRaWAN.h @@ -626,7 +626,7 @@ class LoRaWANNode { uint8_t difsSlots; // available channel frequencies from list passed during OTA activation - LoRaWANChannel_t availableChannels[2][RADIOLIB_LORAWAN_NUM_AVAILABLE_CHANNELS] = { { 0 }, { 0 } }; + LoRaWANChannel_t availableChannels[2][RADIOLIB_LORAWAN_NUM_AVAILABLE_CHANNELS]; // currently configured channels for TX and RX1 LoRaWANChannel_t currentChannels[2] = { RADIOLIB_LORAWAN_CHANNEL_NONE, RADIOLIB_LORAWAN_CHANNEL_NONE };