Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1774 → Rev 1775

/branches/dongfang_FC_rewrite/controlMixer.h
1,22 → 1,10
#include <inttypes.h>
/*
* The throttle range is normalized to [0, THROTTLE_RANGE[
* This is the normal range. Exceeding it a little is allowed.
*/
#define THROTTLE_RANGE 256
 
/*
* The stick (pitch, roll, yaw) ranges are normalized to [-STICK_RANGE, STICK_RANGE]
* This is the normal range. Exceeding it a little is allowed.
*/
#define STICK_RANGE 256
 
/*
* An attempt to define a generic control. That could be an R/C receiver, an external control
* (serial over Bluetooth, Wi232, XBee, whatever) or the NaviCtrl.
* This resembles somewhat an object-oriented class definition (except that there are no virtuals).
* The idea is that the combination of different control inputs, of the way they superimpose upon
* each other, the proirities between them and the behavior in case that one fails is simplified,
* each other, the priorities between them and the behavior in case that one fails is simplified,
* and all in one place.
*/
35,22 → 23,12
#define SIGNAL_GOOD 4
 
/*
* An enumeration over the start motors, stop motors, calibrate gyros
* and calibreate acc. meters commands.
*/
#define COMMAND_NONE 0
#define COMMAND_START 6
#define COMMAND_STOP 8
#define COMMAND_GYROCAL 2
#define COMMAND_ACCCAL 4
 
/*
* The PRTY arrays
*/
#define CONTROL_PITCH 0
#define CONTROL_ROLL 1
#define CONTROL_PITCH 0
#define CONTROL_ROLL 1
#define CONTROL_THROTTLE 2
#define CONTROL_YAW 3
#define CONTROL_YAW 3
 
/*
* Looping flags.
93,15 → 71,18
/*
* Our output.
*/
extern int16_t control[2], controlYaw, controlThrottle;
// extern int16_t stickOffsetNick, stickOffsetRoll;
extern int16_t control[2];
extern int16_t controlYaw, controlThrottle;
extern uint16_t maxControl[2];
extern uint8_t looping;
 
extern volatile uint8_t MKFlags;
extern uint16_t isFlying;
 
void controlMixer_initVariables(void);
void controlMixer_updateVariables(void);
 
void controlMixer_setNeutral(uint8_t calibrate);
void controlMixer_setNeutral(void);
 
/*
* Update the exported variables. Called at every flight control cycle.
118,11 → 99,11
uint8_t controlMixer_getSignalQuality(void);
 
/*
* The motor throttles can be set in an [0..256[ interval.
* The calculation of motor throttle values from sensor and control information (basically
* flight.c) take place in an [0..256*CONTROL_SCALING[ interval for better precision.
* The controls operate in a [-150 * CONTROL_SCALING, 150 * CONTROL_SCALING] interval
* Throttle is [0..300 * CONTROL_SCALING].
* (just about. No precision needed).
*/
#define CONTROL_SCALING 4
#define CONTROL_SCALING (1024/256)
 
/*
* Gets the argument for the current command (a number).
139,8 → 120,8
*
* Not in any of these positions: 0
*/
// void controlMixer_handleCommands(void);
uint8_t controlMixer_getArgument(void);
uint8_t controlMixer_isCommandRepeated(void);
// TODO: Abstract away if possible.
// void controlMixer_setCompassCalState(void);
// void controlMixer_updateCompass(void);
uint8_t controlMixer_testCompassCalState(void);