mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-12 19:10:27 +03:00
Added FW level trim to in flight adjustments
This commit is contained in:
parent
c3b79eb53c
commit
2e9bf6b6e7
5 changed files with 21 additions and 15 deletions
|
@ -159,6 +159,7 @@ this reason ensure that you define enough ranges to cover the range channel's us
|
|||
| 55 | TPA_BREAKPOINT |
|
||||
| 56 | NAV_FW_CONTROL_SMOOTHNESS |
|
||||
| 57 | FW_TPA_TIME_CONSTANT |
|
||||
| 58 | FW_LEVEL_TRIM |
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
|
@ -293,6 +293,10 @@ static const adjustmentConfig_t defaultAdjustmentConfigs[ADJUSTMENT_FUNCTION_COU
|
|||
.adjustmentFunction = ADJUSTMENT_FW_TPA_TIME_CONSTANT,
|
||||
.mode = ADJUSTMENT_MODE_STEP,
|
||||
.data = { .stepConfig = { .step = 5 }}
|
||||
}, {
|
||||
.adjustmentFunction = ADJUSTMENT_FW_LEVEL_TRIM,
|
||||
.mode = ADJUSTMENT_MODE_STEP,
|
||||
.data = { .stepConfig = { .step = 1 }}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -607,6 +611,15 @@ static void applyStepAdjustment(controlRateConfig_t *controlRateConfig, uint8_t
|
|||
case ADJUSTMENT_NAV_FW_CONTROL_SMOOTHNESS:
|
||||
applyAdjustmentU8(ADJUSTMENT_NAV_FW_CONTROL_SMOOTHNESS, &navConfigMutable()->fw.control_smoothness, delta, SETTING_NAV_FW_CONTROL_SMOOTHNESS_MIN, SETTING_NAV_FW_CONTROL_SMOOTHNESS_MAX);
|
||||
break;
|
||||
case ADJUSTMENT_FW_LEVEL_TRIM:
|
||||
{
|
||||
float newValue = pidProfileMutable()->fixedWingLevelTrim + (delta / 10.0f);
|
||||
if (newValue > SETTING_FW_LEVEL_PITCH_TRIM_MAX) {newValue = (float)SETTING_FW_LEVEL_PITCH_TRIM_MAX;}
|
||||
else if (newValue < SETTING_FW_LEVEL_PITCH_TRIM_MIN) {newValue = (float)SETTING_FW_LEVEL_PITCH_TRIM_MIN;}
|
||||
pidProfileMutable()->fixedWingLevelTrim = newValue;
|
||||
blackboxLogInflightAdjustmentEvent(ADJUSTMENT_FW_LEVEL_TRIM, (int)(newValue * 10.0f));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
|
|
@ -83,6 +83,7 @@ typedef enum {
|
|||
ADJUSTMENT_TPA_BREAKPOINT = 55,
|
||||
ADJUSTMENT_NAV_FW_CONTROL_SMOOTHNESS = 56,
|
||||
ADJUSTMENT_FW_TPA_TIME_CONSTANT = 57,
|
||||
ADJUSTMENT_FW_LEVEL_TRIM = 58,
|
||||
ADJUSTMENT_FUNCTION_COUNT // must be last
|
||||
} adjustmentFunction_e;
|
||||
|
||||
|
|
|
@ -3019,24 +3019,14 @@ static bool osdDrawSingleElement(uint8_t item)
|
|||
}
|
||||
case OSD_TPA_TIME_CONSTANT:
|
||||
{
|
||||
/* char buff[7];
|
||||
textAttributes_t attr;
|
||||
|
||||
if (isAdjustmentFunctionSelected(ADJUSTMENT_FW_TPA_TIME_CONSTANT)) {
|
||||
displayWrite(osdDisplayPort, elemPosX, elemPosY, "TC OK");
|
||||
} else {
|
||||
displayWrite(osdDisplayPort, elemPosX, elemPosY, "TPA TC");
|
||||
}
|
||||
|
||||
attr = TEXT_ATTRIBUTES_NONE;
|
||||
tfp_sprintf(buff, "%4d", currentControlRateProfile->throttle.fixedWingTauMs);
|
||||
if (isAdjustmentFunctionSelected(ADJUSTMENT_FW_TPA_TIME_CONSTANT)) {
|
||||
TEXT_ATTRIBUTES_ADD_BLINK(attr);
|
||||
}
|
||||
displayWriteWithAttr(osdDisplayPort, elemPosX + 7, elemPosY, buff, attr);*/
|
||||
osdDisplayAdjustableDecimalValue(elemPosX, elemPosY, "TPA TC", 0, currentControlRateProfile->throttle.fixedWingTauMs, 4, 0, ADJUSTMENT_FW_TPA_TIME_CONSTANT);
|
||||
return true;
|
||||
}
|
||||
case OSD_FW_LEVEL_TRIM:
|
||||
{
|
||||
osdDisplayAdjustableDecimalValue(elemPosX, elemPosY, "LEVEL", 0, pidProfileMutable()->fixedWingLevelTrim, 3, 1, ADJUSTMENT_FW_LEVEL_TRIM);
|
||||
return true;
|
||||
}
|
||||
|
||||
case OSD_NAV_FW_CONTROL_SMOOTHNESS:
|
||||
osdDisplayAdjustableDecimalValue(elemPosX, elemPosY, "CTL S", 0, navConfig()->fw.control_smoothness, 1, 0, ADJUSTMENT_NAV_FW_CONTROL_SMOOTHNESS);
|
||||
|
|
|
@ -258,6 +258,7 @@ typedef enum {
|
|||
OSD_SWITCH_INDICATOR_2,
|
||||
OSD_SWITCH_INDICATOR_3,
|
||||
OSD_TPA_TIME_CONSTANT,
|
||||
OSD_FW_LEVEL_TRIM,
|
||||
OSD_ITEM_COUNT // MUST BE LAST
|
||||
} osd_items_e;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue