mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-26 17:55:28 +03:00
Props-In setting as bool
This commit is contained in:
parent
2c35b763c5
commit
90e9f77a52
4 changed files with 16 additions and 9 deletions
|
@ -1419,7 +1419,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
|||
break;
|
||||
|
||||
case MSP2_INAV_MIXER:
|
||||
sbufWriteU8(dst, mixerConfig()->yaw_motor_direction);
|
||||
sbufWriteU8(dst, mixerConfig()->motorDirectionInverted);
|
||||
sbufWriteU16(dst, 0);
|
||||
sbufWriteU8(dst, mixerConfig()->platformType);
|
||||
sbufWriteU8(dst, mixerConfig()->hasFlaps);
|
||||
|
@ -2749,7 +2749,7 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
|||
break;
|
||||
|
||||
case MSP2_INAV_SET_MIXER:
|
||||
mixerConfigMutable()->yaw_motor_direction = sbufReadU8(src);
|
||||
mixerConfigMutable()->motorDirectionInverted = sbufReadU8(src);
|
||||
sbufReadU16(src); // Was yaw_jump_prevention_limit
|
||||
mixerConfigMutable()->platformType = sbufReadU8(src);
|
||||
mixerConfigMutable()->hasFlaps = sbufReadU8(src);
|
||||
|
|
|
@ -685,9 +685,9 @@ groups:
|
|||
- name: PG_MIXER_CONFIG
|
||||
type: mixerConfig_t
|
||||
members:
|
||||
- name: yaw_motor_direction
|
||||
min: -1
|
||||
max: 1
|
||||
- name: motor_direction_inverted
|
||||
field: motorDirectionInverted
|
||||
type: bool
|
||||
- name: platform_type
|
||||
field: platformType
|
||||
type: uint8_t
|
||||
|
|
|
@ -63,6 +63,7 @@ static EXTENDED_FASTRAM uint8_t motorCount = 0;
|
|||
EXTENDED_FASTRAM int mixerThrottleCommand;
|
||||
static EXTENDED_FASTRAM int throttleIdleValue = 0;
|
||||
static EXTENDED_FASTRAM int motorValueWhenStopped = 0;
|
||||
static EXTENDED_FASTRAM int8_t motorYawMultiplier = 1;
|
||||
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(reversibleMotorsConfig_t, reversibleMotorsConfig, PG_REVERSIBLE_MOTORS_CONFIG, 0);
|
||||
|
||||
|
@ -72,10 +73,10 @@ PG_RESET_TEMPLATE(reversibleMotorsConfig_t, reversibleMotorsConfig,
|
|||
.neutral = 1460
|
||||
);
|
||||
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(mixerConfig_t, mixerConfig, PG_MIXER_CONFIG, 2);
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(mixerConfig_t, mixerConfig, PG_MIXER_CONFIG, 3);
|
||||
|
||||
PG_RESET_TEMPLATE(mixerConfig_t, mixerConfig,
|
||||
.yaw_motor_direction = 1,
|
||||
.motorDirectionInverted = 0,
|
||||
.platformType = PLATFORM_MULTIROTOR,
|
||||
.hasFlaps = false,
|
||||
.appliedMixerPreset = -1, //This flag is not available in CLI and used by Configurator only
|
||||
|
@ -245,6 +246,12 @@ void mixerInit(void)
|
|||
} else {
|
||||
motorRateLimitingApplyFn = nullMotorRateLimiting;
|
||||
}
|
||||
|
||||
if (mixerConfig()->motorDirectionInverted) {
|
||||
motorYawMultiplier = -1;
|
||||
} else {
|
||||
motorYawMultiplier = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void mixerResetDisarmedMotors(void)
|
||||
|
@ -354,7 +361,7 @@ void FAST_CODE NOINLINE mixTable(const float dT)
|
|||
rpyMix[i] =
|
||||
(input[PITCH] * currentMixer[i].pitch +
|
||||
input[ROLL] * currentMixer[i].roll +
|
||||
-mixerConfig()->yaw_motor_direction * input[YAW] * currentMixer[i].yaw) * mixerScale;
|
||||
-motorYawMultiplier * input[YAW] * currentMixer[i].yaw) * mixerScale;
|
||||
|
||||
if (rpyMix[i] > rpyMixMax) rpyMixMax = rpyMix[i];
|
||||
if (rpyMix[i] < rpyMixMin) rpyMixMin = rpyMix[i];
|
||||
|
|
|
@ -63,7 +63,7 @@ typedef struct motorMixer_s {
|
|||
PG_DECLARE_ARRAY(motorMixer_t, MAX_SUPPORTED_MOTORS, primaryMotorMixer);
|
||||
|
||||
typedef struct mixerConfig_s {
|
||||
int8_t yaw_motor_direction;
|
||||
int8_t motorDirectionInverted;
|
||||
uint8_t platformType;
|
||||
bool hasFlaps;
|
||||
int16_t appliedMixerPreset;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue