RegisterSearchFAQMemberlistUsergroupsLog in
Reply to topic Page 1 of 1
Understanding behaviour of Linear Bar
Author Message
Reply with quote
Post Understanding behaviour of Linear Bar 
I'm having trouble understanding the behaviour of the linear bar and how to set it up.

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:

  --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

This exceeds max of 5 steps and last 2 steps don't show.
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:
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


View user's profile Send private message
Reply with quote
Post  
Hi,

Sorry for the delayed response. The key for this is to configure the graph for stepped mode.

https://wiki.autosportlabs.com/ShiftX2#Configure_Linear_Graph

That way, when you set the threshold, you can configure the step length using the "Set Linear Graph Threshold"

Hope this helps. Try something simple at first, then expand from there.


_________________
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter
View user's profile Send private message Send e-mail
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum