34 lines
629 B
C++
34 lines
629 B
C++
#include "DisplayManager.h"
|
|
|
|
DisplayManager::DisplayManager()
|
|
: lcd(0x27, 16, 2), lastUpdate(0) {}
|
|
|
|
void DisplayManager::begin() {
|
|
lcd.init();
|
|
lcd.backlight();
|
|
lcd.setCursor(0, 0);
|
|
lcd.print("Drybox v0.1");
|
|
}
|
|
|
|
bool DisplayManager::ready(unsigned long now) {
|
|
if (now - lastUpdate < interval) return false;
|
|
lastUpdate = now;
|
|
return true;
|
|
}
|
|
|
|
void DisplayManager::showText(String line1, String line2) {
|
|
if (line1 == lastLine1 && line2 == lastLine2) {
|
|
return;
|
|
}
|
|
|
|
lastLine1 = line1;
|
|
lastLine2 = line2;
|
|
|
|
lcd.clear();
|
|
|
|
lcd.setCursor(0, 0);
|
|
lcd.print(line1);
|
|
|
|
lcd.setCursor(0, 1);
|
|
lcd.print(line2);
|
|
} |