diff --git a/src/main/fc/settings.c b/src/main/fc/settings.c index 48d4f9b33..aa636bebd 100644 --- a/src/main/fc/settings.c +++ b/src/main/fc/settings.c @@ -646,6 +646,8 @@ const clivalue_t valueTable[] = { { "osd_pidrate_profile_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_PIDRATE_PROFILE]) }, { "osd_battery_warning_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_MAIN_BATT_WARNING]) }, { "osd_avg_cell_voltage_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_AVG_CELL_VOLTAGE]) }, + { "osd_pit_ang_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_PITCH_ANGLE]) }, + { "osd_rol_ang_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_ROLL_ANGLE]) }, #endif // PG_SYSTEM_CONFIG diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 6c2775204..fdbd7a207 100755 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -471,6 +471,14 @@ static void osdDrawSingleElement(uint8_t item) break; } + case OSD_PITCH_ANGLE: + case OSD_ROLL_ANGLE: + { + const int angle = (item == OSD_PITCH_ANGLE) ? attitude.values.pitch : attitude.values.roll; + tfp_sprintf(buff, "%c%02d.%01d", angle < 0 ? '-' : ' ', abs(angle / 10), abs(angle % 10)); + break; + } + default: return; } @@ -522,6 +530,8 @@ void osdDrawElements(void) osdDrawSingleElement(OSD_MAIN_BATT_WARNING); osdDrawSingleElement(OSD_AVG_CELL_VOLTAGE); osdDrawSingleElement(OSD_DEBUG); + osdDrawSingleElement(OSD_PITCH_ANGLE); + osdDrawSingleElement(OSD_ROLL_ANGLE); #ifdef GPS #ifdef CMS @@ -564,6 +574,8 @@ void pgResetFn_osdConfig(osdConfig_t *osdProfile) osdProfile->item_pos[OSD_MAIN_BATT_WARNING] = OSD_POS(9, 10) | VISIBLE_FLAG; osdProfile->item_pos[OSD_AVG_CELL_VOLTAGE] = OSD_POS(12, 2) | VISIBLE_FLAG; osdProfile->item_pos[OSD_DEBUG] = OSD_POS(7, 12) | VISIBLE_FLAG; + osdProfile->item_pos[OSD_PITCH_ANGLE] = OSD_POS(1, 8) | VISIBLE_FLAG; + osdProfile->item_pos[OSD_ROLL_ANGLE] = OSD_POS(1, 9) | VISIBLE_FLAG; osdProfile->item_pos[OSD_GPS_LAT] = OSD_POS(18, 14) | VISIBLE_FLAG; osdProfile->item_pos[OSD_GPS_LON] = OSD_POS(18, 15) | VISIBLE_FLAG; diff --git a/src/main/io/osd.h b/src/main/io/osd.h index bc3f5bac2..42d2b8e1b 100755 --- a/src/main/io/osd.h +++ b/src/main/io/osd.h @@ -53,6 +53,8 @@ typedef enum { OSD_GPS_LON, OSD_GPS_LAT, OSD_DEBUG, + OSD_PITCH_ANGLE, + OSD_ROLL_ANGLE, OSD_ITEM_COUNT // MUST BE LAST } osd_items_e;