[LoRaWAN] Fix shadowed variable

This commit is contained in:
jgromes 2024-05-26 11:26:15 +01:00
parent 41f89198aa
commit cc2cb2c9a0

View file

@ -2277,8 +2277,8 @@ bool LoRaWANNode::execMacCommand(LoRaWANMacCommand_t* cmd) {
uint16_t chMask = LoRaWANNode::ntoh<uint16_t>(&cmd->payload[1]); uint16_t chMask = LoRaWANNode::ntoh<uint16_t>(&cmd->payload[1]);
uint8_t chMaskCntl = (cmd->payload[3] & 0x70) >> 4; uint8_t chMaskCntl = (cmd->payload[3] & 0x70) >> 4;
uint8_t nbTrans = cmd->payload[3] & 0x0F; uint8_t nbTransMac = cmd->payload[3] & 0x0F;
RADIOLIB_DEBUG_PROTOCOL_PRINTLN("LinkADRReq: dataRate = %d, txSteps = %d, chMask = 0x%04x, chMaskCntl = %d, nbTrans = %d", drUp, txSteps, chMask, chMaskCntl, nbTrans); RADIOLIB_DEBUG_PROTOCOL_PRINTLN("LinkADRReq: dataRate = %d, txSteps = %d, chMask = 0x%04x, chMaskCntl = %d, nbTrans = %d", drUp, txSteps, chMask, chMaskCntl, nbTransMac);
// try to apply the datarate configuration // try to apply the datarate configuration
int16_t state; int16_t state;
@ -2349,8 +2349,8 @@ bool LoRaWANNode::execMacCommand(LoRaWANMacCommand_t* cmd) {
} }
} }
if(nbTrans) { // if there is a value for NbTrans, set this value if(nbTransMac) { // if there is a value for NbTrans, set this value
this->nbTrans = nbTrans; this->nbTrans = nbTransMac;
} }
// replace 'placeholder' or failed values with the current values for saving // replace 'placeholder' or failed values with the current values for saving
@ -2362,7 +2362,7 @@ bool LoRaWANNode::execMacCommand(LoRaWANMacCommand_t* cmd) {
if(txSteps == 0x0F || !pwrAck) { if(txSteps == 0x0F || !pwrAck) {
cmd->payload[0] = (cmd->payload[0] & 0xF0) | this->txPowerSteps; cmd->payload[0] = (cmd->payload[0] & 0xF0) | this->txPowerSteps;
} }
if(nbTrans == 0) { if(nbTransMac == 0) {
cmd->payload[3] = (cmd->payload[3] & 0xF0) | this->nbTrans; cmd->payload[3] = (cmd->payload[3] & 0xF0) | this->nbTrans;
} }