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;
|
break;
|
||||||
|
|
||||||
case MSP2_INAV_MIXER:
|
case MSP2_INAV_MIXER:
|
||||||
sbufWriteU8(dst, mixerConfig()->yaw_motor_direction);
|
sbufWriteU8(dst, mixerConfig()->motorDirectionInverted);
|
||||||
sbufWriteU16(dst, 0);
|
sbufWriteU16(dst, 0);
|
||||||
sbufWriteU8(dst, mixerConfig()->platformType);
|
sbufWriteU8(dst, mixerConfig()->platformType);
|
||||||
sbufWriteU8(dst, mixerConfig()->hasFlaps);
|
sbufWriteU8(dst, mixerConfig()->hasFlaps);
|
||||||
|
@ -2749,7 +2749,7 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSP2_INAV_SET_MIXER:
|
case MSP2_INAV_SET_MIXER:
|
||||||
mixerConfigMutable()->yaw_motor_direction = sbufReadU8(src);
|
mixerConfigMutable()->motorDirectionInverted = sbufReadU8(src);
|
||||||
sbufReadU16(src); // Was yaw_jump_prevention_limit
|
sbufReadU16(src); // Was yaw_jump_prevention_limit
|
||||||
mixerConfigMutable()->platformType = sbufReadU8(src);
|
mixerConfigMutable()->platformType = sbufReadU8(src);
|
||||||
mixerConfigMutable()->hasFlaps = sbufReadU8(src);
|
mixerConfigMutable()->hasFlaps = sbufReadU8(src);
|
||||||
|
|
|
@ -685,9 +685,9 @@ groups:
|
||||||
- name: PG_MIXER_CONFIG
|
- name: PG_MIXER_CONFIG
|
||||||
type: mixerConfig_t
|
type: mixerConfig_t
|
||||||
members:
|
members:
|
||||||
- name: yaw_motor_direction
|
- name: motor_direction_inverted
|
||||||
min: -1
|
field: motorDirectionInverted
|
||||||
max: 1
|
type: bool
|
||||||
- name: platform_type
|
- name: platform_type
|
||||||
field: platformType
|
field: platformType
|
||||||
type: uint8_t
|
type: uint8_t
|
||||||
|
|
|
@ -63,6 +63,7 @@ static EXTENDED_FASTRAM uint8_t motorCount = 0;
|
||||||
EXTENDED_FASTRAM int mixerThrottleCommand;
|
EXTENDED_FASTRAM int mixerThrottleCommand;
|
||||||
static EXTENDED_FASTRAM int throttleIdleValue = 0;
|
static EXTENDED_FASTRAM int throttleIdleValue = 0;
|
||||||
static EXTENDED_FASTRAM int motorValueWhenStopped = 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);
|
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
|
.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,
|
PG_RESET_TEMPLATE(mixerConfig_t, mixerConfig,
|
||||||
.yaw_motor_direction = 1,
|
.motorDirectionInverted = 0,
|
||||||
.platformType = PLATFORM_MULTIROTOR,
|
.platformType = PLATFORM_MULTIROTOR,
|
||||||
.hasFlaps = false,
|
.hasFlaps = false,
|
||||||
.appliedMixerPreset = -1, //This flag is not available in CLI and used by Configurator only
|
.appliedMixerPreset = -1, //This flag is not available in CLI and used by Configurator only
|
||||||
|
@ -245,6 +246,12 @@ void mixerInit(void)
|
||||||
} else {
|
} else {
|
||||||
motorRateLimitingApplyFn = nullMotorRateLimiting;
|
motorRateLimitingApplyFn = nullMotorRateLimiting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mixerConfig()->motorDirectionInverted) {
|
||||||
|
motorYawMultiplier = -1;
|
||||||
|
} else {
|
||||||
|
motorYawMultiplier = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mixerResetDisarmedMotors(void)
|
void mixerResetDisarmedMotors(void)
|
||||||
|
@ -354,7 +361,7 @@ void FAST_CODE NOINLINE mixTable(const float dT)
|
||||||
rpyMix[i] =
|
rpyMix[i] =
|
||||||
(input[PITCH] * currentMixer[i].pitch +
|
(input[PITCH] * currentMixer[i].pitch +
|
||||||
input[ROLL] * currentMixer[i].roll +
|
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] > rpyMixMax) rpyMixMax = rpyMix[i];
|
||||||
if (rpyMix[i] < rpyMixMin) rpyMixMin = 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);
|
PG_DECLARE_ARRAY(motorMixer_t, MAX_SUPPORTED_MOTORS, primaryMotorMixer);
|
||||||
|
|
||||||
typedef struct mixerConfig_s {
|
typedef struct mixerConfig_s {
|
||||||
int8_t yaw_motor_direction;
|
int8_t motorDirectionInverted;
|
||||||
uint8_t platformType;
|
uint8_t platformType;
|
||||||
bool hasFlaps;
|
bool hasFlaps;
|
||||||
int16_t appliedMixerPreset;
|
int16_t appliedMixerPreset;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue