TFT fix globally

This commit is contained in:
richonguzman 2024-07-11 08:17:42 -04:00
parent 758e8412f8
commit 5275fdfbd3
1 changed files with 23 additions and 11 deletions

View File

@ -80,6 +80,14 @@ namespace MENU_Utils {
} }
} }
String fillStringLength(const String& line, uint8_t length) {
String outputLine = line;
for (int a = line.length(); a < length; a++) {
outputLine += " ";
}
return outputLine;
}
void showOnScreen() { void showOnScreen() {
String lastLine, firstLineDecoder, courseSpeedAltitude, speedPacketDec, coursePacketDec, pathDec; String lastLine, firstLineDecoder, courseSpeedAltitude, speedPacketDec, coursePacketDec, pathDec;
uint32_t lastMenuTime = millis() - menuTime; uint32_t lastMenuTime = millis() - menuTime;
@ -595,11 +603,6 @@ namespace MENU_Utils {
fifthRowMainMenu = "LAST Rx = "; fifthRowMainMenu = "LAST Rx = ";
fifthRowMainMenu += MSG_Utils::getLastHeardTracker(); fifthRowMainMenu += MSG_Utils::getLastHeardTracker();
} }
#ifdef HAS_TFT
for (int z = fifthRowMainMenu.length(); z < 22; z++) {
fifthRowMainMenu += " ";
}
#endif
if (POWER_Utils::getBatteryInfoIsConnected()) { if (POWER_Utils::getBatteryInfoIsConnected()) {
String batteryVoltage = POWER_Utils::getBatteryInfoVoltage(); String batteryVoltage = POWER_Utils::getBatteryInfoVoltage();
@ -657,12 +660,21 @@ namespace MENU_Utils {
} else { } else {
sixthRowMainMenu = "No Battery Connected" ; sixthRowMainMenu = "No Battery Connected" ;
} }
show_display(firstRowMainMenu, #ifdef HAS_TFT
secondRowMainMenu, show_display(firstRowMainMenu,
thirdRowMainMenu, fillStringLength(secondRowMainMenu, 22),
fourthRowMainMenu, fillStringLength(thirdRowMainMenu, 22),
fifthRowMainMenu, fillStringLength(fourthRowMainMenu, 22),
sixthRowMainMenu); fillStringLength(fifthRowMainMenu, 22),
fillStringLength(sixthRowMainMenu, 22));
#else
show_display(firstRowMainMenu,
secondRowMainMenu,
thirdRowMainMenu,
fourthRowMainMenu,
fifthRowMainMenu,
sixthRowMainMenu);
#endif
break; break;
} }
} }