Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -887,14 +887,7 @@ static void refloat_thd(void *arg) {
brake_tilt_winddown(&d->brake_tilt);
} else {
apply_noseangling(d);
turn_tilt_update(
&d->turn_tilt,
&d->motor,
&d->atr,
d->imu.balance_pitch,
d->noseangling_interpolated,
&d->float_conf
);
turn_tilt_update(&d->turn_tilt, &d->motor, &d->float_conf);

torque_tilt_update(&d->torque_tilt, &d->motor, &d->float_conf);
atr_update(&d->atr, &d->motor, &d->float_conf);
Expand Down
33 changes: 1 addition & 32 deletions src/turn_tilt.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,7 @@ void turn_tilt_aggregate(TurnTilt *tt, const IMU *imu) {
}
}

void turn_tilt_update(
TurnTilt *tt,
const MotorData *md,
const ATR *atr,
float balance_pitch,
float noseangling,
const RefloatConfig *config
) {
void turn_tilt_update(TurnTilt *tt, const MotorData *md, const RefloatConfig *config) {
if (config->turntilt_strength == 0) {
return;
}
Expand Down Expand Up @@ -127,30 +120,6 @@ void turn_tilt_update(
} else {
tt->target *= md->erpm_sign;
}

// ATR interference: Reduce target during moments of high torque response
float atr_min = 2;
float atr_max = 5;
if (sign(atr->target) != sign(tt->target)) {
// further reduced turntilt during moderate to steep downhills
atr_min = 1;
atr_max = 4;
}
if (fabsf(atr->target) > atr_min) {
// Start scaling turntilt when ATR>2, down to 0 turntilt for ATR > 5 degrees
float atr_scaling = (atr_max - fabsf(atr->target)) / (atr_max - atr_min);
if (atr_scaling < 0) {
atr_scaling = 0;
// during heavy torque response clear the yaw aggregate too
tt->yaw_aggregate = 0;
}
tt->target *= atr_scaling;
}
if (fabsf(balance_pitch - noseangling) > 4) {
// no setpoint changes during heavy acceleration or braking
tt->target = 0;
tt->yaw_aggregate = 0;
}
}

// Smoothen changes in tilt angle by ramping the step size
Expand Down
10 changes: 1 addition & 9 deletions src/turn_tilt.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#pragma once

#include "atr.h"
#include "conf/datatypes.h"
#include "imu.h"
#include "motor_data.h"
Expand Down Expand Up @@ -45,13 +44,6 @@ void turn_tilt_configure(TurnTilt *tt, const RefloatConfig *config);

void turn_tilt_aggregate(TurnTilt *tt, const IMU *imu);

void turn_tilt_update(
TurnTilt *tt,
const MotorData *md,
const ATR *atr,
float balance_pitch,
float noseangling,
const RefloatConfig *config
);
void turn_tilt_update(TurnTilt *tt, const MotorData *md, const RefloatConfig *config);

void turn_tilt_winddown(TurnTilt *tt);
Loading