It could be made to work on the fly. The max current in the program is saved in the variable maxCurrent. You could just monitor those other A/D inputs maybe only 100 times a second (like the other slow changing stuff: throttle position and aluminum heat spreader temperature). You would just compute the new value for maxCurrent at that time. If you read 0v from the A/D converter, that would mean the maxCurrent should be set to the minimum value(whatever that should be), and if you read 5v, set it to whatever the largest safe maxCurrent, and something between 0v and 5v means you just set the maxCurrent to the appropriate value between the minimum maxCurrent and the maximum maxCurrent. That would be nice to have it on the dashboard too! It would be sort of worthless having the knob sitting in the engine compartment. hehe
The code for it would take about 5 minutes, and the extra circuitry would be really simple too! Identical to the throttle! But instead of reading it and setting the PWM pulse width, you would do that other stuff above.
|