Emtron: Difference between revisions

(→‎Lua Script: fixed offset)
Line 27: Line 27:
--handle TPS message data
--handle TPS message data
function process_tps(data)
function process_tps(data)
     local tps = (data[2] * 256 + data[1]) * 0.1
     local tps = ((data[2] * 256 + data[1]) - 1000) * 0.1
     setChannel(tps_id, tps)
     setChannel(tps_id, tps)
end
end

Revision as of 22:48, 12 February 2015

Emtron ECU

Emtron KV8.jpg

Configuration

This script integrates the Emtron ECU with RaceCapture/Pro telemetry, using the factory standard CAN bus mapping

Baud Rate

The default baud rate for Emtron is 1mbps.

  • You can configure this on the CAN bus configuration page in the RaceCapture App.

Channels

TPS

  • CAN ID: 1251
  • Bytes: 1,2 (little endian)
  • Scaling: 1000 = 0.0% ; 2000 = 100.0%
  • Precision: 0.1

Lua Script


setTickRate(30) --30Hz

--set up virtual channels
tps_id = addChannel("TPS", 10, 1)

--handle TPS message data
function process_tps(data)
    local tps = ((data[2] * 256 + data[1]) - 1000) * 0.1
    setChannel(tps_id, tps)
end

function onTick()
    repeat --will drain CAN buffer on each tick
        id, e, data = rxCAN(0)
        if id == 1251 then process_tps(data) end
    until id == nil
end