ESP32 | Cloud Firestore - Ep 0. Showing temp/humidity from DHT11 on TTGO display [Upgraded Version]

This commit is contained in:
Eric
2021-08-08 21:54:26 -07:00
parent 2ddce7f16c
commit 9a111786e0
3 changed files with 246 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
#include "Display.h"
Display::Display() {
tft = new TFT_eSPI();
}
Display::~Display() {
delete tft;
}
void Display::initTFT() {
tft->init();
tft->fillScreen(TFT_BLACK);
tft->setRotation(1);
tft->setTextColor(TFT_WHITE, TFT_BLACK);
tft->setTextDatum(MC_DATUM);
tft->setFreeFont(&Orbitron_Light_24);
}
void Display::centerMsg(String text) {
tft->drawString(text, tft->width() / 2, 60);
}
void Display::tempUpdates(String temp, String hum, String status) {
tft->setTextPadding(tft->width());
tft->drawString(temp, tft->width() / 2, 40);
tft->drawString(hum, tft->width() / 2, 70);
tft->drawString(status, tft->width() / 2, 110);
}