cleanup lcddisplay a lil

This commit is contained in:
Drath
2025-10-29 18:29:13 +01:00
parent 871edb642e
commit 25cee5f669
3 changed files with 44 additions and 36 deletions

View File

@@ -92,17 +92,24 @@ void sensorsThread(std::stop_token st, Sensors* s) {
void displayThread(std::stop_token st, Sensors* s) {
log(LOG::INF, "Thread", "Starting display_thread, pid {}", gettid());
// init internal variables of LCDDisplay class
LCDDisplay lcd(LCD_PORT);
// basic lcd setup
lcd.open();
lcd.setContrast(LCD_CONTRAST);
lcd.setBacklight(true);
lcd.writeStr(2, 0, center("Waiting for sensors...", 40));
lcd.setCustomChar(0, {16, 6, 9, 8, 8, 9, 6, 0}); // celcius
lcd.setCustomChar(1, {0, 0, 4, 10, 10, 17, 31, 0}); // delta
lcd.setCustomChar(2, {0, 8, 21, 21, 2, 0, 0, 0}); // home (tilde)
lcd._close();
lcd.close();
// welcome msg
lcd.writeBuf(2, 0, center("Waiting for sensors...", 40));
lcd.flushBuf();
lcd.clearBuf();
// actual main display loop
while (!st.stop_requested()) {
sem::display.acquire(); // holds the loop until sensor data is ready
{
@@ -147,10 +154,9 @@ void displayThread(std::stop_token st, Sensors* s) {
lcd.clearBuf();
}
lcd._open();
lcd.clear();
lcd.writeStr(2, 0, center("linuxSmartie closed", 40));
lcd._close();
// goodbye msg
lcd.writeBuf(2, 0, center("linuxSmartie closed", 40));
lcd.flushBuf();
}
int main(int argc, char* argv[]) {