Skip to content

Commit

Permalink
Add MSP_WP_GETINFO command to get waypoint capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalentity committed Apr 18, 2017
1 parent 4ec8929 commit aae5f49
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/main/fc/fc_msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,19 @@ static bool mspFcProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProcessFn
}
break;

case MSP_WP_GETINFO:
#ifdef NAV
sbufWriteU8(dst, 0); // Reserved for waypoint capabilities
sbufWriteU8(dst, NAV_MAX_WAYPOINTS); // Maximum number of waypoints supported
sbufWriteU8(dst, isWaypointListValid()); // Is current mission valid
sbufWriteU8(dst, getWaypointCount()); // Number of waypoints in current mission
#else
sbufWriteU8(dst, 0);
sbufWriteU8(dst, 0);
sbufWriteU8(dst, 0);
sbufWriteU8(dst, 0);
#endif
break;

#ifdef USE_SERIAL_4WAY_BLHELI_INTERFACE
case MSP_SET_4WAY_IF:
Expand Down
3 changes: 2 additions & 1 deletion src/main/msp/msp_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
#define MSP_PROTOCOL_VERSION 0

#define API_VERSION_MAJOR 1 // increment when major changes are made
#define API_VERSION_MINOR 24 // increment when any change is made, reset to zero when major changes are released after changing API_VERSION_MAJOR
#define API_VERSION_MINOR 25 // increment when any change is made, reset to zero when major changes are released after changing API_VERSION_MAJOR

#define API_VERSION_LENGTH 2

Expand Down Expand Up @@ -116,6 +116,7 @@

#define MSP_WP_MISSION_LOAD 18 // Load mission from NVRAM
#define MSP_WP_MISSION_SAVE 19 // Save mission to NVRAM
#define MSP_WP_GETINFO 20

//
// MSP commands for Cleanflight original features
Expand Down

0 comments on commit aae5f49

Please sign in to comment.