Rev 2048 | Rev 2051 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2048 | Rev 2049 | ||
---|---|---|---|
Line 119... | Line 119... | ||
119 | * Decode commands but do not execute them. |
119 | * Decode commands but do not execute them. |
120 | */ |
120 | */ |
121 | int16_t tempPRTY[4]; |
121 | int16_t tempPRTY[4]; |
Line 122... | Line 122... | ||
122 | 122 | ||
- | 123 | void controlMixer_periodicTask(void) { |
|
- | 124 | // Decode commands. |
|
- | 125 | uint8_t rcCommand = (RC_getSignalQuality() >= SIGNAL_OK) ? RC_getCommand() |
|
123 | void controlMixer_periodicTask(void) { |
126 | : COMMAND_NONE; |
- | 127 | uint8_t ecCommand = (EC_getSignalQuality() >= SIGNAL_OK) ? EC_getCommand() |
|
- | 128 | : COMMAND_NONE; |
|
- | 129 | ||
- | 130 | // Update variables ("potis"). |
|
- | 131 | if (controlMixer_getSignalQuality() >= SIGNAL_GOOD) { |
|
- | 132 | controlMixer_updateVariables(); |
|
124 | // calculate Stick inputs by rc channels (P) and changing of rc channels (D) |
133 | controlMixer_didReceiveSignal = 1; |
- | 134 | } else { // Signal is not OK |
|
- | 135 | // Could handle switch to emergency flight here. |
|
- | 136 | // throttle is handled elsewhere. |
|
- | 137 | } |
|
- | 138 | ||
- | 139 | if (rcCommand != COMMAND_NONE) { |
|
- | 140 | isCommandRepeated = (lastCommand == rcCommand); |
|
- | 141 | lastCommand = rcCommand; |
|
- | 142 | lastArgument = RC_getArgument(); |
|
- | 143 | } else if (ecCommand != COMMAND_NONE) { |
|
- | 144 | isCommandRepeated = (lastCommand == ecCommand); |
|
- | 145 | lastCommand = ecCommand; |
|
- | 146 | lastArgument = EC_getArgument(); |
|
- | 147 | } else { |
|
- | 148 | // Both sources have no command, or one or both are out. |
|
125 | // TODO: If no signal --> zero. |
149 | // Just set to false. There is no reason to check if the none-command was repeated anyway. |
- | 150 | isCommandRepeated = 0; |
|
- | 151 | lastCommand = COMMAND_NONE; |
|
Line 126... | Line 152... | ||
126 | // HC_periodicTask(); |
152 | } |
127 | 153 | ||
Line 128... | Line 154... | ||
128 | // This will init the values (not just add to them). |
154 | // This will init the values (not just add to them). |
Line 149... | Line 175... | ||
149 | updateControlAndMeasureControlActivity(CONTROL_YAW, tempPRTY[CONTROL_YAW]); |
175 | updateControlAndMeasureControlActivity(CONTROL_YAW, tempPRTY[CONTROL_YAW]); |
150 | dampenControlActivity(); |
176 | dampenControlActivity(); |
Line 151... | Line 177... | ||
151 | 177 | ||
Line 152... | Line -... | ||
152 | debugOut.analog[17] = controlActivity/10; |
- | |
153 | - | ||
154 | // Update variables ("potis"). |
- | |
155 | if (controlMixer_getSignalQuality() >= SIGNAL_GOOD) { |
- | |
156 | controlMixer_updateVariables(); |
- | |
157 | controlMixer_didReceiveSignal = 1; |
- | |
158 | } else { // Signal is not OK |
- | |
159 | // Could handle switch to emergency flight here. |
- | |
160 | // throttle is handled elsewhere. |
- | |
161 | } |
178 | debugOut.analog[17] = controlActivity/10; |
162 | 179 | ||
Line 163... | Line 180... | ||
163 | // We can safely do this even with a bad signal - the variables will not have been updated then. |
180 | // We can safely do this even with a bad signal - the variables will not have been updated then. |
Line 182... | Line 199... | ||
182 | maxControl[axis] = 100; |
199 | maxControl[axis] = 100; |
183 | } else if (maxControl[axis]) |
200 | } else if (maxControl[axis]) |
184 | maxControl[axis]--; |
201 | maxControl[axis]--; |
185 | } |
202 | } |
186 | */ |
203 | */ |
187 | - | ||
188 | // Decode commands. |
- | |
189 | uint8_t rcCommand = (RC_getSignalQuality() >= SIGNAL_OK) ? RC_getCommand() |
- | |
190 | : COMMAND_NONE; |
- | |
191 | uint8_t ecCommand = (EC_getSignalQuality() >= SIGNAL_OK) ? EC_getCommand() |
- | |
192 | : COMMAND_NONE; |
- | |
193 | - | ||
194 | if (rcCommand != COMMAND_NONE) { |
- | |
195 | isCommandRepeated = (lastCommand == rcCommand); |
- | |
196 | lastCommand = rcCommand; |
- | |
197 | lastArgument = RC_getArgument(); |
- | |
198 | } else if (ecCommand != COMMAND_NONE) { |
- | |
199 | isCommandRepeated = (lastCommand == ecCommand); |
- | |
200 | lastCommand = ecCommand; |
- | |
201 | lastArgument = EC_getArgument(); |
- | |
202 | } else { |
- | |
203 | // Both sources have no command, or one or both are out. |
- | |
204 | // Just set to false. There is no reason to check if the none-command was repeated anyway. |
- | |
205 | isCommandRepeated = 0; |
- | |
206 | lastCommand = COMMAND_NONE; |
- | |
207 | } |
- | |
208 | } |
204 | } |