refactor(Format code): Improve readability and structure

This commit is contained in:
2026-02-18 17:57:54 -08:00
parent c81e23f7cd
commit e4609c6978
11 changed files with 120 additions and 136 deletions

View File

@@ -1,4 +1,5 @@
#include "DisplayDriverTFT.h"
#include <KlubhausCore.h>
extern DisplayManager display;
@@ -35,7 +36,8 @@ void DisplayDriverTFT::setBacklight(bool on) { digitalWrite(PIN_LCD_BL, on ? HIG
// ── Rendering ───────────────────────────────────────────────
void DisplayDriverTFT::render(const ScreenState& st) {
if(st.screen != _lastScreen || (st.screen == ScreenID::BOOT && st.bootStage != _lastBootStage)) {
if(st.screen != _lastScreen
|| (st.screen == ScreenID::BOOT && st.bootStage != _lastBootStage)) {
_needsRedraw = true;
_lastScreen = st.screen;
_lastBootStage = st.bootStage;
@@ -162,7 +164,7 @@ void DisplayDriverTFT::drawDashboard(const ScreenState& st) {
_tft.setTextSize(2);
int textLen = strlen(tileLabels[i]);
int textW = textLen * 12;
_tft.setCursor(x + w/2 - textW/2, y + h/2 - 10);
_tft.setCursor(x + w / 2 - textW / 2, y + h / 2 - 10);
_tft.print(tileLabels[i]);
}
}
@@ -202,9 +204,7 @@ TouchEvent DisplayDriverTFT::readTouch() {
return evt;
}
uint16_t DisplayDriverTFT::getRawTouchZ() {
return _tft.getTouchRawZ();
}
uint16_t DisplayDriverTFT::getRawTouchZ() { return _tft.getTouchRawZ(); }
void DisplayDriverTFT::transformTouch(int* x, int* y) {
// Resistive touch panel is rotated 90° vs display - swap coordinates