1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-25 01:05:21 +03:00

MSP2 frame for getting and setting new mixer properties

This commit is contained in:
Pawel Spychalski (DzikuVx) 2018-03-28 15:44:34 +02:00
parent 9df8e5cfea
commit d2ecaedc4b
5 changed files with 24 additions and 2 deletions

View file

@ -1295,6 +1295,14 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
#endif
break;
case MSP2_INAV_MIXER:
sbufWriteU8(dst, mixerConfig()->yaw_motor_direction);
sbufWriteU16(dst, mixerConfig()->yaw_jump_prevention_limit);
sbufWriteU8(dst, mixerConfig()->platformType);
sbufWriteU8(dst, mixerConfig()->hasFlaps);
sbufWriteU16(dst, mixerConfig()->appliedMixerPreset);
break;
default:
return false;
}
@ -2368,6 +2376,15 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
return MSP_RESULT_ERROR;
break;
case MSP2_INAV_SET_MIXER:
mixerConfigMutable()->yaw_motor_direction = sbufReadU8(src);
mixerConfigMutable()->yaw_jump_prevention_limit = sbufReadU16(src);
mixerConfigMutable()->platformType = sbufReadU8(src);
mixerConfigMutable()->hasFlaps = sbufReadU8(src);
mixerConfigMutable()->appliedMixerPreset = sbufReadU16(src);
mixerUpdateStateFlags();
break;
default:
return MSP_RESULT_ERROR;
}

View file

@ -74,7 +74,8 @@ PG_RESET_TEMPLATE(mixerConfig_t, mixerConfig,
.yaw_motor_direction = 1,
.yaw_jump_prevention_limit = 200,
.platformType = PLATFORM_MULTIROTOR,
.hasFlaps = false
.hasFlaps = false,
appliedMixerPreset = -1 //This flag is not available in CLI and used by Configurator only
);
#ifdef BRUSHED_MOTORS

View file

@ -59,6 +59,7 @@ typedef struct mixerConfig_s {
uint16_t yaw_jump_prevention_limit; // make limit configurable (original fixed value was 100)
uint8_t platformType;
bool hasFlaps;
int appliedMixerPreset;
} mixerConfig_t;
PG_DECLARE(mixerConfig_t, mixerConfig);

View file

@ -60,7 +60,7 @@
#define MSP_PROTOCOL_VERSION 0 // Same version over MSPv1 & MSPv2 - message format didn't change and it backward compatible
#define API_VERSION_MAJOR 2 // increment when major changes are made
#define API_VERSION_MINOR 1 // increment when any change is made, reset to zero when major changes are released after changing API_VERSION_MAJOR
#define API_VERSION_MINOR 2 // increment when any change is made, reset to zero when major changes are released after changing API_VERSION_MAJOR
#define API_VERSION_LENGTH 2

View file

@ -28,3 +28,6 @@
#define MSP2_INAV_RATE_PROFILE 0x2007
#define MSP2_INAV_SET_RATE_PROFILE 0x2008
#define MSP2_INAV_AIR_SPEED 0x2009
#define MSP2_INAV_MIXER 0x2010
#define MSP2_INAV_SET_MIXER 0x2011