2014-01-14 19:02:57 -04:00
|
|
|
#!nsh
|
|
|
|
#
|
|
|
|
# Script to configure control interface
|
|
|
|
#
|
|
|
|
|
2014-03-06 07:45:10 -04:00
|
|
|
if [ $MIXER != none -a $MIXER != skip]
|
2014-01-14 19:02:57 -04:00
|
|
|
then
|
|
|
|
#
|
|
|
|
# Load mixer
|
|
|
|
#
|
|
|
|
set MIXERSD /fs/microsd/etc/mixers/$MIXER.mix
|
|
|
|
|
|
|
|
#Use the mixer file from the SD-card if it exists
|
|
|
|
if [ -f $MIXERSD ]
|
|
|
|
then
|
|
|
|
set MIXER_FILE $MIXERSD
|
|
|
|
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 mixer load $OUTPUT_DEV $MIXER_FILE
|
|
|
|
then
|
|
|
|
echo "[init] Mixer loaded: $MIXER_FILE"
|
|
|
|
else
|
|
|
|
echo "[init] Error loading mixer: $MIXER_FILE"
|
|
|
|
tone_alarm $TUNE_OUT_ERROR
|
|
|
|
fi
|
|
|
|
else
|
2014-03-06 07:45:10 -04:00
|
|
|
if [ $MIXER != skip ]
|
|
|
|
then
|
|
|
|
echo "[init] Mixer not defined"
|
|
|
|
tone_alarm $TUNE_OUT_ERROR
|
|
|
|
fi
|
2014-01-14 19:02:57 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $OUTPUT_MODE == fmu -o $OUTPUT_MODE == io ]
|
|
|
|
then
|
|
|
|
if [ $PWM_OUTPUTS != none ]
|
|
|
|
then
|
|
|
|
#
|
|
|
|
# Set PWM output frequency
|
|
|
|
#
|
|
|
|
if [ $PWM_RATE != none ]
|
|
|
|
then
|
|
|
|
echo "[init] Set PWM rate: $PWM_RATE"
|
|
|
|
pwm rate -c $PWM_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 $PWM_OUTPUTS -p $PWM_DISARMED
|
|
|
|
fi
|
|
|
|
if [ $PWM_MIN != none ]
|
|
|
|
then
|
|
|
|
echo "[init] Set PWM min: $PWM_MIN"
|
|
|
|
pwm min -c $PWM_OUTPUTS -p $PWM_MIN
|
|
|
|
fi
|
|
|
|
if [ $PWM_MAX != none ]
|
|
|
|
then
|
|
|
|
echo "[init] Set PWM max: $PWM_MAX"
|
|
|
|
pwm max -c $PWM_OUTPUTS -p $PWM_MAX
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|