RegisterSearchFAQMemberlistUsergroupsLog in
Reply to topic Page 1 of 1
Bug in sxCfgLinearGraph scaling?
Author Message
Reply with quote
Post Bug in sxCfgLinearGraph scaling? 
It seems like there is a bug in the sxCfgLinearGraph scaling. It only seems to work as expected with zero to something scaling. If I want to start scaling at say 5000rpm, it doesn't work as expected. Script is below.

setTickRate(10) --TickRate is in Hz
--function onTick()
  local speed = getGpsSpeed()*1.6092*255  --convert to kph and rescale for increased precision
  speedL =, 0xFF) --mask out high byte
  speedH = bit.rshift(speed, 8) --shift high byte to the right
  --format the speed in a CAN message. Speed is in the first two bytes
  local msg = {speedL,speedH}
  txCAN(1, 1917, 0, msg)

-- Set ShiftX2 configuration parameters with default parameters
-- orientation: 0=normal, 1=inverted (display above LED bar)
-- brightness: 0-100%, 0 = auto brightness
-- can bus: 0=CAN1, 1=CAN2
--config shift light
sxCfgLinearGraph(0,0,5000,7000) --left to right graph, smooth style, 0 - 7000 RPM range

sxSetLinearThresh(0,0,5000,0,255,0,0) --green at 2000 RPM
sxSetLinearThresh(1,0,6000,255,255,0,0) --yellow at 6000 RPM
sxSetLinearThresh(2,0,7000,255,0,0,10) --red+flash at 7000 RPM

function onTick()
  local nmot = 6000

If I scale 0 to 7000rpm then it works as expected. If I set "nmot" = 5000 then five of the seven LED's light up green. And so on.

But when I change the scaling to 5000 to 7000, I would expect the LED's to first start lighting up at 5000rpm, and then all to be lit up at 7000rpm. But that's not what happens.

What happens is, with nmot =
10000 all green,
1000 all red flashing (real head scratcher because 1000 is below 5000 so nothing should happen....)
11000 all yellow,
6000 none (here I would have expected half to light up, because 6000rpm is halfway between 5000rpm and 7000rpm.....)

View user's profile Send private message
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