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