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.
82 lines
1.3 KiB
82 lines
1.3 KiB
#!nsh |
|
# |
|
# Script to configure control interface |
|
# |
|
|
|
if [ $MIXER != none -a $MIXER != skip ] |
|
then |
|
# |
|
# Load mixer |
|
# |
|
|
|
#Use the mixer file from the SD-card if it exists |
|
if [ -f /fs/microsd/etc/mixers/$MIXER.mix ] |
|
then |
|
set MIXER_FILE /fs/microsd/etc/mixers/$MIXER.mix |
|
else |
|
set MIXER_FILE /etc/mixers/$MIXER.mix |
|
fi |
|
|
|
if [ $OUTPUT_MODE == mkblctrl ] |
|
then |
|
set OUTPUT_DEV /dev/mkblctrl |
|
else |
|
set OUTPUT_DEV /dev/pwm_output |
|
fi |
|
|
|
if [ $OUTPUT_MODE == uavcan_esc ] |
|
then |
|
set OUTPUT_DEV /dev/uavcan/esc |
|
fi |
|
|
|
if mixer load $OUTPUT_DEV $MIXER_FILE |
|
then |
|
echo "[i] Mixer: $MIXER_FILE" |
|
else |
|
echo "[i] Error loading mixer: $MIXER_FILE" |
|
tone_alarm $TUNE_ERR |
|
fi |
|
|
|
unset MIXER_FILE |
|
else |
|
if [ $MIXER != skip ] |
|
then |
|
echo "[i] Mixer not defined" |
|
tone_alarm $TUNE_ERR |
|
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 |
|
|
|
if [ $FAILSAFE != none ] |
|
then |
|
pwm failsafe -d $OUTPUT_DEV $FAILSAFE |
|
fi |
|
fi
|
|
|