When I get out of town on some of my 4WD trips I use my Car Speedo’s trip meter either for resetting to 0.0 at the beginning of a track where I am looking for a track or turnoff that is not always marked on the map. I also use it to calculate fuel consumption especially in long sandy trips where the fuel consumption is greater than normal.

This got me thinking about making a RoadRunner screen with 2 or 3 trip meters, where you can either set the starting value to 0.0 and have it count up or set a distance and have it count backwards.

I have now got a basic working trip meter but need to get some feedback as to what to do next.

As a prototype I just used AutoIT as I don’t have any VB skills. This is the logic to how it works.

Read GPSLAT & GPSLON from RR work out the distance between this lat and long and the previous set you read. Add the difference to a counter.

then send the value of the counter back to RR as a custom label

On a test run in the car today over 12km on my Speedo I got 12.04 one-way and 12.02 in reverse

One thing I did notice that will have to be added to the code is not to increment the counter if the speed is less that 1km, sitting at the lights I was getting very small increments but over time they could add up

--------------------------------------------------------------------------

$pi = 3.14159265358979

$counter1 = 0.00

$lat2 =rrget("GPSLAT")

$lon2 =rrget("GPSLON")

while 1

$lat1 =rrget("GPSLAT")

$lon1 =rrget("GPSLON")

$dist3 =distance($lat1, $lon1, $lat2, $lon2)

;swap the points ready for next calculation

$lat2 = $lat1

$lon2 = $lon1

$counter1 = $counter1 + $dist3

rrsnd("!MYCTR", $counter1)

sleep(1000)

wend

exit

I have the following AutoIt functions

rrget– will read a label from RR

rrsnd– will send back to RR a custom label

distance– calculates the distance between ($lat1, $lon1, $lat2, $lon2)

rrget and rrsnd were written by @cool dude back in march when I was playing around with getting a compass working, and he changed the VB SDK example so you can talk to the SDK it without the VB form.

--------------------------------------------------------------------------

All the mathematics are in the distance function

I found on the www a few different ways to calculate the distance between 2 geographical coordinates; I have used a formula that is based on spherical trigonometry which is supposed to be more accurate than some of the others

I would also like to see Average speed as a label

Why I have posted is to get some feedback on what to do next

Are there enough people that would like to have a trip meter as part of RR in which case we can ask Guino to add it to RR

Or I just continue using AutoIT and finish off the development myself and release it when I finish my 4WD skin

Thinking outside the box and on a comment Rustyboxx made is if you have 3 or 4 trip counters you could assign one for work mileage and save the counter to a file when you exit RR, probably even a description of the work trip.

Your comments and thoughts