Clean up LCD conditionals, DWIN

This commit is contained in:
Scott Lahteine
2020-09-06 21:40:58 -05:00
parent b709baba7a
commit a445746a8b
35 changed files with 253 additions and 169 deletions

View File

@@ -37,6 +37,9 @@
#include "dwin_lcd.h"
#include <string.h> // for memset
//#define DEBUG_OUT 1
#include "../../core/debug_out.h"
// Make sure DWIN_SendBuf is large enough to hold the largest string plus draw command and tail.
// Assume the narrowest (6 pixel) font and 2-byte gb2312-encoded characters.
uint8_t DWIN_SendBuf[11 + DWIN_WIDTH / 6 * 2] = { 0xAA };
@@ -79,10 +82,8 @@ inline void DWIN_String(size_t &i, const __FlashStringHelper * string) {
// Send the data in the buffer and the packet end
inline void DWIN_Send(size_t &i) {
++i;
LOOP_L_N(n, i) { MYSERIAL1.write(DWIN_SendBuf[n]);
delayMicroseconds(1); }
LOOP_L_N(n, 4) { MYSERIAL1.write(DWIN_BufTail[n]);
delayMicroseconds(1); }
LOOP_L_N(n, i) { MYSERIAL1.write(DWIN_SendBuf[n]); delayMicroseconds(1); }
LOOP_L_N(n, 4) { MYSERIAL1.write(DWIN_BufTail[n]); delayMicroseconds(1); }
}
/*-------------------------------------- System variable function --------------------------------------*/
@@ -185,7 +186,6 @@ void DWIN_Draw_Rectangle(uint8_t mode, uint16_t color,
DWIN_Send(i);
}
//
// Move a screen area
// mode: 0, circle shift; 1, translation
// dir: 0=left, 1=right, 2=up, 3=down
@@ -230,19 +230,6 @@ void DWIN_Draw_String(bool widthAdjust, bool bShow, uint8_t size,
DWIN_Send(i);
}
void DWIN_Draw_String(bool widthAdjust, bool bShow, uint8_t size,
uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const __FlashStringHelper *string) {
size_t i = 0;
DWIN_Byte(i, 0x11);
DWIN_Byte(i, (widthAdjust * 0x80) | (bShow * 0x40) | size);
DWIN_Word(i, color);
DWIN_Word(i, bColor);
DWIN_Word(i, x);
DWIN_Word(i, y);
DWIN_String(i, string);
DWIN_Send(i);
}
// Draw a positive integer
// bShow: true=display background color; false=don't display background color
// zeroFill: true=zero fill; false=no zero fill
@@ -343,8 +330,9 @@ void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
DWIN_Send(i);
}
// Unzip the JPG picture to virtual display area #1
// id: picture ID
// Unzip the JPG picture to a virtual display area
// n: Cache index
// id: Picture ID
void DWIN_JPG_CacheToN(uint8_t n, uint8_t id) {
size_t i = 0;
DWIN_Byte(i, 0x25);