fix error in downlink handling

This commit is contained in:
2023-01-29 00:33:43 +01:00
parent 4203d2e77e
commit 589b1990ce
2 changed files with 20 additions and 4 deletions

View File

@ -156,15 +156,15 @@ void downLinkDataHandle(McpsIndication_t *mcpsIndication)
for (uint8_t i = 0; i < NUM_OF_SENSORS; i++) {
bool found = false;
for (uint8_t j = 0; j < NUM_OF_SENSORS; j++) {
if (sensors[i].addr == downlinkSensors[i].addr) {
if (sensors[i].addr == downlinkSensors[j].addr) {
found = true;
sensors[i].index = downlinkSensors[i].index;
memcpy(sensors[i].label, downlinkSensors[i].label, LABEL_LENGTH);
sensors[i].index = downlinkSensors[j].index;
memcpy(sensors[i].label, downlinkSensors[j].label, LABEL_LENGTH);
sensors[i].label[LABEL_LENGTH] = 0;
}
}
if (! found) {
Serial.printf("Illegal label received for not existing %08x\n\r", downlinkSensors[i].addr);
Serial.printf("Illegal label received for not existing %016llx\n\r", downlinkSensors[i].addr);
errorCode |= ERR_ILLEGAL_DOWNLINK_MESSAGE_RECEIVED;
}
}