Automatically Start Logging when engine is running issue

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
rocket6706
Posts: 22
Joined: Fri Oct 24, 2014 11:49 am
Location: Seattle

Automatically Start Logging when engine is running issue

Post by rocket6706 »

I am trying to get the RCP to start logging automatically when the engine running by setting up a lab environment. I connected the RCP to my windows laptop and was able to get the application software connected. I installed the Lua script for subject function and then connected the +12V power to a variable DC power supply. When the RCP is running on USB the voltage is hovering around 4.6v as displayed on Battery display on App. I then switched on the power supply at 12v and saw the battery voltage change on the app, and the Green LED for logging to SD card was off. I then increased the voltage to 14v and verified it displayed same value on battery channel for app, but the green LED remained off. Why didn't the RCP start logging when the voltage exceeded the threshold of 13V in the Script.

Question: In the script should it read "If GetAnalog (7)" or GetAnalog (8 )? Should the last analog channel be scaled from 0-15 or leave it at 0-5 as the default.
Rocket 6706

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

Post by brentp »

Hi,

Can you copy and paste your script here for review? We can take a look at it and see if there's anything amiss.

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

rocket6706
Posts: 22
Joined: Fri Oct 24, 2014 11:49 am
Location: Seattle

Post by rocket6706 »

here is what I have in script section. The behavior expected is battery voltage > 13 = green light flashing and data writing to SD card. What I get is Light off. I can press the button at both > and < 13 volts and it will start logging with flashing light. btw, I am a hardware (EE/ME) guy so this is all new to me.

function onTick()
if getAnalog(7) > 13 then
startLogging()
else
stopLogging()
end
end
Rocket 6706

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

Post by brentp »

To debug try something simple that will output the current voltage value to the log. for example:



function onTick()
println(getAnalog(7))
end




This will show you the actual value being registered by RaceCapture/Pro under varying conditions. Yes, #7 is the battery voltage input.
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

rocket6706
Posts: 22
Joined: Fri Oct 24, 2014 11:49 am
Location: Seattle

Post by rocket6706 »

Mystery solved. I found an I/D-ten-t (IDIOT) failure on my part and eliminated a space in my code. All working and additional scripts added as,well.
Rocket 6706

fmbo
Posts: 16
Joined: Sat Jul 11, 2015 2:59 pm

Post by fmbo »

Have the same problem and actually I wonder, how is it possible that 7th analogue channel is used for the battery if the logging unit have 7 physical analogue inputs and I can map e.g. my temeperature sensor to analogue 7?

crteam
Posts: 1
Joined: Mon Aug 31, 2015 7:59 pm

Post by crteam »

Input 1 = analog 0
Input 2 = analog 1
Input 3 = analog 2

etc.

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

Post by brentp »

So, in scripting the analog channels are zero based, so the first analog channel is 0, then 1, etc.

Channel 7 is the 8th channel, which is tied to battery voltage.

Hope this helps!
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

Post Reply