Page 1 of 1

Script for a more stable shiftX light

Posted: Sun Mar 29, 2015 6:33 am
by stingg
Found that the basic script especially at high rpm is not stable and the light jump to and from the cutoff point. Below script gives a more stable shift light by averaging the rpm and having different on-rpm and off-rpm.

setTickRate(30)
a = 0
y = 0
function onTick()
if getGpsSpeed() > 10 then startLogging() end
local r = getTimerRpm(2)
a = (r+y)/2
if a > 7200 then setGpio(0,1) elseif a < 7000 then setGpio(0,0) end
if a > 7700 then setGpio(1,1) elseif a < 7500 then setGpio(1,0) end
if a > 8200 then setGpio(2,1) elseif a < 8000 then setGpio(2,0) end
y = r

end[/list]

Posted: Tue Apr 14, 2015 7:05 pm
by brentp
Thanks for the script - are you saying that right at the RPM threshold between 'steps' it jumps?

How stable is your RPM reading while monitoring it in the dashboard?