Copy/paste logic in rc.interface to group MIXER and MIXER_AUX logic, alphabetize hardware list in rc.interface, alphabetize set/unset lists in rcS, and add -p argument to pwm failsafe calls per issue #9775.

This commit is contained in:
mcsauder
2018-07-17 04:24:02 -06:00
committed by Beat Küng
parent 50b5e124d5
commit 71ceb0cfd6
2 changed files with 85 additions and 109 deletions
+71 -93
View File
@@ -9,26 +9,36 @@
# Otherwise, the variable name goes to the end of the argument. # Otherwise, the variable name goes to the end of the argument.
# #
set MIXER_AUX_FILE none
set OUTPUT_AUX_DEV /dev/pwm_output1
set SDCARD_MIXERS_PATH /fs/microsd/etc/mixers set SDCARD_MIXERS_PATH /fs/microsd/etc/mixers
if ver hwcmp AEROFC_V1 AV_X_V1 CRAZYFLIE MINDPX_V2 NXPHLITE_V3 PX4FMU_V4 OMNIBUS_F4SD
then
set MIXER_AUX none
fi
if [ $USE_IO == no ]
then
set MIXER_AUX none
fi
if [ $MIXER != none -a $MIXER != skip ] if [ $MIXER != none -a $MIXER != skip ]
then then
# #
# Load main mixer # Load main mixer.
# #
if [ $MIXER_AUX == none -a $USE_IO == yes ] if [ $MIXER_AUX == none -a $USE_IO == yes ]
then then
set MIXER_AUX ${MIXER} set MIXER_AUX ${MIXER}
fi fi
# Use the mixer file from the SD-card if it exists
if [ -f ${SDCARD_MIXERS_PATH}/${MIXER}.main.mix ] if [ -f ${SDCARD_MIXERS_PATH}/${MIXER}.main.mix ]
then then
# Use the mixer file from the SD-card if it exists.
set MIXER_FILE ${SDCARD_MIXERS_PATH}/${MIXER}.main.mix set MIXER_FILE ${SDCARD_MIXERS_PATH}/${MIXER}.main.mix
# Try out the old convention, for backward compatibility
else else
# Try out the old convention, for backward compatibility.
if [ -f ${SDCARD_MIXERS_PATH}/${MIXER}.mix ] if [ -f ${SDCARD_MIXERS_PATH}/${MIXER}.mix ]
then then
set MIXER_FILE ${SDCARD_MIXERS_PATH}/${MIXER}.mix set MIXER_FILE ${SDCARD_MIXERS_PATH}/${MIXER}.mix
@@ -73,72 +83,11 @@ else
fi fi
fi fi
if [ $OUTPUT_MODE == fmu -o $OUTPUT_MODE == io ]
then
if [ $PWM_OUT != none ]
then
#
# Set PWM output frequency
#
if [ $PWM_RATE != none ]
then
pwm rate -c ${PWM_OUT} -r ${PWM_RATE}
fi
#
# Set disarmed, min and max PWM values
#
if [ $PWM_DISARMED != none ]
then
pwm disarmed -c ${PWM_OUT} -p ${PWM_DISARMED}
fi
if [ $PWM_MIN != none ]
then
pwm min -c ${PWM_OUT} -p ${PWM_MIN}
fi
if [ $PWM_MAX != none ]
then
pwm max -c ${PWM_OUT} -p ${PWM_MAX}
fi
fi
#
# Per channel disarmed settings
#
pwm disarmed -c 1 -p p:PWM_MAIN_DIS1
pwm disarmed -c 2 -p p:PWM_MAIN_DIS2
pwm disarmed -c 3 -p p:PWM_MAIN_DIS3
pwm disarmed -c 4 -p p:PWM_MAIN_DIS4
pwm disarmed -c 5 -p p:PWM_MAIN_DIS5
pwm disarmed -c 6 -p p:PWM_MAIN_DIS6
pwm disarmed -c 7 -p p:PWM_MAIN_DIS7
pwm disarmed -c 8 -p p:PWM_MAIN_DIS8
if [ $FAILSAFE != none ]
then
pwm failsafe -d ${OUTPUT_DEV} ${FAILSAFE}
fi
fi
if ver hwcmp MINDPX_V2 CRAZYFLIE AEROFC_V1 PX4FMU_V4 NXPHLITE_V3 OMNIBUS_F4SD AV_X_V1
then
set MIXER_AUX none
fi
if [ $USE_IO == no ]
then
set MIXER_AUX none
fi
if [ $MIXER_AUX != none -a $AUX_MODE != none ] if [ $MIXER_AUX != none -a $AUX_MODE != none ]
then then
# #
# Load aux mixer # Load aux mixer.
# #
set MIXER_AUX_FILE none
set OUTPUT_AUX_DEV /dev/pwm_output1
if [ -f ${SDCARD_MIXERS_PATH}/${MIXER_AUX}.aux.mix ] if [ -f ${SDCARD_MIXERS_PATH}/${MIXER_AUX}.aux.mix ]
then then
set MIXER_AUX_FILE ${SDCARD_MIXERS_PATH}/${MIXER_AUX}.aux.mix set MIXER_AUX_FILE ${SDCARD_MIXERS_PATH}/${MIXER_AUX}.aux.mix
@@ -154,7 +103,7 @@ then
then then
if fmu mode_${AUX_MODE} $FMU_ARGS if fmu mode_${AUX_MODE} $FMU_ARGS
then then
# Append aux mixer to main device # Append aux mixer to main device.
if param compare SYS_HITL 1 if param compare SYS_HITL 1
then then
if mixer append ${OUTPUT_DEV} ${MIXER_AUX_FILE} if mixer append ${OUTPUT_DEV} ${MIXER_AUX_FILE}
@@ -185,12 +134,10 @@ then
set FAILSAFE_AUX none set FAILSAFE_AUX none
fi fi
# Set min / max for aux out and rates # Set min / max for aux out and rates.
if [ $PWM_AUX_OUT != none ] if [ $PWM_AUX_OUT != none ]
then then
# # Set PWM_AUX output frequency.
# Set PWM_AUX output frequency
#
if [ $PWM_AUX_RATE != none ] if [ $PWM_AUX_RATE != none ]
then then
pwm rate -c ${PWM_AUX_OUT} -r ${PWM_AUX_RATE} -d ${OUTPUT_AUX_DEV} pwm rate -c ${PWM_AUX_OUT} -r ${PWM_AUX_RATE} -d ${OUTPUT_AUX_DEV}
@@ -206,17 +153,17 @@ then
fi fi
fi fi
# Set disarmed values for aux out #
# Set disarmed values for aux out.
# Transitional support until all configs # Transitional support until all configs are updated.
# are updated #
if [ $PWM_ACHDIS == none ] if [ $PWM_ACHDIS == none ]
then then
set PWM_ACHDIS ${PWM_AUX_OUT} set PWM_ACHDIS ${PWM_AUX_OUT}
fi fi
# #
# Set disarmed, min and max PWM_AUX values # Set disarmed, min and max PWM_AUX values.
# #
if [ $PWM_AUX_DISARMED != none -a $PWM_ACHDIS != none ] if [ $PWM_AUX_DISARMED != none -a $PWM_ACHDIS != none ]
then then
@@ -224,7 +171,7 @@ then
fi fi
# #
# Per channel disarmed settings # Per channel disarmed settings.
# #
pwm disarmed -c 1 -p p:PWM_AUX_DIS1 -d ${OUTPUT_AUX_DEV} pwm disarmed -c 1 -p p:PWM_AUX_DIS1 -d ${OUTPUT_AUX_DEV}
pwm disarmed -c 2 -p p:PWM_AUX_DIS2 -d ${OUTPUT_AUX_DEV} pwm disarmed -c 2 -p p:PWM_AUX_DIS2 -d ${OUTPUT_AUX_DEV}
@@ -235,23 +182,54 @@ then
if [ $FAILSAFE_AUX != none ] if [ $FAILSAFE_AUX != none ]
then then
pwm failsafe -d ${OUTPUT_AUX_DEV} ${FAILSAFE} pwm failsafe -p ${FAILSAFE} -d ${OUTPUT_AUX_DEV}
fi fi
fi fi
fi fi
unset PWM_OUT if [ $OUTPUT_MODE == fmu -o $OUTPUT_MODE == io ]
unset PWM_RATE then
unset PWM_ACHDIS if [ $PWM_OUT != none ]
unset PWM_MIN then
unset PWM_MAX # Set PWM output frequency.
unset PWM_AUX_OUT if [ $PWM_RATE != none ]
unset PWM_AUX_RATE then
unset PWM_AUX_DISARMED pwm rate -c ${PWM_OUT} -r ${PWM_RATE}
unset PWM_AUX_MIN fi
unset PWM_AUX_MAX
unset FAILSAFE_AUX # Set disarmed, min and max PWM values.
unset FAILSAFE if [ $PWM_DISARMED != none ]
unset OUTPUT_DEV then
pwm disarmed -c ${PWM_OUT} -p ${PWM_DISARMED}
fi
if [ $PWM_MIN != none ]
then
pwm min -c ${PWM_OUT} -p ${PWM_MIN}
fi
if [ $PWM_MAX != none ]
then
pwm max -c ${PWM_OUT} -p ${PWM_MAX}
fi
fi
#
# Per channel disarmed settings.
#
pwm disarmed -c 1 -p p:PWM_MAIN_DIS1
pwm disarmed -c 2 -p p:PWM_MAIN_DIS2
pwm disarmed -c 3 -p p:PWM_MAIN_DIS3
pwm disarmed -c 4 -p p:PWM_MAIN_DIS4
pwm disarmed -c 5 -p p:PWM_MAIN_DIS5
pwm disarmed -c 6 -p p:PWM_MAIN_DIS6
pwm disarmed -c 7 -p p:PWM_MAIN_DIS7
pwm disarmed -c 8 -p p:PWM_MAIN_DIS8
if [ $FAILSAFE != none ]
then
pwm failsafe -p ${FAILSAFE} -d ${OUTPUT_DEV}
fi
fi
unset MIXER_AUX_FILE
unset OUTPUT_AUX_DEV unset OUTPUT_AUX_DEV
unset SDCARD_MIXERS_PATH
+14 -16
View File
@@ -39,17 +39,17 @@ set MK_MODE none
set MKBLCTRL_ARG "" set MKBLCTRL_ARG ""
set OUTPUT_MODE none set OUTPUT_MODE none
set PARAM_FILE /fs/microsd/params set PARAM_FILE /fs/microsd/params
set PWM_OUT none
set PWM_RATE p:PWM_RATE
set PWM_DISARMED p:PWM_DISARMED
set PWM_MIN p:PWM_MIN
set PWM_MAX p:PWM_MAX
set PWM_AUX_OUT none
set PWM_AUX_RATE none
set PWM_ACHDIS none set PWM_ACHDIS none
set PWM_AUX_DISARMED p:PWM_AUX_DISARMED set PWM_AUX_DISARMED p:PWM_AUX_DISARMED
set PWM_AUX_MIN p:PWM_AUX_MIN
set PWM_AUX_MAX p:PWM_AUX_MAX set PWM_AUX_MAX p:PWM_AUX_MAX
set PWM_AUX_MIN p:PWM_AUX_MIN
set PWM_AUX_OUT none
set PWM_AUX_RATE none
set PWM_DISARMED p:PWM_DISARMED
set PWM_MAX p:PWM_MAX
set PWM_MIN p:PWM_MIN
set PWM_OUT none
set PWM_RATE p:PWM_RATE
set TUNE_ERR "ML<<CP4CP4CP4CP4CP4" set TUNE_ERR "ML<<CP4CP4CP4CP4CP4"
set USE_IO no set USE_IO no
set VEHICLE_TYPE none set VEHICLE_TYPE none
@@ -636,22 +636,20 @@ unset MIXER
unset MIXER_AUX unset MIXER_AUX
unset MK_MODE unset MK_MODE
unset MKBLCTRL_ARG unset MKBLCTRL_ARG
unset OUTPUT_AUX_DEV
unset OUTPUT_DEV unset OUTPUT_DEV
unset OUTPUT_MODE unset OUTPUT_MODE
unset PARAM_FILE unset PARAM_FILE
unset PWM_ACHDIS unset PWM_ACHDIS
unset PWM_AUX_DISARMED
unset PWM_AUX_MAX
unset PWM_AUX_MIN
unset PWM_AUX_OUT
unset PWM_AUX_RATE
unset PWM_OUT unset PWM_OUT
unset PWM_RATE unset PWM_RATE
unset PWM_DISARMED unset PWM_DISARMED
unset PWM_MIN
unset PWM_MAX unset PWM_MAX
unset PWM_AUX_OUT unset PWM_MIN
unset PWM_AUX_RATE
unset PWM_ACHDIS
unset PWM_AUX_DISARMED
unset PWM_AUX_MIN
unset PWM_AUX_MAX
unset TUNE_ERR unset TUNE_ERR
unset USE_IO unset USE_IO
unset VEHICLE_TYPE unset VEHICLE_TYPE