mavlink/mavlink — Issue #17: Incorrect order in mavlink_parse_state_t enum
Author: swordfishBob
Created: 2012-03-07 23:33:59+00:00
State: open

I find mavlink_types.h contains

typedef enum {
MAVLINK_PARSE_STATE_UNINIT=0,
MAVLINK_PARSE_STATE_IDLE,
MAVLINK_PARSE_STATE_GOT_STX,
MAVLINK_PARSE_STATE_GOT_SEQ,
MAVLINK_PARSE_STATE_GOT_LENGTH,
MAVLINK_PARSE_STATE_GOT_SYSID,
MAVLINK_PARSE_STATE_GOT_COMPID,
MAVLINK_PARSE_STATE_GOT_MSGID,
MAVLINK_PARSE_STATE_GOT_PAYLOAD,
MAVLINK_PARSE_STATE_GOT_CRC1
} mavlink_parse_state_t; ///< The state machine for the comm parser

Note the order of _SEQ before _LENGTH. This is not a problem for the supplied helper fuctions which use CASE to select a state. It would be cleaner to have the parse states enum'd in order of packet content, which would also allow > comparisons on the state in custom code assessing parser state.