mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-26 17:36:40 +08:00
pwm_out, dshot: remove mode_* handling and capture ioctl's
They now use all unused pins, whereas camera_capture, camera_trigger and pwm_input modules start before to reserve their pins.
This commit is contained in:
@@ -21,8 +21,6 @@ then
|
||||
fi
|
||||
|
||||
# initialize script variables
|
||||
set AUX_MODE none
|
||||
set AUX_BANK2 none
|
||||
set IO_PRESENT no
|
||||
set MAV_TYPE none
|
||||
set MIXER none
|
||||
|
||||
@@ -29,12 +29,6 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
# USE_IO is set to 'no' for all boards w/o px4io driver or SYS_USE_IO disabled
|
||||
if [ $USE_IO = no -a $AUX_BANK2 = none ]
|
||||
then
|
||||
set AUX_MODE none
|
||||
fi
|
||||
|
||||
#
|
||||
# Set the default output mode if none was set.
|
||||
#
|
||||
@@ -76,15 +70,6 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $OUTPUT_MODE = $OUTPUT_CMD ]
|
||||
then
|
||||
if ! $OUTPUT_CMD mode_$FMU_MODE
|
||||
then
|
||||
echo "$OUTPUT_CMD start failed"
|
||||
tune_control play error
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $OUTPUT_MODE = uavcan_esc ]
|
||||
then
|
||||
if param compare UAVCAN_ENABLE 0
|
||||
@@ -98,6 +83,15 @@ then
|
||||
. ${R}etc/init.d/rc.io
|
||||
fi
|
||||
|
||||
if [ $OUTPUT_MODE = $OUTPUT_CMD -o $OUTPUT_MODE = io ]
|
||||
then
|
||||
if ! $OUTPUT_CMD start
|
||||
then
|
||||
echo "$OUTPUT_CMD start failed"
|
||||
tune_control play error
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Start IO for RC input if needed.
|
||||
#
|
||||
@@ -161,7 +155,7 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $MIXER_AUX != none -a $AUX_MODE != none ]
|
||||
if [ $MIXER_AUX != none ]
|
||||
then
|
||||
#
|
||||
# Load aux mixer.
|
||||
@@ -179,34 +173,26 @@ then
|
||||
|
||||
if [ $MIXER_AUX_FILE != none ]
|
||||
then
|
||||
# Start the output module
|
||||
if $OUTPUT_CMD mode_${AUX_MODE}
|
||||
# Append aux mixer to main device.
|
||||
if param greater SYS_HITL 0
|
||||
then
|
||||
# Append aux mixer to main device.
|
||||
if param greater SYS_HITL 0
|
||||
if mixer append ${OUTPUT_DEV} ${MIXER_AUX_FILE}
|
||||
then
|
||||
if mixer append ${OUTPUT_DEV} ${MIXER_AUX_FILE}
|
||||
then
|
||||
echo "INFO [init] Mixer: ${MIXER_AUX_FILE} appended to ${OUTPUT_DEV}"
|
||||
else
|
||||
echo "ERROR [init] Failed appending mixer: ${MIXER_AUX_FILE}"
|
||||
fi
|
||||
fi
|
||||
if [ -e $OUTPUT_AUX_DEV -a $OUTPUT_MODE != hil ]
|
||||
then
|
||||
if mixer load ${OUTPUT_AUX_DEV} ${MIXER_AUX_FILE}
|
||||
then
|
||||
echo "INFO [init] Mixer: ${MIXER_AUX_FILE} on ${OUTPUT_AUX_DEV}"
|
||||
else
|
||||
echo "ERROR [init] Failed loading mixer: ${MIXER_AUX_FILE}"
|
||||
fi
|
||||
echo "INFO [init] Mixer: ${MIXER_AUX_FILE} appended to ${OUTPUT_DEV}"
|
||||
else
|
||||
echo "INFO [init] setting PWM_AUX_OUT none"
|
||||
set PWM_AUX_OUT none
|
||||
echo "ERROR [init] Failed appending mixer: ${MIXER_AUX_FILE}"
|
||||
fi
|
||||
fi
|
||||
if [ -e $OUTPUT_AUX_DEV -a $OUTPUT_MODE != hil ]
|
||||
then
|
||||
if mixer load ${OUTPUT_AUX_DEV} ${MIXER_AUX_FILE}
|
||||
then
|
||||
echo "INFO [init] Mixer: ${MIXER_AUX_FILE} on ${OUTPUT_AUX_DEV}"
|
||||
else
|
||||
echo "ERROR [init] Failed loading mixer: ${MIXER_AUX_FILE}"
|
||||
fi
|
||||
else
|
||||
echo "ERROR: Could not start: pwm_out mode_pwm"
|
||||
tune_control play -t 18 # tune 18 = PROG_PX4IO_ERR
|
||||
echo "INFO [init] setting PWM_AUX_OUT none"
|
||||
set PWM_AUX_OUT none
|
||||
fi
|
||||
|
||||
@@ -228,36 +214,6 @@ fi
|
||||
|
||||
param set PWM_AUX_OUT ${PWM_AUX_OUT}
|
||||
|
||||
if [ $MIXER_AUX != none -a $AUX_MODE = none -a -e $OUTPUT_AUX_DEV ]
|
||||
then
|
||||
#
|
||||
# Load aux mixer.
|
||||
#
|
||||
if [ -f ${SDCARD_MIXERS_PATH}/${MIXER_AUX}.aux.mix ]
|
||||
then
|
||||
set MIXER_AUX_FILE ${SDCARD_MIXERS_PATH}/${MIXER_AUX}.aux.mix
|
||||
else
|
||||
|
||||
if [ -f /etc/mixers/${MIXER_AUX}.aux.mix ]
|
||||
then
|
||||
set MIXER_AUX_FILE /etc/mixers/${MIXER_AUX}.aux.mix
|
||||
fi
|
||||
fi
|
||||
|
||||
if mixer load ${OUTPUT_AUX_DEV} ${MIXER_AUX_FILE}
|
||||
then
|
||||
echo "INFO [init] Mixer: ${MIXER_AUX_FILE} on ${OUTPUT_AUX_DEV}"
|
||||
|
||||
# Set PWM_AUX output frequency.
|
||||
if [ $PWM_AUX_RATE != none ]
|
||||
then
|
||||
pwm rate -c ${PWM_AUX_OUT} -r ${PWM_AUX_RATE} -d ${OUTPUT_AUX_DEV}
|
||||
fi
|
||||
else
|
||||
echo "ERROR [init] Failed loading mixer: ${MIXER_AUX_FILE}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $OUTPUT_MODE = pwm_out -o $OUTPUT_MODE = io ]
|
||||
then
|
||||
if [ $PWM_OUT != none ]
|
||||
|
||||
@@ -22,10 +22,8 @@ set +e
|
||||
#
|
||||
set R /
|
||||
set AUTOCNF no
|
||||
set AUX_MODE pwm
|
||||
set FCONFIG /fs/microsd/etc/config.txt
|
||||
set FEXTRAS /fs/microsd/etc/extras.txt
|
||||
set FMU_MODE pwm
|
||||
set FRC /fs/microsd/etc/rc.txt
|
||||
set IOFW "/etc/extras/px4_io-v2_default.bin"
|
||||
set IO_PRESENT no
|
||||
@@ -376,52 +374,9 @@ else
|
||||
commander start
|
||||
fi
|
||||
|
||||
# Sensors on the PWM interface bank.
|
||||
if param compare -s SENS_EN_LL40LS 1
|
||||
then
|
||||
# Clear pins 5 and 6.
|
||||
set FMU_MODE pwm4
|
||||
set AUX_MODE pwm4
|
||||
fi
|
||||
|
||||
|
||||
# Check if ATS is enabled
|
||||
if param compare FD_EXT_ATS_EN 1
|
||||
then
|
||||
# Clear pins 5 and 6.
|
||||
set FMU_MODE pwm4
|
||||
set AUX_MODE pwm4
|
||||
fi
|
||||
|
||||
if param greater -s TRIG_MODE 0
|
||||
then
|
||||
if param compare TRIG_PINS_EX 0
|
||||
then
|
||||
# We ONLY support trigger on pins 5+6 or 7+8 when simultanously using AUX for actuator output.
|
||||
if param compare TRIG_PINS 56
|
||||
then
|
||||
# clear pins 5 and 6
|
||||
set FMU_MODE pwm4
|
||||
set AUX_MODE pwm4
|
||||
else
|
||||
if param compare TRIG_PINS 78
|
||||
then
|
||||
# clear pins 7 and 8
|
||||
set FMU_MODE pwm6
|
||||
set AUX_MODE pwm6
|
||||
else
|
||||
set FMU_MODE none
|
||||
set AUX_MODE none
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if param compare TRIG_PINS_EX 12288
|
||||
then
|
||||
set FMU_MODE pwm12
|
||||
set AUX_MODE pwm12
|
||||
fi
|
||||
fi
|
||||
|
||||
camera_trigger start
|
||||
camera_feedback start
|
||||
fi
|
||||
@@ -449,14 +404,7 @@ else
|
||||
rc_input start $RC_INPUT_ARGS
|
||||
fi
|
||||
|
||||
#
|
||||
# Configure vehicle type specific parameters.
|
||||
# Note: rc.vehicle_setup is the entry point for rc.interface,
|
||||
# rc.fw_apps, rc.mc_apps, rc.rover_apps, and rc.vtol_apps.
|
||||
#
|
||||
. ${R}etc/init.d/rc.vehicle_setup
|
||||
|
||||
# Camera capture driver
|
||||
# Camera capture driver (before pwm_out)
|
||||
if param greater -s CAM_CAP_FBACK 0
|
||||
then
|
||||
if camera_capture start
|
||||
@@ -465,6 +413,13 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Configure vehicle type specific parameters.
|
||||
# Note: rc.vehicle_setup is the entry point for rc.interface,
|
||||
# rc.fw_apps, rc.mc_apps, rc.rover_apps, and rc.vtol_apps.
|
||||
#
|
||||
. ${R}etc/init.d/rc.vehicle_setup
|
||||
|
||||
#
|
||||
# Start the navigator.
|
||||
#
|
||||
@@ -564,10 +519,8 @@ fi
|
||||
#
|
||||
unset R
|
||||
unset AUTOCNF
|
||||
unset AUX_MODE
|
||||
unset FCONFIG
|
||||
unset FEXTRAS
|
||||
unset FMU_MODE
|
||||
unset FRC
|
||||
unset IO_PRESENT
|
||||
unset IOFW
|
||||
|
||||
Reference in New Issue
Block a user