What I was hoping for is a classic simple shift light to build on:
No led till 4000 rpm
1 then 2 then 3 green leds till 5200 rpm
3 green + 1 then 2 yellow leds till 6000
3 green, 2 yellow then 1 + 2 reds till 6800
finally flashing
How can I do this basic shift light??
How do you address individual leds so you can have multiple colours on bar?
Closest I've got is
Code: Select all
--config shift light
sxCfgLinearGraph(0,1,0000,6800)
sxSetLinearThresh(0,1,4000,000,255,000,0)
sxSetLinearThresh(1,2,4400,000,255,000,0)
sxSetLinearThresh(2,3,4800,000,255,000,0) --green
sxSetLinearThresh(3,4,5200,255,255,000,0) --yellow
sxSetLinearThresh(4,5,5600,255,255,000,0) --yellow
sxSetLinearThresh(5,6,6000,255,000,000,0) --red Exceeds maximum steps!
sxSetLinearThresh(6,6,6800,255,000,000,10) --red
And only a single colour shows for all leds on the bar.
The linear bar gives gradual graduations which don't really work. I'd really like a glance to tell me there 1 or 2 green, yellow or red lights showing or if I've dropped below minimum revs for a corner.
To help debug this rather then running the motor I've added a startup script to run through the warning and rev ranges. Uses uptime in ms to run through ranges over 15s.
Code: Select all
function sxOnUpdate()
--Startup Sequence
ut=getUptime()
if ut<15000 then
println("UpTime:"..ut.." "..7*ut/10)
sxUpdateLinearGraph(7*ut/15)
sxUpdateAlert(0, 150*ut/15000)
sxUpdateAlert(1, 50*ut/15000)
else
--add your code to update ShiftX2 alerts or linear graph during run time.
--Runs continuously based on tickRate.
sxUpdateLinearGraph(getChannel("RPM"))
--update engine temp alert
sxUpdateAlert(0, getChannel("OilTempC"))
--update oil pressure alert
sxUpdateAlert(1, getAnalog(0))
end
end