From aae5f497abd79b47886b14e6ca4bdb32094d4ad0 Mon Sep 17 00:00:00 2001 From: "Konstantin Sharlaimov (DigitalEntity)" Date: Tue, 18 Apr 2017 23:39:48 +1000 Subject: [PATCH] Add MSP_WP_GETINFO command to get waypoint capabilities --- src/main/fc/fc_msp.c | 13 +++++++++++++ src/main/msp/msp_protocol.h | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index 367fcb5594a..f8b0a4d93a5 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -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: diff --git a/src/main/msp/msp_protocol.h b/src/main/msp/msp_protocol.h index 30f65cbe83f..b4889828ae2 100644 --- a/src/main/msp/msp_protocol.h +++ b/src/main/msp/msp_protocol.h @@ -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 @@ -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