You can debug the script while watching the logging output under the script window - check the 'poll log' button.
You can also add some println() statements in your script to help you debug it's behavior, too. like:
println("Logging started")
etc.
The channel name in setup is not reflected in the Lua script - it's always represented by the numeric channel ID.
Script feedback; you might want to disable the else if.
try this:
Code: Select all
function onTick()
local speed = getGpsSpeed()
local rpm = getTimerRpm(0)
if speed > 10 and rpm > 500 then
startLogging()
end
if speed < 5 and rpm < 100 then
stopLogging()
end
end
See how I added some hysteresis to prevent the logging from quickly starting/stopping? This will help create some crisp start/stopping of the logging.