aboutsummaryrefslogtreecommitdiff
path: root/ROMFS/px4fmu_common/init.d/rc.mc_interface
blob: 2a05012a60b94df95e3df82c30ada326f2f5d6ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!nsh
#
# Script to set PWM min / max limits and mixer
#

#
# Load mixer
#
if [ $FRAME_GEOMETRY == x ]
then
    echo "Frame geometry X"
    mixer load /dev/pwm_output /etc/mixers/FMU_quad_x.mix
else
    if [ $FRAME_GEOMETRY == w ]
    then
	echo "Frame geometry W"
	mixer load /dev/pwm_output /etc/mixers/FMU_quad_w.mix
    else
	echo "Frame geometry +"
    	mixer load /dev/pwm_output /etc/mixers/FMU_quad_+.mix
    fi
fi

if [ $FRAME_COUNT == 4 ]
then
    set OUTPUTS 1234
    param set MAV_TYPE 2
else
    if [ $FRAME_COUNT == 6 ]
    then
	set OUTPUTS 123456
	param set MAV_TYPE 13
    else
	set OUTPUTS 12345678
    fi
fi

#
# 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