From ac6a46262a46f797ab537205c5db9aced97375fd Mon Sep 17 00:00:00 2001 From: atc1441 Date: Thu, 22 May 2025 10:40:49 +0200 Subject: [PATCH] Update main.c --- .../OpenEPaperLink_esp32_C6_AP/main/main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/main.c b/ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/main.c index 8c1ffc3d..a512c840 100644 --- a/ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/main.c +++ b/ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/main.c @@ -149,7 +149,7 @@ uint8_t getBlockDataLength() { } // pendingdata slot stuff -int8_t findSlotForMac(const uint8_t *mac) { +int32_t findSlotForMac(const uint8_t *mac) { for (uint8_t c = 0; c < MAX_PENDING_MACS; c++) { if (memcmp(mac, ((uint8_t *) &(pendingDataArr[c].targetMac)), 8) == 0) { if (pendingDataArr[c].attemptsLeft != 0) { @@ -159,7 +159,7 @@ int8_t findSlotForMac(const uint8_t *mac) { } return -1; } -int8_t findFreeSlot() { +int32_t findFreeSlot() { for (uint8_t c = 0; c < MAX_PENDING_MACS; c++) { if (pendingDataArr[c].attemptsLeft == 0) { return c; @@ -167,7 +167,7 @@ int8_t findFreeSlot() { } return -1; } -int8_t findSlotForVer(const uint8_t *ver) { +int32_t findSlotForVer(const uint8_t *ver) { for (uint8_t c = 0; c < MAX_PENDING_MACS; c++) { if (memcmp(ver, ((uint8_t *) &(pendingDataArr[c].availdatainfo.dataVer)), 8) == 0) { if (pendingDataArr[c].attemptsLeft != 0) return c; @@ -176,14 +176,14 @@ int8_t findSlotForVer(const uint8_t *ver) { return -1; } void deleteAllPendingDataForVer(const uint8_t *ver) { - int8_t slot = -1; + int32_t slot = -1; do { slot = findSlotForVer(ver); if (slot != -1) pendingDataArr[slot].attemptsLeft = 0; } while (slot != -1); } void deleteAllPendingDataForMac(const uint8_t *mac) { - int8_t slot = -1; + int32_t slot = -1; do { slot = findSlotForMac(mac); if (slot != -1) pendingDataArr[slot].attemptsLeft = 0; @@ -314,7 +314,7 @@ void processSerial(uint8_t lastchar) { if (bytesRemain == 0) { if (checkCRC(serialbuffer, sizeof(struct pendingData))) { struct pendingData *pd = (struct pendingData *) serialbuffer; - int8_t slot = findSlotForMac(pd->targetMac); + int32_t slot = findSlotForMac(pd->targetMac); if (slot == -1) slot = findFreeSlot(); if (slot != -1) { memcpy(&(pendingDataArr[slot]), serialbuffer, sizeof(struct pendingData)); @@ -624,7 +624,7 @@ void processXferComplete(uint8_t *buffer) { if (memcmp(lastAckMac, rxHeader->src, 8) != 0) { memcpy((void *) lastAckMac, (void *) rxHeader->src, 8); espNotifyXferComplete(rxHeader->src); - int8_t slot = findSlotForMac(rxHeader->src); + int32_t slot = findSlotForMac(rxHeader->src); if (slot != -1) pendingDataArr[slot].attemptsLeft = 0; } } @@ -788,7 +788,7 @@ void app_main(void) { housekeepingTimer = getMillis(); while (1) { while ((getMillis() - housekeepingTimer) < ((1000 * HOUSEKEEPING_INTERVAL) - 100)) { - int8_t ret = commsRxUnencrypted(radiorxbuffer); + int32_t ret = commsRxUnencrypted(radiorxbuffer); if (ret > 1) { led_flash(0);