Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/Inflight Adjustments.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ this reason ensure that you define enough ranges to cover the range channel's us
| 54 | TPA |
| 55 | TPA_BREAKPOINT |
| 56 | NAV_FW_CONTROL_SMOOTHNESS |
| 57 | FW_TPA_TIME_CONSTANT |

## Examples

Expand Down
4 changes: 2 additions & 2 deletions docs/Settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -1374,11 +1374,11 @@ Reference airspeed. Set this to airspeed at which PIDs were tuned. Usually shoul

### fw_tpa_time_constant

TPA smoothing and delay time constant to reflect non-instant speed/throttle response of the plane. Planes with low thrust/weight ratio generally need higher time constant. Default is zero for compatibility with old setups
TPA smoothing and delay time constant to reflect non-instant speed/throttle response of the plane. See **PID Attenuation and scaling** Wiki for full details.

| Default | Min | Max |
| --- | --- | --- |
| 0 | 0 | 5000 |
| 1500 | 0 | 5000 |

---

Expand Down
7 changes: 7 additions & 0 deletions src/main/fc/rc_adjustments.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ static const adjustmentConfig_t defaultAdjustmentConfigs[ADJUSTMENT_FUNCTION_COU
.adjustmentFunction = ADJUSTMENT_NAV_FW_CONTROL_SMOOTHNESS,
.mode = ADJUSTMENT_MODE_STEP,
.data = { .stepConfig = { .step = 1 }}
}, {
.adjustmentFunction = ADJUSTMENT_FW_TPA_TIME_CONSTANT,
.mode = ADJUSTMENT_MODE_STEP,
.data = { .stepConfig = { .step = 5 }}
}
};

Expand Down Expand Up @@ -597,6 +601,9 @@ static void applyStepAdjustment(controlRateConfig_t *controlRateConfig, uint8_t
case ADJUSTMENT_TPA_BREAKPOINT:
applyAdjustmentU16(ADJUSTMENT_TPA_BREAKPOINT, &controlRateConfig->throttle.pa_breakpoint, delta, PWM_RANGE_MIN, PWM_RANGE_MAX);
break;
case ADJUSTMENT_FW_TPA_TIME_CONSTANT:
applyAdjustmentU16(ADJUSTMENT_FW_TPA_TIME_CONSTANT, &controlRateConfig->throttle.fixedWingTauMs, delta, SETTING_FW_TPA_TIME_CONSTANT_MIN, SETTING_FW_TPA_TIME_CONSTANT_MAX);
break;
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;
Expand Down
113 changes: 57 additions & 56 deletions src/main/fc/rc_adjustments.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,63 +25,64 @@
//#define USE_INFLIGHT_PROFILE_ADJUSTMENT - not currently enabled

typedef enum {
ADJUSTMENT_NONE = 0,
ADJUSTMENT_RC_RATE = 1,
ADJUSTMENT_RC_EXPO = 2,
ADJUSTMENT_THROTTLE_EXPO = 3,
ADJUSTMENT_PITCH_ROLL_RATE = 4,
ADJUSTMENT_YAW_RATE = 5,
ADJUSTMENT_PITCH_ROLL_P = 6,
ADJUSTMENT_PITCH_ROLL_I = 7,
ADJUSTMENT_PITCH_ROLL_D = 8,
ADJUSTMENT_PITCH_ROLL_FF = 9,
ADJUSTMENT_PITCH_P = 10,
ADJUSTMENT_PITCH_I = 11,
ADJUSTMENT_PITCH_D = 12,
ADJUSTMENT_PITCH_FF = 13,
ADJUSTMENT_ROLL_P = 14,
ADJUSTMENT_ROLL_I = 15,
ADJUSTMENT_ROLL_D = 16,
ADJUSTMENT_ROLL_FF = 17,
ADJUSTMENT_YAW_P = 18,
ADJUSTMENT_YAW_I = 19,
ADJUSTMENT_YAW_D = 20,
ADJUSTMENT_YAW_FF = 21,
ADJUSTMENT_RATE_PROFILE = 22, // Unused, placeholder for compatibility
ADJUSTMENT_PITCH_RATE = 23,
ADJUSTMENT_ROLL_RATE = 24,
ADJUSTMENT_RC_YAW_EXPO = 25,
ADJUSTMENT_MANUAL_RC_EXPO = 26,
ADJUSTMENT_MANUAL_RC_YAW_EXPO = 27,
ADJUSTMENT_MANUAL_PITCH_ROLL_RATE = 28,
ADJUSTMENT_MANUAL_ROLL_RATE = 29,
ADJUSTMENT_MANUAL_PITCH_RATE = 30,
ADJUSTMENT_MANUAL_YAW_RATE = 31,
ADJUSTMENT_NAV_FW_CRUISE_THR = 32,
ADJUSTMENT_NAV_FW_PITCH2THR = 33,
ADJUSTMENT_ROLL_BOARD_ALIGNMENT = 34,
ADJUSTMENT_PITCH_BOARD_ALIGNMENT = 35,
ADJUSTMENT_LEVEL_P = 36,
ADJUSTMENT_LEVEL_I = 37,
ADJUSTMENT_LEVEL_D = 38,
ADJUSTMENT_POS_XY_P = 39,
ADJUSTMENT_POS_XY_I = 40,
ADJUSTMENT_POS_XY_D = 41,
ADJUSTMENT_POS_Z_P = 42,
ADJUSTMENT_POS_Z_I = 43,
ADJUSTMENT_POS_Z_D = 44,
ADJUSTMENT_HEADING_P = 45,
ADJUSTMENT_VEL_XY_P = 46,
ADJUSTMENT_VEL_XY_I = 47,
ADJUSTMENT_VEL_XY_D = 48,
ADJUSTMENT_VEL_Z_P = 49,
ADJUSTMENT_VEL_Z_I = 50,
ADJUSTMENT_VEL_Z_D = 51,
ADJUSTMENT_NONE = 0,
ADJUSTMENT_RC_RATE = 1,
ADJUSTMENT_RC_EXPO = 2,
ADJUSTMENT_THROTTLE_EXPO = 3,
ADJUSTMENT_PITCH_ROLL_RATE = 4,
ADJUSTMENT_YAW_RATE = 5,
ADJUSTMENT_PITCH_ROLL_P = 6,
ADJUSTMENT_PITCH_ROLL_I = 7,
ADJUSTMENT_PITCH_ROLL_D = 8,
ADJUSTMENT_PITCH_ROLL_FF = 9,
ADJUSTMENT_PITCH_P = 10,
ADJUSTMENT_PITCH_I = 11,
ADJUSTMENT_PITCH_D = 12,
ADJUSTMENT_PITCH_FF = 13,
ADJUSTMENT_ROLL_P = 14,
ADJUSTMENT_ROLL_I = 15,
ADJUSTMENT_ROLL_D = 16,
ADJUSTMENT_ROLL_FF = 17,
ADJUSTMENT_YAW_P = 18,
ADJUSTMENT_YAW_I = 19,
ADJUSTMENT_YAW_D = 20,
ADJUSTMENT_YAW_FF = 21,
ADJUSTMENT_RATE_PROFILE = 22, // Unused, placeholder for compatibility
ADJUSTMENT_PITCH_RATE = 23,
ADJUSTMENT_ROLL_RATE = 24,
ADJUSTMENT_RC_YAW_EXPO = 25,
ADJUSTMENT_MANUAL_RC_EXPO = 26,
ADJUSTMENT_MANUAL_RC_YAW_EXPO = 27,
ADJUSTMENT_MANUAL_PITCH_ROLL_RATE = 28,
ADJUSTMENT_MANUAL_ROLL_RATE = 29,
ADJUSTMENT_MANUAL_PITCH_RATE = 30,
ADJUSTMENT_MANUAL_YAW_RATE = 31,
ADJUSTMENT_NAV_FW_CRUISE_THR = 32,
ADJUSTMENT_NAV_FW_PITCH2THR = 33,
ADJUSTMENT_ROLL_BOARD_ALIGNMENT = 34,
ADJUSTMENT_PITCH_BOARD_ALIGNMENT = 35,
ADJUSTMENT_LEVEL_P = 36,
ADJUSTMENT_LEVEL_I = 37,
ADJUSTMENT_LEVEL_D = 38,
ADJUSTMENT_POS_XY_P = 39,
ADJUSTMENT_POS_XY_I = 40,
ADJUSTMENT_POS_XY_D = 41,
ADJUSTMENT_POS_Z_P = 42,
ADJUSTMENT_POS_Z_I = 43,
ADJUSTMENT_POS_Z_D = 44,
ADJUSTMENT_HEADING_P = 45,
ADJUSTMENT_VEL_XY_P = 46,
ADJUSTMENT_VEL_XY_I = 47,
ADJUSTMENT_VEL_XY_D = 48,
ADJUSTMENT_VEL_Z_P = 49,
ADJUSTMENT_VEL_Z_I = 50,
ADJUSTMENT_VEL_Z_D = 51,
ADJUSTMENT_FW_MIN_THROTTLE_DOWN_PITCH_ANGLE = 52,
ADJUSTMENT_VTX_POWER_LEVEL = 53,
ADJUSTMENT_TPA = 54,
ADJUSTMENT_TPA_BREAKPOINT = 55,
ADJUSTMENT_NAV_FW_CONTROL_SMOOTHNESS = 56,
ADJUSTMENT_VTX_POWER_LEVEL = 53,
ADJUSTMENT_TPA = 54,
ADJUSTMENT_TPA_BREAKPOINT = 55,
ADJUSTMENT_NAV_FW_CONTROL_SMOOTHNESS = 56,
ADJUSTMENT_FW_TPA_TIME_CONSTANT = 57,
ADJUSTMENT_FUNCTION_COUNT // must be last
} adjustmentFunction_e;

Expand Down
4 changes: 2 additions & 2 deletions src/main/fc/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1355,8 +1355,8 @@ groups:
min: PWM_RANGE_MIN
max: PWM_RANGE_MAX
- name: fw_tpa_time_constant
description: "TPA smoothing and delay time constant to reflect non-instant speed/throttle response of the plane. Planes with low thrust/weight ratio generally need higher time constant. Default is zero for compatibility with old setups"
default_value: 0
description: "TPA smoothing and delay time constant to reflect non-instant speed/throttle response of the plane. See **PID Attenuation and scaling** Wiki for full details."
default_value: 1500
field: throttle.fixedWingTauMs
min: 0
max: 5000
Expand Down
20 changes: 20 additions & 0 deletions src/main/io/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3017,6 +3017,26 @@ static bool osdDrawSingleElement(uint8_t item)

return true;
}
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_NAV_FW_CONTROL_SMOOTHNESS:
osdDisplayAdjustableDecimalValue(elemPosX, elemPosY, "CTL S", 0, navConfig()->fw.control_smoothness, 1, 0, ADJUSTMENT_NAV_FW_CONTROL_SMOOTHNESS);
Expand Down
1 change: 1 addition & 0 deletions src/main/io/osd.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ typedef enum {
OSD_SWITCH_INDICATOR_1,
OSD_SWITCH_INDICATOR_2,
OSD_SWITCH_INDICATOR_3,
OSD_TPA_TIME_CONSTANT,
OSD_ITEM_COUNT // MUST BE LAST
} osd_items_e;

Expand Down