logging start/stop switch

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
smallspeed
Posts: 43
Joined: Mon Nov 30, 2015 1:08 pm
Location: Leicester, UK

logging start/stop switch

Post by smallspeed »

not sure where this should go, or if its been covered before - I searched and searched in the forums but I always seem to get like 500 results :(

with the new wifi module controlling go-pro, is it possible to install a remote "start logging" button somewhere? For example on the steering wheel.. I don't really want it to start automatically at certain speeds or engine speeds, and I can't reach my RCP when strapped into the car, so thinking a steering wheel button would be perfect.. ideally I can just push a momentary button once to start and again to stop both the RCP and (as a result, via wifi) the gopro

the only way I can think of doing this is to use a channel and either ground it or send it a voltage, but if possible i'd like to try and avoid that as its a channel I then can't use for anything else..

any ideas, tips, tricks, etc appreciated!

rdoherty
Posts: 215
Joined: Fri Mar 08, 2013 3:32 am

Post by rdoherty »

Yes, you could install a remote start/stop button. You'd need a momentary button and hook it into RCP's analog or digital inputs. You can use LuaScript to watch the voltage level and when it changes, start logging. Then when it changes again, stop logging.

Something like this should work (button plugged in to GPIO #1). I haven't tested the code, so there might be a bug or two:

Code: Select all

setTickRate&#40;30&#41;
logging = false
lastChange = getGpsTime&#40;&#41;
timeout = 5

function onTick&#40;&#41;
  local button = getGpio&#40;0&#41;
  time = getGpsTime&#40;&#41;

  if &#40;time - lastChange&#41; >= timeout then
    if button == 1 and logging == false then
      logging = true
      startLogging&#40;&#41;
      lastChange = getGpsTime&#40;&#41;
    elseif button == 1 and logging == true then
      logging = false
      stopLogging&#40;&#41;
      lastChange = getGpsTime&#40;&#41;
    end
  end
end
The code watches a momentary button for changes. If it changes AND it's been 5s or greater since the last time it was pressed, it will start or stop logging.

Hope that helps!
Ryan Doherty
Autosports Labs

smallspeed
Posts: 43
Joined: Mon Nov 30, 2015 1:08 pm
Location: Leicester, UK

Post by smallspeed »

Awesome, thanks! I will give this a try..
Going to rig this up with a battery eliminator and your new WiFi module so I can just click on the way out of the pits and again on the way back in :)

Post Reply