Skip to content

Commit

Permalink
TFTSurenoo: initialize improvement
Browse files Browse the repository at this point in the history
Sometimes the timing of transmitted data through Nextion UART port on
MMDVM board is not accurate. For example, 250ms delay of lcdReset() is
ignored.

(via MMDVM LCD-UART port)
[2021/10/29 23:04:57.481] RESET;
[2021/10/29 23:04:57.482] CLR(0);
[2021/10/29 23:04:58.100]
[2021/10/29 23:04:58.101] DIR(1);BL(50);SBC(0);
[2021/10/29 23:04:58.142] BOXF(0,0,159,127,0);DCV24(0,0,'MMDVM',4);DCV16(0,32,'JG1UAA / 440xxxx',5);DCV16(0,48,'IDLE',5);

(via native serial port)
[2021/10/30 08:11:21.587] RESET;
[2021/10/30 08:11:21.827] CLR(0);
[2021/10/30 08:11:37.478]
[2021/10/30 08:11:37.480] DIR(1);BL(50);SBC(0);
[2021/10/30 08:11:37.498] BOXF(0,0,159,127,0);DCV24(0,0,'MMDVM',4);DCV16(0,32,'JG1UAA / 440xxxx',5);DCV16(0,48,'IDLE',5);

Ignoring screen direction(DIR), background color(SBC) breaks screen layout.
To solve this, send some LCD configuration command at refreshDisplay().
This is not smart solution, but inevitable.
  • Loading branch information
jg1uaa committed Oct 29, 2021
1 parent 204b414 commit 483a886
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions TFTSurenoo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ bool CTFTSurenoo::open()

lcdReset();
clearScreen(BG_COLOUR);

setRotation(ROTATION_LANDSCAPE);
setBrightness(m_brightness);
setBackground(BG_COLOUR);
setIdle();

m_refreshTimer.start();
Expand Down Expand Up @@ -456,6 +452,13 @@ void CTFTSurenoo::refreshDisplay(void)
::snprintf(m_temp, sizeof(m_temp), STR_CRLF);
m_serial->write((unsigned char*)m_temp, (unsigned int)::strlen(m_temp));

// config display
setRotation(ROTATION_LANDSCAPE);
setBrightness(m_brightness);
setBackground(BG_COLOUR);
m_serial->write((unsigned char*)m_temp, (unsigned int)::strlen(m_temp));
CThread::sleep(5);

// clear display
::snprintf(m_temp, sizeof(m_temp), "BOXF(%d,%d,%d,%d,%d);",
0, 0, X_WIDTH - 1, Y_WIDTH - 1, BG_COLOUR);
Expand Down

0 comments on commit 483a886

Please sign in to comment.