Subversion Repositories FlightCtrl

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2189 - 1
#ifndef _DEFINITIONS_H
2
#define _DEFINITIONS_H
3
 
4
/*
5
 * Signal qualities, used to determine the availability of a control.
6
 * NO_SIGNAL means there was never a signal. SIGNAL_LOST that there was a signal, but it was lost.
7
 * SIGNAL_BAD is too bad for flight. This is the hysteresis range for deciding whether to engage
8
 * or disengage emergency landing.
9
 * SIGNAL_OK means the signal is usable for flight.
10
 * SIGNAL_GOOD means the signal can also be used for setting parameters.
11
 */
12
#define NO_SIGNAL   0
13
#define SIGNAL_LOST 1
14
#define SIGNAL_BAD  2
15
#define SIGNAL_OK   3
16
#define SIGNAL_GOOD 4
17
 
18
/*
19
 * The RPTY arrays
20
 */
21
#define CONTROL_ROLL     0
22
#define CONTROL_PITCH    1
23
#define CONTROL_THROTTLE 2
24
#define CONTROL_YAW      3
25
 
26
 
27
/*
28
 * The controls operate in [-1024, 1024] just about.
29
 * We compute control input and output in terms of 11 bit ranges then.
30
 */
31
 
32
#define LOG_CONTROL_RANGE 11
33
#define CONTROL_RANGE (1<<LOG_CONTROL_RANGE)
34
 
35
// For scaling control input quantities to bytes (configuration parameters).
36
#define LOG_CONTROL_BYTE_SCALING (LOG_CONTROL_RANGE - 8)
37
 
38
// MK BLC 1.x use 8 bit values. MK BLC 2.x use 10 bits. 10 bits is not implemented and probably doesnt 
39
// make a practical difference anyway.
40
#define LOG_I2C_CONTROL_RANGE 8
41
 
42
// Scale throttle levels to MK BLCs 8 bit range:
43
#define LOG_I2C_CONTROL_SCALING (LOG_CONTROL_RANGE - LOG_I2C_CONTROL_RANGE)
44
 
45
#endif