Help with a Math/decimal problem

Being American, we want to display our fuel in gallons, as we don’t understand Liters, so I’m trying to convert Liters to Gallons from the adu.vft.remainingFuel variable.

I’ve written a conversion, see below, but my issue is that it’s truncating and losing the decimal place in my gallons. For example our full tank is 19.6 gallons = 47.19L. The result of my equation gives me 19. When I try to add a decimal to the adu.vft.remainingfuel*1000, I then get 1.9 as my result.


Sat here looking at things. Going to give the following a try, but won’t know until I get back to the car.

i struggeled with the same issue. ADU is kind of confusing in terms of decimal numbers.
I always do a bit try and error.
But here some rules:

  • If u want one decimal place then u need to set the decimal places.
  • If u set decimal palces it kind of acts like deviding by 10 per decimal place to the input variable…means u must directly multiply it with 10 per decimal place set
  • ADU doesn’t like too big numbers…i would avoid more than 4 digits

Here a simple example of fuelcons corrective factor in my vehicle:
Target here is to just mutiply the input value with 1,14 with one decimal. But i need to multiply it with 10 cause of setting one decimal place

use virtual fuel tank functionality there is factor there to correct it

Ultimately my second formula formula worked great to convert the Liters to Gallons. I then exported it via Canbus to our Podium so we can broadcast back to the pits.

Our challenge is for endurance racing is we can’t always “fill” the tank due to pit strategy, so on day 1 we had to calculate how much fuel we had based on several things. On day 2 we did a better job using/monitoring our fuel, so we managed to run longer per tank and not overfill as we did once on day 1.

I’m now thinking about ways to transmit a # via our telemtry to “fill” the tank, so we can 100% track our fuel.