diff --git a/fw_dumps/0000026619db3438.bin b/fw_dumps/0000026619db3438.bin new file mode 100644 index 00000000..24f558b9 Binary files /dev/null and b/fw_dumps/0000026619db3438.bin differ diff --git a/crap/027C4B633B1A.bin b/fw_dumps/027C4B633B1A.bin similarity index 100% rename from crap/027C4B633B1A.bin rename to fw_dumps/027C4B633B1A.bin diff --git a/crap/027C4B633B1A.bin.html b/fw_dumps/027C4B633B1A.bin.html similarity index 99% rename from crap/027C4B633B1A.bin.html rename to fw_dumps/027C4B633B1A.bin.html index 44d31fcf..a167eff9 100644 --- a/crap/027C4B633B1A.bin.html +++ b/fw_dumps/027C4B633B1A.bin.html @@ -6,17 +6,6 @@
- -code:0000 ; -code:0000 ; +-------------------------------------------------------------------------+ -code:0000 ; | This file was generated by The Interactive Disassembler (IDA) | -code:0000 ; | Copyright (c) 2019 Hex-Rays, <support@hex-rays.com> | -code:0000 ; | License info: | -code:0000 ; +-------------------------------------------------------------------------+ -code:0000 ; -code:0000 ; Input SHA256 : 70C25228315B81666DE14A5CACEEF570D5E8A918429043F10D1CA03DA4EE52E5 -code:0000 ; Input MD5 : 3DF1A99EBA92423B6117D7291E03DCA9 -code:0000 ; Input CRC32 : 53292AA9 code:0000 code:0000 ; Format : Binary file code:0000 ; Base Address: 0000h Range: 0000h - 10000h Loaded length: 10000h diff --git a/fw_dumps/027C4D453B18.bin b/fw_dumps/027C4D453B18.bin new file mode 100644 index 00000000..c1200db8 Binary files /dev/null and b/fw_dumps/027C4D453B18.bin differ diff --git a/fw_dumps/02A901443416.bin b/fw_dumps/02A901443416.bin new file mode 100644 index 00000000..eba2883b Binary files /dev/null and b/fw_dumps/02A901443416.bin differ diff --git a/fw_dumps/02BE4D273B12.bin b/fw_dumps/02BE4D273B12.bin new file mode 100644 index 00000000..7ebc3035 Binary files /dev/null and b/fw_dumps/02BE4D273B12.bin differ diff --git a/tag_fw/drawing.c b/tag_fw/drawing.c index 4465af71..a0a33d9e 100644 --- a/tag_fw/drawing.c +++ b/tag_fw/drawing.c @@ -348,7 +348,7 @@ void drawImageAtAddress(uint32_t addr, uint8_t lut) { clearScreen(); beginWriteFramebuffer(EPD_COLOR_BLACK); epdSelect(); - for (uint16_t c = 0; c < (SCREEN_HEIGHT * SCREEN_WIDTH / 8); c++) { + for (uint16_t c = 0; c < (SCREEN_HEIGHT * (SCREEN_WIDTH / 8)); c++) { if (c % 256 == 0) { epdDeselect(); eepromRead(addr + sizeof(struct EepromImageHeader) + c, mClutMap, 256); @@ -366,7 +366,7 @@ void drawImageAtAddress(uint32_t addr, uint8_t lut) { beginFullscreenImage(); beginWriteFramebuffer(EPD_COLOR_BLACK); epdSelect(); - for (uint16_t c = 0; c < (SCREEN_HEIGHT * SCREEN_WIDTH / 8); c++) { + for (uint16_t c = 0; c < (SCREEN_HEIGHT * (SCREEN_WIDTH / 8)); c++) { if (c % 256 == 0) { epdDeselect(); eepromRead(addr + sizeof(struct EepromImageHeader) + c, mClutMap, 256); @@ -379,10 +379,10 @@ void drawImageAtAddress(uint32_t addr, uint8_t lut) { beginWriteFramebuffer(EPD_COLOR_RED); epdSelect(); - for (uint16_t c = 0; c < (SCREEN_HEIGHT * SCREEN_WIDTH / 8); c++) { + for (uint16_t c = 0; c < (SCREEN_HEIGHT * (SCREEN_WIDTH / 8)); c++) { if (c % 256 == 0) { epdDeselect(); - eepromRead(addr + sizeof(struct EepromImageHeader) + (SCREEN_HEIGHT * SCREEN_WIDTH / 8) + c, mClutMap, 256); + eepromRead(addr + sizeof(struct EepromImageHeader) + (SCREEN_HEIGHT * (SCREEN_WIDTH / 8)) + c, mClutMap, 256); epdSelect(); } epdSend(mClutMap[c % 256]); diff --git a/tag_fw/fw154.bin b/tag_fw/fw154.bin index 3e4a009e..75c7e9a0 100644 Binary files a/tag_fw/fw154.bin and b/tag_fw/fw154.bin differ diff --git a/tag_fw/fw29.bin b/tag_fw/fw29.bin index d4fd320d..c9b50278 100644 Binary files a/tag_fw/fw29.bin and b/tag_fw/fw29.bin differ diff --git a/tag_fw/fw42.bin b/tag_fw/fw42.bin index 9ca220f5..b7abdcd9 100644 Binary files a/tag_fw/fw42.bin and b/tag_fw/fw42.bin differ diff --git a/tag_fw/powermgt.c b/tag_fw/powermgt.c index a2a38a4e..b0a0b6ba 100644 --- a/tag_fw/powermgt.c +++ b/tag_fw/powermgt.c @@ -59,13 +59,13 @@ void setupPortsInitial() { P2PULL = 0x00; } -void initPowerSaving(uint16_t initialValue) { +void initPowerSaving(const uint16_t initialValue) { for (uint8_t c = 0; c < POWER_SAVING_SMOOTHING; c++) { dataReqAttemptArr[c] = initialValue; } } -void configSPI(bool setup) { +static void configSPI(const bool setup) { if (setup == spiActive) return; if (setup) { P0FUNC |= (1 << 0) | (1 << 1) | (1 << 2); @@ -88,7 +88,7 @@ void configSPI(bool setup) { spiActive = setup; } -void configUART(bool setup) { +static void configUART(const bool setup) { if (uartActive == setup) return; if (setup) { P0FUNC |= (1 << 6); @@ -102,7 +102,7 @@ void configUART(bool setup) { uartActive = setup; } -void configEEPROM(bool setup) { +static void configEEPROM(const bool setup) { if (setup == eepromActive) return; if (setup) { P1FUNC &= ~(1 << 1); @@ -121,7 +121,7 @@ void configEEPROM(bool setup) { setup == eepromActive; } -void powerUp(uint8_t parts) { +void powerUp(const uint8_t parts) { if (parts & INIT_BASE) { clockingAndIntsInit(); timerInit(); @@ -173,7 +173,7 @@ void powerUp(uint8_t parts) { } } -void powerDown(uint8_t parts) { +void powerDown(const uint8_t parts) { if (parts & INIT_UART) { configUART(false); } @@ -203,7 +203,7 @@ void powerDown(uint8_t parts) { } } -void doSleep(uint32_t __xdata t) { +void doSleep(const uint32_t __xdata t) { // if (t > 1000) pr("s=%lu\n ", t / 1000); // powerPortsDownForSleep(); @@ -245,13 +245,12 @@ void doSleep(uint32_t __xdata t) { P1INTEN = 0; if (P1CHSTA && (1 << 0)) { wakeUpReason = WAKEUP_REASON_GPIO; - pr("button pressed\n"); P1CHSTA &= ~(1 << 0); } #endif } -uint32_t getNextScanSleep(bool increment) { +uint32_t getNextScanSleep(const bool increment) { if (increment) { if (scanAttempts < 255) scanAttempts++; diff --git a/tag_fw/powermgt.h b/tag_fw/powermgt.h index 806a63ba..e65d0bcc 100644 --- a/tag_fw/powermgt.h +++ b/tag_fw/powermgt.h @@ -61,17 +61,17 @@ extern void setupPortsInitial(); -extern void powerUp(uint8_t parts); -extern void powerDown(uint8_t parts); +extern void powerUp(const uint8_t parts); +extern void powerDown(const uint8_t parts); extern void initAfterWake(); -extern void doSleep(uint32_t __xdata t); +extern void doSleep(const uint32_t __xdata t); extern void addAverageValue(); extern uint16_t getNextSleep(); -extern uint32_t getNextScanSleep(bool increment); -extern void initPowerSaving(uint16_t initialValue); +extern uint32_t getNextScanSleep(const bool increment); +extern void initPowerSaving(const uint16_t initialValue); extern uint8_t __xdata wakeUpReason; diff --git a/tag_fw/proto.h b/tag_fw/proto.h index bc6f4f45..2ee3da03 100644 --- a/tag_fw/proto.h +++ b/tag_fw/proto.h @@ -121,6 +121,7 @@ struct AvailDataReq { #define DATATYPE_IMG_DIFF 0x10 // always 1BPP #define DATATYPE_IMG_RAW_1BPP 0x20 // 2888 bytes for 1.54" / 4736 2.9" / 15000 4.2" #define DATATYPE_IMG_RAW_2BPP 0x21 // 5776 bytes for 1.54" / 9472 2.9" / 30000 4.2" +#define DATATYPE_IMG_RAW_1BPP_DIRECT 0x3F // only for 1.54", don't write to EEPROM, but straightaway to the EPD struct AvailDataInfo { uint8_t checksum; diff --git a/tag_fw/syncedproto.c b/tag_fw/syncedproto.c index a5656ee0..755437f2 100644 --- a/tag_fw/syncedproto.c +++ b/tag_fw/syncedproto.c @@ -26,33 +26,32 @@ // download-stuff uint8_t __xdata blockXferBuffer[BLOCK_XFER_BUFFER_SIZE] = {0}; -struct blockRequest __xdata curBlock = {0}; // used by the block-requester, contains the next request that we'll send -struct AvailDataInfo __xdata curDataInfo = {0}; // last 'AvailDataInfo' we received from the AP -bool __xdata requestPartialBlock = false; +static struct blockRequest __xdata curBlock = {0}; // used by the block-requester, contains the next request that we'll send +static struct AvailDataInfo __xdata curDataInfo = {0}; // last 'AvailDataInfo' we received from the AP +static bool __xdata requestPartialBlock = false; // if we should ask the AP to get this block from the host or not #define BLOCK_TRANSFER_ATTEMPTS 5 uint8_t __xdata prevImgSlot = 0xFF; uint8_t __xdata curImgSlot = 0xFF; -uint32_t __xdata curHighSlotId = 0; -uint8_t __xdata nextImgSlot = 0; -uint8_t __xdata imgSlots = 0; +static uint32_t __xdata curHighSlotId = 0; +static uint8_t __xdata nextImgSlot = 0; +static uint8_t __xdata imgSlots = 0; uint8_t __xdata drawWithLut = 0; // stuff we need to keep track of related to the network/AP uint8_t __xdata APmac[8] = {0}; uint16_t __xdata APsrcPan = 0; uint8_t __xdata mSelfMac[8] = {0}; -uint8_t __xdata seq = 0; +static uint8_t __xdata seq = 0; uint8_t __xdata currentChannel = 0; // buffer we use to prepare/read packets -// static uint8_t __xdata mRxBuf[130]; static uint8_t __xdata inBuffer[128] = {0}; static uint8_t __xdata outBuffer[128] = {0}; // tools -uint8_t __xdata getPacketType(void *__xdata buffer) { - struct MacFcs *__xdata fcs = buffer; +static uint8_t __xdata getPacketType(const void *__xdata buffer) { + const struct MacFcs *__xdata fcs = buffer; if ((fcs->frameType == 1) && (fcs->destAddrType == 2) && (fcs->srcAddrType == 3) && (fcs->panIdCompressed == 0)) { // broadcast frame uint8_t __xdata type = ((uint8_t *)buffer)[sizeof(struct MacFrameBcast)]; @@ -64,8 +63,8 @@ uint8_t __xdata getPacketType(void *__xdata buffer) { } return 0; } -bool pktIsUnicast(void *__xdata buffer) { - struct MacFcs *__xdata fcs = buffer; +static bool pktIsUnicast(const void *__xdata buffer) { + const struct MacFcs *__xdata fcs = buffer; if ((fcs->frameType == 1) && (fcs->destAddrType == 2) && (fcs->srcAddrType == 3) && (fcs->panIdCompressed == 0)) { return false; } else if ((fcs->frameType == 1) && (fcs->destAddrType == 3) && (fcs->srcAddrType == 3) && (fcs->panIdCompressed == 1)) { @@ -75,7 +74,7 @@ bool pktIsUnicast(void *__xdata buffer) { // unknown type... return false; } -void dump(uint8_t *__xdata a, uint16_t __xdata l) { +void dump(const uint8_t *__xdata a, const uint16_t __xdata l) { pr("\n "); #define ROWS 16 for (uint8_t c = 0; c < ROWS; c++) { @@ -97,7 +96,7 @@ void dump(uint8_t *__xdata a, uint16_t __xdata l) { } pr("\n"); } -bool checkCRC(void *p, uint8_t len) { +static bool checkCRC(const void *p, const uint8_t len) { uint8_t total = 0; for (uint8_t c = 1; c < len; c++) { total += ((uint8_t *)p)[c]; @@ -105,7 +104,7 @@ bool checkCRC(void *p, uint8_t len) { // pr("CRC: rx %d, calc %d\n", ((uint8_t *)p)[0], total); return ((uint8_t *)p)[0] == total; } -void addCRC(void *p, uint8_t len) { +static void addCRC(void *p, const uint8_t len) { uint8_t total = 0; for (uint8_t c = 1; c < len; c++) { total += ((uint8_t *)p)[c]; @@ -114,7 +113,7 @@ void addCRC(void *p, uint8_t len) { } // radio stuff -void sendPing() { +static void sendPing() { struct MacFrameBcast __xdata *txframe = (struct MacFrameBcast *)(outBuffer + 1); memset(outBuffer, 0, sizeof(struct MacFrameBcast) + 2 + 4); outBuffer[0] = sizeof(struct MacFrameBcast) + 1 + 2; @@ -130,7 +129,7 @@ void sendPing() { txframe->srcPan = PROTO_PAN_ID; commsTxNoCpy(outBuffer); } -uint8_t detectAP(uint8_t channel) { +uint8_t detectAP(const uint8_t channel) { uint32_t __xdata t; radioRxEnable(false, true); radioSetChannel(channel); @@ -157,7 +156,7 @@ uint8_t detectAP(uint8_t channel) { } // data xfer stuff -void sendShortAvailDataReq() { +static void sendShortAvailDataReq() { struct MacFrameBcast __xdata *txframe = (struct MacFrameBcast *)(outBuffer + 1); outBuffer[0] = sizeof(struct MacFrameBcast) + 1 + 2; outBuffer[sizeof(struct MacFrameBcast) + 1] = PKT_AVAIL_DATA_SHORTREQ; @@ -165,12 +164,12 @@ void sendShortAvailDataReq() { outBuffer[1] = 0x21; outBuffer[2] = 0xC8; // quickly set txframe fcs structure for broadcast packet txframe->seq = seq++; - txframe->dstPan = 0xFFFF; + txframe->dstPan = PROTO_PAN_ID; txframe->dstAddr = 0xFFFF; txframe->srcPan = PROTO_PAN_ID; commsTxNoCpy(outBuffer); } -void sendAvailDataReq() { +static void sendAvailDataReq() { struct MacFrameBcast __xdata *txframe = (struct MacFrameBcast *)(outBuffer + 1); memset(outBuffer, 0, sizeof(struct MacFrameBcast) + sizeof(struct AvailDataReq) + 2 + 4); struct AvailDataReq *__xdata availreq = (struct AvailDataReq *)(outBuffer + 2 + sizeof(struct MacFrameBcast)); @@ -182,7 +181,7 @@ void sendAvailDataReq() { txframe->fcs.destAddrType = 2; txframe->fcs.srcAddrType = 3; txframe->seq = seq++; - txframe->dstPan = 0xFFFF; + txframe->dstPan = PROTO_PAN_ID; txframe->dstAddr = 0xFFFF; txframe->srcPan = PROTO_PAN_ID; // TODO: send some (more) meaningful data @@ -244,7 +243,7 @@ struct AvailDataInfo *__xdata getShortAvailDataInfo() { dataReqLastAttempt = DATA_REQ_MAX_ATTEMPTS; return NULL; } -bool processBlockPart(struct blockPart *bp) { +static bool processBlockPart(const struct blockPart *bp) { uint16_t __xdata start = bp->blockPart * BLOCK_PART_DATA_SIZE; uint16_t __xdata size = BLOCK_PART_DATA_SIZE; // validate if it's okay to copy data @@ -267,7 +266,7 @@ bool processBlockPart(struct blockPart *bp) { return false; } } -bool blockRxLoop(uint32_t timeout) { +static bool blockRxLoop(const uint32_t timeout) { uint32_t __xdata t; bool success = false; radioRxEnable(true, true); @@ -285,12 +284,12 @@ bool blockRxLoop(uint32_t timeout) { radioRxFlush(); return success; } -struct blockRequestAck *__xdata continueToRX() { +static struct blockRequestAck *__xdata continueToRX() { struct blockRequestAck *ack = (struct blockRequestAck *)(inBuffer + sizeof(struct MacFrameNormal) + 1); ack->pleaseWaitMs = 0; return ack; } -void sendBlockRequest() { +static void sendBlockRequest() { memset(outBuffer, 0, sizeof(struct MacFrameNormal) + sizeof(struct blockRequest) + 2 + 2); struct MacFrameNormal *__xdata f = (struct MacFrameNormal *)(outBuffer + 1); struct blockRequest *__xdata blockreq = (struct blockRequest *)(outBuffer + 2 + sizeof(struct MacFrameNormal)); @@ -318,7 +317,7 @@ void sendBlockRequest() { addCRC(blockreq, sizeof(struct blockRequest)); commsTxNoCpy(outBuffer); } -struct blockRequestAck *__xdata performBlockRequest() { +static struct blockRequestAck *__xdata performBlockRequest() { uint32_t __xdata t; radioRxEnable(true, true); radioRxFlush(); @@ -352,7 +351,7 @@ struct blockRequestAck *__xdata performBlockRequest() { return continueToRX(); // return NULL; } -void sendXferCompletePacket() { +static void sendXferCompletePacket() { memset(outBuffer, 0, sizeof(struct MacFrameNormal) + 2 + 4); struct MacFrameNormal *__xdata f = (struct MacFrameNormal *)(outBuffer + 1); outBuffer[0] = sizeof(struct MacFrameNormal) + 2 + 2; @@ -371,7 +370,7 @@ void sendXferCompletePacket() { f->seq = seq++; commsTxNoCpy(outBuffer); } -void sendXferComplete() { +static void sendXferComplete() { radioRxEnable(true, true); for (uint8_t c = 0; c < 8; c++) { @@ -390,7 +389,7 @@ void sendXferComplete() { pr("XFC NACK!\n"); return; } -bool validateBlockData() { +static bool validateBlockData() { struct blockData *bd = (struct blockData *)blockXferBuffer; // pr("expected len = %04X, checksum=%04X\n", bd->size, bd->checksum); uint16_t t = 0; @@ -401,10 +400,10 @@ bool validateBlockData() { } // EEprom related stuff -uint32_t getAddressForSlot(uint8_t s) { +static uint32_t getAddressForSlot(const uint8_t s) { return EEPROM_IMG_START + (EEPROM_IMG_EACH * s); } -void getNumSlots() { +static void getNumSlots() { uint32_t eeSize = eepromGetSize(); uint16_t nSlots = mathPrvDiv32x16(eeSize - EEPROM_IMG_START, EEPROM_IMG_EACH >> 8) >> 8; if (eeSize < EEPROM_IMG_START || !nSlots) { @@ -417,7 +416,7 @@ void getNumSlots() { } else imgSlots = nSlots; } -uint8_t findSlot(uint8_t *__xdata ver) { +static uint8_t findSlot(const uint8_t *__xdata ver) { // return 0xFF; // remove me! This forces the tag to re-download each and every upload without checking if it's already in the eeprom somewhere uint32_t __xdata markerValid = EEPROM_IMG_VALID; for (uint8_t __xdata c = 0; c < imgSlots; c++) { @@ -431,28 +430,28 @@ uint8_t findSlot(uint8_t *__xdata ver) { } return 0xFF; } -void eraseUpdateBlock() { +static void eraseUpdateBlock() { eepromErase(EEPROM_UPDATA_AREA_START, EEPROM_UPDATE_AREA_LEN / EEPROM_ERZ_SECTOR_SZ); } -void eraseImageBlock(uint8_t c) { +static void eraseImageBlock(const uint8_t c) { eepromErase(getAddressForSlot(c), EEPROM_IMG_EACH / EEPROM_ERZ_SECTOR_SZ); } -void saveUpdateBlockData(uint8_t blockId) { +static void saveUpdateBlockData(uint8_t blockId) { if (!eepromWrite(EEPROM_UPDATA_AREA_START + (blockId * BLOCK_DATA_SIZE), blockXferBuffer + sizeof(struct blockData), BLOCK_DATA_SIZE)) pr("EEPROM write failed\n"); } -void saveImgBlockData(uint8_t imgSlot, uint8_t blockId) { +static void saveImgBlockData(const uint8_t imgSlot, const uint8_t blockId) { uint16_t length = EEPROM_IMG_EACH - (sizeof(struct EepromImageHeader) + (blockId * BLOCK_DATA_SIZE)); if (length > 4096) length = 4096; if (!eepromWrite(getAddressForSlot(imgSlot) + sizeof(struct EepromImageHeader) + (blockId * BLOCK_DATA_SIZE), blockXferBuffer + sizeof(struct blockData), length)) pr("EEPROM write failed\n"); } -void drawImageFromEeprom(uint8_t imgSlot) { +void drawImageFromEeprom(const uint8_t imgSlot) { drawImageAtAddress(getAddressForSlot(imgSlot), drawWithLut); drawWithLut = 0; // default back to the regular ol' stock/OTP LUT } -uint32_t getHighSlotId() { +static uint32_t getHighSlotId() { uint32_t temp = 0; uint32_t __xdata markerValid = EEPROM_IMG_VALID; for (uint8_t __xdata c = 0; c < imgSlots; c++) { @@ -469,11 +468,12 @@ uint32_t getHighSlotId() { return temp; } -bool getDataBlock(uint16_t blockSize) { - static uint8_t __xdata partsThisBlock = 0; - static uint8_t __xdata blockAttempts = 0; - blockAttempts = BLOCK_TRANSFER_ATTEMPTS; +static uint8_t __xdata partsThisBlock = 0; +static uint8_t __xdata blockAttempts = 0; // these CAN be local to the function, but for some reason, they won't survive sleep? + // they get overwritten with 7F 32 44 20 00 00 00 00 11, I don't know why. +static bool getDataBlock(const uint16_t blockSize) { + blockAttempts = BLOCK_TRANSFER_ATTEMPTS; if (blockSize == BLOCK_DATA_SIZE) { partsThisBlock = BLOCK_MAX_PARTS; memset(curBlock.requestedParts, 0xFF, BLOCK_REQ_PARTS_BYTES); @@ -505,6 +505,7 @@ bool getDataBlock(uint16_t blockSize) { #endif powerUp(INIT_RADIO); struct blockRequestAck *__xdata ack = performBlockRequest(); + if (ack == NULL) { pr("Cancelled request\n"); return false; @@ -513,15 +514,13 @@ bool getDataBlock(uint16_t blockSize) { if (ack->pleaseWaitMs < 35) { timerDelay(ack->pleaseWaitMs * TIMER_TICKS_PER_MS); } else { - powerDown(INIT_GPIO); doSleep(ack->pleaseWaitMs - 10); - powerUp(INIT_BASE | INIT_GPIO | INIT_UART | INIT_RADIO); + powerUp(INIT_UART | INIT_RADIO); radioRxEnable(true, true); } } else { // immediately start with the reception of the block data } - blockRxLoop(270); // BLOCK RX LOOP - receive a block, until the timeout has passed powerDown(INIT_RADIO); @@ -569,7 +568,7 @@ bool getDataBlock(uint16_t blockSize) { return false; } -bool downloadFWUpdate(struct AvailDataInfo *__xdata avail) { +static bool downloadFWUpdate(const struct AvailDataInfo *__xdata avail) { // check if we already started the transfer of this information & haven't completed it if (xMemEqual((const void *__xdata) & avail->dataVer, (const void *__xdata) & curDataInfo.dataVer, 8) && curDataInfo.dataSize) { // looks like we did. We'll carry on where we left off. @@ -607,7 +606,7 @@ bool downloadFWUpdate(struct AvailDataInfo *__xdata avail) { // no more data, download complete return true; } -bool downloadImageData(struct AvailDataInfo *__xdata avail) { +static bool downloadImageDataToEEPROM(const struct AvailDataInfo *__xdata avail) { static uint16_t __xdata imageSize = 0; // check if we already started the transfer of this information & haven't completed it if (xMemEqual((const void *__xdata) & avail->dataVer, (const void *__xdata) & curDataInfo.dataVer, 8) && curDataInfo.dataSize) { @@ -668,7 +667,7 @@ bool downloadImageData(struct AvailDataInfo *__xdata avail) { return true; } -bool processAvailDataInfo(struct AvailDataInfo *__xdata avail) { +bool processAvailDataInfo(const struct AvailDataInfo *__xdata avail) { switch (avail->dataType) { case DATATYPE_IMG_BMP: case DATATYPE_IMG_DIFF: @@ -710,7 +709,8 @@ bool processAvailDataInfo(struct AvailDataInfo *__xdata avail) { // not found in cache, prepare to download drawWithLut = avail->dataTypeArgument; powerUp(INIT_EEPROM); - downloadImageData(avail); + downloadImageDataToEEPROM(avail); + wdt60s(); powerUp(INIT_EPD); drawImageFromEeprom(curImgSlot); powerDown(INIT_EPD | INIT_EEPROM); diff --git a/tag_fw/syncedproto.h b/tag_fw/syncedproto.h index 6b6fdb07..b5bd6139 100644 --- a/tag_fw/syncedproto.h +++ b/tag_fw/syncedproto.h @@ -16,9 +16,9 @@ extern void killRadio(void); extern struct AvailDataInfo *__xdata getAvailDataInfo(); extern struct AvailDataInfo *__xdata getShortAvailDataInfo(); -extern void drawImageFromEeprom(uint8_t imgSlot); -extern bool processAvailDataInfo(struct AvailDataInfo *__xdata avail); +extern void drawImageFromEeprom(const uint8_t imgSlot); +extern bool processAvailDataInfo(const struct AvailDataInfo *__xdata avail); extern void initializeProto(); -extern uint8_t detectAP(uint8_t channel); +extern uint8_t detectAP(const uint8_t channel); #endif \ No newline at end of file