[Ovmsdev] Change to API for vehicle poll0 and poll1 functions
Michael Jochum
mikeljo at me.com
Fri Nov 8 22:29:20 HKT 2013
Hi mark,
i did this in "vehicle_voltampera.c:" in 2.2.7
else if (id == 0x7e9)
{
switch (pid)
{
case 0x2487: //Distance Traveled on Battery Energy This Drive Cycle
edrive_distance = KM2MI((can_databuffer[5] + ((unsigned int)can_databuffer[4] << 8)) / 100); // German Volt Report im KM
if ((edrive_distance > va_drive_distance_bat_max) && (car_chargestate == 4)) va_drive_distance_bat_max = edrive_distance;
break;
}
}
cause the return value is placed on 2 Bytes.
I think it is necessary to implement a parameter how much return byte expected.
Bye
Michael
Am 02.11.2013 um 14:14 schrieb Mark Webb-Johnson <mark at webb-johnson.net>:
> I just committed a change to all vehicle modules, to change the api for the poll0() and poll1() functions.
>
> 1aaa0a3 Move can bus low level register access to vehicle.c, out of individual vehicle modules
>
> The new API sets up:
>
> unsigned int can_id; // ID of can message
> unsigned char can_filter; // CAN filter
> unsigned char can_datalength; // The number of valid bytes in the can_databuffer
> unsigned char can_databuffer[8]; // CAN message bytes
>
> prior to the calls to poll0() and poll1(). So, the individual vehicle modules no longer need to (and no longer are able to) access the low-level CAN bus registers in any way.
>
> I tried to move all the vehicle modules to the new mechanism, but there seemed to be significant differences in the way each module did things. Hopefully the work I did was ok and hasn’t broken anything, but please check your respective modules to make sure they still work.
>
> Overall, we’ve saved about 500-to-600 bytes of flash doing this.
>
> I’ve labelled this 2.6.1, as it has the capacity to break things.
>
> Regards, Mark.
>
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.teslaclub.hk
> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20131108/327a747a/attachment.htm>
More information about the OvmsDev
mailing list