Paul, also see post #139 in this thread: AEM-X-Series-OBDII-Wideband-UEGO-AFR-Sensor-Controller-Gauge
Paul, also see post #139 in this thread: AEM-X-Series-OBDII-Wideband-UEGO-AFR-Sensor-Controller-Gauge
I don't know if this is what you are trying to accomplish, but I just built this in V8.
If not totally disregard.
Before asking for help, please read this.
So did what i have for a single wideband be all i need to have for a functioning BEN factor to populate a map?
Until i connect to an ecu, i can't tell if it's actually going to populate a map. Seems you need to manually type in the data pid. How come we can't just select a pid like we can for the row/column tables?
The language is Lua, so whatever is available in that language is what you can use. I'm not able to modify the Lua language - sorry :(
https://www.lua.org/manual/5.2/#index
You could try this: http://hisham.hm/2011/05/04/luas-and...nary-operator/ (although there's issues with nil values).
I think it would look something like this:
Or you could just write a function to do it, like this:Code:return pid("EQIVRATIO") * ((pid("WO2LAM1")>pid("WO2LAM2")) and pid("WO2LAM1") or pid("WO2LAM2"))
Code:function iff(cond, a, b) if cond then return a else return b end end return pid("EQIVRATIO") * iff(pid("WO2LAM1")>pid("WO2LAM2"),pid("WO2LAM1"),pid("WO2LAM2"))
Regards
Paul
Before asking for help, please read this.
Thanks Paul...
that's what programming is about, working with what is available;
I ended up defining my own, the .ini looks like this now:
[Groups]
FUNCTION=Function definitions
WO2SER=Wide Band O2 Sensors (Serial-Comms)
WO2CAN=Wide Band O2 Sensors (CAN-bus)
[FUNCTION]
IFF=IFF,factor,0
[FUNCTION.IFF]
0=|-- FUNCTION.IFF
1=|function iff(x,y,z)
2=|if (x) then return y else return z end
3=|end
[WO2SER]
WO2BEN="Base Efficiency Numerator (Serial-Comms)(Dynamically-Leanest)",factor,3
[WO2SER.WO2BEN]
0=|-- WO2SER.WO2BEN
1=|return iff(pid("WO2LAM1")>pid("WO2LAM2"),pid("WO2LAM1"),p id("WO2LAM2"))*pid("EQIVRATIO")
[WO2CAN]
WO2BEN="Base Efficiency Numerator (CAN-bus)(Dynamically-Leanest)",factor,3
[WO2CAN.WO2BEN]
0=|-- WO2CAN.WO2BEN
1=|return iff(pid("WO2S11")>pid("WO2S21"),pid("WO2S11"),pid( "WO2S21"))/pid("EQ_RAT")
It seems like a pretty arbitrary and strange pair of tokens to use for block comments but it makes including/excluding blocks of code much easier:
--[[ I want to exclude the next two lines
a = b+c
d = e+f
--]]
---[[ I want to include the next two lines
a = b+c
d = e+f
--]]
Notice that by just adding another minus sign to the --[[ start comment token, it is no longer a valid start comment block, it is just a single line comment, so the two lines of code are now included again.
The end comment token is also ignored because it is now just a single line comment.
Regards
Paul
Before asking for help, please read this.