Rev 2102 | Rev 2104 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2102 | Rev 2103 | ||
---|---|---|---|
Line 124... | Line 124... | ||
124 | return value + NEUTRAL_PULSELENGTH; |
124 | return value + NEUTRAL_PULSELENGTH; |
125 | } |
125 | } |
Line 126... | Line 126... | ||
126 | 126 | ||
127 | void calculateControlServoValues(void) { |
127 | void calculateControlServoValues(void) { |
128 | int16_t value; |
128 | int16_t value; |
129 | for (uint8_t axis=0; axis<3; axis++) { |
129 | for (uint8_t axis=0; axis<4; axis++) { |
130 | value = controlServos[axis]; |
130 | value = controlServos[axis]; |
131 | value /= 2; |
131 | value *= 2; |
132 | servoValues[axis] = value + NEUTRAL_PULSELENGTH; |
132 | servoValues[axis] = value + NEUTRAL_PULSELENGTH; |
133 | } |
133 | } |
- | 134 | debugOut.analog[24] = servoValues[0]; |
|
134 | debugOut.analog[18] = servoValues[0]; |
135 | debugOut.analog[25] = servoValues[1]; |
- | 136 | debugOut.analog[26] = servoValues[2]; |
|
135 | debugOut.analog[19] = servoValues[2]; |
137 | debugOut.analog[27] = servoValues[3]; |
Line 136... | Line 138... | ||
136 | } |
138 | } |
137 | 139 | ||
138 | void calculateFeaturedServoValues(void) { |
140 | void calculateFeaturedServoValues(void) { |
Line 142... | Line 144... | ||
142 | // Save the computation cost of computing a new value before the old one is used. |
144 | // Save the computation cost of computing a new value before the old one is used. |
143 | if (!recalculateServoTimes) return; |
145 | if (!recalculateServoTimes) return; |
Line 144... | Line 146... | ||
144 | 146 | ||
145 | for (axis=0; axis<2; axis++) { |
147 | for (axis=0; axis<2; axis++) { |
146 | value = featuredServoValue(axis); |
148 | value = featuredServoValue(axis); |
147 | servoValues[axis + 3] = value; |
149 | servoValues[axis + 4] = value; |
148 | } |
150 | } |
149 | for (axis=2; axis<MAX_SERVOS; axis++) { |
151 | for (axis=2; axis<MAX_SERVOS; axis++) { |
150 | value = 128 * SCALE_FACTOR; |
152 | value = 128 * SCALE_FACTOR; |
151 | servoValues[axis + 3] = value; |
153 | servoValues[axis + 4] = value; |
Line 152... | Line 154... | ||
152 | } |
154 | } |
153 | 155 |