You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

64 lines
1.3 KiB

#!nsh
#
# Script to configure multicopter control interface
#
if [ $FRAME_GEOMETRY == quad_x -o $FRAME_GEOMETRY == quad_+ ]
then
set OUTPUTS 1234
param set MAV_TYPE 2
fi
if [ $FRAME_GEOMETRY == quad_w -o $FRAME_GEOMETRY == quad_v ]
then
set OUTPUTS 1234
param set MAV_TYPE 2
fi
if [ $FRAME_GEOMETRY == hex_x -o $FRAME_GEOMETRY == hex_+ ]
then
set OUTPUTS 123456
param set MAV_TYPE 13
fi
if [ $FRAME_GEOMETRY == octo_x -o $FRAME_GEOMETRY == octo_+ ]
then
set OUTPUTS 12345678
param set MAV_TYPE 14
fi
#
# Load mixer
#
echo "[init] Frame geometry: $FRAME_GEOMETRY"
set MIXER /etc/mixers/FMU_$FRAME_GEOMETRY.mix
echo "[init] Loading mixer: $MIXER"
mixer load /dev/pwm_output $MIXER
if [ $OUTPUT_MODE == fmu_pwm -o $OUTPUT_MODE == io_pwm ]
then
#
# Set PWM output frequency
#
if [ $PWM_RATE != none ]
then
echo "[init] Set PWM rate: $PWM_RATE"
pwm rate -c $OUTPUTS -r $PWM_RATE
fi
#
# Set disarmed, min and max PWM values
#
if [ $PWM_DISARMED != none ]
then
echo "[init] Set PWM disarmed: $PWM_DISARMED"
pwm disarmed -c $OUTPUTS -p $PWM_DISARMED
fi
if [ $PWM_MIN != none ]
then
echo "[init] Set PWM min: $PWM_MIN"
pwm min -c $OUTPUTS -p $PWM_MIN
fi
if [ $PWM_MAX != none ]
then
echo "[init] Set PWM max: $PWM_MAX"
pwm max -c $OUTPUTS -p $PWM_MAX
fi
fi