Understanding behaviour of Linear Bar

Q&A For ShiftX2, RGB sequential shift light <a href="https://wiki.autosportlabs.com/ShiftX2">Installation and Operation Guide</a>
Post Reply
stephen
Posts: 10
Joined: Wed Aug 22, 2018 2:32 am

Understanding behaviour of Linear Bar

Post by stephen »

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: Select all

  --config shift light
  sxCfgLinearGraph&#40;0,1,0000,6800&#41; 
  sxSetLinearThresh&#40;0,1,4000,000,255,000,0&#41;
  sxSetLinearThresh&#40;1,2,4400,000,255,000,0&#41;
  sxSetLinearThresh&#40;2,3,4800,000,255,000,0&#41; --green 
  sxSetLinearThresh&#40;3,4,5200,255,255,000,0&#41; --yellow 
  sxSetLinearThresh&#40;4,5,5600,255,255,000,0&#41; --yellow 
  sxSetLinearThresh&#40;5,6,6000,255,000,000,0&#41; --red     Exceeds maximum steps!
  sxSetLinearThresh&#40;6,6,6800,255,000,000,10&#41; --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: Select all

function sxOnUpdate&#40;&#41;
  --Startup Sequence
  ut=getUptime&#40;&#41;
  if ut<15000 then
    println&#40;"UpTime&#58;"..ut.."  "..7*ut/10&#41;
    sxUpdateLinearGraph&#40;7*ut/15&#41;
    sxUpdateAlert&#40;0, 150*ut/15000&#41;
    sxUpdateAlert&#40;1, 50*ut/15000&#41;
  else
  --add your code to update ShiftX2 alerts or linear graph during run time.
  --Runs continuously based on tickRate.
    sxUpdateLinearGraph&#40;getChannel&#40;"RPM"&#41;&#41;
  --update engine temp alert
    sxUpdateAlert&#40;0, getChannel&#40;"OilTempC"&#41;&#41;
  --update oil pressure alert
    sxUpdateAlert&#40;1, getAnalog&#40;0&#41;&#41;
  end
end

brentp
Site Admin
Posts: 6274
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

Hi,

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

https://wiki.autosportlabs.com/ShiftX2# ... near_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

Post Reply