From 16588cb9a9074ffd878a64366151a13a87dfdf9e Mon Sep 17 00:00:00 2001 From: Drath Date: Sat, 13 Sep 2025 14:18:15 +0200 Subject: [PATCH] slightly cleaner? --- src/LCDDisplay.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/LCDDisplay.cpp b/src/LCDDisplay.cpp index f91b755..79279cb 100644 --- a/src/LCDDisplay.cpp +++ b/src/LCDDisplay.cpp @@ -90,17 +90,16 @@ void LCDDisplay::clearBuf() { /* hyper optimized buffer flush command, writes whole disp with a single write */ void LCDDisplay::flushBuf() { - char writebuf[168]; // 4x40 chars + 2x4 setcursor commands - uint8_t setDisp[] = {254, 71, 1}; // skeleton set cursor command + uint8_t writebuf[168]; // 4x40 chars + 2x4 setcursor commands + uint8_t setDisp[] = {254, 71, 1, 1}; // setr cursor to char 1, line 1 - std::memcpy(&writebuf[0], setDisp, 3); // copy template set cursor command - writebuf[3] = 1; // actual set cursor param, set to 1st row - std::memcpy(&writebuf[4], linebuf[0], 40); // copy 1st line - std::memcpy(&writebuf[44], linebuf[1], 40); // copy 2nd line - std::memcpy(&writebuf[84], setDisp, 3); // copy template set cursor command - writebuf[87] = 3; // set cursor to 3rd line - std::memcpy(&writebuf[88], linebuf[2], 40); // copy 3rd line - std::memcpy(&writebuf[128], linebuf[3], 40); // copy 4th line + std::memcpy(&writebuf[0], setDisp, 4); // copy set cursor command + std::memcpy(&writebuf[4], linebuf[0], 40); // copy 1st line + std::memcpy(&writebuf[44], linebuf[1], 40); // copy 2nd line + std::memcpy(&writebuf[84], setDisp, 3); // copy set cursor command but skip the line byte + writebuf[87] = 3; // set cursor to 3rd line + std::memcpy(&writebuf[88], linebuf[2], 40); // copy 3rd line + std::memcpy(&writebuf[128], linebuf[3], 40); // copy 4th line write(_lcd, writebuf, 168); }