05-09-2022, 07:42 PM

I have a vehicle that does not provide fuel economy so I've found there are some formulas to use based on other OBD2 PIDs depending on whether you have a MAF or not. I do not so I'm using a formula based on MAP. Here are the relevant configs:

openauto_dbd_pids.ini:

openauto_odb_gauges.ini

What I'm finding is the gauge reports 0.0 as the value. If I trim some entries out of the formula to shorten it for testing purposes, then it does provide a non-zero result (albeit an inaccurate number due to missing formula entries). I have also checked to make sure PIDs 1, 2, 3, and 4 are non-zero individually and they all register greater than zero.

So, I'm wondering -- is there a limitation on how long the gauge formula can be?

openauto_dbd_pids.ini:

```
[ObdPid_1]
;Engine speed
Query=010C
Formula=(256*a+b)/4
[ObdPid_2]
;Vehicle speed
Query=010D
Formula=a
[ObdPid_3]
;Intake manifold absolute pressure
Query=010B
Formula=a
[ObdPid_4]
;Intake air temperature
Query=010F
Formula=a-40
```

openauto_odb_gauges.ini

```
[ObdGauge_11]
MinValue=0
MaxValue=100
Limit=0
Formula=((getPidValue(2)*0.6214)/(3600*1000))/((((getPidValue(1)*getPidValue(3)/getPidValue(4)/2)/60)*(70/100)*4.6*28.97/8.314)/14.7/6.17/454)
Label=MPG
Precision=1
```

What I'm finding is the gauge reports 0.0 as the value. If I trim some entries out of the formula to shorten it for testing purposes, then it does provide a non-zero result (albeit an inaccurate number due to missing formula entries). I have also checked to make sure PIDs 1, 2, 3, and 4 are non-zero individually and they all register greater than zero.

So, I'm wondering -- is there a limitation on how long the gauge formula can be?