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: Restart from FAS in mode 2 using momentary + joystick #5

Open Hurricos opened 9 months ago

Hurricos commented 9 months ago

This is a WIP because this isn't the ideal way to write this code.

Before this commit, after using regen FAS in mode 2, the ECM will spend some time attempting to restart the engine (i.e. switching to mode 0 would give us an auto-restart), but eventually give up.

Now, when the engine is considered "force-stopped", translate the momentary button to MAMODE1_STATE_IS_START. Pressing the momentary button will mark mode-START; if immediately followed by a return to mode ASSIST plus some CMDPWR, the engine will start -- this is what you get when you press momentary + flick the joystick.

(I assume the MAMODE1 START state tells the MCM it's OK to be torquey, or that it needs to do some special magic to resolve the motor position.)

Note that this code is not tested against actual auto-stop. I have tested it against a key-off at neutral, and the engine DOES start ;^)

WIP because this isn't the ideal way to do this: we should really be instead generating a state and intentionally walking a bit of assist into the engine to re-start it.

No s-o-b yet, let's fix this WIP.

Hurricos commented 9 months ago

Another WIP issue: I don't check clutch state. It's possible that on the MT, with the clutch closed and car in gear, this would attempt to move the car -- but in the CVT, while stopped and with engine off in D, the ATPNP signal value is misleading -- the start clutch is depressurized.

Getting around that MT/CVT logic mismatch might be doable if we abstract the car's neutral state behind a function. We can ifdef to separate MT from CVT, then take the clutch-state for the MT directly to determine whether to inhibit start; for the CVT, a motionless engine and wheels guarantees a neutral position -- only if those aren't both true should we check ATPNP.

Hurricos commented 9 months ago

Another WIP issue: not handling mode 1. This behavior should be the same in all cases, if possible.

Hurricos commented 9 months ago

Yet another WIP issue, mirroring the first issue I mentioned: The M/T has different stop and start conditions than the CVT. In particular, the OEM system generally wants to attempt to autostart when the clutch is pressed while in gear and not moving -- as does IMAC&C -- but LiControl does not check this.

Hurricos commented 8 months ago

It appears the M/T never bails attempting to autostart (or, perhaps only bails if the clutch switch is held open for the full time -- but nobody drives like that, right?).

I'm going to adjust this PR to hide it behind a config ifdef #TRANSMISSION_IS_CVT.

Hurricos commented 5 months ago

https://www.insightcentral.net/threads/licontrol-support-thread.132434/page-9#post-1541304 describes the actual "wanted" PR. Once I have parsed through that post again, tested my assumptions and then made a checklist of reasonable safeties, I'll implement this in a new PR. Leaving this PR open until then.