mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 00:35:39 +03:00
Allow TPA_LOW to be negative (for wings) (#13661)
* Allow TPA_LOW to be negative (for wings) * Fix minimax type Co-authored-by: Mark Haslinghuis <mark@numloq.nl> * Range -128 to 127 Co-authored-by: Mark Haslinghuis <mark@numloq.nl> * Proper limits for TPA Co-authored-by: Jan Post <Rm2k-Freak@web.de> * separate minmaxes for wing/without wing for TPA_LOW Co-authored-by: Mark Haslinghuis <mark@numloq.nl> * Separate define for TPA_LOW_RATE_MIN --------- Co-authored-by: Mark Haslinghuis <mark@numloq.nl> Co-authored-by: Jan Post <Rm2k-Freak@web.de>
This commit is contained in:
parent
e2e1a68ba0
commit
f140fec847
3 changed files with 11 additions and 5 deletions
|
@ -1261,7 +1261,7 @@ const clivalue_t valueTable[] = {
|
|||
#endif
|
||||
{ PARAM_NAME_TPA_RATE, VAR_UINT8 | PROFILE_VALUE, .config.minmaxUnsigned = { 0, TPA_MAX}, PG_PID_PROFILE, offsetof(pidProfile_t, tpa_rate) },
|
||||
{ PARAM_NAME_TPA_BREAKPOINT, VAR_UINT16 | PROFILE_VALUE, .config.minmaxUnsigned = { PWM_RANGE_MIN, PWM_RANGE_MAX }, PG_PID_PROFILE, offsetof(pidProfile_t, tpa_breakpoint) },
|
||||
{ PARAM_NAME_TPA_LOW_RATE, VAR_UINT8 | PROFILE_VALUE, .config.minmaxUnsigned = { 0, TPA_MAX}, PG_PID_PROFILE, offsetof(pidProfile_t, tpa_low_rate) },
|
||||
{ PARAM_NAME_TPA_LOW_RATE, VAR_INT8 | PROFILE_VALUE, .config.minmax = { TPA_LOW_RATE_MIN, TPA_MAX }, PG_PID_PROFILE, offsetof(pidProfile_t, tpa_low_rate) },
|
||||
{ PARAM_NAME_TPA_LOW_BREAKPOINT, VAR_UINT16 | PROFILE_VALUE, .config.minmaxUnsigned = { PWM_RANGE_MIN, PWM_RANGE_MAX }, PG_PID_PROFILE, offsetof(pidProfile_t, tpa_low_breakpoint) },
|
||||
{ PARAM_NAME_TPA_LOW_ALWAYS, VAR_UINT8 | PROFILE_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_PID_PROFILE, offsetof(pidProfile_t, tpa_low_always) },
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ static uint8_t cmsx_simplified_gyro_filter;
|
|||
static uint8_t cmsx_simplified_gyro_filter_multiplier;
|
||||
static uint8_t cmsx_tpa_rate;
|
||||
static uint16_t cmsx_tpa_breakpoint;
|
||||
static uint8_t cmsx_tpa_low_rate;
|
||||
static int8_t cmsx_tpa_low_rate;
|
||||
static uint16_t cmsx_tpa_low_breakpoint;
|
||||
static uint8_t cmsx_tpa_low_always;
|
||||
|
||||
|
@ -552,7 +552,7 @@ static uint8_t cmsx_feedforward_jitter_factor;
|
|||
|
||||
static uint8_t cmsx_tpa_rate;
|
||||
static uint16_t cmsx_tpa_breakpoint;
|
||||
static uint8_t cmsx_tpa_low_rate;
|
||||
static int8_t cmsx_tpa_low_rate;
|
||||
static uint16_t cmsx_tpa_low_breakpoint;
|
||||
static uint8_t cmsx_tpa_low_always;
|
||||
|
||||
|
@ -725,7 +725,7 @@ static const OSD_Entry cmsx_menuProfileOtherEntries[] = {
|
|||
|
||||
{ "TPA RATE", OME_FLOAT, NULL, &(OSD_FLOAT_t) { &cmsx_tpa_rate, 0, 100, 1, 10} },
|
||||
{ "TPA BRKPT", OME_UINT16, NULL, &(OSD_UINT16_t){ &cmsx_tpa_breakpoint, 1000, 2000, 10} },
|
||||
{ "TPA LOW RATE", OME_UINT8, NULL, &(OSD_UINT8_t) { &cmsx_tpa_low_rate, 0, 100, 1} },
|
||||
{ "TPA LOW RATE", OME_INT8, NULL, &(OSD_INT8_t) { &cmsx_tpa_low_rate, TPA_LOW_RATE_MIN, TPA_MAX , 1} },
|
||||
{ "TPA LOW BRKPT", OME_UINT16, NULL, &(OSD_UINT16_t){ &cmsx_tpa_low_breakpoint, 1000, 2000, 10} },
|
||||
{ "TPA LOW ALWYS", OME_Bool, NULL, &cmsx_tpa_low_always },
|
||||
|
||||
|
|
|
@ -70,6 +70,12 @@
|
|||
|
||||
#define TPA_MAX 100
|
||||
|
||||
#ifdef USE_WING
|
||||
#define TPA_LOW_RATE_MIN INT8_MIN
|
||||
#else
|
||||
#define TPA_LOW_RATE_MIN 0
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
TPA_MODE_PD,
|
||||
TPA_MODE_D
|
||||
|
@ -239,7 +245,7 @@ typedef struct pidProfile_s {
|
|||
uint8_t angle_feedforward_smoothing_ms; // Smoothing factor for angle feedforward as time constant in milliseconds
|
||||
uint8_t angle_earth_ref; // Control amount of "co-ordination" from yaw into roll while pitched forward in angle mode
|
||||
uint16_t horizon_delay_ms; // delay when Horizon Strength increases, 50 = 500ms time constant
|
||||
uint8_t tpa_low_rate; // Percent reduction in P or D at zero throttle
|
||||
int8_t tpa_low_rate; // Percent reduction in P or D at zero throttle
|
||||
uint16_t tpa_low_breakpoint; // Breakpoint where lower TPA is deactivated
|
||||
uint8_t tpa_low_always; // off, on - if OFF then low TPA is only active until tpa_low_breakpoint is reached the first time
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue