mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 22:35:23 +03:00
Merge pull request #5686 from pulquero/antigrav_osd
Display anti-gravity activity in OSD.
This commit is contained in:
commit
2f2c95a556
6 changed files with 22 additions and 0 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -830,6 +830,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]) },
|
||||
|
|
|
@ -527,6 +527,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.
|
||||
|
@ -894,6 +903,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)) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -1020,4 +1020,6 @@ extern "C" {
|
|||
bool isFlipOverAfterCrashMode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
float pidItermAccelerator(void) { return 1.0; }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue