diff --git a/binaries/Tag_FW_1.54.bin b/binaries/Tag_FW_1.54.bin index 0c094b14..d36400ce 100644 Binary files a/binaries/Tag_FW_1.54.bin and b/binaries/Tag_FW_1.54.bin differ diff --git a/binaries/Tag_FW_2.9-uc8151.bin b/binaries/Tag_FW_2.9-uc8151.bin index 1055798c..3768cf80 100644 Binary files a/binaries/Tag_FW_2.9-uc8151.bin and b/binaries/Tag_FW_2.9-uc8151.bin differ diff --git a/binaries/Tag_FW_2.9.bin b/binaries/Tag_FW_2.9.bin index 63832de5..7df3a4f2 100644 Binary files a/binaries/Tag_FW_2.9.bin and b/binaries/Tag_FW_2.9.bin differ diff --git a/binaries/Tag_FW_4.2.bin b/binaries/Tag_FW_4.2.bin index 62d14c50..592deb62 100644 Binary files a/binaries/Tag_FW_4.2.bin and b/binaries/Tag_FW_4.2.bin differ diff --git a/binaries/Tag_FW_Pack.bin b/binaries/Tag_FW_Pack.bin index a497b0ae..d8da01fd 100644 Binary files a/binaries/Tag_FW_Pack.bin and b/binaries/Tag_FW_Pack.bin differ diff --git a/tag_types.h b/tag_types.h index 73d0fb61..ec7fc74b 100755 --- a/tag_types.h +++ b/tag_types.h @@ -6,6 +6,8 @@ #define SOLUM_SEG_EU 0xF1 #define SOLUM_NODISPLAY 0xFF +#define CAPABILITY_SUPPORTS_CUSTOM_LUTS 0x04 +#define CAPABILITY_ALT_LUT_SIZE 0x08 #define CAPABILITY_HAS_EXT_POWER 0x10 #define CAPABILITY_HAS_WAKE_BUTTON 0x20 #define CAPABILITY_HAS_NFC 0x40 @@ -18,6 +20,7 @@ #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 +#define DATATYPE_UK_SEGMENTED 0x51 // Segmented data for the UK Segmented display type #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 +#define DATATYPE_CUSTOM_LUT_OTA 0xB0 // Custom OTA updated LUT diff --git a/zbs243_Tag_FW/Makefile b/zbs243_Tag_FW/Makefile index 38eddeaf..5fe685aa 100644 --- a/zbs243_Tag_FW/Makefile +++ b/zbs243_Tag_FW/Makefile @@ -48,6 +48,13 @@ main.elf: $(OBJS) objcopy $^ $@ -I ihex -O binary .PHONY: clean + +SOURCES += board/zbs29_ssd1619/screen.c +SOURCES += board/zbs42_ssd1619/screen.c +SOURCES += board/zbs154_ssd1619/screen.c +SOURCES += board/zbs29_uc8151/screen.c + + clean: rm -f $(patsubst %.c,%.asm,$(SOURCES)) rm -f $(patsubst %.c,%.lst,$(SOURCES)) diff --git a/zbs243_Tag_FW/builder.php b/zbs243_Tag_FW/builder.php index d93607f6..3c2ad93c 100644 --- a/zbs243_Tag_FW/builder.php +++ b/zbs243_Tag_FW/builder.php @@ -23,7 +23,7 @@ $stackdisturbed = false; $mem = checkmem(); while(1){ $errlist = array(); - exec("make BUILD=zbs29v033 CPU=8051 SOC=zbs243 2>&1 | grep error | grep -v make", $errlist); + exec("make BUILD=zbs29_ssd1619 CPU=8051 SOC=zbs243 2>&1 | grep error | grep -v make", $errlist); if(checkmem()!=$mem){ $stackdisturbed = true; echo "Stack size was $mem, is now ".checkmem()." !!!\n"; diff --git a/zbs243_Tag_FW/main.c b/zbs243_Tag_FW/main.c index ce7b32b7..2ebdcc9f 100755 --- a/zbs243_Tag_FW/main.c +++ b/zbs243_Tag_FW/main.c @@ -227,6 +227,14 @@ void main() { powerUp(INIT_EPD); showSplashScreen(); +// we've now displayed something on the screen; for the SSD1619, we are now aware of the lut-size +#ifdef EPD_SSD1619 + capabilities |= CAPABILITY_SUPPORTS_CUSTOM_LUTS; + if (dispLutSize != 7) { + capabilities |= CAPABILITY_ALT_LUT_SIZE; + } +#endif + powerUp(INIT_EPD); wdt30s(); currentChannel = showChannelSelect(); diff --git a/zbs243_Tag_FW/settings.h b/zbs243_Tag_FW/settings.h index 33e0def5..38b69be8 100755 --- a/zbs243_Tag_FW/settings.h +++ b/zbs243_Tag_FW/settings.h @@ -4,7 +4,7 @@ #include #define FW_VERSION 017 // version number (max 2.5.5 :) ) -#define FW_VERSION_SUFFIX "-WF" // suffix, like -RC1 or whatever. +#define FW_VERSION_SUFFIX "-CLUT" // suffix, like -RC1 or whatever. // #define DEBUGBLOCKS // uncomment to enable extra debug information on the block transfers // #define PRINT_LUT // uncomment if you want the tag to print the LUT for the current temperature bracket #endif \ No newline at end of file diff --git a/zbs243_Tag_FW/syncedproto.c b/zbs243_Tag_FW/syncedproto.c index 5b0beaf5..d504d98f 100755 --- a/zbs243_Tag_FW/syncedproto.c +++ b/zbs243_Tag_FW/syncedproto.c @@ -844,6 +844,39 @@ bool processAvailDataInfo(struct AvailDataInfo *__xdata avail) { } return false; break; + case DATATYPE_CUSTOM_LUT_OTA: + // Handle data for the NFC IC (if we have it) + + // check if we actually have the capability to do OTA Luts + if (!(capabilities & CAPABILITY_SUPPORTS_CUSTOM_LUTS)) { + // looks like we don't. mark as complete and then bail! + powerUp(INIT_RADIO); + sendXferComplete(); + powerDown(INIT_RADIO); + return true; + } +#ifdef EPD_SSD1619 + pr("OTA LUT received\n"); + if (curDataInfo.dataSize == 0 && xMemEqual((const void *__xdata) & avail->dataVer, (const void *__xdata) & curDataInfo.dataVer, 8)) { + pr("this was the same as the last transfer, disregard\n"); + powerUp(INIT_RADIO); + sendXferComplete(); + powerDown(INIT_RADIO); + return true; + } + xMemCopyShort(&curDataInfo, (void *)avail, sizeof(struct AvailDataInfo)); + + if (getDataBlock(avail->dataSize)) { + powerUp(INIT_RADIO); + sendXferComplete(); + powerDown(INIT_RADIO); + curDataInfo.dataSize = 0; // mark as transfer not pending + memcpy(customLUT, sizeof(struct blockData) + blockXferBuffer, dispLutSize * 10); + return true; + } +#endif + return false; + break; } return true; } diff --git a/zbs243_Tag_FW/userinterface.c b/zbs243_Tag_FW/userinterface.c index 1ef87c8c..a777ad8c 100755 --- a/zbs243_Tag_FW/userinterface.c +++ b/zbs243_Tag_FW/userinterface.c @@ -217,7 +217,7 @@ void showApplyUpdate() { epdPrintBegin(12, 60, EPD_DIRECTION_X, EPD_SIZE_DOUBLE, EPD_COLOR_BLACK); #endif #if (SCREEN_WIDTH == 128) - epdPrintBegin(48, 86, EPD_DIRECTION_Y, EPD_SIZE_DOUBLE, EPD_COLOR_BLACK); + epdPrintBegin(48, 220, EPD_DIRECTION_Y, EPD_SIZE_DOUBLE, EPD_COLOR_BLACK); #endif #if (SCREEN_WIDTH == 400) diff --git a/zbs243_shared/board/ssd1619.c b/zbs243_shared/board/ssd1619.c index 11081088..0dcd58b6 100755 --- a/zbs243_shared/board/ssd1619.c +++ b/zbs243_shared/board/ssd1619.c @@ -1,3 +1,5 @@ +#include "ssd1619.h" + #include #include @@ -5,12 +7,11 @@ #include "barcode.h" #include "board.h" #include "cpu.h" -#include "ssd1619.h" #include "font.h" #include "lut.h" #include "printf.h" #include "screen.h" -//#include "settings.h" +// #include "settings.h" #include "sleep.h" #include "spi.h" #include "timer.h" @@ -74,14 +75,16 @@ static uint8_t __xdata rbuffer[32]; // used to rotate bits around static uint16_t __xdata fontCurXpos = 0; // current X value we're working with static uint16_t __xdata fontCurYpos = 0; // current Y value we're working with static uint8_t __xdata currentLut = 0; -static uint8_t __xdata dispLutSize = 0; +uint8_t __xdata dispLutSize = 0; // we'll need to expose this in the 'capabilities' flag static bool __xdata isInited = false; bool __xdata epdGPIOActive = false; #define LUT_BUFFER_SIZE 128 -uint8_t waveformbuffer[LUT_BUFFER_SIZE]; +static uint8_t waveformbuffer[LUT_BUFFER_SIZE]; +uint8_t __xdata customLUT[LUT_BUFFER_SIZE] = {0}; + struct waveform10* __xdata waveform10 = (struct waveform10*)waveformbuffer; // holds the LUT/waveform struct waveform* __xdata waveform7 = (struct waveform*)waveformbuffer; // holds the LUT/waveform @@ -249,7 +252,7 @@ void epdSetup() { commandEnd(); // shortCommand1(CMD_DATA_ENTRY_MODE, 0x03); - //shortCommand1(CMD_BORDER_WAVEFORM_CTRL, 0xC0); // blurry edges + // shortCommand1(CMD_BORDER_WAVEFORM_CTRL, 0xC0); // blurry edges shortCommand1(CMD_BORDER_WAVEFORM_CTRL, 0x01); shortCommand1(CMD_TEMP_SENSOR_CONTROL, 0x80); shortCommand1(CMD_DISP_UPDATE_CTRL2, 0xB1); // mode 1 (i2C) @@ -375,6 +378,14 @@ void selectLUT(uint8_t lut) { return; } + // Handling if we received an OTA LUT + if (lut == EPD_LUT_OTA) { + memcpy(waveformbuffer, customLUT, dispLutSize * 10); + writeLut(); + currentLut = lut; + return; + } + if (currentLut != EPD_LUT_DEFAULT) { // load the 'default' LUT for the current temperature in the EPD lut register shortCommand1(CMD_DISP_UPDATE_CTRL2, 0xB1); // mode 1? @@ -399,9 +410,11 @@ void selectLUT(uint8_t lut) { #ifdef PRINT_LUT dump(waveformbuffer, LUT_BUFFER_SIZE); #endif + memcpy(customLUT, waveformbuffer, dispLutSize * 10); } switch (lut) { + default: case EPD_LUT_NO_REPEATS: lutGroupDisable(LUTGROUP_NEGATIVE); lutGroupDisable(LUTGROUP_FASTBLINK); diff --git a/zbs243_shared/board/ssd1619.h b/zbs243_shared/board/ssd1619.h old mode 100644 new mode 100755 index a94bb934..c0b8bc5c --- a/zbs243_shared/board/ssd1619.h +++ b/zbs243_shared/board/ssd1619.h @@ -4,6 +4,8 @@ #include #include +#define EPD_SSD1619 + #define epdSend spiTXByte #define EPD_DIRECTION_X false #define EPD_DIRECTION_Y true @@ -21,6 +23,7 @@ #define EPD_LUT_NO_REPEATS 1 #define EPD_LUT_FAST_NO_REDS 2 #define EPD_LUT_FAST 3 +#define EPD_LUT_OTA 0x10 #define epdSelect() \ do { \ @@ -38,6 +41,8 @@ uint16_t epdGetBattery(); void epdConfigGPIO(bool setup); extern bool __xdata epdGPIOActive; +extern uint8_t __xdata dispLutSize; +extern uint8_t __xdata customLUT[]; void setWindowX(uint16_t start, uint16_t end); void setWindowY(uint16_t start, uint16_t end); diff --git a/zbs243_shared/board/uc8151.c b/zbs243_shared/board/uc8151.c old mode 100644 new mode 100755 index 9fe32796..724aa224 --- a/zbs243_shared/board/uc8151.c +++ b/zbs243_shared/board/uc8151.c @@ -457,6 +457,7 @@ static void lutGroupRepeatReduce(uint8_t group, uint8_t factor) { void selectLUT(uint8_t lut) { // implement alternative LUTs here. Currently just reset the watchdog to two minutes, // to ensure it doesn't reset during the much longer bootup procedure + lut+=1; // make the compiler a happy camper wdtSetResetVal(0xFF8E797F); // 120 s wdtOn(); return; @@ -476,6 +477,9 @@ void setWindowXY(uint16_t xstart, uint16_t xend, uint16_t ystart, uint16_t yend) } void setColorMode(uint8_t red, uint8_t bw) { + // this does exactly nothing, just keeps the compiler from barking + red=1; + bw=0; return; } void clearScreen() { diff --git a/zbs243_shared/soc/zbs243/flash.c b/zbs243_shared/soc/zbs243/flash.c old mode 100644 new mode 100755 index e8c566e2..6bb01ea4 --- a/zbs243_shared/soc/zbs243/flash.c +++ b/zbs243_shared/soc/zbs243/flash.c @@ -25,8 +25,6 @@ static uint8_t flashAddrCheck(uint32_t flashAddr, uint16_t len) __reentrant /* t break; case 0x80: - if (pgNo)//hmm - return 0xff; pgNo = 0x80; break;