Skip to content

Commit eb70859

Browse files
digitalentitymikeller
authored andcommitted
MSPv2 implementation (#3977)
Some refactoring Refactor CRC calculations; Unsigned type for size and offset
1 parent e3c258d commit eb70859

File tree

4 files changed

+321
-80
lines changed

4 files changed

+321
-80
lines changed

src/main/interface/msp.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@
1919

2020
#include "common/streambuf.h"
2121

22+
#define MSP_V2_FRAME_ID 255
23+
24+
typedef enum {
25+
MSP_V1 = 0,
26+
MSP_V2_OVER_V1 = 1,
27+
MSP_V2_NATIVE = 2,
28+
MSP_VERSION_COUNT
29+
} mspVersion_e;
30+
31+
#define MSP_VERSION_MAGIC_INITIALIZER { 'M', 'M', 'X' }
32+
2233
// return positive for ACK, negative on error, zero for no reply
2334
typedef enum {
2435
MSP_RESULT_ACK = 1,
@@ -35,6 +46,7 @@ typedef enum {
3546
typedef struct mspPacket_s {
3647
sbuf_t buf;
3748
int16_t cmd;
49+
uint8_t flags;
3850
int16_t result;
3951
uint8_t direction;
4052
} mspPacket_t;

src/main/interface/msp_protocol.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@
312312
#define MSP_RESERVE_2 252 //reserved for system usage
313313
#define MSP_DEBUGMSG 253 //out message debug string buffer
314314
#define MSP_DEBUG 254 //out message debug1,debug2,debug3,debug4
315-
#define MSP_RESERVE_3 255 //reserved for system usage
315+
#define MSP_V2_FRAME 255 //MSPv2 payload indicator
316316

317317
// Additional commands that are not compatible with MultiWii
318318
#define MSP_STATUS_EX 150 //out message cycletime, errors_count, CPU load, sensor present etc

0 commit comments

Comments
 (0)