From b75c548cdfc2d237cb50f7d2252837ba44f1a08c Mon Sep 17 00:00:00 2001 From: bota87 <52842374+bota87@users.noreply.github.com> Date: Sat, 15 Nov 2025 19:43:40 +0100 Subject: [PATCH] Replaced the hardcoded screen width with a setting --- fossa/105_display.ino | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/fossa/105_display.ino b/fossa/105_display.ino index 5c3bf31..12e61d0 100644 --- a/fossa/105_display.ino +++ b/fossa/105_display.ino @@ -4,31 +4,31 @@ void printMessage(String text1, String text2, String text3, int ftcolor, int bgc tft.fillScreen(bgcolor); tft.setTextColor(ftcolor, bgcolor); tft.setTextSize(4); - tft.setCursor((480 - textWidth(text1, 4)) / 2, 40); + tft.setCursor((TFT_WIDTH - textWidth(text1, 4)) / 2, 40); tft.println(text1); - tft.setCursor((480 - textWidth(text2, 4)) / 2, 120); + tft.setCursor((TFT_WIDTH - textWidth(text2, 4)) / 2, 120); tft.println(text2); tft.setTextSize(3); - tft.setCursor((480 - textWidth(text3, 3)) / 2, 200); + tft.setCursor((TFT_WIDTH - textWidth(text3, 3)) / 2, 200); tft.println(text3); } void feedmefiat() { tft.setTextColor(TFT_WHITE); - tft.setCursor((480 - textWidth(fossaT, 2)) / 2, 40); + tft.setCursor((TFT_WIDTH - textWidth(fossaT, 2)) / 2, 40); tft.setTextSize(2); tft.println(fossaT); - tft.setCursor((480 - textWidth(feedT + " " + String(charge) + chargeT, 2)) / 2, 280); + tft.setCursor((TFT_WIDTH - textWidth(feedT + " " + String(charge) + chargeT, 2)) / 2, 280); tft.setTextSize(2); tft.println(feedT + " " + String(charge) + chargeT); } void feedmefiatloop() { tft.setTextColor(homeScreenColors[homeScreenNumColorCount]); tft.setTextSize(8); - tft.setCursor((480 - textWidth(satsT, 8)) / 2, 80); + tft.setCursor((TFT_WIDTH - textWidth(satsT, 8)) / 2, 80); tft.println(satsT); - tft.setCursor((480 - textWidth(forT, 8)) / 2, 140); + tft.setCursor((TFT_WIDTH - textWidth(forT, 8)) / 2, 140); tft.println(forT); - tft.setCursor((480 - textWidth(fiatT, 8)) / 2, 200); + tft.setCursor((TFT_WIDTH - textWidth(fiatT, 8)) / 2, 200); tft.println(fiatT); delay(100); } @@ -68,4 +68,4 @@ void qrShowCodeLNURL(String message) { int textWidth(String text, int textSize) { tft.setTextSize(textSize); return tft.textWidth(text); -} \ No newline at end of file +}