Re #2671: fixes difference between top and main LCD TX battery bars, code made more readable with macros

This commit is contained in:
Damjan Adamic
2015-08-17 13:55:41 +02:00
committed by Bertrand Songis
parent 00a5437dde
commit 5b4f0a0bbb
9 changed files with 29 additions and 23 deletions
+1 -3
View File
@@ -209,7 +209,6 @@ void displayTopBarGauge(coord_t x, int count, bool blinking=false)
{
if (!blinking || BLINK_ON_PHASE)
drawFilledRect(x+1, BAR_Y+2, 11, 5, SOLID, ERASE);
count = min(10, count);
for (int i=0; i<count; i+=2)
lcd_vline(x+2+i, BAR_Y+3, 3);
}
@@ -300,8 +299,7 @@ void displayTopBar()
drawFilledRect(BAR_X, BAR_Y, BAR_W, BAR_H, SOLID, FILL_WHITE|GREY(12)|ROUND);
/* The inside of the Batt gauge */
int count = 10 * (g_vbat100mV - g_eeGeneral.vBatMin - 90) / (30 + g_eeGeneral.vBatMax - g_eeGeneral.vBatMin);
displayTopBarGauge(batt_icon_x+FW, count, g_vbat100mV <= g_eeGeneral.vBatWarn);
displayTopBarGauge(batt_icon_x+FW, GET_TXBATT_BARS(), IS_TXBATT_WARNING());
/* The inside of the RSSI gauge */
if (TELEMETRY_RSSI() > 0) {