1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 19:40:31 +03:00

Re-name ezDisarm variables and tidying up (#13835)

* just re-naming variables and tidying up

* change name to landing_disarm_threshold
This commit is contained in:
ctzsnooze 2024-08-21 17:01:49 +10:00 committed by GitHub
parent 8feb741e17
commit dd73ce4dd7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 14 additions and 15 deletions

View file

@ -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]);

View file

@ -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]) },

View file

@ -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}

View file

@ -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"

View file

@ -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);

View file

@ -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];

View file

@ -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;
}

View file

@ -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); }