Tag: Added OTA LUT capability

This commit is contained in:
jjwbruijn
2023-05-23 21:12:02 +02:00
parent 0641547d73
commit a888991ecc
16 changed files with 82 additions and 11 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -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

View File

@@ -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))

View File

@@ -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";

View File

@@ -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();

View File

@@ -4,7 +4,7 @@
#include <stdint.h>
#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

View File

@@ -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;
}

View File

@@ -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)

View File

@@ -1,3 +1,5 @@
#include "ssd1619.h"
#include <stdbool.h>
#include <string.h>
@@ -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);

5
zbs243_shared/board/ssd1619.h Normal file → Executable file
View File

@@ -4,6 +4,8 @@
#include <stdbool.h>
#include <stdint.h>
#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);

4
zbs243_shared/board/uc8151.c Normal file → Executable file
View File

@@ -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() {

2
zbs243_shared/soc/zbs243/flash.c Normal file → Executable file
View File

@@ -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;