diff --git a/src/main/blackbox/blackbox.c b/src/main/blackbox/blackbox.c index 59ac1246d3..118dc43ed2 100644 --- a/src/main/blackbox/blackbox.c +++ b/src/main/blackbox/blackbox.c @@ -1419,7 +1419,7 @@ static bool blackboxWriteSysinfo(void) BLACKBOX_PRINT_HEADER_LINE(PARAM_NAME_EZ_LANDING_THRESHOLD, "%d", currentPidProfile->ez_landing_threshold); BLACKBOX_PRINT_HEADER_LINE(PARAM_NAME_EZ_LANDING_LIMIT, "%d", currentPidProfile->ez_landing_limit); BLACKBOX_PRINT_HEADER_LINE(PARAM_NAME_EZ_LANDING_SPEED, "%d", currentPidProfile->ez_landing_speed); - BLACKBOX_PRINT_HEADER_LINE(PARAM_NAME_EZ_DISARM_THRESHOLD, "%d", currentPidProfile->ez_landing_disarm_threshold); + BLACKBOX_PRINT_HEADER_LINE(PARAM_NAME_LANDING_DISARM_THRESHOLD, "%d", currentPidProfile->landing_disarm_threshold); #ifdef USE_WING BLACKBOX_PRINT_HEADER_LINE(PARAM_NAME_SPA_ROLL_CENTER, "%d", currentPidProfile->spa_center[FD_ROLL]); diff --git a/src/main/cli/settings.c b/src/main/cli/settings.c index cf5bf048a5..a9c10ffe7c 100644 --- a/src/main/cli/settings.c +++ b/src/main/cli/settings.c @@ -1278,7 +1278,7 @@ const clivalue_t valueTable[] = { { PARAM_NAME_EZ_LANDING_THRESHOLD, VAR_UINT8 | PROFILE_VALUE, .config.minmaxUnsigned = { 0, 200 }, PG_PID_PROFILE, offsetof(pidProfile_t, ez_landing_threshold) }, { PARAM_NAME_EZ_LANDING_LIMIT, VAR_UINT8 | PROFILE_VALUE, .config.minmaxUnsigned = { 0, 75 }, PG_PID_PROFILE, offsetof(pidProfile_t, ez_landing_limit) }, { PARAM_NAME_EZ_LANDING_SPEED, VAR_UINT8 | PROFILE_VALUE, .config.minmaxUnsigned = { 0, 250 }, PG_PID_PROFILE, offsetof(pidProfile_t, ez_landing_speed) }, - { PARAM_NAME_EZ_DISARM_THRESHOLD, VAR_UINT8 | PROFILE_VALUE, .config.minmaxUnsigned = { 0, 250 }, PG_PID_PROFILE, offsetof(pidProfile_t, ez_landing_disarm_threshold) }, + { PARAM_NAME_LANDING_DISARM_THRESHOLD, VAR_UINT8 | PROFILE_VALUE, .config.minmaxUnsigned = { 0, 250 }, PG_PID_PROFILE, offsetof(pidProfile_t, landing_disarm_threshold) }, #ifdef USE_WING { PARAM_NAME_SPA_ROLL_CENTER, VAR_UINT16 | PROFILE_VALUE, .config.minmaxUnsigned = { 0, UINT16_MAX }, PG_PID_PROFILE, offsetof(pidProfile_t, spa_center[FD_ROLL]) }, diff --git a/src/main/cms/cms_menu_imu.c b/src/main/cms/cms_menu_imu.c index 2daf813112..b052256ca1 100644 --- a/src/main/cms/cms_menu_imu.c +++ b/src/main/cms/cms_menu_imu.c @@ -266,7 +266,7 @@ static uint16_t cmsx_tpa_breakpoint; static int8_t cmsx_tpa_low_rate; static uint16_t cmsx_tpa_low_breakpoint; static uint8_t cmsx_tpa_low_always; -static uint8_t cmsx_ez_landing_disarm_threshold; +static uint8_t cmsx_landing_disarm_threshold; static const void *cmsx_simplifiedTuningOnEnter(displayPort_t *pDisp) { @@ -611,7 +611,7 @@ static const void *cmsx_profileOtherOnEnter(displayPort_t *pDisp) cmsx_tpa_low_rate = pidProfile->tpa_low_rate; cmsx_tpa_low_breakpoint = pidProfile->tpa_low_breakpoint; cmsx_tpa_low_always = pidProfile->tpa_low_always; - cmsx_ez_landing_disarm_threshold = pidProfile->ez_landing_disarm_threshold; + cmsx_landing_disarm_threshold = pidProfile->landing_disarm_threshold; return NULL; } @@ -669,7 +669,7 @@ static const void *cmsx_profileOtherOnExit(displayPort_t *pDisp, const OSD_Entry pidProfile->tpa_low_rate = cmsx_tpa_low_rate; pidProfile->tpa_low_breakpoint = cmsx_tpa_low_breakpoint; pidProfile->tpa_low_always = cmsx_tpa_low_always; - pidProfile->ez_landing_disarm_threshold = cmsx_ez_landing_disarm_threshold; + pidProfile->landing_disarm_threshold = cmsx_landing_disarm_threshold; initEscEndpoints(); return NULL; @@ -730,7 +730,7 @@ static const OSD_Entry cmsx_menuProfileOtherEntries[] = { { "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 }, - { "EZDISARM THR", OME_UINT8, NULL, &(OSD_UINT8_t) { &cmsx_ez_landing_disarm_threshold, 0, 150, 1} }, + { "EZDISARM THR", OME_UINT8, NULL, &(OSD_UINT8_t) { &cmsx_landing_disarm_threshold, 0, 150, 1} }, { "BACK", OME_Back, NULL, NULL }, { NULL, OME_END, NULL, NULL} diff --git a/src/main/fc/parameter_names.h b/src/main/fc/parameter_names.h index 30540b28b7..7a2414af5c 100644 --- a/src/main/fc/parameter_names.h +++ b/src/main/fc/parameter_names.h @@ -65,7 +65,7 @@ #define PARAM_NAME_EZ_LANDING_THRESHOLD "ez_landing_threshold" #define PARAM_NAME_EZ_LANDING_LIMIT "ez_landing_limit" #define PARAM_NAME_EZ_LANDING_SPEED "ez_landing_speed" -#define PARAM_NAME_EZ_DISARM_THRESHOLD "ez_landing_disarm_threshold" +#define PARAM_NAME_LANDING_DISARM_THRESHOLD "landing_disarm_threshold" #define PARAM_NAME_SPA_ROLL_CENTER "spa_roll_center" #define PARAM_NAME_SPA_ROLL_WIDTH "spa_roll_width" #define PARAM_NAME_SPA_ROLL_MODE "spa_roll_mode" diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index f5be1d0910..5da5f5ef0f 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -236,7 +236,7 @@ void resetPidProfile(pidProfile_t *pidProfile) .spa_center = { 0, 0, 0 }, .spa_width = { 0, 0, 0 }, .spa_mode = { 0, 0, 0 }, - .ez_landing_disarm_threshold = 0 , + .landing_disarm_threshold = 0, // relatively safe values are around 100 ); #ifndef USE_D_MIN @@ -780,7 +780,7 @@ static FAST_CODE_NOINLINE void disarmOnImpact(void) // if all sticks are within 5% of center, and throttle low, check accDelta for impacts // threshold should be high enough to avoid unwanted disarms in the air on throttle chops if (isAirmodeActivated() && getMaxRcDeflectionAbs() < 0.05f && mixerGetRcThrottle() < 0.05f && - fabsf(acc.accDelta) > pidRuntime.ezLandingDisarmThreshold) { + fabsf(acc.accDelta) > pidRuntime.landingDisarmThreshold) { // disarm on accDelta transients setArmingDisabled(ARMING_DISABLED_ARM_SWITCH); disarm(DISARM_REASON_LANDING); diff --git a/src/main/flight/pid.h b/src/main/flight/pid.h index 6023cd0183..a4291bcd09 100644 --- a/src/main/flight/pid.h +++ b/src/main/flight/pid.h @@ -261,7 +261,7 @@ typedef struct pidProfile_s { uint8_t ez_landing_threshold; // Threshold stick position below which motor output is limited uint8_t ez_landing_limit; // Maximum motor output when all sticks centred and throttle zero uint8_t ez_landing_speed; // Speed below which motor output is limited - uint8_t ez_landing_disarm_threshold; // Accelerometer vector threshold which disarms if exceeded + uint8_t landing_disarm_threshold; // Accelerometer vector delta (jerk) threshold with disarms if exceeded uint16_t tpa_delay_ms; // TPA delay for fixed wings using pt2 filter (time constant) uint16_t spa_center[XYZ_AXIS_COUNT]; // RPY setpoint at which PIDs are reduced to 50% (setpoint PID attenuation) @@ -361,7 +361,7 @@ typedef struct pidRuntime_s { float tpaLowMultiplier; bool tpaLowAlways; bool useEzDisarm; - float ezLandingDisarmThreshold; + float landingDisarmThreshold; #ifdef USE_ITERM_RELAX pt1Filter_t windupLpf[XYZ_AXIS_COUNT]; diff --git a/src/main/flight/pid_init.c b/src/main/flight/pid_init.c index 383e71ccc2..3a507a3f51 100644 --- a/src/main/flight/pid_init.c +++ b/src/main/flight/pid_init.c @@ -442,8 +442,8 @@ void pidInitConfig(const pidProfile_t *pidProfile) pidRuntime.tpaLowMultiplier = pidProfile->tpa_low_rate / (100.0f * pidRuntime.tpaLowBreakpoint); pidRuntime.tpaLowAlways = pidProfile->tpa_low_always; - pidRuntime.useEzDisarm = pidProfile->ez_landing_disarm_threshold > 0; - pidRuntime.ezLandingDisarmThreshold = pidProfile->ez_landing_disarm_threshold * 10.0f; + pidRuntime.useEzDisarm = pidProfile->landing_disarm_threshold > 0; + pidRuntime.landingDisarmThreshold = pidProfile->landing_disarm_threshold * 10.0f; } diff --git a/src/test/unit/pid_unittest.cc b/src/test/unit/pid_unittest.cc index 28825708db..afc7d8770e 100644 --- a/src/test/unit/pid_unittest.cc +++ b/src/test/unit/pid_unittest.cc @@ -89,8 +89,7 @@ extern "C" { bool isAirmodeActivated(void) { return simulatedAirmodeEnabled; } float getRcDeflectionAbs(int axis) { return fabsf(simulatedRcDeflection[axis]); } - // for ezLanding auto-disarm - // note that there is no test to check that this code works. + // used by ezDisarm auto-disarm code float getMaxRcDeflectionAbs() { return fabsf(simulatedMaxRcDeflectionAbs); } float mixerGetRcThrottle() { return fabsf(simulatedMixerGetRcThrottle); }