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));
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());
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());
}
}
}
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();
}