Skip to content

Commit de63e93

Browse files
committed
fix: tcon local display problem.
1 parent 2e1a7e5 commit de63e93

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

Extensions/Tcon.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,9 @@ void TFT_eSPI::tconHostAreaPackedPixelWrite(TCONLdImgInfo* pstLdImgInfo,TCONArea
273273
uint16_t height = pstAreaImgInfo->usHeight;
274274
uint16_t width = pstAreaImgInfo->usWidth;
275275
if(pstLdImgInfo->usPixelFormat == IT8951_4BPP)
276-
width = width / 4;
276+
width = (width + 3) / 4;
277277
else if(pstLdImgInfo->usPixelFormat == IT8951_8BPP)
278-
width = width / 2;
278+
width = (width + 1) / 2;
279279

280280
TWord *mirroredFrameBuf = (TWord *)malloc(width * height * sizeof(TWord));
281281
if(mirroredFrameBuf == NULL) {
@@ -361,9 +361,9 @@ void TFT_eSPI::tconLoad1bppImage(const TByte* p1bppImgBuf, TWord usX, TWord usY,
361361
stLdImgInfo.ulImgBufBaseAddr = _gulImgBufAddr;
362362
stLdImgInfo.usFilp = enFilp;
363363
//Set Load Area
364-
stAreaImgInfo.usX = usX/8;
364+
stAreaImgInfo.usX = (usX + 7)/8;
365365
stAreaImgInfo.usY = usY;
366-
stAreaImgInfo.usWidth = usW/8;//1bpp, Chaning Transfer size setting to 1/8X of 8bpp mode
366+
stAreaImgInfo.usWidth = (usW + 7)/8;//1bpp, Chaning Transfer size setting to 1/8X of 8bpp mode
367367
stAreaImgInfo.usHeight = usH;
368368
//printf("IT8951HostAreaPackedPixelWrite [wait]\n\r");
369369
//Load Image from Host to IT8951 Image Buffer
@@ -431,6 +431,13 @@ void TFT_eSPI::hostTconInit()
431431
tconWriteReg(I80CPCR, 0x0001);
432432
}
433433

434+
void TFT_eSPI::hostTconInitFast()
435+
{
436+
setTconVcom(1400);
437+
_gulImgBufAddr = 0XBE78 | (0X003D << 16);
438+
tconWriteReg(I80CPCR, 0x0001);
439+
}
440+
434441
void TFT_eSPI::setTconWindowsData(TWord x1, TWord y1, TWord x2, TWord y2)
435442
{
436443
_imgAreaInfo.usX = x1;
@@ -466,7 +473,7 @@ TWord TFT_eSPI::getTconVcom()
466473
void TFT_eSPI::setTconVcom(TWord vcom)
467474
{
468475
tconWriteCmdCode(0x0039);
469-
tconWirteData(0x01);
476+
tconWirteData(0x02);
470477
tconWirteData(vcom);
471478
}
472479

Extensions/Tcon.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
void getTconInfo(void* pBuf);
8080
void setTconWindowsData(TWord x1, TWord y1, TWord x2, TWord y2);
8181
void hostTconInit();
82+
void hostTconInitFast();
8283

8384
void tconSleep();
8485
void tconWake();

TFT_Drivers/ED103TC2_Defines.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#define EPD_COLOR_DEPTH 1
1919

20+
#define USE_PARTIAL_EPAPER
2021
#define USE_MUTIGRAY_EPAPER
2122
#define GRAY_LEVEL16 16
2223

@@ -60,6 +61,12 @@
6061
#define CHECK_BUSY()
6162
#endif
6263

64+
#define EPD_UPDATE_PARTIAL() \
65+
do \
66+
{ \
67+
tconDisplayArea1bpp(_imgAreaInfo.usX,_imgAreaInfo.usY, _imgAreaInfo.usWidth, _imgAreaInfo.usHeight, 0x01, 0x00, 0xff); \
68+
} while (0);
69+
6370
#define EPD_UPDATE() \
6471
do \
6572
{ \
@@ -99,6 +106,7 @@
99106
} while (0)
100107

101108
#define EPD_WAKEUP_GRAY EPD_WAKEUP
109+
#define EPD_WAKEUP_PARTIAL EPD_WAKEUP
102110

103111
#define EPD_SET_WINDOW(x1, y1, x2, y2) \
104112
do \

TFT_Drivers/ED103TC2_Init.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
digitalWrite(ITE_ENABLE, HIGH);
1111
#endif
1212
digitalWrite(TFT_RST, LOW);
13-
delay(20);
13+
delay(10);
1414
digitalWrite(TFT_RST, HIGH);
1515
delay(10);
16+
//hostTconInitFast();
1617
hostTconInit();

0 commit comments

Comments
 (0)