AEM Infinity 6H: Difference between revisions

No edit summary
(added more channels)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
=AEM Inifinity 6H ECU=
=AEM Inifinity 6H ECU=


[[Image:AEM_infinity.jpg|500px]]


<pre>
setTickRate(25)
initCAN(0, 500000)
CAN_chan = 0
CAN_map = {
  [32546816] = function(data)
  map_chan(rpmId, data, 0, 2, 0.39063, 0)
  map_chan(tpsId, data, 4, 2, 0.0015259, 0)
  map_chan(atsId, data, 6, 1, 1, 0)
  map_chan(ctsId, data, 7, 1, 1, 0)
  end,


<pre>
  [32546820] = function(data)
setTickRate(25)  
  map_chan(fpsId, data, 3, 1, 0.580151, 0)
initCAN(0, 500000)  
  map_chan(opsId, data, 4, 1, 0.580151, 0)
CAN_chan = 0  
  map_chan(mapId, data, 0, 2, 0.014504, -14.6960)
  end,
 
  [32546823] = function(data)
  map_chan(otId, data, 6, 1, 1, -50)
  end,
 
  [32546819] = function(data)
  map_chan(afrId, data, 0, 1, 0.057227, 7.325)
end
 
}


CAN_map = {
rpmId = addChannel("RPM", 25, 0, 0, 10000, 'RPM')
[32546816] = function(data)  
tpsId = addChannel("TPS", 10, 1, 0, 100, '%')
  map_chan(rpmId, data, 0, 2, 0.39063, 0)  
atsId = addChannel("IAT", 10, 1, 0, 200, 'C')
  map_chan(tpsId, data, 4, 2, 0.0015259, 0)  
ctsId = addChannel("EngineTemp", 10, 1, 0, 200, 'C')
  map_chan(atsId, data, 6, 1, 1, 0)  
fpsId = addChannel("FuelPress", 10, 1, 0, 200, 'PSI')
  map_chan(ctsId, data, 7, 1, 1, 0)  
opsId = addChannel("OilPress", 10, 1, 0, 200, 'PSI')
end,
otId = addChannel("OilTemp", 10, 1, -50, 200, 'C')
[32546820] = function(data)  
afrId = addChannel("AFR", 10, 2, 0, 20, '')
  map_chan(fpsId, data, 3, 1, 0.580151, 0)  
mapId = addChannel("MAP", 10, 1, 0, 200, 'PSI')
  map_chan(opsId, data, 4, 1, 0.580151, 0)  
end
}


rpmId = addChannel("RPM", 25, 0, 0, 10000, 'RPM')  
function onTick()
tpsId = addChannel("TPS", 10, 1, 0, 100, '%')  
processCAN()
atsId = addChannel("IAT", 10, 1, 0, 200, 'C')
end
ctsId = addChannel("EngineTemp", 10, 1, 0, 200, 'C')
fpsId = addChannel("FuelPress", 10, 1, 0, 200, 'PSI')
opsId = addChannel("OilPress", 10, 1, 0, 200, 'PSI')


function onTick()  
function processCAN()
   processCAN()  
repeat
end  
   local id, e, data = rxCAN(0)
  if id ~= nil then
    local map = CAN_map[id]
    if map ~= nil then
      map(data)
    end
  end
until id == nil
end


function processCAN()  
function map_chan(cid, data, offset, len, mult, add)
  repeat
offset = offset + 1
    local id, e, data = rxCAN(0)
local value = 0
    if id ~= nil then
while len > 0 do
      local map = CAN_map[id]  
  value = (value * 256) + data[offset]
      if map ~= nil then
  offset = offset + 1
        map(data)
   len = len - 1
      end
end
    end
   until id == nil
end  


function map_chan(cid, data, offset, len, mult, add)
setChannel(cid, (value * mult) + add)
  offset = offset + 1
  local value = 0
  while len > 0 do
    value = (value * 256) + data[offset]
    offset = offset + 1
    len = len - 1
  end
  setChannel(cid, (value * mult) + add)  
end
end
</pre>
</pre>

Latest revision as of 06:01, 18 December 2016

AEM Inifinity 6H ECU

AEM infinity.jpg

setTickRate(25)
initCAN(0, 500000)
CAN_chan = 0
CAN_map = {
  [32546816] = function(data)
  map_chan(rpmId, data, 0, 2, 0.39063, 0)
  map_chan(tpsId, data, 4, 2, 0.0015259, 0)
  map_chan(atsId, data, 6, 1, 1, 0)
  map_chan(ctsId, data, 7, 1, 1, 0)
  end,

  [32546820] = function(data)
  map_chan(fpsId, data, 3, 1, 0.580151, 0)
  map_chan(opsId, data, 4, 1, 0.580151, 0)
  map_chan(mapId, data, 0, 2, 0.014504, -14.6960)
  end,

  [32546823] = function(data)
  map_chan(otId, data, 6, 1, 1, -50)
  end,

  [32546819] = function(data)
  map_chan(afrId, data, 0, 1, 0.057227, 7.325)
end

}

rpmId = addChannel("RPM", 25, 0, 0, 10000, 'RPM')
tpsId = addChannel("TPS", 10, 1, 0, 100, '%')
atsId = addChannel("IAT", 10, 1, 0, 200, 'C')
ctsId = addChannel("EngineTemp", 10, 1, 0, 200, 'C')
fpsId = addChannel("FuelPress", 10, 1, 0, 200, 'PSI')
opsId = addChannel("OilPress", 10, 1, 0, 200, 'PSI')
otId = addChannel("OilTemp", 10, 1, -50, 200, 'C')
afrId = addChannel("AFR", 10, 2, 0, 20, '')
mapId = addChannel("MAP", 10, 1, 0, 200, 'PSI')

function onTick()
processCAN()
end

function processCAN()
repeat
  local id, e, data = rxCAN(0)
  if id ~= nil then
    local map = CAN_map[id]
    if map ~= nil then
      map(data)
    end
  end
until id == nil
end

function map_chan(cid, data, offset, len, mult, add)
offset = offset + 1
local value = 0
while len > 0 do
  value = (value * 256) + data[offset]
  offset = offset + 1
  len = len - 1
end

setChannel(cid, (value * mult) + add)
end