Rev 2109 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2108 | - | 1 | #include <stdlib.h> |
2 | #include "commands.h" |
||
3 | #include "controlMixer.h" |
||
4 | #include "flight.h" |
||
5 | #include "eeprom.h" |
||
6 | #include "attitude.h" |
||
7 | #include "output.h" |
||
8 | #include "rc.h" |
||
9 | |||
10 | #ifdef USE_MK3MAG |
||
11 | // TODO: Kick that all outa here! |
||
12 | uint8_t compassCalState = 0; |
||
13 | #endif |
||
14 | |||
15 | void commands_handleCommands(void) { |
||
16 | /* |
||
17 | * Get the current command (start/stop motors, calibrate), if any. |
||
18 | */ |
||
19 | uint8_t command = controlMixer_getCommand(); |
||
20 | uint8_t repeated = controlMixer_isCommandRepeated(); |
||
21 | uint8_t argument = controlMixer_getArgument(); |
||
22 | |||
23 | // TODO! Mode change gadget of some kind. |
||
24 | if (!isFlying) { |
||
25 | if (command == COMMAND_GYROCAL && !repeated) { |
||
26 | // Gyro calinbration, with or without selecting a new parameter-set. |
||
27 | paramSet_readFromEEProm(1); |
||
28 | analog_calibrate(); |
||
29 | attitude_setNeutral(); |
||
30 | controlMixer_setNeutral(); |
||
31 | beepNumber(1); |
||
32 | } else if (command == COMMAND_CHMOD && !repeated) { |
||
33 | configuration_setFlightParameters(argument); |
||
34 | } |
||
35 | } // end !MOTOR_RUN condition. |
||
36 | } |