dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
msp_messages.h
Go to the documentation of this file.
1 
11 /*
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful, but
18  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20  * for more details.
21  *
22  * You should have received a copy of the GNU General Public License along
23  * with this program; if not, see <http://www.gnu.org/licenses/>
24  *
25  * Additional note on redistribution: The copyright and license notices above
26  * must be maintained in each individual source file that is a derivative work
27  * of this source file; otherwise redistribution is prohibited.
28  */
29 
30 #ifndef MSP_MESSAGES_H_
31 #define MSP_MESSAGES_H_
32 
42  /* read */
43  MSP_MSG_IDENT = 100, /* 0x64 */
44  MSP_MSG_STATUS = 101, /* 0x65 */
45  MSP_MSG_RAW_IMU = 102, /* 0x66 */
46  MSP_MSG_SERVO = 103, /* 0x67 */
47  MSP_MSG_MOTOR = 104, /* 0x68 */
48  MSP_MSG_RC = 105, /* 0x69 */
49  MSP_MSG_RAW_GPS = 106, /* 0x6a */
50  MSP_MSG_COMP_GPS = 107, /* 0x6b */
51  MSP_MSG_ATTITUDE = 108, /* 0x6c */
52  MSP_MSG_ALTITUDE = 109, /* 0x6d */
53  MSP_MSG_ANALOG = 110, /* 0x6e */
54  MSP_MSG_RC_TUNING = 111, /* 0x6f */
55  MSP_MSG_PID = 112, /* 0x70 */
56  MSP_MSG_BOX = 113, /* 0x71 */
57  MSP_MSG_MISC = 114, /* 0x72 */
58  MSP_MSG_MOTOR_PINS = 115, /* 0x73 */
59  MSP_MSG_BOXNAMES = 116, /* 0x74 */
60  MSP_MSG_PIDNAMES = 117, /* 0x75 */
61  MSP_MSG_WP = 118, /* 0x76 */
62  MSP_MSG_BOXIDS = 119, /* 0x77 */
63  MSP_MSG_SERVO_CONF = 120, /* 0x78 */
64  /* write */
65  MSP_MSG_SET_RAW_RC = 200, /* 0xc8 */
66  MSP_MSG_SET_RAW_GPS = 201, /* 0xc9 */
67  MSP_MSG_SET_PID = 202, /* 0xca */
68  MSP_MSG_SET_BOX = 203, /* 0xcb */
69  MSP_MSG_SET_RC_TUNING = 204, /* 0xcc */
70  MSP_MSG_ACC_CALIBRATION = 205, /* 0xcd */
71  MSP_MSG_MAG_CALIBRATION = 206, /* 0xce */
72  MSP_MSG_SET_MISC = 207, /* 0xcf */
73  MSP_MSG_RESET_CONF = 208, /* 0xd0 */
74  MSP_MSG_SET_WP = 209, /* 0xd1 */
75  MSP_MSG_SELECT_SETTING = 210, /* 0xd2 */
76  MSP_MSG_SET_HEAD = 211, /* 0xd3 */
77  MSP_MSG_SET_SERVO_CONF = 212, /* 0xd4 */
78  MSP_MSG_SET_MOTOR = 214, /* 0xd6 */
79  MSP_MSG_BIND = 240, /* 0xf0 */
80  MSP_MSG_EEPROM_WRITE = 250, /* 0xfa */
81 
82  /* unofficial protocol extensions from *flight,
83  * here be dragons (and some outright silliness)
84  * Note: please don't add extensions marked as private,
85  * and preferably not commands that provide a subset of
86  * the original Multiwii protocol (use the original ones
87  * for wider compatibility) */
88  MSP_EXT_NAV_STATUS = 121, /* 0x79 */
89  MSP_EXT_NAV_CONFIG = 122, /* 0x7a */
90  MSP_EXT_FW_CONFIG = 123, /* 0x7b */
91  MSP_EXT_UID = 160, /* 0xa0 */
92  MSP_EXT_GPSSVINFO = 164, /* 0xa4 */
93  MSP_EXT_GPSDEBUGINFO = 166, /* 0xa6 */
94  MSP_EXT_ACC_TRIM = 240, /* 0xf0 WARNING: shadows MSP_MSG_BIND */
95  MSP_EXT_SERVOMIX_CONF = 241, /* 0xf1 */
96 
97  MSP_EXT_SET_NAV_CONFIG = 215, /* 0xd7 */
98  MSP_EXT_SET_FW_CONFIG = 216, /* 0xd8 */
99  MSP_EXT_SET_ACC_TRIM = 239, /* 0xef */
100  MSP_EXT_SET_SERVOMIX_CONF = 242, /* 0xf2 */
102  MSP_EXT_DEBUGMSG = 253, /* 0xfd */
103  MSP_EXT_DEBUG = 254, /* 0xfe */
104 };
106 struct msp_ident {
107  uint8_t version;
108  uint8_t multitype;
109  uint8_t msp_version;
110  uint32_t capability;
111 } __attribute((packed));
112 
113 struct msp_status {
114  uint16_t cycle_time; /* us */
116  uint16_t sensor;
117  uint32_t flag;
118  uint8_t current_set;
119 } __attribute((packed));
120 
121 /* this is a bit of a mess, unit depends on board sensors :/ */
122 struct msp_raw_imu {
123  int16_t accx;
124  int16_t accy;
125  int16_t accz;
126  int16_t gyrx;
127  int16_t gyry;
128  int16_t gyrz;
129  int16_t magx;
130  int16_t magy;
131  int16_t magz;
132 } __attribute((packed));
133 
134 /* Note: MSP doc is ambiguous on the length of these */
135 struct msp_servo {
136  uint16_t servo[8]; /* [1000:2000] us */
137 } __attribute((packed));
138 
139 struct msp_motor {
140  uint16_t motor[8];
141 } __attribute((packed)); /* [1000:2000] us */
142 
144  uint16_t motor[8];
145 } __attribute((packed)); /* [1000:2000] us */
146 
147 struct msp_rc {
148  uint16_t rc_data[8];
149 } __attribute((packed)); /* [1000:2000] us */
150 
152  uint16_t rc_data[8];
153 } __attribute((packed)); /* [1000:2000] us */
154 
155 struct msp_raw_gps {
156  uint8_t fix; /* bool */
157  uint8_t num_sat;
158  uint32_t coord_lat; /* 1 / 10 000 000 deg */
159  uint32_t coord_lon; /* 1 / 10 000 000 deg */
160  uint16_t altitude; /* m */
161  uint16_t speed; /* cm/s */
162  uint16_t ground_course; /* deg * 10 */
163 } __attribute((packed));
164 
165 /* inexplicably no ground_course in this one? */
167  uint8_t fix; /* bool */
168  uint8_t num_sat;
169  uint32_t coord_lat; /* 1 / 10 000 000 deg */
170  uint32_t coord_lon; /* 1 / 10 000 000 deg */
171  uint16_t altitude; /* m */
172  uint16_t speed; /* cm/s */
173 } __attribute((packed));
174 
175 struct msp_comp_gps {
177  uint16_t direction_to_home; /* [-180:180] deg */
178  uint8_t update;
179 } __attribute((packed));
180 
181 struct msp_attitude {
182  int16_t angx; /* [-1800:1800] 1/10 deg */
183  int16_t angy; /* [-900:900] 1/10 deg */
184  int16_t heading; /* [-180:180] deg */
185 } __attribute((packed));
186 
187 struct msp_altitude {
188  int32_t est_alt; /* cm */
189  int16_t vario; /* cm/s */
190 } __attribute((packed));
191 
192 struct msp_analog {
193  uint8_t vbat; /* 1/10 V */
194  uint16_t power_meter_sum;
195  uint16_t rssi; /* [0:1023] */
196  uint16_t amperage;
197 } __attribute((packed));
198 
200  uint8_t rc_rate; /* [0:100] */
201  uint8_t rc_expo; /* [0:100] */
202  uint8_t roll_pitch_rate; /* [0:100] */
203  uint8_t yaw_rate; /* [0:100] */
204  uint8_t dyn_thr_pid; /* [0:100] */
205  uint8_t throttle_mid; /* [0:100] */
206  uint8_t throttle_expo; /* [0:100] */
207 } __attribute((packed));
208 
210  uint8_t rc_rate;
211  uint8_t rc_expo;
213  uint8_t yaw_rate;
214  uint8_t dyn_thr_pid;
215  uint8_t throttle_mid;
216  uint8_t throttle_expo;
217 } __attribute((packed));
218 
220  uint8_t p;
221  uint8_t i;
222  uint8_t d;
223 } __attribute((packed));
224 
225 struct msp_pid {
236 } __attribute((packed));
237 
238 struct msp_set_pid {
249 } __attribute((packed));
250 
251 /* TODO: this is extremely poorly specified */
252 struct msp_box {
253  uint16_t boxitems[1];
254 } __attribute__((packed));
255 
256 struct msp_set_box {
257  uint16_t boxitems[1];
258 } __attribute__((packed));
259 
260 struct msp_misc {
261  uint16_t power_trigger;
262  uint16_t min_throttle; /* [1000:2000] us, neutral value */
263  uint16_t max_throttle; /* [1000:2000] us, max value */
264  uint16_t min_command; /* [1000:2000] us, min value */
265  uint16_t failsafe_throttle; /* [1000:2000] us */
266  uint16_t arm_count;
267  uint32_t lifetime;
268  uint16_t mag_declination; /* 1/10 deg */
269  uint8_t vbat_scale;
270  uint8_t vbat_warn1; /* 1/10 V */
271  uint8_t vbat_warn2; /* 1/10 V */
272  uint8_t vbat_crit; /* 1/10 V */
273 } __attribute__((packed));
274 
275 struct msp_set_misc {
276  uint16_t power_trigger;
277  uint16_t min_throttle; /* [1000:2000] us, neutral value */
278  uint16_t max_throttle; /* [1000:2000] us, max value */
279  uint16_t min_command; /* [1000:2000] us, min value */
280  uint16_t failsafe_throttle; /* [1000:2000] us */
281  uint16_t arm_count;
282  uint32_t lifetime;
283  uint16_t mag_declination; /* 1/10 deg */
284  uint8_t vbat_scale;
285  uint8_t vbat_warn1; /* 1/10 V */
286  uint8_t vbat_warn2; /* 1/10 V */
287  uint8_t vbat_crit; /* 1/10 V */
288 } __attribute__((packed));
289 
291  uint8_t pwm_pin[8];
292 } __attribute__((packed));
293 
294 /* cannot know length in advance */
295 struct msp_boxnames {
296  char items[0]; /* ; separated */
297 } __attribute__((packed));
298 
299 /* cannot know length in advance */
300 struct msp_pidnames {
301  char items[0]; /* ; separated */
302 } __attribute__((packed));
303 
304 struct msp_wp {
305  uint8_t wp_no; /* home = 0, hold = 15 */
306  uint32_t lat;
307  uint32_t lon;
308  uint32_t alt_hold;
309  uint16_t heading;
310  uint16_t time_to_stay;
311  uint8_t nav_flag;
312 } __attribute__((packed));
313 
314 struct msp_set_wp {
315  uint8_t wp_no; /* home = 0, hold = 15 */
316  uint32_t lat;
317  uint32_t lon;
318  uint32_t alt_hold;
319  uint16_t heading;
320  uint16_t time_to_stay;
321  uint8_t nav_flag;
322 } __attribute__((packed));
323 
324 struct msp_boxids {
325  uint8_t checkbox_items[0]; /* TODO: poor specification */
326 } __attribute__((packed));
327 
328 /* NOTE: cleanflight made some incompatible extensions to this *sigh* */
330  uint16_t min; /* [1000:2000] us */
331  uint16_t max; /* [1000:2000] us */
332  uint16_t middle; /* [1000:2000] us */
333  uint8_t rate; /* [0:100] ?? */
334 } __attribute__((packed));
335 
338 } __attribute__((packed));
339 
341  uint8_t current_set;
342 } __attribute__((packed));
343 
344 struct msp_set_head {
345  uint16_t mag_hold;
346 } __attribute__((packed));
347 
348 #endif // MSP_MESSAGES_H_
349 
uint16_t boxitems[1]
Definition: msp_messages.h:253
struct _msp_pid_item mag
Definition: msp_messages.h:234
uint16_t altitude
Definition: msp_messages.h:171
struct _msp_pid_item posr
Definition: msp_messages.h:244
struct _msp_pid_item posr
Definition: msp_messages.h:231
uint8_t wp_no
Definition: msp_messages.h:305
char items[0]
Definition: msp_messages.h:301
uint16_t ground_course
Definition: msp_messages.h:162
uint32_t lifetime
Definition: msp_messages.h:282
uint16_t power_meter_sum
Definition: msp_messages.h:194
int16_t gyrz
Definition: msp_messages.h:128
struct _msp_pid_item alt
Definition: msp_messages.h:242
int16_t accx
Definition: msp_messages.h:123
struct _msp_pid_item level
Definition: msp_messages.h:246
uint32_t flag
Definition: msp_messages.h:117
uint8_t roll_pitch_rate
Definition: msp_messages.h:202
uint16_t motor[8]
Definition: msp_messages.h:144
uint16_t servo[8]
Definition: msp_messages.h:136
uint32_t lon
Definition: msp_messages.h:307
uint8_t vbat_warn1
Definition: msp_messages.h:270
uint16_t rssi
Definition: msp_messages.h:195
struct _msp_pid_item pos
Definition: msp_messages.h:243
int16_t magx
Definition: msp_messages.h:129
struct msp_ident __attribute((packed))
int16_t gyrx
Definition: msp_messages.h:126
uint8_t vbat_scale
Definition: msp_messages.h:269
uint16_t power_trigger
Definition: msp_messages.h:276
uint16_t mag_declination
Definition: msp_messages.h:268
uint16_t time_to_stay
Definition: msp_messages.h:310
uint16_t sensor
Definition: msp_messages.h:116
int16_t gyry
Definition: msp_messages.h:127
uint32_t alt_hold
Definition: msp_messages.h:308
uint16_t failsafe_throttle
Definition: msp_messages.h:280
uint16_t distance_to_home
Definition: msp_messages.h:176
int16_t angx
Definition: msp_messages.h:182
uint8_t nav_flag
Definition: msp_messages.h:311
uint8_t throttle_expo
Definition: msp_messages.h:206
int16_t angy
Definition: msp_messages.h:183
uint32_t coord_lat
Definition: msp_messages.h:169
uint32_t lifetime
Definition: msp_messages.h:267
int16_t magz
Definition: msp_messages.h:131
struct _msp_servo_conf_item servos[8]
Definition: msp_messages.h:337
struct _msp_pid_item pitch
Definition: msp_messages.h:227
int32_t est_alt
Definition: msp_messages.h:188
uint8_t nav_flag
Definition: msp_messages.h:321
uint32_t lat
Definition: msp_messages.h:306
uint16_t min_throttle
Definition: msp_messages.h:262
uint16_t i2c_errors_count
Definition: msp_messages.h:115
uint8_t vbat_crit
Definition: msp_messages.h:287
uint16_t arm_count
Definition: msp_messages.h:266
uint8_t checkbox_items[0]
Definition: msp_messages.h:325
uint8_t vbat
Definition: msp_messages.h:193
uint16_t min_command
Definition: msp_messages.h:279
struct msp_box __attribute__((packed))
Definition: serial_4way.h:38
uint8_t roll_pitch_rate
Definition: msp_messages.h:212
struct _msp_pid_item alt
Definition: msp_messages.h:229
uint8_t throttle_mid
Definition: msp_messages.h:205
struct _msp_pid_item navr
Definition: msp_messages.h:245
uint16_t direction_to_home
Definition: msp_messages.h:177
uint16_t time_to_stay
Definition: msp_messages.h:320
uint16_t heading
Definition: msp_messages.h:309
int16_t accz
Definition: msp_messages.h:125
uint16_t power_trigger
Definition: msp_messages.h:261
uint8_t version
Definition: msp_messages.h:107
msp_message_id
Definition: msp_messages.h:41
uint8_t dyn_thr_pid
Definition: msp_messages.h:204
struct _msp_pid_item level
Definition: msp_messages.h:233
uint16_t arm_count
Definition: msp_messages.h:281
uint32_t alt_hold
Definition: msp_messages.h:318
uint8_t fix
Definition: msp_messages.h:156
int16_t magy
Definition: msp_messages.h:130
uint8_t yaw_rate
Definition: msp_messages.h:203
struct _msp_pid_item yaw
Definition: msp_messages.h:241
uint16_t min_command
Definition: msp_messages.h:264
uint16_t speed
Definition: msp_messages.h:161
uint8_t num_sat
Definition: msp_messages.h:157
uint32_t coord_lon
Definition: msp_messages.h:159
uint16_t mag_hold
Definition: msp_messages.h:345
uint16_t rc_data[8]
Definition: msp_messages.h:148
uint16_t max_throttle
Definition: msp_messages.h:263
uint8_t multitype
Definition: msp_messages.h:108
uint16_t boxitems[1]
Definition: msp_messages.h:257
uint8_t vbat_warn1
Definition: msp_messages.h:285
struct _msp_pid_item pitch
Definition: msp_messages.h:240
uint8_t vbat_warn2
Definition: msp_messages.h:286
uint32_t lat
Definition: msp_messages.h:316
uint16_t min_throttle
Definition: msp_messages.h:277
struct _msp_pid_item mag
Definition: msp_messages.h:247
uint16_t cycle_time
Definition: msp_messages.h:114
uint8_t pwm_pin[8]
Definition: msp_messages.h:291
uint16_t rc_data[8]
Definition: msp_messages.h:152
uint16_t altitude
Definition: msp_messages.h:160
int16_t vario
Definition: msp_messages.h:189
uint16_t heading
Definition: msp_messages.h:319
struct _msp_pid_item navr
Definition: msp_messages.h:232
struct _msp_pid_item roll
Definition: msp_messages.h:239
uint8_t vbat_warn2
Definition: msp_messages.h:271
int16_t accy
Definition: msp_messages.h:124
uint32_t coord_lon
Definition: msp_messages.h:170
uint16_t failsafe_throttle
Definition: msp_messages.h:265
uint8_t wp_no
Definition: msp_messages.h:315
uint8_t update
Definition: msp_messages.h:178
uint32_t capability
Definition: msp_messages.h:110
struct _msp_pid_item roll
Definition: msp_messages.h:226
struct _msp_pid_item yaw
Definition: msp_messages.h:228
int16_t heading
Definition: msp_messages.h:184
uint8_t rc_expo
Definition: msp_messages.h:201
char items[0]
Definition: msp_messages.h:296
uint32_t coord_lat
Definition: msp_messages.h:158
uint8_t vbat_scale
Definition: msp_messages.h:284
struct _msp_pid_item vel
Definition: msp_messages.h:248
struct _msp_pid_item pos
Definition: msp_messages.h:230
uint16_t amperage
Definition: msp_messages.h:196
uint16_t mag_declination
Definition: msp_messages.h:283
uint32_t lon
Definition: msp_messages.h:317
uint8_t vbat_crit
Definition: msp_messages.h:272
struct _msp_pid_item vel
Definition: msp_messages.h:235
uint8_t current_set
Definition: msp_messages.h:118
uint8_t msp_version
Definition: msp_messages.h:109
uint16_t motor[8]
Definition: msp_messages.h:140
uint8_t rc_rate
Definition: msp_messages.h:200
uint16_t max_throttle
Definition: msp_messages.h:278