mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +03:00
Add average cell voltage to OSD
This can make it a little easier for some pilots to see where their battery is at, especially if they move forth and back between different cell counts a lot.
This commit is contained in:
parent
60a41c7706
commit
a151d50929
4 changed files with 16 additions and 0 deletions
|
@ -409,6 +409,14 @@ static void osdDrawSingleElement(uint8_t item)
|
|||
break;
|
||||
}
|
||||
|
||||
case OSD_AVG_CELL_VOLTAGE:
|
||||
{
|
||||
uint16_t cellV = getVbat() * 10 / batteryCellCount;
|
||||
buff[0] = SYM_BATT_5;
|
||||
sprintf(buff + 1, "%d.%dV", cellV / 100, cellV % 100);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
@ -458,6 +466,7 @@ void osdDrawElements(void)
|
|||
osdDrawSingleElement(OSD_POWER);
|
||||
osdDrawSingleElement(OSD_PIDRATE_PROFILE);
|
||||
osdDrawSingleElement(OSD_MAIN_BATT_WARNING);
|
||||
osdDrawSingleElement(OSD_AVG_CELL_VOLTAGE);
|
||||
|
||||
#ifdef GPS
|
||||
#ifdef CMS
|
||||
|
@ -495,6 +504,7 @@ void pgResetFn_osdConfig(osdConfig_t *osdProfile)
|
|||
osdProfile->item_pos[OSD_POWER] = OSD_POS(15, 1);
|
||||
osdProfile->item_pos[OSD_PIDRATE_PROFILE] = OSD_POS(2, 13);
|
||||
osdProfile->item_pos[OSD_MAIN_BATT_WARNING] = OSD_POS(8, 6);
|
||||
osdProfile->item_pos[OSD_MAIN_BATT_VOLTAGE] = OSD_POS(12, 0);
|
||||
|
||||
osdProfile->rssi_alarm = 20;
|
||||
osdProfile->cap_alarm = 2200;
|
||||
|
@ -556,9 +566,11 @@ void osdUpdateAlarms(void)
|
|||
if (getVbat() <= (batteryWarningVoltage - 1)) {
|
||||
SET_BLINK(OSD_MAIN_BATT_VOLTAGE);
|
||||
SET_BLINK(OSD_MAIN_BATT_WARNING);
|
||||
SET_BLINK(OSD_AVG_CELL_VOLTAGE);
|
||||
} else {
|
||||
CLR_BLINK(OSD_MAIN_BATT_VOLTAGE);
|
||||
CLR_BLINK(OSD_MAIN_BATT_WARNING);
|
||||
CLR_BLINK(OSD_AVG_CELL_VOLTAGE);
|
||||
}
|
||||
|
||||
if (STATE(GPS_FIX) == 0)
|
||||
|
@ -591,6 +603,7 @@ void osdResetAlarms(void)
|
|||
CLR_BLINK(OSD_FLYTIME);
|
||||
CLR_BLINK(OSD_MAH_DRAWN);
|
||||
CLR_BLINK(OSD_ALTITUDE);
|
||||
CLR_BLINK(OSD_AVG_CELL_VOLTAGE);
|
||||
}
|
||||
|
||||
static void osdResetStats(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue