From 5f77358bd0659951a04375c3d5c44480a4c61fd9 Mon Sep 17 00:00:00 2001 From: jjwbruijn Date: Wed, 10 Apr 2024 21:23:03 +0200 Subject: [PATCH] Fixed transfers that wouldn't validate properly if size%99==0 --- ARM_Tag_FW/common/drawing.cpp | 6 ++++++ ARM_Tag_FW/common/oepl-protocol.cpp | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ARM_Tag_FW/common/drawing.cpp b/ARM_Tag_FW/common/drawing.cpp index b25d831f..cc9e3032 100644 --- a/ARM_Tag_FW/common/drawing.cpp +++ b/ARM_Tag_FW/common/drawing.cpp @@ -224,6 +224,9 @@ void drawImageAtAddressWrap(uint32_t addr, uint8_t lut) { #endif switch (eih.dataType) { case DATATYPE_IMG_RAW_1BPP: { +#ifdef DEBUG_DRAWING + printf("DRAW: 1BPP\n"); +#endif drawItem *di = new drawItem; // di->setRotation(ro); di->xpos = 0; @@ -241,6 +244,9 @@ void drawImageAtAddressWrap(uint32_t addr, uint8_t lut) { di->addToList(); } break; case DATATYPE_IMG_RAW_2BPP: { +#ifdef DEBUG_DRAWING + printf("DRAW: 2BPP\n"); +#endif drawItem *di = new drawItem; // di->setRotation(ro); di->xpos = 0; diff --git a/ARM_Tag_FW/common/oepl-protocol.cpp b/ARM_Tag_FW/common/oepl-protocol.cpp index bcc580b0..bff433d7 100644 --- a/ARM_Tag_FW/common/oepl-protocol.cpp +++ b/ARM_Tag_FW/common/oepl-protocol.cpp @@ -552,7 +552,7 @@ static uint8_t *getDataBlock(const uint16_t blockSize) { memset(curBlock.requestedParts, 0xFF, BLOCK_REQ_PARTS_BYTES); } else { partsThisBlock = (sizeof(struct blockData) + blockSize) / BLOCK_PART_DATA_SIZE; - if (blockSize % BLOCK_PART_DATA_SIZE) + if ((sizeof(struct blockData) + blockSize) % BLOCK_PART_DATA_SIZE) partsThisBlock++; memset(curBlock.requestedParts, 0x00, BLOCK_REQ_PARTS_BYTES); for (uint8_t c = 0; c < partsThisBlock; c++) { @@ -952,6 +952,9 @@ bool processImageDataAvail(struct AvailDataInfo *avail) { } bool processAvailDataInfo(struct AvailDataInfo *avail) { +#ifdef DEBUG_PROTO + printf("PROTO: New dataAvail with type 0x%02X\n", avail->dataType); +#endif switch (avail->dataType) { case DATATYPE_IMG_RAW_1BPP: case DATATYPE_IMG_RAW_2BPP: