mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-20 14:55:21 +03:00
Added ability to display PIDs in OSD
This commit is contained in:
parent
ad95800f4d
commit
41dda49b44
4 changed files with 52 additions and 16 deletions
|
@ -1559,7 +1559,10 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
||||||
osdProfile()->alt_alarm = sbufReadU16(src);
|
osdProfile()->alt_alarm = sbufReadU16(src);
|
||||||
} else {
|
} else {
|
||||||
// set a position setting
|
// set a position setting
|
||||||
osdProfile()->item_pos[addr] = sbufReadU16(src);
|
const uint16_t pos = sbufReadU16(src);
|
||||||
|
if (addr < OSD_ITEM_COUNT) {
|
||||||
|
osdProfile()->item_pos[addr] = pos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -333,6 +333,27 @@ static void osdDrawSingleElement(uint8_t item)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case OSD_ROLL_PIDS:
|
||||||
|
{
|
||||||
|
const pidProfile_t *pidProfile = ¤tProfile->pidProfile;
|
||||||
|
sprintf(buff, "ROL %3d,%3d,%3d", pidProfile->P8[PIDROLL], pidProfile->I8[PIDROLL], pidProfile->D8[PIDROLL]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case OSD_PITCH_PIDS:
|
||||||
|
{
|
||||||
|
const pidProfile_t *pidProfile = ¤tProfile->pidProfile;
|
||||||
|
sprintf(buff, "PIT %3d,%3d,%3d", pidProfile->P8[PIDPITCH], pidProfile->I8[PIDPITCH], pidProfile->D8[PIDPITCH]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case OSD_YAW_PIDS:
|
||||||
|
{
|
||||||
|
const pidProfile_t *pidProfile = ¤tProfile->pidProfile;
|
||||||
|
sprintf(buff, "YAW %3d,%3d,%3d", pidProfile->P8[PIDYAW], pidProfile->I8[PIDYAW], pidProfile->D8[PIDYAW]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -372,6 +393,9 @@ void osdDrawElements(void)
|
||||||
osdDrawSingleElement(OSD_MAH_DRAWN);
|
osdDrawSingleElement(OSD_MAH_DRAWN);
|
||||||
osdDrawSingleElement(OSD_CRAFT_NAME);
|
osdDrawSingleElement(OSD_CRAFT_NAME);
|
||||||
osdDrawSingleElement(OSD_ALTITUDE);
|
osdDrawSingleElement(OSD_ALTITUDE);
|
||||||
|
osdDrawSingleElement(OSD_ROLL_PIDS);
|
||||||
|
osdDrawSingleElement(OSD_PITCH_PIDS);
|
||||||
|
osdDrawSingleElement(OSD_YAW_PIDS);
|
||||||
|
|
||||||
#ifdef GPS
|
#ifdef GPS
|
||||||
#ifdef CMS
|
#ifdef CMS
|
||||||
|
@ -403,6 +427,9 @@ void osdResetConfig(osd_profile_t *osdProfile)
|
||||||
osdProfile->item_pos[OSD_GPS_SPEED] = OSD_POS(2, 2);
|
osdProfile->item_pos[OSD_GPS_SPEED] = OSD_POS(2, 2);
|
||||||
osdProfile->item_pos[OSD_GPS_SATS] = OSD_POS(2, 12);
|
osdProfile->item_pos[OSD_GPS_SATS] = OSD_POS(2, 12);
|
||||||
osdProfile->item_pos[OSD_ALTITUDE] = OSD_POS(1, 5);
|
osdProfile->item_pos[OSD_ALTITUDE] = OSD_POS(1, 5);
|
||||||
|
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->rssi_alarm = 20;
|
osdProfile->rssi_alarm = 20;
|
||||||
osdProfile->cap_alarm = 2200;
|
osdProfile->cap_alarm = 2200;
|
||||||
|
|
|
@ -40,6 +40,9 @@ typedef enum {
|
||||||
OSD_GPS_SPEED,
|
OSD_GPS_SPEED,
|
||||||
OSD_GPS_SATS,
|
OSD_GPS_SATS,
|
||||||
OSD_ALTITUDE,
|
OSD_ALTITUDE,
|
||||||
|
OSD_ROLL_PIDS,
|
||||||
|
OSD_PITCH_PIDS,
|
||||||
|
OSD_YAW_PIDS,
|
||||||
OSD_ITEM_COUNT // MUST BE LAST
|
OSD_ITEM_COUNT // MUST BE LAST
|
||||||
} osd_items_e;
|
} osd_items_e;
|
||||||
|
|
||||||
|
|
|
@ -967,21 +967,24 @@ const clivalue_t valueTable[] = {
|
||||||
{ "osd_time_alarm", VAR_UINT16 | MASTER_VALUE, &osdProfile()->time_alarm, .config.minmax = { 0, 60 } },
|
{ "osd_time_alarm", VAR_UINT16 | MASTER_VALUE, &osdProfile()->time_alarm, .config.minmax = { 0, 60 } },
|
||||||
{ "osd_alt_alarm", VAR_UINT16 | MASTER_VALUE, &osdProfile()->alt_alarm, .config.minmax = { 0, 10000 } },
|
{ "osd_alt_alarm", VAR_UINT16 | MASTER_VALUE, &osdProfile()->alt_alarm, .config.minmax = { 0, 10000 } },
|
||||||
|
|
||||||
{ "osd_main_voltage_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_MAIN_BATT_VOLTAGE], .config.minmax = { 0, 65536 } },
|
{ "osd_main_voltage_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_MAIN_BATT_VOLTAGE], .config.minmax = { 0, UINT16_MAX } },
|
||||||
{ "osd_rssi_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_RSSI_VALUE], .config.minmax = { 0, 65536 } },
|
{ "osd_rssi_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_RSSI_VALUE], .config.minmax = { 0, UINT16_MAX } },
|
||||||
{ "osd_flytimer_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_FLYTIME], .config.minmax = { 0, 65536 } },
|
{ "osd_flytimer_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_FLYTIME], .config.minmax = { 0, UINT16_MAX } },
|
||||||
{ "osd_ontime_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_ONTIME], .config.minmax = { 0, 65536 } },
|
{ "osd_ontime_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_ONTIME], .config.minmax = { 0, UINT16_MAX } },
|
||||||
{ "osd_flymode_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_FLYMODE], .config.minmax = { 0, 65536 } },
|
{ "osd_flymode_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_FLYMODE], .config.minmax = { 0, UINT16_MAX } },
|
||||||
{ "osd_throttle_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_THROTTLE_POS], .config.minmax = { 0, 65536 } },
|
{ "osd_throttle_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_THROTTLE_POS], .config.minmax = { 0, UINT16_MAX } },
|
||||||
{ "osd_vtx_channel_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_VTX_CHANNEL], .config.minmax = { 0, 65536 } },
|
{ "osd_vtx_channel_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_VTX_CHANNEL], .config.minmax = { 0, UINT16_MAX } },
|
||||||
{ "osd_crosshairs", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_CROSSHAIRS], .config.minmax = { 0, 65536 } },
|
{ "osd_crosshairs", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_CROSSHAIRS], .config.minmax = { 0, UINT16_MAX } },
|
||||||
{ "osd_artificial_horizon", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_ARTIFICIAL_HORIZON], .config.minmax = { 0, 65536 } },
|
{ "osd_artificial_horizon", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_ARTIFICIAL_HORIZON], .config.minmax = { 0, UINT16_MAX } },
|
||||||
{ "osd_current_draw_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_CURRENT_DRAW], .config.minmax = { 0, 65536 } },
|
{ "osd_current_draw_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_CURRENT_DRAW], .config.minmax = { 0, UINT16_MAX } },
|
||||||
{ "osd_mah_drawn_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_MAH_DRAWN], .config.minmax = { 0, 65536 } },
|
{ "osd_mah_drawn_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_MAH_DRAWN], .config.minmax = { 0, UINT16_MAX } },
|
||||||
{ "osd_craft_name_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_CRAFT_NAME], .config.minmax = { 0, 65536 } },
|
{ "osd_craft_name_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_CRAFT_NAME], .config.minmax = { 0, UINT16_MAX } },
|
||||||
{ "osd_gps_speed_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_GPS_SPEED], .config.minmax = { 0, 65536 } },
|
{ "osd_gps_speed_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_GPS_SPEED], .config.minmax = { 0, UINT16_MAX } },
|
||||||
{ "osd_gps_sats_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_GPS_SATS], .config.minmax = { 0, 65536 } },
|
{ "osd_gps_sats_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_GPS_SATS], .config.minmax = { 0, UINT16_MAX } },
|
||||||
{ "osd_altitude_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_ALTITUDE], .config.minmax = { 0, 65536 } },
|
{ "osd_altitude_pos", VAR_UINT16 | MASTER_VALUE, &osdProfile()->item_pos[OSD_ALTITUDE], .config.minmax = { 0, UINT16_MAX } },
|
||||||
|
{ "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 } },
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_MAX7456
|
#ifdef USE_MAX7456
|
||||||
{ "vcd_video_system", VAR_UINT8 | MASTER_VALUE, &vcdProfile()->video_system, .config.minmax = { 0, 2 } },
|
{ "vcd_video_system", VAR_UINT8 | MASTER_VALUE, &vcdProfile()->video_system, .config.minmax = { 0, 2 } },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue