generated from TDD-Templates/cmake_cpputest_template
Updated the display helper functions, Tested display location to ensure text isn't cut off.
This commit is contained in:
parent
0d506bc2f1
commit
fa01a20576
|
@ -20,7 +20,7 @@ Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST); // Initialize d
|
|||
CRGB leds[NUM_LEDS]; // Array to hold LED colors
|
||||
SoftwareSerial gpsSerial(GPS_RX_PIN, GPS_TX_PIN); // Software serial for GPS
|
||||
TinyGPSPlus gps; // TinyGPS++ object to process GPS data
|
||||
RH_RF95 rf95(RFM9X_CS, RMF9X_INT); // Radio instance.
|
||||
RH_RF95 rf95(RFM9X_CS, RFM9X_INT); // Radio instance.
|
||||
|
||||
|
||||
// Variables
|
||||
|
@ -269,13 +269,14 @@ void updateLEDs(int heading) {
|
|||
// Updates the distance part of the display
|
||||
void TFT_UpdateDistance(uint16_t meters) {
|
||||
Serial.println("TFT_UpdateDistance()");
|
||||
tft.setTextWrap(false);
|
||||
tft.setCursor(0, 0);
|
||||
tft.setTextSize(4);
|
||||
tft.setCursor(0, 20);
|
||||
tft.setTextColor(ST77XX_WHITE);
|
||||
tft.setTextSize(2);
|
||||
tft.println(meters);
|
||||
tft.println(" Meters");
|
||||
|
||||
tft.setTextWrap(true);
|
||||
tft.println(" Distance");
|
||||
tft.print(" ");
|
||||
tft.print(distance);
|
||||
tft.print("m");
|
||||
}
|
||||
|
||||
// Updates the direction part of the display
|
||||
|
@ -295,14 +296,21 @@ 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");
|
||||
|
||||
tft.setTextSize(4);
|
||||
tft.setCursor(0, 100);
|
||||
if(percentage >= 80){
|
||||
tft.setTextColor(ST77XX_GREEN);
|
||||
}
|
||||
else if(percentage < 80 && percentage > 50) {
|
||||
tft.setTextColor(ST77XX_ORANGE);
|
||||
}
|
||||
else if(percentage <= 50) {
|
||||
tft.setTextColor(ST77XX_RED);
|
||||
}
|
||||
tft.setTextWrap(true);
|
||||
tft.print("Batt: ");
|
||||
tft.print(percentage);
|
||||
tft.print("%");
|
||||
return Ok;
|
||||
}
|
||||
|
||||
|
@ -316,10 +324,7 @@ void TFT_DisplaySpecs(void) {
|
|||
uint8_t TFT_Reset() {
|
||||
Serial.println("TFT_Reset()");
|
||||
tft.fillScreen(ST77XX_BLACK); // Set the screen background to black
|
||||
|
||||
TFT_UpdateDistance(0);
|
||||
TFT_UpdateDirection(0);
|
||||
TFT_UpdateBatteryState(100);
|
||||
//Can add default startup logo/screen here for later.
|
||||
}
|
||||
|
||||
// Initalizes the Screen with default startup screen.
|
||||
|
@ -355,6 +360,7 @@ void updateDisplay() {
|
|||
// tft.print("Distance: ");
|
||||
// tft.print(calculatedDistance);
|
||||
|
||||
tft.fillScreen(ST77XX_BLACK); // Set the screen background to black
|
||||
TFT_UpdateDistance(0);
|
||||
TFT_UpdateDirection(0);
|
||||
TFT_UpdateBatteryState(100);
|
||||
|
|
Loading…
Reference in New Issue