mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-20 23:05:19 +03:00
initial debug changes
This commit is contained in:
parent
504b1479fb
commit
6d2c1a3c01
1 changed files with 16 additions and 5 deletions
|
@ -815,17 +815,23 @@ void FAST_CODE pidController(const pidProfile_t *pidProfile, const rollAndPitchT
|
||||||
if (itermRelax && (axis < FD_YAW || itermRelax == ITERM_RELAX_RPY )) {
|
if (itermRelax && (axis < FD_YAW || itermRelax == ITERM_RELAX_RPY )) {
|
||||||
const float setpointLpf = pt1FilterApply(&windupLpf[axis], currentPidSetpoint);
|
const float setpointLpf = pt1FilterApply(&windupLpf[axis], currentPidSetpoint);
|
||||||
const float setpointHpf = fabsf(currentPidSetpoint - setpointLpf);
|
const float setpointHpf = fabsf(currentPidSetpoint - setpointLpf);
|
||||||
if (itermRelaxType == ITERM_RELAX_SETPOINT && setpointHpf < 60) {
|
|
||||||
itermErrorRate = (1 - setpointHpf / 60.0f) * (currentPidSetpoint - gyroRate);
|
|
||||||
}
|
|
||||||
if (axis == FD_ROLL) {
|
if (axis == FD_ROLL) {
|
||||||
DEBUG_SET(DEBUG_ITERM_RELAX, 0, lrintf(setpointLpf));
|
DEBUG_SET(DEBUG_ITERM_RELAX, 0, lrintf(setpointLpf));
|
||||||
DEBUG_SET(DEBUG_ITERM_RELAX, 1, lrintf(setpointHpf));
|
DEBUG_SET(DEBUG_ITERM_RELAX, 1, lrintf(setpointHpf));
|
||||||
DEBUG_SET(DEBUG_ITERM_RELAX, 2, lrintf(currentPidSetpoint));
|
}
|
||||||
DEBUG_SET(DEBUG_ITERM_RELAX, 3, lrintf(axisError[axis] * 10));
|
if (itermRelaxType == ITERM_RELAX_SETPOINT && setpointHpf < 60) {
|
||||||
|
itermErrorRate = (1 - setpointHpf / 60.0f) * (currentPidSetpoint - gyroRate);
|
||||||
|
if (axis == FD_ROLL) {
|
||||||
|
DEBUG_SET(DEBUG_ITERM_RELAX, 2, lrintf(currentPidSetpoint));
|
||||||
|
DEBUG_SET(DEBUG_ITERM_RELAX, 3, lrintf((1 - setpointHpf / 60.0f) * 100));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (itermRelaxType == ITERM_RELAX_GYRO ) {
|
if (itermRelaxType == ITERM_RELAX_GYRO ) {
|
||||||
itermErrorRate = fapplyDeadband(setpointLpf - gyroRate, setpointHpf);
|
itermErrorRate = fapplyDeadband(setpointLpf - gyroRate, setpointHpf);
|
||||||
|
if (axis == FD_ROLL) {
|
||||||
|
DEBUG_SET(DEBUG_ITERM_RELAX, 2, lrintf(gyroRate + setpointHpf));
|
||||||
|
DEBUG_SET(DEBUG_ITERM_RELAX, 3, lrintf(gyroRate - setpointHpf));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USE_ABSOLUTE_CONTROL)
|
#if defined(USE_ABSOLUTE_CONTROL)
|
||||||
|
@ -845,6 +851,11 @@ void FAST_CODE pidController(const pidProfile_t *pidProfile, const rollAndPitchT
|
||||||
} else {
|
} else {
|
||||||
acErrorRate = (gyroRate > gmaxac ? gmaxac : gminac ) - gyroRate;
|
acErrorRate = (gyroRate > gmaxac ? gmaxac : gminac ) - gyroRate;
|
||||||
}
|
}
|
||||||
|
if (axis == FD_ROLL) {
|
||||||
|
DEBUG_SET(DEBUG_ITERM_RELAX, 2, lrintf(acErrorRate));
|
||||||
|
DEBUG_SET(DEBUG_ITERM_RELAX, 3, lrintf(axisError[axis] * 10));
|
||||||
|
}
|
||||||
|
|
||||||
#endif // USE_ABSOLUTE_CONTROL
|
#endif // USE_ABSOLUTE_CONTROL
|
||||||
} else
|
} else
|
||||||
#endif // USE_ITERM_RELAX
|
#endif // USE_ITERM_RELAX
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue