1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 13:25:30 +03:00

Merge pull request #11705 from phobos-/msp_vtx

VTX Device over MSP
This commit is contained in:
haslinghuis 2022-09-12 18:11:29 +02:00 committed by GitHub
commit abfa5faa1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 1036 additions and 37 deletions

View file

@ -105,6 +105,7 @@
#include "io/usb_msc.h"
#include "io/vtx_control.h"
#include "io/vtx.h"
#include "io/vtx_msp.h"
#include "msp/msp_box.h"
#include "msp/msp_protocol.h"
@ -1053,10 +1054,14 @@ static bool mspCommonProcessOutCommand(int16_t cmdMSP, sbuf_t *dst, mspPostProce
return true;
}
static bool mspProcessOutCommand(int16_t cmdMSP, sbuf_t *dst)
static bool mspProcessOutCommand(mspDescriptor_t srcDesc, int16_t cmdMSP, sbuf_t *dst)
{
bool unsupportedCommand = false;
#if !defined(USE_VTX_COMMON) || !defined(USE_VTX_MSP)
UNUSED(srcDesc);
#endif
switch (cmdMSP) {
case MSP_STATUS_EX:
case MSP_STATUS:
@ -2030,7 +2035,9 @@ static bool mspProcessOutCommand(int16_t cmdMSP, sbuf_t *dst)
sbufWriteU8(dst, 0);
sbufWriteU8(dst, 0);
#endif
#ifdef USE_VTX_MSP
setMspVtxDeviceStatusReady(srcDesc);
#endif
}
break;
#endif
@ -2308,6 +2315,9 @@ static mspResult_e mspFcProcessOutCommandWithArg(mspDescriptor_t srcDesc, int16_
} else {
return MSP_RESULT_ERROR;
}
#ifdef USE_VTX_MSP
setMspVtxDeviceStatusReady(srcDesc);
#endif
}
break;
@ -2324,6 +2334,9 @@ static mspResult_e mspFcProcessOutCommandWithArg(mspDescriptor_t srcDesc, int16_
} else {
return MSP_RESULT_ERROR;
}
#ifdef USE_VTX_MSP
setMspVtxDeviceStatusReady(srcDesc);
#endif
}
break;
#endif // USE_VTX_TABLE
@ -3271,6 +3284,9 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP,
sbufReadU8(src);
#endif
}
#ifdef USE_VTX_MSP
setMspVtxDeviceStatusReady(srcDesc);
#endif
}
break;
#endif
@ -3318,6 +3334,9 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP,
} else {
return MSP_RESULT_ERROR;
}
#ifdef USE_VTX_MSP
setMspVtxDeviceStatusReady(srcDesc);
#endif
}
break;
@ -3342,6 +3361,9 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP,
} else {
return MSP_RESULT_ERROR;
}
#ifdef USE_VTX_MSP
setMspVtxDeviceStatusReady(srcDesc);
#endif
}
break;
#endif
@ -4057,7 +4079,7 @@ mspResult_e mspFcProcessCommand(mspDescriptor_t srcDesc, mspPacket_t *cmd, mspPa
if (mspCommonProcessOutCommand(cmdMSP, dst, mspPostProcessFn)) {
ret = MSP_RESULT_ACK;
} else if (mspProcessOutCommand(cmdMSP, dst)) {
} else if (mspProcessOutCommand(srcDesc, cmdMSP, dst)) {
ret = MSP_RESULT_ACK;
} else if ((ret = mspFcProcessOutCommandWithArg(srcDesc, cmdMSP, src, dst, mspPostProcessFn)) != MSP_RESULT_CMD_UNKNOWN) {
/* ret */;