[Ovmsdev] Merging in Twizy and Volt/Ampera work
mark at webb-johnson.net
Sun Nov 4 11:11:25 HKT 2012
A while ago, Michael Balzer suggested to me that it would be best to have one firmware supporting all cars. I agreed, but at the time, flash space was tight in the v1 hardware and I was concerned we would run out of flash. So, we implemented two separate builds.
Now that the v2 hardware is out, I think that is much less of an issue than it was, as the v2 hardware has 50% more flash (taking away the baseline code, that at least triples the amount of free flash we have) - there should be plenty of space to support the cars that need it for the forceable future.
In the coming few months, as the Volt/Ampera and Renault Twizy code becomes usable and usable by end-users (rather than developers), it would be much easier to be providing modules pre-flashed with a single version of firmware supporting all the cars.
As the work on Twizy and Volt/Ampera is now progressing so fast, I think it best to make the change now rather than later. What I suggest is:
We leave the current car modules basically as they are: can_teslaroadster, can_voltampera, and can_twizy.
We leave the v1 firmware build basically as it is - just using can_teslaroadster. All the v2 hardware users are Tesla Roadster users.
We move the 'shared' interrupt code (can_int_service, high_isr) out of the car_* modules into a can_canbus module.
We create a mechanism for car_* modules to register themselves at startup.
We create an eeprom parameter to define the vehicle type, and a switch at startup to hook the module supporting the currently defined car. It might be interesting in future to create a car_autodetect module to auto-detect the vehicle type from can bus traffic, but for the moment I think a manual parameter is acceptable.
The existing V2_T2, V2_VA and V2_RT build configurations would disappear and be replaced with a single V2 firmware that would include all three car_* modules.
I'm not sure of the exact mechanism for  and , but it should not be too hard to do. I really want to avoid having a single list of the cars anywhere. I'd much rather just have the existence of code in the can_* modules cause the code to be included.
Does this sound sensible to everyone? Any better suggestions, or comments?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the OvmsDev