1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-24 08:45:31 +03:00

Add preprocessor definitions

This commit is contained in:
Scavanger 2024-02-12 16:40:19 -03:00
parent 0871ef3612
commit d48971a48f
11 changed files with 133 additions and 31 deletions

View file

@ -1660,6 +1660,7 @@ static mspResult_e mspFcSafeHomeOutCommand(sbuf_t *dst, sbuf_t *src)
}
#endif
#ifdef USE_FW_AUTOLAND
static mspResult_e mspFwApproachOutCommand(sbuf_t *dst, sbuf_t *src)
{
const uint8_t idx = sbufReadU8(src);
@ -1676,6 +1677,7 @@ static mspResult_e mspFwApproachOutCommand(sbuf_t *dst, sbuf_t *src)
return MSP_RESULT_ERROR;
}
}
#endif
static mspResult_e mspFcLogicConditionCommand(sbuf_t *dst, sbuf_t *src) {
const uint8_t idx = sbufReadU8(src);
@ -2668,7 +2670,7 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
case MSP_SET_WP:
if (dataSize == 21) {
static uint8_t mmIdx = 0;
const uint8_t msp_wp_no = sbufReadU8(src); // get the waypoint number
navWaypoint_t msp_wp;
msp_wp.action = sbufReadU8(src); // action
@ -2681,7 +2683,8 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
msp_wp.flag = sbufReadU8(src); // future: to set nav flag
setWaypoint(msp_wp_no, &msp_wp);
uint8_t fwAppraochStartIdx = 8;
#ifdef USE_FW_AUTOLAND
static uint8_t mmIdx = 0, fwAppraochStartIdx = 8;
#ifdef USE_SAFE_HOME
fwAppraochStartIdx = MAX_SAFE_HOMES;
#endif
@ -2691,8 +2694,11 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
mmIdx++;
}
resetFwAutolandApproach(fwAppraochStartIdx + mmIdx);
} else
#endif
} else {
return MSP_RESULT_ERROR;
}
break;
case MSP2_COMMON_SET_RADAR_POS:
if (dataSize == 19) {
@ -3149,13 +3155,16 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
safeHomeConfigMutable(i)->enabled = sbufReadU8(src);
safeHomeConfigMutable(i)->lat = sbufReadU32(src);
safeHomeConfigMutable(i)->lon = sbufReadU32(src);
#ifdef USE_FW_AUTOLAND
resetFwAutolandApproach(i);
#endif
} else {
return MSP_RESULT_ERROR;
}
break;
#endif
#ifdef USE_FW_AUTOLAND
case MSP2_INAV_SET_FW_APPROACH:
if (dataSize == 15) {
uint8_t i;
@ -3178,6 +3187,7 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
return MSP_RESULT_ERROR;
}
break;
#endif
#ifdef USE_EZ_TUNE
@ -3691,10 +3701,11 @@ bool mspFCProcessInOutCommand(uint16_t cmdMSP, sbuf_t *dst, sbuf_t *src, mspResu
*ret = mspFcSafeHomeOutCommand(dst, src);
break;
#endif
#ifdef USE_FW_AUTOLAND
case MSP2_INAV_FW_APPROACH:
*ret = mspFwApproachOutCommand(dst, src);
break;
#endif
#ifdef USE_SIMULATOR
case MSP_SIMULATOR:
tmp_u8 = sbufReadU8(src); // Get the Simulator MSP version