doppelhub / MuddersMIMA

Mudders Take on Manual IMA Control in the G1 Honda Insight
GNU General Public License v3.0
2 stars 4 forks source link

[WIP] feat: mode1: Better blending #6

Open Hurricos opened 8 months ago

Hurricos commented 8 months ago

Improve how we blend the stored and current joystick value.

Before this commit, when in mode 1, a stored assist value was overridden by any joystick use. This means that increasing a joystick assist value requires us to reduce from stored down to manually requested value, creating a small jerk as power is instantly changed.

Now, combine the joystick and stored value if they are in the same direction. If a stored value is (absolutely) greater than the current joystick position, the stored value takes precedence. This allows us to carefully adjust-up or adjust-down assist without jerking the drivetrain around.

Out-of-scope

Blending with OEM ECM values; this PR is an incremental improvement.

WIP:

WIP, because: failed testing: when using this code, pressing the joystick just past the neutral position range in the assist direction causes it to override [the stored value] if you're close to the neutral range. I believe this comes from JOYSTICKNEUTRAL{MAX,MIN}_PERCENT not adequately filtering out cases?

Hurricos commented 8 months ago

9801c16 to 06dcbbe: Remove commits from unrelated PRs.