select lut as argument for drawing

This commit is contained in:
Jelmer
2023-02-11 23:35:20 +01:00
parent 9a62d70266
commit 11e5cf34e0
6 changed files with 9 additions and 5 deletions

View File

@@ -333,7 +333,7 @@ void ByteDecode(uint8_t byte) {
}
}
void drawImageAtAddress(uint32_t addr) {
void drawImageAtAddress(uint32_t addr, uint8_t lut) {
uint32_t __xdata clutAddr;
pr("sending to EPD - ");
clutAddr = drawPrvParseHeader(addr);
@@ -342,6 +342,7 @@ void drawImageAtAddress(uint32_t addr) {
drawPrvLoadAndMapClut(clutAddr);
epdSetup();
if(lut)selectLUT(lut);
mPassNo = 0;
beginFullscreenImage();
beginWriteFramebuffer(EPD_COLOR_BLACK);

View File

@@ -7,7 +7,7 @@
void set_offline(__bit state);
#pragma callee_saves drawImageAtAddress
void drawImageAtAddress(uint32_t addr);
void drawImageAtAddress(uint32_t addr, uint8_t lut);
#endif

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -38,6 +38,7 @@ uint8_t __xdata curImgSlot = 0;
uint32_t __xdata curHighSlotId = 0;
uint8_t __xdata nextImgSlot = 0;
uint8_t __xdata imgSlots = 0;
uint8_t __xdata drawWithLut = 0;
// doDownload persistent variables
bool __xdata lastBlock = false;
@@ -456,7 +457,9 @@ void drawImageFromEeprom() {
// enable WDT, to make sure de tag resets if it's for some reason unable to draw the image
wdtSetResetVal(0xFFFFFFFF - 0x38C340);
wdtOn();
drawImageAtAddress(getAddressForSlot(curImgSlot));
drawImageAtAddress(getAddressForSlot(curImgSlot), drawWithLut);
drawWithLut = 0; // default back to the regular ol' stock/OTP LUT
powerDown(INIT_EPD);
}
uint32_t getHighSlotId() {
@@ -519,7 +522,7 @@ bool doDataDownload(struct AvailDataInfo *__xdata avail) {
// mark as completed and draw from EEPROM
curXferComplete = true;
xMemCopyShort(&curDataInfo, (void *)avail, sizeof(struct AvailDataInfo));
drawWithLut = avail->dataTypeArgument;
drawImageFromEeprom();
return true;
} else {
@@ -528,7 +531,7 @@ bool doDataDownload(struct AvailDataInfo *__xdata avail) {
nextImgSlot++;
if (nextImgSlot >= imgSlots) nextImgSlot = 0;
curImgSlot = nextImgSlot;
drawWithLut = avail->dataTypeArgument;
eepromErase(getAddressForSlot(curImgSlot), EEPROM_IMG_EACH / EEPROM_ERZ_SECTOR_SZ);
pr("new download, writing to slot %d\n", curImgSlot);
// continue!