From 589b1990cea8d78ac6fbfb273c21be42634afc32 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Sun, 29 Jan 2023 00:33:43 +0100 Subject: [PATCH] fix error in downlink handling --- sketch/production.cpp | 8 ++++---- snippets/decoding2.txt | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/sketch/production.cpp b/sketch/production.cpp index 7349a84..bbbda4d 100644 --- a/sketch/production.cpp +++ b/sketch/production.cpp @@ -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; } } diff --git a/snippets/decoding2.txt b/snippets/decoding2.txt index 7adef10..6f7a0fa 100644 --- a/snippets/decoding2.txt +++ b/snippets/decoding2.txt @@ -60,3 +60,19 @@ typedef struct { 28 C7 11 F6 62 20 01 B8 00 30 2C 35 6D 3A 00 + + +ED89E319826E7A9B61E39983A4CAFAD9E8DA3C798914947D787E0E150C6D22482010D4C018D7B67BF4C01160388551637C5F8C16173634A4 + +28 c7 11 f6 62 20 01 b8 +00 +30 2c 35 6d 3a +28 19 c3 0a 0d 00 00 b4 +01 +32 2c 30 6d 3a +28 8c 4f 6a 0d 00 00 94 +02 +33 2c 30 6d 3a +28 35 86 6a 0d 00 00 d4 +03 +34 2c 30 6d 3a \ No newline at end of file