diff --git a/binaries/AP_FW_1.54.bin b/binaries/AP_FW_1.54.bin index ca828166..9c04395f 100644 Binary files a/binaries/AP_FW_1.54.bin and b/binaries/AP_FW_1.54.bin differ diff --git a/binaries/AP_FW_2.9.bin b/binaries/AP_FW_2.9.bin index 7a1e1a3c..b53427d4 100644 Binary files a/binaries/AP_FW_2.9.bin and b/binaries/AP_FW_2.9.bin differ diff --git a/binaries/AP_FW_Nodisplay.bin b/binaries/AP_FW_Nodisplay.bin index b267d67f..f05c2e01 100644 Binary files a/binaries/AP_FW_Nodisplay.bin and b/binaries/AP_FW_Nodisplay.bin differ diff --git a/binaries/AP_FW_Pack.bin b/binaries/AP_FW_Pack.bin index 0642f9c6..f0ac526b 100644 Binary files a/binaries/AP_FW_Pack.bin and b/binaries/AP_FW_Pack.bin differ diff --git a/binaries/AP_FW_Segmented_UK.bin b/binaries/AP_FW_Segmented_UK.bin index 19607cb6..4e455d77 100644 Binary files a/binaries/AP_FW_Segmented_UK.bin and b/binaries/AP_FW_Segmented_UK.bin differ diff --git a/tag_types.h b/tag_types.h index 2b351ed8..caada3e5 100755 --- a/tag_types.h +++ b/tag_types.h @@ -4,6 +4,7 @@ #define SOLUM_SEG_UK 0xF0 #define SOLUM_NODISPLAY 0xFF +#define CAPABILITY_HAS_EXT_POWER 0x10 #define CAPABILITY_HAS_WAKE_BUTTON 0x20 #define CAPABILITY_HAS_NFC 0x40 #define CAPABILITY_NFC_WAKE 0x80 @@ -17,3 +18,4 @@ #define DATATYPE_IMG_RAW_1BPP_DIRECT 0x3F // only for 1.54", don't write to EEPROM, but straightaway to the EPD #define DATATYPE_NFC_RAW_CONTENT 0xA0 // raw memory content for the NT3H1101 #define DATATYPE_NFC_URL_DIRECT 0xA1 // URL format for NT3H1101 +#define DATATYPE_UK_SEGMENTED 0x51 // Segmented data for the UK Segmented display type diff --git a/zbs243_AP_FW/APDisplay.c b/zbs243_AP_FW/APDisplay.c index 26caf57b..0f5cf282 100755 --- a/zbs243_AP_FW/APDisplay.c +++ b/zbs243_AP_FW/APDisplay.c @@ -25,10 +25,15 @@ extern uint8_t __xdata curPendingData; extern uint8_t __xdata curNoUpdate; #if (SCREEN_WIDTH == 1) +// Segmented display type + +bool __xdata showAPDisplay = true; +bool __xdata SisInverted = true; + void epdInitialize() { epdEnable(); pr("Setting up EPD\n"); - if (!epdSetup(false)) pr("EPD setup failed\n"); + if (!epdSetup(true)) pr("EPD setup failed\n"); epdSetPos(0); epdpr("boot"); setEPDIcon(EPD_ICON_DIAMOND, true); @@ -39,6 +44,7 @@ void epdInitialize() { } void epdShowRun() { + if(!showAPDisplay) return; epdClear(); epdSetPos(0); epdpr("run"); @@ -58,11 +64,13 @@ void epdShowRun() { if (updateCount == 10) { while (is_drawing()) { }; - epdSetup(true); + epdSetup(false); + SisInverted = false; } else if (updateCount == 20) { while (is_drawing()) { }; - epdSetup(false); + epdSetup(true); + SisInverted = true; updateCount = 0; } } diff --git a/zbs243_AP_FW/emulateTag.c b/zbs243_AP_FW/emulateTag.c index 02d9e88b..79eb7307 100755 --- a/zbs243_AP_FW/emulateTag.c +++ b/zbs243_AP_FW/emulateTag.c @@ -36,6 +36,13 @@ static uint8_t blockCount = 0; static uint32_t __xdata lastRequest = 0; static bool dataRequested = false; +#if (SCREEN_WIDTH == 1) +extern bool __xdata showAPDisplay; +extern bool __xdata SisInverted; +extern uint8_t __xdata epdSegmentData[12]; +#endif + +#if (HAS_EEPROM == 1) static bool validateBlockData() { struct blockData *bd = (struct blockData *)blockbuffer; // pr("expected len = %04X, checksum=%04X\n", bd->size, bd->checksum); @@ -60,6 +67,7 @@ void epdWriteByte(uint8_t b) { } void fakeTagGetData() { + // non-segmented if ((timerGet() - lastRequest) > (1200UL * 1333)) { if (dataRequested == false) { if (ad.dataSize) { @@ -100,14 +108,49 @@ void fakeTagGetData() { } } } +#endif void fakePendingData(struct pendingData *pd) { +#if (SCREEN_WIDTH == 1) + // segmented data, this contains all the info. No block transfers + if (pd->availdatainfo.dataType == DATATYPE_UK_SEGMENTED) { + if (pd->availdatainfo.dataVer == 0 && pd->availdatainfo.dataSize == 0) { + showAPDisplay = true; + } else { + showAPDisplay = false; + // check if we should re-init the EPD for the correct image (inverted or not) + //if (SisInverted != (pd->availdatainfo.dataTypeArgument & 0x01)) { + if (pd->availdatainfo.dataTypeArgument & 0x01) { + SisInverted = true; + } else { + SisInverted = false; + } + epdSetup(SisInverted); + //} + epdSetPos(0); + + char *epdp = (char *)&(pd->availdatainfo.dataVer); + + for (uint8_t c = 0; c < 10; c++) { + writeCharEPD(epdp[c]); + } + setEPDIcon(0xFFFF, false); + // memcpy(epdSegmentData, &(pd->availdatainfo.dataVer), 12); + setEPDIcon(*((uint16_t *)(epdp + 10)), true); + epdUpdate(); + } + espNotifyXferComplete(fakeTagMac); + } + +#else + // non-segmented tags, we'll have to do a block transfer here if ((pd->availdatainfo.dataType == DATATYPE_IMG_RAW_1BPP) || (pd->availdatainfo.dataType == DATATYPE_IMG_RAW_2BPP) || (pd->availdatainfo.dataType == DATATYPE_IMG_RAW_1BPP_DIRECT)) { memcpy(&ad, &(pd->availdatainfo), sizeof(struct AvailDataInfo)); blockCount = 0; fakeTagTrafficPending = true; dataRequested = false; } +#endif } void fakeTagCheckIn() { @@ -119,6 +162,7 @@ void fakeTagCheckIn() { adr->hwType = HW_TYPE; adr->lastPacketLQI = 100; adr->lastPacketRSSI = 100; + adr->capabilities |= CAPABILITY_HAS_EXT_POWER; if (firstboot) { adr->wakeupReason = 0xFC; firstboot = false; diff --git a/zbs243_AP_FW/main.c b/zbs243_AP_FW/main.c index d5395f8e..692f264c 100755 --- a/zbs243_AP_FW/main.c +++ b/zbs243_AP_FW/main.c @@ -30,7 +30,7 @@ struct pendingData __xdata pendingDataArr[MAX_PENDING_MACS]; // VERSION GOES HERE! -uint16_t __xdata version = 0x0013; +uint16_t __xdata version = 0x0014; #define RAW_PKT_PADDING 2 @@ -272,8 +272,8 @@ void processSerial(uint8_t lastchar) { struct pendingData *pd = (struct pendingData *)serialbuffer; #if (AP_EMULATE_TAG == 1) if (memcmp(pd->targetMac, fakeTagMac, 8) == 0) { - fakePendingData(pd); pr("ACK>\n"); + fakePendingData(pd); } else { #endif int8_t slot = findSlotForMac(pd->targetMac); @@ -301,7 +301,7 @@ void processSerial(uint8_t lastchar) { if (bytesRemain == 0) { if (checkCRC(serialbuffer, sizeof(struct pendingData))) { struct pendingData *pd = (struct pendingData *)serialbuffer; -#if (AP_EMULATE_TAG == 1) +#if (AP_EMULATE_TAG == 1 && HAS_EEPROM == 1) if (memcmp(pd->targetMac, fakeTagMac, 8) == 0) { fakeTagTrafficPending = false; pr("ACK>\n"); @@ -310,7 +310,7 @@ void processSerial(uint8_t lastchar) { // deleteAllPendingDataForVer((uint8_t *)&pd->availdatainfo.dataVer); deleteAllPendingDataForMac((uint8_t *)&pd->targetMac); pr("ACK>\n"); -#if (AP_EMULATE_TAG == 1) +#if (AP_EMULATE_TAG == 1 && HAS_EEPROM == 1) } #endif } else { @@ -416,6 +416,9 @@ void espNotifyAPInfo() { countSlots(); pr("PEN>%02X\n", curPendingData); pr("NOP>%02X\n", curNoUpdate); +#if (AP_EMULATE_TAG == 1) + fakeTagCheckIn(); +#endif } // process data from tag @@ -660,7 +663,7 @@ void sendPong(void *__xdata buf) { radioTx(radiotxbuffer); } -#if (AP_EMULATE_TAG == 1) +#if (AP_EMULATE_TAG == 1 && HAS_EEPROM == 1) void attemptFakeTagUpdate() { if (memcmp(fakeTagMac, lastBlockMac, 8) == 0) { lastBlockRequest = timerGet(); @@ -726,9 +729,6 @@ void main(void) { pr("RES>\n"); pr("RDY>\n"); -#if (AP_EMULATE_TAG == 1) - fakeTagCheckIn(); -#endif housekeepingTimer = timerGet(); @@ -781,8 +781,7 @@ void main(void) { loopCount--; if (loopCount == 0) { #if (HAS_SCREEN == 1) - -#if (AP_EMULATE_TAG == 1) +#if (AP_EMULATE_TAG == 1 && HAS_EEPROM == 1) if (fakeTagTrafficPending) attemptFakeTagUpdate(); #else countSlots(); diff --git a/zbs243_shared/board/zbs_segmented_uk/board.h b/zbs243_shared/board/zbs_segmented_uk/board.h index 4e7ea09b..7deb17ee 100755 --- a/zbs243_shared/board/zbs_segmented_uk/board.h +++ b/zbs243_shared/board/zbs_segmented_uk/board.h @@ -7,7 +7,7 @@ #define HAS_EEPROM 0 #define HAS_SCREEN 1 -#define AP_EMULATE_TAG 0 +#define AP_EMULATE_TAG 1 #define HW_TYPE SOLUM_SEG_UK