Fix for showing bar and meter.

pull/32/head
Holger Wirtz 5 years ago
parent a75494b7fa
commit 9299eb43d9
  1. 18
      UI.hpp

@ -4535,7 +4535,6 @@ void lcd_display_bar_float(const char* title, float value, float factor, int32_t
} }
else else
{ {
for (uint8_t i = 0; i < vi; i++) for (uint8_t i = 0; i < vi; i++)
lcd.write((uint8_t)4); // full block lcd.write((uint8_t)4); // full block
if (vi < LCD_cols) if (vi < LCD_cols)
@ -4593,15 +4592,24 @@ void lcd_display_meter_float(const char* title, float value, float factor, float
if (vi == 0) if (vi == 0)
{ {
lcd.write((uint8_t)vf / 2.0 - 0.5); lcd.write((uint8_t)(vf / 2.0 + 0.5));
lcd.print(F(" ")); for (uint8_t i = 1; i < LCD_cols; i++)
lcd.print(F(" ")); // empty block
}
else if (vi == LCD_cols)
{
for (uint8_t i = 0; i < LCD_cols - 1; i++)
lcd.print(F(" ")); // empty block
lcd.write(4);
} }
else else
{ {
for (uint8_t i = 0; i < LCD_cols; i++) for (uint8_t i = 0; i < LCD_cols; i++)
lcd.print(F(" ")); // empty block lcd.print(F(" ")); // empty block
lcd.setCursor(vi - 1, 1); lcd.setCursor(vi, 1);
lcd.write((uint8_t)vf / 2.0 - 0.5); lcd.write((uint8_t)(vf / 2.0 + 0.5));
for (uint8_t i = vi + 1; i < LCD_cols; i++)
lcd.print(F(" ")); // empty block
} }
} }

Loading…
Cancel
Save