Created
December 12, 2016 21:37
-
-
Save brentpicasso/247d898f369cfb731e0014bb6f9dcb3c to your computer and use it in GitHub Desktop.
Create Random tire and brake temperature data for RaceCapture/Pro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tires = 4 | |
tireZones = 4 | |
tirePrefixes = {'TireTmpFL', 'TireTmpFR', 'TireTmpRL', 'TireTmpRR'} | |
tireValues = {} | |
tireIds = {} | |
minTireVal = 0 | |
maxTireVal = 300 | |
brakes = 4 | |
brakeZones = 4 | |
brakePrefixes = {'BrakeTmpFL', 'BrakeTmpFR', 'BrakeTmpRL', 'BrakeTmpRR'} | |
brakeValues = {} | |
brakeIds = {} | |
minBrakeVal = 0 | |
maxBrakeVal = 1000 | |
function setupChannels(prefixes, ids, items, zones, minVal, maxVal) | |
local ti = 1 | |
for c=1,items do | |
for t=1,zones do | |
local name = prefixes[c] .. t | |
name = name:sub(1, -3) --trim deimal point | |
println('setting up "' ..name ..'"') | |
ids[ti] = addChannel(name, 10, 0, minVal, maxVal) | |
ti=ti+1 | |
end | |
end | |
end | |
function updateTires() | |
local i=1 | |
for c=1, tires do | |
for t=1,tireZones do | |
tireValues[i] = math.random(0,300) | |
setChannel(tireIds[i], tireValues[i]) | |
i=i+1 | |
end | |
end | |
end | |
function updateBrakes() | |
local i=1 | |
for c=1, brakes do | |
for t=1,brakeZones do | |
brakeValues[i] = math.random(0,1000) | |
setChannel(brakeIds[i], brakeValues[i]) | |
i=i+1 | |
end | |
end | |
end | |
function onTick() | |
updateTires() | |
updateBrakes() | |
end | |
setTickRate(10) | |
setupChannels(tirePrefixes, tireIds, tires, tireZones, minTireVal, maxTireVal) | |
setupChannels(brakePrefixes, brakeIds, brakes, brakeZones, minBrakeVal, maxBrakeVal) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment