Display anti-gravity activity in OSD.

Signed-off-by: Mark Hale <mark.hale@physics.org>
This commit is contained in:
Mark Hale 2018-04-05 17:49:53 +01:00
parent 02efd46833
commit b2e43abf2d
6 changed files with 22 additions and 0 deletions

View File

@ -168,6 +168,11 @@ void pidSetItermAccelerator(float newItermAccelerator)
itermAccelerator = newItermAccelerator;
}
float pidItermAccelerator(void)
{
return itermAccelerator;
}
void pidStabilisationState(pidStabilisationState_e pidControllerState)
{
pidStabilisationEnabled = (pidControllerState == PID_STABILISATION_ON) ? true : false;

View File

@ -151,6 +151,7 @@ extern pt1Filter_t throttleLpf;
void pidResetITerm(void);
void pidStabilisationState(pidStabilisationState_e pidControllerState);
void pidSetItermAccelerator(float newItermAccelerator);
float pidItermAccelerator(void);
void pidInitFilters(const pidProfile_t *pidProfile);
void pidInitConfig(const pidProfile_t *pidProfile);
void pidInit(const pidProfile_t *pidProfile);

View File

@ -839,6 +839,7 @@ const clivalue_t valueTable[] = {
{ "osd_tim_2_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_ITEM_TIMER_2]) },
{ "osd_remaining_time_estimate_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_REMAINING_TIME_ESTIMATE]) },
{ "osd_flymode_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_FLYMODE]) },
{ "osd_anti_gravity_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_ANTI_GRAVITY]) },
{ "osd_throttle_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_THROTTLE_POS]) },
{ "osd_vtx_channel_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_VTX_CHANNEL]) },
{ "osd_crosshairs_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_CROSSHAIRS]) },

View File

@ -520,6 +520,15 @@ static bool osdDrawSingleElement(uint8_t item)
break;
}
case OSD_ANTI_GRAVITY:
{
if (pidItermAccelerator() > 1.0f) {
strcpy(buff, "AG");
}
break;
}
case OSD_CRAFT_NAME:
// This does not strictly support iterative updating if the craft name changes at run time. But since the craft name is not supposed to be changing this should not matter, and blanking the entire length of the craft name string on update will make it impossible to configure elements to be displayed on the right hand side of the craft name.
//TODO: When iterative updating is implemented, change this so the craft name is only printed once whenever the OSD 'flight' screen is entered.
@ -887,6 +896,7 @@ static void osdDrawElements(void)
osdDrawSingleElement(OSD_NUMERICAL_HEADING);
osdDrawSingleElement(OSD_NUMERICAL_VARIO);
osdDrawSingleElement(OSD_COMPASS_BAR);
osdDrawSingleElement(OSD_ANTI_GRAVITY);
#ifdef USE_GPS
if (sensors(SENSOR_GPS)) {

View File

@ -47,6 +47,8 @@ extern const char * const osdTimerSourceNames[OSD_NUM_TIMER_TYPES];
#define OSD_TIMER_PRECISION(timer) ((timer >> 4) & 0x0F)
#define OSD_TIMER_ALARM(timer) ((timer >> 8) & 0xFF)
// NB: to ensure backwards compatibility, new enum values must be appended at the end but before the OSD_XXXX_COUNT entry.
typedef enum {
OSD_RSSI_VALUE,
OSD_MAIN_BATT_VOLTAGE,
@ -89,6 +91,7 @@ typedef enum {
OSD_RTC_DATETIME,
OSD_ADJUSTMENT_RANGE,
OSD_CORE_TEMPERATURE,
OSD_ANTI_GRAVITY,
OSD_ITEM_COUNT // MUST BE LAST
} osd_items_e;

View File

@ -1020,4 +1020,6 @@ extern "C" {
bool isFlipOverAfterCrashMode(void) {
return false;
}
float pidItermAccelerator(void) { return 1.0; }
}