From: Eugene Crosser Date: Mon, 22 Jul 2024 18:16:45 +0000 (+0200) Subject: Adjust geometry X-Git-Url: http://average.org/gitweb/?a=commitdiff_plain;h=362442344ec48f2849fa557ee2a738354f8e2229;p=ThermoBeaconDisplay.git Adjust geometry --- diff --git a/ThermoBeaconDisplay.ino b/ThermoBeaconDisplay.ino index e2700f1..304b3ef 100644 --- a/ThermoBeaconDisplay.ino +++ b/ThermoBeaconDisplay.ino @@ -29,12 +29,11 @@ void displayT(String addr, int bat, int tmp, int hum, int ticks, int rssi) { for (int i = 0; i <= 1; i++) { if (viewports[i] == addr) { - tft.setViewport(i * (tft.width() / 2), 0, tft.width() / 2, tft.height()); + tft.setViewport(i * (tft.width() / 2) + 4, 4, tft.width() / 2 - 4, tft.height() - 4); } } tft.fillScreen(TFT_BLACK); - tft.frameViewport(TFT_NAVY, 1); - tft.setCursor(4, 4, 4); + tft.setCursor(0, 0, 4); tft.setTextColor(TFT_WHITE); tft.setTextSize(1); tft.println(addr.substring(3)); @@ -57,6 +56,10 @@ void displayT(String addr, int bat, int tmp, int hum, int ticks, int rssi) { tft.resetViewport(); } +void updateCache(String addr, int bat, int tmp, int hum, int ticks, int rssi) { + displayT(addr, bat, tmp, hum, ticks, rssi); +} + void dbg(BLEDevice peripheral) { Serial.print("Address: "); Serial.println(peripheral.address()); @@ -111,7 +114,7 @@ void advHandler(BLEDevice dev) { Serial.print(" Rssi: "); Serial.print(dev.rssi()); Serial.println(); - displayT(dev.address().substring(6), bat, tmp, hum, ticks, dev.rssi()); + updateCache(dev.address().substring(6), bat, tmp, hum, ticks, dev.rssi()); } } } @@ -130,8 +133,10 @@ void setup() { tft.setRotation(1); tft.fillScreen(TFT_BLACK); tft.setViewport(0, 0, tft.width() / 2, tft.height()); + tft.frameViewport(TFT_NAVY, 1); tft.resetViewport(); tft.setViewport(tft.width() / 2, 0, tft.width() / 2, tft.height()); + tft.frameViewport(TFT_NAVY, 1); tft.resetViewport(); }