Add electrical power to OSD

This commit is contained in:
Florian Ragwitz 2016-12-11 11:53:17 -08:00
parent cd9a18dbab
commit 893ffd54d5
4 changed files with 11 additions and 0 deletions

View File

@ -80,6 +80,7 @@ OSD_Entry menuOsdActiveElemsEntries[] =
{"GPS SATS.", OME_VISIBLE, NULL, &osdProfile()->item_pos[OSD_GPS_SATS], 0},
#endif // GPS
{"ALTITUDE", OME_VISIBLE, NULL, &osdProfile()->item_pos[OSD_ALTITUDE], 0},
{"POWER", OME_VISIBLE, NULL, &osdProfile()->item_pos[OSD_POWER], 0},
{"BACK", OME_Back, NULL, NULL, 0},
{NULL, OME_END, NULL, NULL, 0}
};

View File

@ -354,6 +354,12 @@ static void osdDrawSingleElement(uint8_t item)
break;
}
case OSD_POWER:
{
sprintf(buff, "%dW", amperage * vbat / 1000);
break;
}
default:
return;
}
@ -396,6 +402,7 @@ void osdDrawElements(void)
osdDrawSingleElement(OSD_ROLL_PIDS);
osdDrawSingleElement(OSD_PITCH_PIDS);
osdDrawSingleElement(OSD_YAW_PIDS);
osdDrawSingleElement(OSD_POWER);
#ifdef GPS
#ifdef CMS
@ -430,6 +437,7 @@ void osdResetConfig(osd_profile_t *osdProfile)
osdProfile->item_pos[OSD_ROLL_PIDS] = OSD_POS(2, 10) | VISIBLE_FLAG;
osdProfile->item_pos[OSD_PITCH_PIDS] = OSD_POS(2, 11) | VISIBLE_FLAG;
osdProfile->item_pos[OSD_YAW_PIDS] = OSD_POS(2, 12) | VISIBLE_FLAG;
osdProfile->item_pos[OSD_POWER] = OSD_POS(15, 1);
osdProfile->rssi_alarm = 20;
osdProfile->cap_alarm = 2200;

View File

@ -43,6 +43,7 @@ typedef enum {
OSD_ROLL_PIDS,
OSD_PITCH_PIDS,
OSD_YAW_PIDS,
OSD_POWER,
OSD_ITEM_COUNT // MUST BE LAST
} osd_items_e;

View File

@ -992,6 +992,7 @@ const clivalue_t valueTable[] = {
{ "osd_pid_roll_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_ROLL_PIDS], .config.minmax = { 0, UINT16_MAX } },
{ "osd_pid_pitch_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_PITCH_PIDS], .config.minmax = { 0, UINT16_MAX } },
{ "osd_pid_yaw_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_YAW_PIDS], .config.minmax = { 0, UINT16_MAX } },
{ "osd_power_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_POWER], .config.minmax = { 0, UINT16_MAX } },
#endif
#ifdef USE_MAX7456
{ "vcd_video_system", VAR_UINT8 | MASTER_VALUE, &vcdProfile()->video_system, .config.minmax = { 0, 2 } },