Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird logic in rpm_regulator.cpp #65

Open
TomLonergan03 opened this issue Oct 23, 2021 · 0 comments
Open

Weird logic in rpm_regulator.cpp #65

TomLonergan03 opened this issue Oct 23, 2021 · 0 comments

Comments

@TomLonergan03
Copy link
Contributor

TomLonergan03 commented Oct 23, 2021

In RPM_Regulator::calculateRPM when the temperature is over the maximum temperature the output is to maintain current RPMs. This feels counterintuitive and needs confirmed whether it is correct behaviour.

if (act_temp <= MAX_TEMP) {
if (act_current < MAX_CURRENT && act_temp < MAX_TEMP && act_rpm < opt_rpm) {
return act_rpm + step(opt_rpm, true);
} else if (act_current > MAX_CURRENT || act_temp > MAX_TEMP || act_rpm > opt_rpm) {
int32_t target = act_rpm - step(opt_rpm, false);
if (target < 0) {
return 0;
} else {
return target;
}
} else {
return act_rpm;
}
} else {
return act_rpm;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant