scriping only working when PC attached

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
anastos
Posts: 35
Joined: Fri Apr 14, 2017 4:31 am
Location: Wisconsin

scriping only working when PC attached

Post by anastos »

Hi All,
I have been trying to get RCP Mk3 to perform automatic SD card data logging but have not been successful.
I made it as simple as possible entering "startLogging()" in the onTick function and discovered that it only works when my PC is attached to RCP via USB. If I disconnect the PC logging never starts. Also I was somewhat surprised when at the track last weekend by the overall operation of SD card logging. I rewired the power supply for RCP to be hot whenever the battery disconnect switch was on and started logging with the action button while the car was still in the paddock. I did this because it is sometimes necessary to switch off the engine while waiting on the grid before the race starts, previously RCP power was via ignition switch. Anyway after the race I found two logs on the card one that I started and one that started by itself after the car was restarted on the grid. (There was no remaining script to control logging in my setup, other than "if getActionButton() > 0 then startLogging() end", which was not pressed a second time). Is there built-in code that causes this behavior?
Thanks,
Anastos

anastos
Posts: 35
Joined: Fri Apr 14, 2017 4:31 am
Location: Wisconsin

Post by anastos »

I forgot to mention it, but yes I did perform the write to controller operation after changing the script.
Thanks,
Anastos

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

Post by brentp »

Hi, Unfortunately it was a bit hard to follow your post, sorry.

Can you post your current script here so we can look at it?

When the unit is logging it will flash the logging LED on the unit. It does not need the USB connection to do that.

The front panel button is like a logging override; it will start logging if it is not running, and will stop it if it is running.
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

anastos
Posts: 35
Joined: Fri Apr 14, 2017 4:31 am
Location: Wisconsin

scripting only working when PC attached

Post by anastos »

Here is the script I am currently using.
I tried
Removing;
"function lgStart()
if getButton() > 0 then
startLogging()
end
end"

And going with;
"function onTick()
processCAN(CAN_chan)
startLogging()

end"

That is when RCP logged to SD card while PC attached, but not if PC disconnected.
Attachments
RCP_Script.txt
script currently being used, requires action button input to log on SD card.
(1.86 KiB) Downloaded 88 times
Thanks,
Anastos

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

Post by brentp »

Ok.

Try this:

* erase the script completely and write it back to RCP
* disconnect USB
* apply 12v pwer
* press the 'action button'. Do you see the logging LED flash?
* press it again. Does it stop?
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

anastos
Posts: 35
Joined: Fri Apr 14, 2017 4:31 am
Location: Wisconsin

Post by anastos »

I will have to try that next weekend.
The car is at a fabrication shop this week.

Thanks for the prompt reply.

We are racing July 8 & 9 hope to have this resolved before then.
Are there any bug fixes in 10.0.1 related to SD card logging?
I have not tried that version yet.
Thanks,
Anastos

anastos
Posts: 35
Joined: Fri Apr 14, 2017 4:31 am
Location: Wisconsin

Post by anastos »

I erased script and rewrote as suggested.
The SD card starts logging when button pushed, does not stop logging if pushed again.
Thanks,
Anastos

anastos
Posts: 35
Joined: Fri Apr 14, 2017 4:31 am
Location: Wisconsin

Post by anastos »

I found that the button is not responsive, I sometimes need to press it multiple times in order to initiate SD card logging.
So I tried once again the following script
function onTick()
processCAN(CAN_chan)
startLogging()
end

It worked once and then never again.
I updated the Race capture software and the RCP firmware.

Tried again - did not work.

Any suggestions?
Thanks,
Anastos

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

Post by brentp »

Hi,

I think the issue you're seeing is 'switch bounce' which is caused by the firmware being too sensitive to the switch contacts literally bouncing from the spring action.

You should be able to overcome this with a slow deliberate press, but this is definitely not ideal.

The upcoming 2.12.0 firmware which we will have in beta test soon fixes the bounce issue and you'll be able to log using the front panel switch.

Question around your script - if you temporarily disable the processCAN() function by commenting it out by prefixing it with -- ; e.g.

function onTick()
--processCAN(CAN_chan)
startLogging()
end

do you see it logging?

Post Reply