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.
 
 
 
 
 
 

56 lines
952 B

#!nsh
#
# Script to set PWM min / max limits and mixer
#
echo "Rotors count: $FRAME_COUNT"
if [ $FRAME_COUNT == 4 ]
then
set FRAME_COUNT_STR quad
set OUTPUTS 1234
param set MAV_TYPE 2
fi
if [ $FRAME_COUNT == 6 ]
then
set FRAME_COUNT_STR hex
set OUTPUTS 123456
param set MAV_TYPE 13
fi
if [ $FRAME_COUNT == 8 ]
then
set FRAME_COUNT_STR octo
set OUTPUTS 12345678
param set MAV_TYPE 14
fi
#
# Load mixer
#
echo "Frame geometry: ${FRAME_GEOMETRY}"
set MIXER /etc/mixers/FMU_${FRAME_GEOMETRY_STR}_${FRAME_GEOMETRY}.mix
echo "Loading mixer: ${MIXER}"
mixer load /dev/pwm_output ${MIXER}
#
# Set PWM output frequency
#
if [ $PWM_RATE != none ]
then
pwm rate -c $OUTPUTS -r $PWM_RATE
fi
#
# Set disarmed, min and max PWM values
#
if [ $PWM_DISARMED != none ]
then
pwm disarmed -c $OUTPUTS -p $PWM_DISARMED
fi
if [ $PWM_MIN != none ]
then
pwm min -c $OUTPUTS -p $PWM_MIN
fi
if [ $PWM_MAX != none ]
then
pwm max -c $OUTPUTS -p $PWM_MAX
fi