Using getDateTime()

Discussion on the Lua Scripting capabilities for RaceCapture/Pro. Also see the <a href="http://autosportlabs.net/RaceCapturePro_Lua_Scripting">Lua Scripting Guide</a>

Moderators: JeffC, stieg

Post Reply
wcorredor
Posts: 49
Joined: Thu Oct 27, 2016 6:29 pm

Using getDateTime()

Post by wcorredor »

We are using the function getDateTime() successfully to automatically lower the intensity of the Three Stage Sequential Shift Light, which may be a problem when racing at night (too bright), but is perfect during the day.

Perhaps an example of how it is called may help others:

Year, Month, Day, Hour, Min, Second, Mil = getDateTime()
Hour = Hour + TZONE
if (Hour < 7 or Hour > 17) then
Intensity = LOW
else
Intensity = HIGH
end

We set TZONE as negative number in comparison to UTC (-5 in Miami), and use Intensity to adjust voltage when calling setAnalogOut. HIGH was set at 0 and LOW at 4.5 (lowest it actually lights up).

There is an error in the documentation as the return value Minute is missing.

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

Post by brentp »

Thanks, we'll take a look at that!
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

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

Post by brentp »

Thanks, documentation fixed!

https://wiki.autosportlabs.com/RaceCapt ... Time.28.29

That's a fantastically cool way to lower the brightness!
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

wcorredor
Posts: 49
Joined: Thu Oct 27, 2016 6:29 pm

Shift light auto intensity and BMW E30

Post by wcorredor »

It is possible to lower intensity even more, if you find that 4.5v is still too bright at night, by setting the analog channel frequency higher. One starts noticing more dimming above 25000 Hz.

To do that add:

setPwmClockFreq(LightFQ)

Make LightFQ = 25000 and above.

Perhaps it is possible to also use (I haven't tried that yet)

setPwmDutyCycle( channel, dutyCyclePct )

and lower the dutyCycle % to dim, so that you can control each light intensity individually.

I set up a BMW E30 with RPM, oil pressure, coolant temp, shift lights, gear position, break pedal, throttle pedal and gas level as well as a neat way to use the shift lights also as alarms. I removed the dashboard completely and replaced it with a Galaxy 10. It works great. I will post detailed instructions on sensors and lua code in January after endurance testing at a Chumcar race at Sebring.

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

Post by brentp »

I love it. We would love to feature it in a blog post, even what you have now! Share any pictures you have when convenient.

Thanks,
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

Post Reply