-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQconfig.h
More file actions
129 lines (102 loc) · 2.95 KB
/
Qconfig.h
File metadata and controls
129 lines (102 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#ifndef QCONFIG
#define QCONFIG
/*-----------------
Serial Port
-----------------*/
#define SERIAL_PORT Serial3
#define DEBUG_SERIAL_PORT Serial
#define RX_PIN 7
/*-------------------------
Quad Configuration
-------------------------*/
#define SLEEP_BAT 10 // in Percent
#define X_CONFIG
//#define PLUS_CONFIG
// Motor pins:
#define FRONT_LEFT 5
#define FRONT_RIGHT 6
#define BACK_RIGHT 9
#define BACK_LEFT 10
#define GO_TO_SLEEP_TIME 180 // Seconds
/*------------------------------
PID controllers settings
------------------------------*/
#define OUTPUT_STEP 20
#define NOISE 0.5
#define LOOK_BACK_SEC 1
#define SAMPLE_TIME 100
/*--------------
Debugging
--------------*/
// Enable debugging:
#define QDEBUG
/**********!!!!! NO NEED TO EDIT BELOW THIS LINE !!!!!**********/
#define MAX_CNTRL_PARAMS 14
#define COMMAND_SIZE 6 + MAX_CNTRL_PARAMS * 4 // Calculated: 2 (HEADER BYTES = 0xDA0B) + 4 (CMD | int_32) + [PARAM count] * 4 (int_32 size) + 1 (END BYTES = 0xB0)
/*-----------------
Quad States
-----------------*/
#define NUM_STATES 7
#define SLEEP 0
#define FLY 1
#define CALIBRATE 2
#define TUNE 3
#define MOVE 4
#define TEST 5
#define SETTINGS 6
#define Q_ACK 99
#define Q_SYN 98
/*-----------------
FEEDBACK COMMANDS
-----------------*/
#define Q_STATUS 1
#define Q_ALERT 2
#define Q_SLEEPING 3
#define Q_TEST 4
/*-----------------
TEST types
-----------------*/
#define Q_TEST_IMU 0
#define Q_TEST_PID 1
#define Q_TEST_MOTORS 2
/*-----------------
ALERT reasons
-----------------*/
#define Q_LOW_BAT 1
#define Q_TIME_OUT 2
#define Q_WOKE_UP 3
/*-----------------
Serial
-----------------*/
#define SERIAL_WRITE SERIAL_PORT.write
#define SERIAL_OUT SERIAL_PORT.print
#define SERIAL_PEEK SERIAL_PORT.peek
#define SERIAL_AVAILABLE SERIAL_PORT.available
#define SERIAL_READ SERIAL_PORT.read
#define SERIAL_READ_BYTES SERIAL_PORT.readBytes
#define SERIAL_READ_BYTES_UNTIL SERIAL_PORT.readStringUntil
#define SERIAL_FLUSH SERIAL_PORT.flush
#define SERIAL_BEGIN SERIAL_PORT.begin
const unsigned char SERIAL_HEAD = 0xDA;
const unsigned char SERIAL_TAIL = 0xB0;
const unsigned char SERIAL_EMPTY[] = {0x00, 0x00, 0x00, 0x00};
void SERIAL_PRINTLN(uint32_t, int, ...);
/*-----------------
Debug
-----------------*/
#ifdef QDEBUG
#define QDEBUG_BEGIN(x) DEBUG_SERIAL_PORT.begin(x)
#define QDEBUG_WRITE(x) DEBUG_SERIAL_PORT.write(x)
#define QDEBUG_PRINT(x) DEBUG_SERIAL_PORT.print(x)
#define QDEBUG_PRINTF(x, y) DEBUG_SERIAL_PORT.printf(x, y)
#define QDEBUG_PRINTLN(x) DEBUG_SERIAL_PORT.println(x)
#define QDEBUG_PRINTLNF(x, y) DEBUG_SERIAL_PORT.printlnf(x, y)
#else
#define QDEBUG_BEGIN(x)
#define QDEBUG_WRITE(x)
#define QDEBUG_PRINT(x)
#define QDEBUG_PRINTF(x, y)
#define QDEBUG_PRINTLN(x)
#define QDEBUG_PRINTLNF(x, y)
#endif
#endif