FIX: removed ui glitches

This commit is contained in:
Robin Dietzel 2023-02-03 11:26:53 +01:00
parent c0ca995fd7
commit 2a9e8efb3d

View File

@ -226,11 +226,11 @@ int main(void) {
display.LCDSetBacklight(S_backlight);
char buf[20];
display.LCDSetCursor(0, 0);
display.LCDSendCString(
const_cast<char *>(std::string(
"Fuellstand " + std::to_string(tankLevel0.getPercent()) + " %").c_str()));
sprintf(buf, "Fuellstand %3d %%", tankLevel0.getPercent());
display.LCDSendCString(buf);
display.LCDSetCursor(0, 1);
if (S_tankempty) {
display.LCDSendCString(const_cast<char *>(std::string("Tank Wassermangel ").c_str()));
@ -254,12 +254,13 @@ int main(void) {
display.LCDSetCursor(0, 3);
if (S_refillcooldown > 0) {
int remaining_mins = S_refillcooldown / 60;
if (remaining_mins > 0)
display.LCDSendCString(const_cast<char *>(std::string(
"Nsp. wartet: min " + std::to_string(S_refillcooldown / 60)).c_str()));
else
display.LCDSendCString(
const_cast<char *>(std::string("Nsp. wartet: s " + std::to_string(S_refillcooldown)).c_str()));
if (remaining_mins > 0) {
sprintf(buf, "Nsp. wartet: %3d min", S_refillcooldown / 60);
display.LCDSendCString(buf);
} else {
sprintf(buf, "Nsp. wartet: %3d sec", S_refillcooldown);
display.LCDSendCString(buf);
}
} else if (S_refillempty) {
display.LCDSendCString(const_cast<char *>(std::string("Nachspeisung mangel ").c_str()));
HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_RESET);