mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-21 21:55:34 +08:00
Failsafe PWM - Add PWM_MAIN/AUX_FAILx parameters to set "failsafe" values.
This commit is contained in:
@@ -266,6 +266,18 @@ then
|
||||
then
|
||||
pwm failsafe -c ${PWM_AUX_OUT} -p ${FAILSAFE} -d ${OUTPUT_AUX_DEV}
|
||||
fi
|
||||
|
||||
#
|
||||
# Per channel failsafe settings.
|
||||
#
|
||||
pwm failsafe -c 1 -p p:PWM_AUX_FAIL1 -d ${OUTPUT_AUX_DEV}
|
||||
pwm failsafe -c 2 -p p:PWM_AUX_FAIL2 -d ${OUTPUT_AUX_DEV}
|
||||
pwm failsafe -c 3 -p p:PWM_AUX_FAIL3 -d ${OUTPUT_AUX_DEV}
|
||||
pwm failsafe -c 4 -p p:PWM_AUX_FAIL4 -d ${OUTPUT_AUX_DEV}
|
||||
pwm failsafe -c 5 -p p:PWM_AUX_FAIL5 -d ${OUTPUT_AUX_DEV}
|
||||
pwm failsafe -c 6 -p p:PWM_AUX_FAIL6 -d ${OUTPUT_AUX_DEV}
|
||||
pwm failsafe -c 7 -p p:PWM_AUX_FAIL7 -d ${OUTPUT_AUX_DEV}
|
||||
pwm failsafe -c 8 -p p:PWM_AUX_FAIL8 -d ${OUTPUT_AUX_DEV}
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -310,6 +322,18 @@ then
|
||||
then
|
||||
pwm failsafe -c ${PWM_OUT} -p ${FAILSAFE} -d ${OUTPUT_DEV}
|
||||
fi
|
||||
|
||||
#
|
||||
# Per channel failsafe settings.
|
||||
#
|
||||
pwm failsafe -c 1 -p p:PWM_MAIN_FAIL1
|
||||
pwm failsafe -c 2 -p p:PWM_MAIN_FAIL2
|
||||
pwm failsafe -c 3 -p p:PWM_MAIN_FAIL3
|
||||
pwm failsafe -c 4 -p p:PWM_MAIN_FAIL4
|
||||
pwm failsafe -c 5 -p p:PWM_MAIN_FAIL5
|
||||
pwm failsafe -c 6 -p p:PWM_MAIN_FAIL6
|
||||
pwm failsafe -c 7 -p p:PWM_MAIN_FAIL7
|
||||
pwm failsafe -c 8 -p p:PWM_MAIN_FAIL8
|
||||
fi
|
||||
|
||||
unset MIXER_AUX_FILE
|
||||
|
||||
@@ -101,6 +101,136 @@ PARAM_DEFINE_INT32(PWM_AUX_MAX, 2000);
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_AUX_DISARMED, 1500);
|
||||
|
||||
/******************************************************************************
|
||||
* PWM_AUX_FAIL *
|
||||
******************************************************************************/
|
||||
/**
|
||||
* Set the failsafe PWM for the auxiliary 1 output
|
||||
*
|
||||
* This is the PWM pulse the autopilot is outputting if in failsafe mode.
|
||||
* When set to -1 the value is set automatically depending if the actuator
|
||||
* is a motor (900us) or a servo (1500us)
|
||||
*
|
||||
* @reboot_required true
|
||||
*
|
||||
* @min -1
|
||||
* @max 2200
|
||||
* @unit us
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_AUX_FAIL1, -1);
|
||||
|
||||
/**
|
||||
* Set the failsafe PWM for the auxiliary 2 output
|
||||
*
|
||||
* This is the PWM pulse the autopilot is outputting if in failsafe mode.
|
||||
* When set to -1 the value is set automatically depending if the actuator
|
||||
* is a motor (900us) or a servo (1500us)
|
||||
*
|
||||
* @reboot_required true
|
||||
*
|
||||
* @min -1
|
||||
* @max 2200
|
||||
* @unit us
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_AUX_FAIL2, -1);
|
||||
|
||||
/**
|
||||
* Set the failsafe PWM for the auxiliary 3 output
|
||||
*
|
||||
* This is the PWM pulse the autopilot is outputting if in failsafe mode.
|
||||
* When set to -1 the value is set automatically depending if the actuator
|
||||
* is a motor (900us) or a servo (1500us)
|
||||
*
|
||||
* @reboot_required true
|
||||
*
|
||||
* @min -1
|
||||
* @max 2200
|
||||
* @unit us
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_AUX_FAIL3, -1);
|
||||
|
||||
/**
|
||||
* Set the failsafe PWM for the auxiliary 4 output
|
||||
*
|
||||
* This is the PWM pulse the autopilot is outputting if in failsafe mode.
|
||||
* When set to -1 the value is set automatically depending if the actuator
|
||||
* is a motor (900us) or a servo (1500us)
|
||||
*
|
||||
* @reboot_required true
|
||||
*
|
||||
* @min -1
|
||||
* @max 2200
|
||||
* @unit us
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_AUX_FAIL4, -1);
|
||||
|
||||
/**
|
||||
* Set the failsafe PWM for the auxiliary 5 output
|
||||
*
|
||||
* This is the PWM pulse the autopilot is outputting if in failsafe mode.
|
||||
* When set to -1 the value is set automatically depending if the actuator
|
||||
* is a motor (900us) or a servo (1500us)
|
||||
*
|
||||
* @reboot_required true
|
||||
*
|
||||
* @min -1
|
||||
* @max 2200
|
||||
* @unit us
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_AUX_FAIL5, -1);
|
||||
|
||||
/**
|
||||
* Set the failsafe PWM for the auxiliary 6 output
|
||||
*
|
||||
* This is the PWM pulse the autopilot is outputting if in failsafe mode.
|
||||
* When set to -1 the value is set automatically depending if the actuator
|
||||
* is a motor (900us) or a servo (1500us)
|
||||
*
|
||||
* @reboot_required true
|
||||
*
|
||||
* @min -1
|
||||
* @max 2200
|
||||
* @unit us
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_AUX_FAIL6, -1);
|
||||
|
||||
/**
|
||||
* Set the failsafe PWM for the auxiliary 7 output
|
||||
*
|
||||
* This is the PWM pulse the autopilot is outputting if in failsafe mode.
|
||||
* When set to -1 the value is set automatically depending if the actuator
|
||||
* is a motor (900us) or a servo (1500us)
|
||||
*
|
||||
* @reboot_required true
|
||||
*
|
||||
* @min -1
|
||||
* @max 2200
|
||||
* @unit us
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_AUX_FAIL7, -1);
|
||||
|
||||
/**
|
||||
* Set the failsafe PWM for the auxiliary 8 output
|
||||
*
|
||||
* This is the PWM pulse the autopilot is outputting if in failsafe mode.
|
||||
* When set to -1 the value is set automatically depending if the actuator
|
||||
* is a motor (900us) or a servo (1500us)
|
||||
*
|
||||
* @reboot_required true
|
||||
*
|
||||
* @min -1
|
||||
* @max 2200
|
||||
* @unit us
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_AUX_FAIL8, -1);
|
||||
|
||||
/******************************************************************************
|
||||
* PWM_AUX_DIS *
|
||||
|
||||
@@ -101,6 +101,138 @@ PARAM_DEFINE_INT32(PWM_MAX, 2000);
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_DISARMED, 900);
|
||||
|
||||
/******************************************************************************
|
||||
* PWM_MAIN_FAIL *
|
||||
******************************************************************************/
|
||||
|
||||
/**
|
||||
* Set the failsafe PWM for the main 1 output
|
||||
*
|
||||
* This is the PWM pulse the autopilot is outputting if in failsafe mode.
|
||||
* When set to -1 the value is set automatically depending if the actuator
|
||||
* is a motor (900us) or a servo (1500us)
|
||||
*
|
||||
* @reboot_required true
|
||||
*
|
||||
* @min -1
|
||||
* @max 2200
|
||||
* @unit us
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_MAIN_FAIL1, -1);
|
||||
|
||||
/**
|
||||
* Set the failsafe PWM for the main 2 output
|
||||
*
|
||||
* This is the PWM pulse the autopilot is outputting if in failsafe mode.
|
||||
* When set to -1 the value is set automatically depending if the actuator
|
||||
* is a motor (900us) or a servo (1500us)
|
||||
*
|
||||
* @reboot_required true
|
||||
*
|
||||
* @min -1
|
||||
* @max 2200
|
||||
* @unit us
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_MAIN_FAIL2, -1);
|
||||
|
||||
/**
|
||||
* Set the failsafe PWM for the main 3 output
|
||||
*
|
||||
* This is the PWM pulse the autopilot is outputting if in failsafe mode.
|
||||
* When set to -1 the value is set automatically depending if the actuator
|
||||
* is a motor (900us) or a servo (1500us)
|
||||
*
|
||||
* @reboot_required true
|
||||
*
|
||||
* @min -1
|
||||
* @max 2200
|
||||
* @unit us
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_MAIN_FAIL3, -1);
|
||||
|
||||
/**
|
||||
* Set the failsafe PWM for the main 4 output
|
||||
*
|
||||
* This is the PWM pulse the autopilot is outputting if in failsafe mode.
|
||||
* When set to -1 the value is set automatically depending if the actuator
|
||||
* is a motor (900us) or a servo (1500us)
|
||||
*
|
||||
* @reboot_required true
|
||||
*
|
||||
* @min -1
|
||||
* @max 2200
|
||||
* @unit us
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_MAIN_FAIL4, -1);
|
||||
|
||||
/**
|
||||
* Set the failsafe PWM for the main 5 output
|
||||
*
|
||||
* This is the PWM pulse the autopilot is outputting if in failsafe mode.
|
||||
* When set to -1 the value is set automatically depending if the actuator
|
||||
* is a motor (900us) or a servo (1500us)
|
||||
*
|
||||
* @reboot_required true
|
||||
*
|
||||
* @min -1
|
||||
* @max 2200
|
||||
* @unit us
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_MAIN_FAIL5, -1);
|
||||
|
||||
/**
|
||||
* Set the failsafe PWM for the main 6 output
|
||||
*
|
||||
* This is the PWM pulse the autopilot is outputting if in failsafe mode.
|
||||
* When set to -1 the value is set automatically depending if the actuator
|
||||
* is a motor (900us) or a servo (1500us)
|
||||
*
|
||||
* @reboot_required true
|
||||
*
|
||||
* @min -1
|
||||
* @max 2200
|
||||
* @unit us
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_MAIN_FAIL6, -1);
|
||||
|
||||
/**
|
||||
* Set the failsafe PWM for the main 7 output
|
||||
*
|
||||
* This is the PWM pulse the autopilot is outputting if in failsafe mode.
|
||||
* When set to -1 the value is set automatically depending if the actuator
|
||||
* is a motor (900us) or a servo (1500us)
|
||||
*
|
||||
* @reboot_required true
|
||||
*
|
||||
* @min -1
|
||||
* @max 2200
|
||||
* @unit us
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_MAIN_FAIL7, -1);
|
||||
|
||||
/**
|
||||
* Set the failsafe PWM for the main 8 output
|
||||
*
|
||||
* This is the PWM pulse the autopilot is outputting if in failsafe mode.
|
||||
* When set to -1 the value is set automatically depending if the actuator
|
||||
* is a motor (900us) or a servo (1500us)
|
||||
*
|
||||
* @reboot_required true
|
||||
*
|
||||
* @min -1
|
||||
* @max 2200
|
||||
* @unit us
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_MAIN_FAIL8, -1);
|
||||
|
||||
/******************************************************************************
|
||||
* PWM_MAIN_DIS *
|
||||
******************************************************************************/
|
||||
|
||||
@@ -597,6 +597,10 @@ pwm_main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (pwm_value < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pwm_value == 0) {
|
||||
usage("failsafe: no PWM provided");
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user