Complete rewrite of Application
This commit is contained in:
34
DisplayManager.cpp
Normal file
34
DisplayManager.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#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);
|
||||
}
|
||||
Reference in New Issue
Block a user