Rev 1910 | Rev 2099 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1910 | Rev 1927 | ||
---|---|---|---|
Line 10... | Line 10... | ||
10 | /* |
10 | /* |
11 | * Get the current command (start/stop motors, calibrate), if any. |
11 | * Get the current command (start/stop motors, calibrate), if any. |
12 | */ |
12 | */ |
13 | uint8_t command = controlMixer_getCommand(); |
13 | uint8_t command = controlMixer_getCommand(); |
14 | uint8_t repeated = controlMixer_isCommandRepeated(); |
14 | uint8_t repeated = controlMixer_isCommandRepeated(); |
15 | uint8_t argument = controlMixer_getArgument(); |
- | |
Line 16... | Line 15... | ||
16 | 15 | ||
17 | if (!(MKFlags & MKFLAG_MOTOR_RUN)) { |
16 | if (!(MKFlags & MKFLAG_MOTOR_RUN)) { |
18 | if (command == COMMAND_GYROCAL && !repeated) { |
17 | if (command == COMMAND_GYROCAL && !repeated) { |
19 | // Run gyro calibration but do not repeat it. |
18 | // Run gyro calibration but do not repeat it. |
Line 23... | Line 22... | ||
23 | // isFlying = 0; |
22 | // isFlying = 0; |
24 | // check roll/pitch stick position |
23 | // check roll/pitch stick position |
25 | // if pitch stick is top or roll stick is left or right --> change parameter setting |
24 | // if pitch stick is top or roll stick is left or right --> change parameter setting |
26 | // according to roll/pitch stick position |
25 | // according to roll/pitch stick position |
Line 27... | Line -... | ||
27 | - | ||
28 | if (argument < 6) { |
- | |
29 | // Gyro calinbration, with or without selecting a new parameter-set. |
- | |
30 | if (argument > 0 && argument < 6) { |
- | |
31 | // A valid parameter-set (1..5) was chosen - use it. |
- | |
32 | setActiveParamSet(argument); |
- | |
33 | } |
26 | |
34 | ParamSet_ReadFromEEProm(getActiveParamSet()); |
27 | ParamSet_ReadFromEEProm(); |
35 | attitude_setNeutral(); |
28 | attitude_setNeutral(); |
36 | flight_setNeutral(); |
29 | flight_setNeutral(); |
37 | controlMixer_setNeutral(); |
- | |
38 | beepNumber(getActiveParamSet()); |
- | |
39 | } else if (staticParams.GlobalConfig & (CFG_COMPASS_ACTIVE |
- | |
40 | | CFG_GPS_ACTIVE) && argument == 7) { |
- | |
41 | // If right stick is centered and down |
- | |
42 | // TODO: Out of here! State machine instead. |
- | |
43 | compassCalState = 1; |
30 | controlMixer_setNeutral(); |
44 | beep(1000); |
- | |
45 | } |
31 | beepNumber(1); |
Line 46... | Line 32... | ||
46 | } |
32 | } |
47 | - | ||
48 | // save the ACC neutral setting to eeprom |
33 | |
49 | else { |
34 | // save the ACC neutral setting to eeprom |
50 | if (command == COMMAND_ACCCAL && !repeated) { |
35 | else if (command == COMMAND_ACCCAL && !repeated) { |
51 | // Run gyro and acc. meter calibration but do not repeat it. |
36 | // Run gyro and acc. meter calibration but do not repeat it. |
52 | GRN_OFF; |
37 | GRN_OFF; |
53 | analog_calibrateAcc(); |
38 | analog_calibrateAcc(); |
54 | attitude_setNeutral(); |
39 | attitude_setNeutral(); |
55 | flight_setNeutral(); |
40 | flight_setNeutral(); |
56 | controlMixer_setNeutral(); |
- | |
57 | beepNumber(getActiveParamSet()); |
41 | controlMixer_setNeutral(); |
58 | } |
42 | beepNumber(1); |
59 | } |
43 | } |
60 | } // end !MOTOR_RUN condition. |
44 | } // end !MOTOR_RUN condition. |
61 | if (command == COMMAND_START) { |
45 | if (command == COMMAND_START) { |