From 5ecbbceeb93ecac8ff5f3ed96e333d5d3a7471f7 Mon Sep 17 00:00:00 2001 From: jake Date: Tue, 1 Oct 2024 19:28:25 -0700 Subject: [PATCH] Defined functions for display updates. + Added defintions for updating the LCD display. --- src/multi-tracker.cpp | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/multi-tracker.cpp b/src/multi-tracker.cpp index 7d0935c..a1b18ad 100644 --- a/src/multi-tracker.cpp +++ b/src/multi-tracker.cpp @@ -266,12 +266,23 @@ void updateLEDs(int heading) { // Updates the distance part of the display void TFT_UpdateDistance(uint16_t meters) { + tft.setTextWrap(false); + tft.setCursor(0, 0); + tft.setTextColor(ST77XX_WHITE); + tft.setTextSize(2); + tft.println(meters); + tft.println(" Meters"); } // Updates the direction part of the display -void TFT_UpdateDirection() { - +void TFT_UpdateDirection(uint16_t degrees) { + tft.setTextWrap(false); + tft.setCursor(0, 40); + tft.setTextColor(ST77XX_WHITE); + tft.setTextSize(2); + tft.println(meters); + tft.println(" Degrees"); } // Updates the batter/voltage state. @@ -279,13 +290,24 @@ uint8_t TFT_UpdateBatteryState(uint8_t percentage) { if(percentage > MAX_BATT_PERCENTAGE || percentage < MIN_BATT_PERCENTAGE){ return Err; } - + + tft.setTextWrap(false); + tft.setCursor(0, 80); + tft.setTextColor(ST77XX_WHITE); + tft.setTextSize(2); + tft.println(percentage); + tft.println("% Batt"); + return Ok; } // Displays the specifications of the node. void TFT_DisplaySpecs(void) { + tft.fillScreen(ST77XX_BLACK); // Set the screen background to black + TFT_UpdateDistance(0); + TFT_UpdateDirection(0); + TFT_UpdateBatteryState(100); } @@ -299,6 +321,7 @@ uint8_t TFT_Init(void) { // Display Setup tft.init(TFT_X, TFT_Y); // Initialize the display with a resolution of 240x280 pixels tft.fillScreen(ST77XX_BLACK); // Set the screen background to black + tft.setRotation(0); // Set's the rotation of the screen. TFT_UpdateDistance(0); TFT_UpdateDirection(0);