mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-25 17:25:18 +03:00
MSP2 frames to support mmix command over MSP
This commit is contained in:
parent
873946d7ec
commit
8584cf50cd
2 changed files with 24 additions and 0 deletions
|
@ -444,6 +444,15 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
|||
break;
|
||||
#endif
|
||||
|
||||
case MSP2_COMMON_MOTOR_MIXER:
|
||||
for (uint8_t i = 0; i < MAX_SUPPORTED_MOTORS; i++) {
|
||||
sbufWriteU16(dst, customMotorMixer(i)->throttle * 1000);
|
||||
sbufWriteU16(dst, customMotorMixer(i)->roll * 1000);
|
||||
sbufWriteU16(dst, customMotorMixer(i)->pitch * 1000);
|
||||
sbufWriteU16(dst, customMotorMixer(i)->yaw * 1000);
|
||||
}
|
||||
break;
|
||||
|
||||
case MSP_MOTOR:
|
||||
for (unsigned i = 0; i < 8; i++) {
|
||||
sbufWriteU16(dst, i < MAX_SUPPORTED_MOTORS ? motor[i] : 0);
|
||||
|
@ -1447,6 +1456,18 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
|||
#endif
|
||||
break;
|
||||
|
||||
case MSP2_COMMON_SET_MOTOR_MIXER:
|
||||
i = sbufReadU8(src);
|
||||
if (i >= MAX_SUPPORTED_MOTORS) {
|
||||
return MSP_RESULT_ERROR;
|
||||
} else {
|
||||
customMotorMixerMutable(i)->throttle = constrainf(sbufReadU16(src) / 1000.0f, 0, 1);
|
||||
customMotorMixerMutable(i)->roll = constrainf(sbufReadU16(src) / 1000.0f, 0, 1);
|
||||
customMotorMixerMutable(i)->pitch = constrainf(sbufReadU16(src) / 1000.0f, 0, 1);
|
||||
customMotorMixerMutable(i)->yaw = constrainf(sbufReadU16(src) / 1000.0f, 0, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case MSP_SET_3D:
|
||||
flight3DConfigMutable()->deadband3d_low = sbufReadU16(src);
|
||||
flight3DConfigMutable()->deadband3d_high = sbufReadU16(src);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue