Merge pull request #1811 from rafl/rafl/osd-wattage

Add electrical power to OSD
This commit is contained in:
borisbstyle 2016-12-30 13:32:13 +01:00 committed by GitHub
commit 50159ef6f6
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

@ -360,6 +360,12 @@ static void osdDrawSingleElement(uint8_t item)
break;
}
case OSD_POWER:
{
sprintf(buff, "%dW", amperage * vbat / 1000);
break;
}
default:
return;
}
@ -402,6 +408,7 @@ void osdDrawElements(void)
osdDrawSingleElement(OSD_ROLL_PIDS);
osdDrawSingleElement(OSD_PITCH_PIDS);
osdDrawSingleElement(OSD_YAW_PIDS);
osdDrawSingleElement(OSD_POWER);
#ifdef GPS
#ifdef CMS
@ -436,6 +443,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

@ -45,6 +45,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

@ -996,6 +996,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 } },