1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-26 09:45:37 +03:00

PreArm allow Re-Arm (without resetting PreArm AUX) (#14013)

* added prearm_until_first_arm setting

* Update src/main/cli/settings.c

space removed

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>

* increased PG revision

* prearm_allow_rearm

* Update src/main/fc/rc_controls.c

Co-authored-by: Jan Post <Rm2k-Freak@web.de>

---------

Co-authored-by: sprv <sprv.nikita@gmail.com>
Co-authored-by: sprv <86803346+niksprv@users.noreply.github.com>
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
Co-authored-by: Jan Post <Rm2k-Freak@web.de>
This commit is contained in:
nerdCopter 2024-12-10 06:57:04 -06:00 committed by GitHub
parent 9fc83c665f
commit 17cef3bba0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 7 additions and 4 deletions

View file

@ -1046,7 +1046,7 @@ const clivalue_t valueTable[] = {
// PG_ARMING_CONFIG
{ "auto_disarm_delay", VAR_UINT8 | MASTER_VALUE, .config.minmaxUnsigned = { 0, 60 }, PG_ARMING_CONFIG, offsetof(armingConfig_t, auto_disarm_delay) },
{ PARAM_NAME_GYRO_CAL_ON_FIRST_ARM, VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_ARMING_CONFIG, offsetof(armingConfig_t, gyro_cal_on_first_arm) },
{ PARAM_NAME_PREARM_ALLOW_REARM, VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_ARMING_CONFIG, offsetof(armingConfig_t, prearm_allow_rearm) },
// PG_GPS_CONFIG
#ifdef USE_GPS
{ PARAM_NAME_GPS_PROVIDER, VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_GPS_PROVIDER }, PG_GPS_CONFIG, offsetof(gpsConfig_t, provider) },

View file

@ -373,7 +373,7 @@ void updateArmingStatus(void)
}
if (isModeActivationConditionPresent(BOXPREARM)) {
if (IS_RC_MODE_ACTIVE(BOXPREARM) && !ARMING_FLAG(WAS_ARMED_WITH_PREARM)) {
if (IS_RC_MODE_ACTIVE(BOXPREARM) && (!ARMING_FLAG(WAS_ARMED_WITH_PREARM) || armingConfig()->prearm_allow_rearm) ) {
unsetArmingDisabled(ARMING_DISABLED_NOPREARM);
} else {
setArmingDisabled(ARMING_DISABLED_NOPREARM);

View file

@ -90,6 +90,7 @@
#define PARAM_NAME_THROTTLE_LIMIT_TYPE "throttle_limit_type"
#define PARAM_NAME_THROTTLE_LIMIT_PERCENT "throttle_limit_percent"
#define PARAM_NAME_GYRO_CAL_ON_FIRST_ARM "gyro_cal_on_first_arm"
#define PARAM_NAME_PREARM_ALLOW_REARM "prearm_allow_rearm"
#define PARAM_NAME_DEADBAND "deadband"
#define PARAM_NAME_YAW_DEADBAND "yaw_deadband"
#define PARAM_NAME_PID_PROCESS_DENOM "pid_process_denom"

View file

@ -81,11 +81,12 @@ PG_RESET_TEMPLATE(rcControlsConfig_t, rcControlsConfig,
.yaw_control_reversed = false,
);
PG_REGISTER_WITH_RESET_TEMPLATE(armingConfig_t, armingConfig, PG_ARMING_CONFIG, 1);
PG_REGISTER_WITH_RESET_TEMPLATE(armingConfig_t, armingConfig, PG_ARMING_CONFIG, 2);
PG_RESET_TEMPLATE(armingConfig_t, armingConfig,
.gyro_cal_on_first_arm = 0,
.auto_disarm_delay = 5
.auto_disarm_delay = 5,
.prearm_allow_rearm = 0,
);
PG_REGISTER_WITH_RESET_TEMPLATE(flight3DConfig_t, flight3DConfig, PG_MOTOR_3D_CONFIG, 0);

View file

@ -131,6 +131,7 @@ PG_DECLARE(flight3DConfig_t, flight3DConfig);
typedef struct armingConfig_s {
uint8_t gyro_cal_on_first_arm; // calibrate the gyro right before the first arm
uint8_t auto_disarm_delay; // allow automatically disarming multicopters after auto_disarm_delay seconds of zero throttle. Disabled when 0
uint8_t prearm_allow_rearm;
} armingConfig_t;
PG_DECLARE(armingConfig_t, armingConfig);