mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 12:55:19 +03:00
Changed 'yaw_control_direction' into 'yaw_control_inverted' and made it a boolean, to get rid of the 'undefined' case 0.
This commit is contained in:
parent
b55b46a2b5
commit
728adb3a86
6 changed files with 7 additions and 6 deletions
|
@ -723,7 +723,7 @@ static const clivalue_t valueTable[] = {
|
|||
{ "alt_hold_fast_change", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_RC_CONTROLS_CONFIG, offsetof(rcControlsConfig_t, alt_hold_fast_change) },
|
||||
{ "deadband", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 32 }, PG_RC_CONTROLS_CONFIG, offsetof(rcControlsConfig_t, deadband) },
|
||||
{ "yaw_deadband", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 100 }, PG_RC_CONTROLS_CONFIG, offsetof(rcControlsConfig_t, yaw_deadband) },
|
||||
{ "yaw_control_direction", VAR_INT8 | MASTER_VALUE, .config.minmax = { -1, 1 }, PG_RC_CONTROLS_CONFIG, offsetof(rcControlsConfig_t, yaw_control_direction) },
|
||||
{ "yaw_control_reversed", VAR_INT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_RC_CONTROLS_CONFIG, offsetof(rcControlsConfig_t, yaw_control_reversed) },
|
||||
|
||||
// PG_PID_CONFIG
|
||||
{ "pid_process_denom", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 1, MAX_PID_PROCESS_DENOM }, PG_PID_CONFIG, offsetof(pidConfig_t, pid_process_denom) },
|
||||
|
|
|
@ -559,7 +559,7 @@ void createDefaultConfig(master_t *config)
|
|||
config->boardAlignment.pitchDegrees = 0;
|
||||
config->boardAlignment.yawDegrees = 0;
|
||||
#endif
|
||||
config->rcControlsConfig.yaw_control_direction = 1;
|
||||
config->rcControlsConfig.yaw_control_reversed = false;
|
||||
|
||||
// xxx_hardware: 0:default/autodetect, 1: disable
|
||||
config->compassConfig.mag_hardware = 1;
|
||||
|
|
|
@ -273,7 +273,7 @@ void updateMagHold(void)
|
|||
dif += 360;
|
||||
if (dif >= +180)
|
||||
dif -= 360;
|
||||
dif *= -rcControlsConfig()->yaw_control_direction;
|
||||
dif *= -GET_YAW_DIRECTION(rcControlsConfig()->yaw_control_reversed);
|
||||
if (STATE(SMALL_ANGLE))
|
||||
rcCommand[YAW] -= dif * currentPidProfile->P8[PIDMAG] / 30; // 18 deg
|
||||
} else
|
||||
|
|
|
@ -284,7 +284,7 @@ void updateRcCommands(void)
|
|||
} else {
|
||||
tmp = 0;
|
||||
}
|
||||
rcCommand[axis] = tmp * -rcControlsConfig()->yaw_control_direction;
|
||||
rcCommand[axis] = tmp * -GET_YAW_DIRECTION(rcControlsConfig()->yaw_control_reversed);
|
||||
}
|
||||
if (rcData[axis] < rxConfig()->midrc) {
|
||||
rcCommand[axis] = -rcCommand[axis];
|
||||
|
|
|
@ -77,7 +77,7 @@ PG_RESET_TEMPLATE(rcControlsConfig_t, rcControlsConfig,
|
|||
.yaw_deadband = 0,
|
||||
.alt_hold_deadband = 40,
|
||||
.alt_hold_fast_change = 1,
|
||||
.yaw_control_direction = 1,
|
||||
.yaw_control_reversed = false,
|
||||
);
|
||||
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(armingConfig_t, armingConfig, PG_ARMING_CONFIG, 0);
|
||||
|
|
|
@ -158,11 +158,12 @@ typedef struct rcControlsConfig_s {
|
|||
uint8_t yaw_deadband; // introduce a deadband around the stick center for yaw axis. Must be greater than zero.
|
||||
uint8_t alt_hold_deadband; // defines the neutral zone of throttle stick during altitude hold, default setting is +/-40
|
||||
uint8_t alt_hold_fast_change; // when disabled, turn off the althold when throttle stick is out of deadband defined with alt_hold_deadband; when enabled, altitude changes slowly proportional to stick movement
|
||||
int8_t yaw_control_direction; // change control direction of yaw (inverted, normal)
|
||||
int8_t yaw_control_reversed; // invert control direction of yaw
|
||||
} rcControlsConfig_t;
|
||||
|
||||
PG_DECLARE(rcControlsConfig_t, rcControlsConfig);
|
||||
|
||||
#define GET_YAW_DIRECTION(isInverted) (2 * (isInverted) - 1)
|
||||
typedef struct flight3DConfig_s {
|
||||
uint16_t deadband3d_low; // min 3d value
|
||||
uint16_t deadband3d_high; // max 3d value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue