From fc7f4d517983547b9b662e55cdb767ce92f4c804 Mon Sep 17 00:00:00 2001 From: oleost Date: Sun, 17 Jul 2016 20:42:10 +0200 Subject: [PATCH 1/3] Changed arming procedure for fixedwing. With Fixedwing and motorstop enable it auto arms as soon as throttle as above throttle_low. Also disarming is disabled. (Must cycle power for it to disarm) Without motorstop there is normal disarm/arming procedure. --- src/main/fc/rc_controls.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/fc/rc_controls.c b/src/main/fc/rc_controls.c index 71d947c8b..b8aafca70 100644 --- a/src/main/fc/rc_controls.c +++ b/src/main/fc/rc_controls.c @@ -195,17 +195,23 @@ void processRcStickPositions(rxConfig_t *rxConfig, throttleStatus_e throttleStat return; } - if (isUsingSticksToArm) { + if (isUsingSticksToArm) { // Disarm on throttle down + yaw if (rcSticks == THR_LO + YAW_LO + PIT_CE + ROL_CE) { + // Dont disarm if fixedwing and motorstop + if (STATE(FIXED_WING) && feature(FEATURE_MOTOR_STOP)) { + return; + } + else { if (ARMING_FLAG(ARMED)) mwDisarm(); else { beeper(BEEPER_DISARM_REPEAT); // sound tone while stick held rcDelayCommand = 0; // reset so disarm tone will repeat + } } } - } + } if (ARMING_FLAG(ARMED)) { // actions during armed @@ -246,6 +252,16 @@ void processRcStickPositions(rxConfig_t *rxConfig, throttleStatus_e throttleStat } } +// Auto arm on throttle when using fixedwing and motorstop + if (isUsingSticksToArm) { + + if ((!throttleStatus == THROTTLE_LOW) && (STATE(FIXED_WING)) && (feature(FEATURE_MOTOR_STOP))) { + // Arm via YAW + mwArm(); + return; + } + } + if (rcSticks == THR_HI + YAW_LO + PIT_LO + ROL_CE) { // Calibrating Acc accSetCalibrationCycles(CALIBRATING_ACC_CYCLES); From 7c185db0605cae6f60d78efbbe7440e14ddc6b05 Mon Sep 17 00:00:00 2001 From: "Konstantin (DigitalEntity) Sharlaimov" Date: Sat, 23 Jul 2016 14:37:34 +0300 Subject: [PATCH 2/3] Auto arm fixed wing aircrafts (improved) --- src/main/config/config_master.h | 1 + src/main/fc/mw.c | 2 +- src/main/fc/rc_controls.c | 47 +++++++++++++++++---------------- src/main/fc/rc_controls.h | 2 +- src/main/io/serial_cli.c | 1 + 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/main/config/config_master.h b/src/main/config/config_master.h index 88b4d9a67..d13a0420d 100644 --- a/src/main/config/config_master.h +++ b/src/main/config/config_master.h @@ -74,6 +74,7 @@ typedef struct master_s { failsafeConfig_t failsafeConfig; + uint8_t fixed_wing_auto_arm; // Auto-arm fixed wing aircraft on throttle up and never disarm uint8_t disarm_kill_switch; // allow disarm via AUX switch regardless of throttle value uint8_t auto_disarm_delay; // allow automatically disarming multicopters after auto_disarm_delay seconds of zero throttle. Disabled when 0 uint8_t small_angle; diff --git a/src/main/fc/mw.c b/src/main/fc/mw.c index a251fd8cc..f03a71a38 100755 --- a/src/main/fc/mw.c +++ b/src/main/fc/mw.c @@ -341,7 +341,7 @@ void processRx(void) } } - processRcStickPositions(&masterConfig.rxConfig, throttleStatus, masterConfig.disarm_kill_switch); + processRcStickPositions(&masterConfig.rxConfig, throttleStatus, masterConfig.disarm_kill_switch, masterConfig.fixed_wing_auto_arm); updateActivatedModes(currentProfile->modeActivationConditions, currentProfile->modeActivationOperator); diff --git a/src/main/fc/rc_controls.c b/src/main/fc/rc_controls.c index b8aafca70..eda363741 100644 --- a/src/main/fc/rc_controls.c +++ b/src/main/fc/rc_controls.c @@ -145,7 +145,7 @@ rollPitchStatus_e calculateRollPitchCenterStatus(rxConfig_t *rxConfig) return NOT_CENTERED; } -void processRcStickPositions(rxConfig_t *rxConfig, throttleStatus_e throttleStatus, bool disarm_kill_switch) +void processRcStickPositions(rxConfig_t *rxConfig, throttleStatus_e throttleStatus, bool disarm_kill_switch, bool fixed_wing_auto_arm) { static uint8_t rcDelayCommand; // this indicates the number of time (multiple of RC measurement at 50Hz) the sticks must be maintained to run or switch off motors static uint8_t rcSticks; // this hold sticks position for command combos @@ -170,7 +170,6 @@ void processRcStickPositions(rxConfig_t *rxConfig, throttleStatus_e throttleStat // perform actions if (!isUsingSticksToArm) { - if (IS_RC_MODE_ACTIVE(BOXARM)) { // Arming via ARM BOX if (throttleStatus == THROTTLE_LOW) { @@ -196,19 +195,19 @@ void processRcStickPositions(rxConfig_t *rxConfig, throttleStatus_e throttleStat } if (isUsingSticksToArm) { - // Disarm on throttle down + yaw - if (rcSticks == THR_LO + YAW_LO + PIT_CE + ROL_CE) { - // Dont disarm if fixedwing and motorstop - if (STATE(FIXED_WING) && feature(FEATURE_MOTOR_STOP)) { + // Dont disarm if fixedwing and motorstop + if (STATE(FIXED_WING) && feature(FEATURE_MOTOR_STOP) && fixed_wing_auto_arm) { return; } - else { - if (ARMING_FLAG(ARMED)) + + // Disarm on throttle down + yaw + if (rcSticks == THR_LO + YAW_LO + PIT_CE + ROL_CE) { + if (ARMING_FLAG(ARMED)) { mwDisarm(); + } else { beeper(BEEPER_DISARM_REPEAT); // sound tone while stick held rcDelayCommand = 0; // reset so disarm tone will repeat - } } } } @@ -239,29 +238,31 @@ void processRcStickPositions(rxConfig_t *rxConfig, throttleStatus_e throttleStat return; } + if (rcSticks == THR_LO + YAW_LO + PIT_LO + ROL_HI) { saveConfigAndNotify(); } - if (isUsingSticksToArm) { - - if (rcSticks == THR_LO + YAW_HI + PIT_CE + ROL_CE) { - // Arm via YAW - mwArm(); - return; - } - } -// Auto arm on throttle when using fixedwing and motorstop if (isUsingSticksToArm) { - - if ((!throttleStatus == THROTTLE_LOW) && (STATE(FIXED_WING)) && (feature(FEATURE_MOTOR_STOP))) { - // Arm via YAW - mwArm(); - return; + if (STATE(FIXED_WING) && feature(FEATURE_MOTOR_STOP) && fixed_wing_auto_arm) { + // Auto arm on throttle when using fixedwing and motorstop + if (throttleStatus != THROTTLE_LOW) { + // Arm via YAW + mwArm(); + return; + } + } + else { + if (rcSticks == THR_LO + YAW_HI + PIT_CE + ROL_CE) { + // Arm via YAW + mwArm(); + return; + } } } + if (rcSticks == THR_HI + YAW_LO + PIT_LO + ROL_CE) { // Calibrating Acc accSetCalibrationCycles(CALIBRATING_ACC_CYCLES); diff --git a/src/main/fc/rc_controls.h b/src/main/fc/rc_controls.h index 4e6b5ae45..7e2e6ba24 100644 --- a/src/main/fc/rc_controls.h +++ b/src/main/fc/rc_controls.h @@ -174,7 +174,7 @@ bool areUsingSticksToArm(void); bool areSticksInApModePosition(uint16_t ap_mode); throttleStatus_e calculateThrottleStatus(rxConfig_t *rxConfig, uint16_t deadband3d_throttle); rollPitchStatus_e calculateRollPitchCenterStatus(rxConfig_t *rxConfig); -void processRcStickPositions(rxConfig_t *rxConfig, throttleStatus_e throttleStatus, bool disarm_kill_switch); +void processRcStickPositions(rxConfig_t *rxConfig, throttleStatus_e throttleStatus, bool disarm_kill_switch, bool fixed_wing_auto_arm); void updateActivatedModes(modeActivationCondition_t *modeActivationConditions, modeActivationOperator_e modeActivationOperator); diff --git a/src/main/io/serial_cli.c b/src/main/io/serial_cli.c index 4e657b3e9..d1d652822 100644 --- a/src/main/io/serial_cli.c +++ b/src/main/io/serial_cli.c @@ -603,6 +603,7 @@ const clivalue_t valueTable[] = { { "motor_pwm_rate", VAR_UINT16 | MASTER_VALUE, &masterConfig.motor_pwm_rate, .config.minmax = { 50, 32000 }, 0 }, + { "fixed_wing_auto_arm", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.fixed_wing_auto_arm, .config.lookup = { TABLE_OFF_ON }, 0 }, { "disarm_kill_switch", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.disarm_kill_switch, .config.lookup = { TABLE_OFF_ON }, 0 }, { "auto_disarm_delay", VAR_UINT8 | MASTER_VALUE, &masterConfig.auto_disarm_delay, .config.minmax = { 0, 60 }, 0 }, { "small_angle", VAR_UINT8 | MASTER_VALUE, &masterConfig.small_angle, .config.minmax = { 0, 180 }, 0 }, From a604138fe3ce9014ee98974f04b13ba9a133c83b Mon Sep 17 00:00:00 2001 From: "Konstantin (DigitalEntity) Sharlaimov" Date: Sun, 24 Jul 2016 04:02:14 +0300 Subject: [PATCH 3/3] Bug fix for bloced arming --- src/main/fc/rc_controls.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/fc/rc_controls.c b/src/main/fc/rc_controls.c index eda363741..73f755650 100644 --- a/src/main/fc/rc_controls.c +++ b/src/main/fc/rc_controls.c @@ -195,14 +195,13 @@ void processRcStickPositions(rxConfig_t *rxConfig, throttleStatus_e throttleStat } if (isUsingSticksToArm) { - // Dont disarm if fixedwing and motorstop - if (STATE(FIXED_WING) && feature(FEATURE_MOTOR_STOP) && fixed_wing_auto_arm) { - return; - } - // Disarm on throttle down + yaw if (rcSticks == THR_LO + YAW_LO + PIT_CE + ROL_CE) { - if (ARMING_FLAG(ARMED)) { + // Dont disarm if fixedwing and motorstop + if (STATE(FIXED_WING) && feature(FEATURE_MOTOR_STOP) && fixed_wing_auto_arm) { + return; + } + else if (ARMING_FLAG(ARMED)) { mwDisarm(); } else {