[Ovmsdev] General issue: metric system ;-)
dexter at expeedo.de
Fri Nov 9 22:32:54 HKT 2012
as car_speed already is stored in the user's units (i.e. Tesla CAN
interrupt eventually needs to convert mph to km/h), this also is a bit
The CAN module could store values in the car units and tell the net
module about the unit(s) used. So conversions would only need to be done
at the output/display level only if the user prefs differ from the car
config, and the can interrupt can be kept simple + fast.
Another solution could be to change to miles/10 for all mile/mph values,
that would give enough precision to not lose in translation.
Am 03.11.2012 15:08, schrieb Mark Webb-Johnson:
> I think that the protocol requires Miles for this, and the Apps convert as necessary. From a precision point of view, it would be best to store it in the user's chosen units, but we do try to minimise what is done in the can bus interrupt service routines.
> It is not so easy to change, but I'll see what is the best way. For the moment, best to leave it in miles?
> Regards, Mark.
> P.S. Miles -> Kilometer formula is (((miles << 4)+5)/10))
> I am sure there is something equally efficient for kilometers -> miles
> Best to avoid using floating point - especially in the interrupt service routines
> On 3 Nov, 2012, at 4:08 AM, Michael Balzer <dexter at expeedo.de> wrote:
>> I hesitate to touch anything outside the can module yet, but I would like to store range values in kilometers.
>> Reason: my car uses km and I'm losing precision if converting them to integer (!) miles.
>> 1 mi = 1.609 km
>> Are there any thoughts on this? Could it be just a labeling switch or does the server/app protocol need miles?
>> Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
>> Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
>> OvmsDev mailing list
>> OvmsDev at lists.teslaclub.hk
> OvmsDev mailing list
> OvmsDev at lists.teslaclub.hk
Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 206 bytes
Desc: not available
More information about the OvmsDev