I've been crashing Analyzer and bricking the hardware trying to script the shift light. I was trying to run something like this (off the top of my head, not at my RCP now):
Code: Select all
r = 0
if r > 5000 then setGpio(2,1) else setGpio(2,0) end
if r > 6000 then setGpio(1,1) else setGpio(1,0) end
if r > 7000 then setGpio(0,1) else setGpio(0,0) end
Is there something I can do to debug what's going wrong? I was able to have the lights blink by incrementing
variable r in onTick and setting each GPIO port with modulus %2,%3,%4 to make each segment blink at different rates.
I am using latest analyzer 1.1.5 and firmware 1.2.7.
This sounds similar to what I had in mind for my ShiftX. As the limit is approaching the light should blink faster and faster, then when the limit is reached the light should stay on solid and the next one should start blinking, etc. So in your example above, the first light would start blinking slowly at say 4000rpm, and start blinking faster as engine speed gets nearer 5000rpm. Then when engine speed is greater than 5000rpm that first light would be solid, and the second light would start blinking slowly, and the blink rate would increase as engine speed approaches 6000, above which it would stay on solid, and so on.
I'm not a SW engineer so coding myself isn't so comfortable, but I'm familiar with the concepts. I guess the implementation would be such that the difference between current engine speed and threshold to next light would be the off time multiplied by a scalar. So for a big difference the off time would be larger, and then as the difference approaches zero the light is essentially on constantly (no off time).