fix payload of DevStatusAns mac-command

Lorawan specs say (e.g. 1.0.4 or 1.1), that the first byte is the
battery-level and the second byte is the margin.
This commit is contained in:
Thomas Schätzlein 2024-05-20 10:51:41 +02:00
parent e121f963dc
commit f2e1b547d5

View file

@ -2386,9 +2386,9 @@ bool LoRaWANNode::execMacCommand(LoRaWANMacCommand_t* cmd) {
// set the uplink reply // set the uplink reply
RADIOLIB_DEBUG_PROTOCOL_PRINTLN("DevStatusReq"); RADIOLIB_DEBUG_PROTOCOL_PRINTLN("DevStatusReq");
cmd->len = 2; cmd->len = 2;
cmd->payload[1] = this->battLevel; cmd->payload[0] = this->battLevel;
int8_t snr = this->phyLayer->getSNR(); int8_t snr = this->phyLayer->getSNR();
cmd->payload[0] = snr & 0x3F; cmd->payload[1] = snr & 0x3F;
RADIOLIB_DEBUG_PROTOCOL_PRINTLN("DevStatusAns: status = 0x%02x%02x", cmd->payload[0], cmd->payload[1]); RADIOLIB_DEBUG_PROTOCOL_PRINTLN("DevStatusAns: status = 0x%02x%02x", cmd->payload[0], cmd->payload[1]);
return(true); return(true);