Fixed stuff.Haven't checked power consumption!

This commit is contained in:
Jelmer
2023-01-29 01:20:06 +01:00
parent 8929afbff2
commit 0b561d2473
5 changed files with 78 additions and 20 deletions

View File

@@ -151,8 +151,6 @@ void selfUpdate(void)
uint8_t i, len = updaterInfo >> 16;
uint8_t __xdata *dst = tempBuffer;
pr("updater len = %d\n", len);
for (i = len; i ; i--)
*dst++ = *src++;

View File

@@ -71,6 +71,7 @@ static bool __xdata directionY = true; // print direction, X or Y (true)
static uint8_t __xdata rbuffer[32]; // used to rotate bits around
static uint16_t __xdata fontCurXpos = 0; // current X value where working with
static bool __xdata isInited = false;
struct waveform __xdata waveform;
#pragma callee_saves epdBusySleep
#pragma callee_saves epdBusyWait
@@ -511,8 +512,6 @@ void epdPrintEnd() {
epdPr = false;
}
extern uint8_t* __xdata tempBuffer;
extern void dump(uint8_t* __xdata a, uint16_t __xdata l);
void loadFixedTempLUT() {
shortCommand1(0x18, 0x48);
@@ -521,24 +520,20 @@ void loadFixedTempLUT() {
shortCommand(CMD_ACTIVATION);
epdBusyWait(1333000UL);
}
static uint8_t readLut() {
uint8_t sta = 0;
static void readLut() {
commandReadBegin(0x33);
uint16_t checksum = 0;
uint16_t ident = 0;
uint16_t shortl = 0;
for (uint16_t c = 0; c < 76; c++) {
sta = epdReadByte();
checksum += sta;
if (c < 70) ident += sta;
if (c < 14) shortl += sta;
tempBuffer[c] = sta;
((uint8_t*)&waveform)[c] = epdReadByte();
}
pr("ident=%04X checksum=%04X shortl=%04X\n", ident, checksum, shortl);
commandReadEnd();
dump(tempBuffer, 96);
}
return sta;
extern void dump(uint8_t* __xdata a, uint16_t __xdata l); // remove me when done
void lutTest() {
readLut();
dump((uint8_t*)&waveform, 96);
}

View File

@@ -54,4 +54,6 @@ void epdPrintEnd();
void beginFullscreenImage();
void beginWriteFramebuffer(bool color);
void lutTest();
#endif

View File

@@ -1,3 +1,30 @@
#define __packed
struct vgroup {
uint8_t A : 2;
uint8_t B : 2;
uint8_t C : 2;
uint8_t D : 2;
} __packed;
struct lut {
struct vgroup group[7];
} __packed;
struct group {
uint8_t phaselength[4];
uint8_t repeat;
} __packed;
struct waveform {
struct lut elut[5];
struct group egroup[7];
uint8_t gatelevel;
uint8_t sourcelevel[3];
uint8_t dummyline;
uint8_t gatewidth;
} __packed;
static const uint8_t __code lut154[] = {
// lut0 (KEEP) voltages
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -108,6 +135,7 @@ static const uint8_t __code lutSHA[] = {
0x0F, 0x0F, 0x0, 0x0, 0x0,
};
static const uint8_t __code lutorig[] = {
0x00, 0x66, 0x21, 0x45, 0x40, 0x00, 0x00,
0x15, 0x66, 0x21, 0xA8, 0x20, 0xA0, 0x00,

View File

@@ -15,12 +15,15 @@
#include "spi.h"
#include "timer.h"
extern uint8_t mSelfMac[];
void showSplashScreen() {
epdSetup();
#if (SCREEN_WIDTH == 152)
lutTest();
#if (SCREEN_WIDTH == 152) // 1.54"
selectLUT(1);
clearScreen();
setColorMode(EPD_MODE_IGNORE, EPD_MODE_INVERT);
setColorMode(EPD_MODE_NORMAL, EPD_MODE_INVERT);
drawLineHorizontal(EPD_COLOR_BLACK, 33, 1);
epdPrintBegin(0, 0, EPD_DIRECTION_X, EPD_SIZE_DOUBLE, EPD_COLOR_BLACK);
pr("Booting!");
@@ -28,10 +31,42 @@ void showSplashScreen() {
draw();
timerDelay(1333000);
#endif
#if (SCREEN_WIDTH == 128) // 2.9"
selectLUT(1);
clearScreen();
setColorMode(EPD_MODE_NORMAL, EPD_MODE_INVERT);
epdPrintBegin(128, 0, EPD_DIRECTION_Y, EPD_SIZE_DOUBLE, EPD_COLOR_BLACK);
pr("Booting!");
epdPrintEnd();
epdPrintBegin(16, 10, EPD_DIRECTION_Y, EPD_SIZE_SINGLE, EPD_COLOR_RED);
pr("MAC: %02X:%02X", mSelfMac[7], mSelfMac[6]);
pr(":%02X:%02X", mSelfMac[5], mSelfMac[4]);
pr(":%02X:%02X", mSelfMac[3], mSelfMac[2]);
pr(":%02X:%02X", mSelfMac[1], mSelfMac[0]);
epdPrintEnd();
draw();
timerDelay(1333000);
#endif
#if (SCREEN_WIDTH == 400) // 2.9"
selectLUT(1);
clearScreen();
setColorMode(EPD_MODE_NORMAL, EPD_MODE_INVERT);
epdPrintBegin(0, 0, EPD_DIRECTION_X, EPD_SIZE_DOUBLE, EPD_COLOR_BLACK);
pr("Booting!");
epdPrintEnd();
epdPrintBegin(16, 284, EPD_DIRECTION_X, EPD_SIZE_SINGLE, EPD_COLOR_RED);
pr("MAC: %02X:%02X", mSelfMac[7], mSelfMac[6]);
pr(":%02X:%02X", mSelfMac[5], mSelfMac[4]);
pr(":%02X:%02X", mSelfMac[3], mSelfMac[2]);
pr(":%02X:%02X", mSelfMac[1], mSelfMac[0]);
epdPrintEnd();
draw();
timerDelay(1333000);
#endif
}
void showApplyUpdate(){
void showApplyUpdate() {
epdSetup();
selectLUT(1);
clearScreen();