Fixed reverse driving and improved disabling of pwmomat
This commit is contained in:
@ -224,10 +224,16 @@ void DefaultMode::update()
|
||||
pwmomat::wish = pwmomat::WISH::NONE;
|
||||
pwmomat::enabled_time = now;
|
||||
}
|
||||
else if ((pwmomat::tempomat_pwm && pwmomat::enabled_time) && (espchrono::ago(*pwmomat::enabled_time) > 500ms) && (pwm >= std::min(*pwmomat::tempomat_pwm+10, 1500.f) || pwmomat::wish == pwmomat::WISH::WISH_DISABLE)) // disable tempomat when pwm is larger than saved pwm
|
||||
else if ((pwmomat::tempomat_pwm && pwmomat::enabled_time) && (espchrono::ago(*pwmomat::enabled_time) > 500ms))
|
||||
{
|
||||
pwmomat::wish = pwmomat::WISH::NONE;
|
||||
pwmomat::tempomat_pwm = std::nullopt;
|
||||
if ((*pwmomat::tempomat_pwm >= 0 && (pwm >= *pwmomat::tempomat_pwm + 10 || pwm < -10)) ||
|
||||
(*pwmomat::tempomat_pwm < 0 && (pwm <= *pwmomat::tempomat_pwm - 10 || pwm > 10)) ||
|
||||
(pwmomat::wish == pwmomat::WISH::WISH_DISABLE)
|
||||
)
|
||||
{
|
||||
pwmomat::wish = pwmomat::WISH::NONE;
|
||||
pwmomat::tempomat_pwm = std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
if (pwmomat::tempomat_pwm)
|
||||
|
Reference in New Issue
Block a user