Subversion Repositories FlightCtrl

Rev

Rev 2109 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#include <stdlib.h>
#include "commands.h"
#include "controlMixer.h"
#include "flight.h"
#include "eeprom.h"
#include "attitude.h"
#include "output.h"
#include "rc.h"

void commands_handleCommands(void) {
        uint8_t command = controlMixer_getCommand();
        uint8_t repeated = controlMixer_isCommandRepeated();
        uint8_t argument = controlMixer_getArgument();
        if (!isFlying) {
                if (command == COMMAND_RCCAL && !repeated) {
                        RC_calibrate();
                        rcTrim_writeToEEProm();
                        beepNumber(2);  // 2 beeps means RC.
                } else if (command == COMMAND_GYROCAL && !repeated) {
                        // Gyro calibration, with or without selecting a new parameter-set.
                        // paramSet_readFromEEProm(1);
                        analog_calibrate();
                        attitude_setNeutral();
                        controlMixer_setNeutral();
                        beepNumber(1);  // 1 beep means gyro.
                } else if (command == COMMAND_CHMOD && !repeated) {
                        configuration_setFlightParameters(argument);
                }
        }
}