Page 1 of 1

Cannot get shift x to work

Posted: Thu Oct 15, 2015 3:40 pm
by Ash-b-84
Hi I have the mk1 I have set the gpio jumpers to out position
Set the digital in/out to outputs 10hz in race capture
Copied an pasted the pula script off the website but changed rpm values
But nothing happens to the lights on the shift x
My rpm is displayed on the rpm2 channel not rpm is there anything else I need to change as getting quite frustrated

Many thanks in advance

Posted: Thu Oct 15, 2015 3:57 pm
by Ash-b-84
Also when 12v car power Is first turned on an the rcp gets power all the leds on the shift x light up at the same time for a second then go off but will not come on at any rpm

Posted: Mon Oct 19, 2015 2:35 pm
by gizmodo
Did you change the script so it is using your RPM input and not the test value?
function ctON(ul,ll)
--RPM=getTimerRpm(0) <-- Remove '--'
RPM=testRPM <-- Remove this line
factor = 0.5 * FREQ_HZ * (1 - (ul - RPM) / (ul - ll))
if factor >= 0.5 * FREQ_HZ then --can't blink faster than tickRate/2--
on_time = MAX_ON_TIME
elseif factor < 1 then --can't blink slower than max period--
on_time = 0
else
on_time = MAX_ON_TIME / factor
end
return on_time / loop_time
end

Posted: Mon Oct 19, 2015 6:06 pm
by brentp
Hi Ash,

Can you post your lua script so we can review further?

Also, are you getting RPM from the RPM connection on RaceCapture/Pro?

Posted: Tue Oct 20, 2015 11:35 am
by Ash-b-84
function onTick() end

setTickRate(15) --15Hz

--Shift Now!!!!
function onTick()
rpm=getTimerRpm(0) --read RPM

--activate LEDs
if rpm > 6600 then setGpio(2,1) else setGpio(2,0) end
if rpm > 6900 then setGpio(1,1) else setGpio(1,0) end
if rpm > 7200 then setGpio(0,1) else setGpio(0,0) end
end

that's what I have my rpm comes from rpm2 when I check the dashboard in racecapture

Posted: Wed Oct 21, 2015 4:23 pm
by brentp
Hi,

The line:

rpm=getTimerRpm(0) --read RPM

means 'get RPM from the first timer input port'

0 = first port
1 = second port
2 = third port

When facing the terminal block, the right most port is 0, then 1 and two towards the middle.

If you have it hooked up to the 3rd port, then you'll have to make this line:

rpm=getTimerRpm(2) --read RPM


Also,

you have onTick() listed twice in the script. It should only be defined once.

Here's an updated script. Let us know if this works:



Code: Select all

setTickRate&#40;15&#41; --15Hz 

--Shift Now!!!! 
function onTick&#40;&#41; 
rpm=getTimerRpm&#40;2&#41; --read RPM 

--activate LEDs 
if rpm > 6600 then setGpio&#40;2,1&#41; else setGpio&#40;2,0&#41; end 
if rpm > 6900 then setGpio&#40;1,1&#41; else setGpio&#40;1,0&#41; end 
if rpm > 7200 then setGpio&#40;0,1&#41; else setGpio&#40;0,0&#41; end 
end 


Posted: Sat Oct 24, 2015 4:05 pm
by Ash-b-84
Managed to get it workin now changed it to output (1) however at set rpm both the amber an green come on at the same time an also I'm still gettin spikes when revved where it will read over 40000rpm for a split second throwing the lights on etc seems more stable when rpm is raised slowly so maybe better under load

Posted: Mon Oct 26, 2015 4:05 pm
by brentp
Hi,

Great - glad you got it working!

Posted: Wed Oct 28, 2015 8:18 am
by Ash-b-84
Beet is there a way I can input a line to say for no more than 7200 rpm turn all LEDs off that way if it does spike higher it won't throw the lights on ?

Posted: Wed Oct 28, 2015 3:11 pm
by brentp
The best way is to actually filter the RPM signal at the source, but if that is not practical or possible then you can possibly apply a band-aid solution, like this:

Code: Select all

setTickRate&#40;15&#41; --15Hz 

--Shift Now!!!! 
function onTick&#40;&#41; 
rpm=getTimerRpm&#40;2&#41; --read RPM 

--activate LEDs 
if rpm > 15000 then return end --this filters out RPM spikes
if rpm > 6600 then setGpio&#40;2,1&#41; else setGpio&#40;2,0&#41; end 
if rpm > 6900 then setGpio&#40;1,1&#41; else setGpio&#40;1,0&#41; end 
if rpm > 7200 then setGpio&#40;0,1&#41; else setGpio&#40;0,0&#41; end 
end 
See if this makes a difference.