Error writing script: An unspecified error occured, why?

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
GTIspirit
Posts: 233
Joined: Wed Jan 09, 2013 11:20 am
Location: SE Michigan

Error writing script: An unspecified error occured, why?

Post by GTIspirit »

I wanted to try my staged, variable frequency shift light, but I got this error. So I figured I did something wrong writing the script since software is not my forte, so I made a very simple script.

Code: Select all

--&#91;&#91;--Pin assignments
RPM is pin 20 / FreqIn channel 0
First light is pin 6 / FreqOut channel 0 / #2 on shift light - green
Second light is pin 5 / FreqOut channel 1 / #1 on shift light - yellow
Third light is pin 4 / FreqOut channel 2 / #3 on shift light - red
--&#93;&#93;--

setTickRate&#40;15&#41;

function onTick&#40;&#41; 
	setPwmDutyCycle&#40;0, 25&#41;
	setPwmDutyCycle&#40;1, 50&#41;
	setPwmDutyCycle&#40;2, 75&#41; 
end
I think this is so simple there can't be anything wrong with it, but even with this very simple script I get this error when I try to "write" the script to the device. What am I doing wrong?

Update, when I read back the configuration, after re-starting RaceAnalyzer the script was there, so it wrote. But the sensor monitor shows FreqOut1, FreqOut2, FreqOut3 at 100%. So clearly my above script is not running. :(

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

Post by brentp »

Can you try it without the big comment block at the top?

Wait for the big MK1 firmware and app update in the next day or two; there will be a number of fixes and improvements in the Lua scripting.

It's a big deal!
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

GTIspirit
Posts: 233
Joined: Wed Jan 09, 2013 11:20 am
Location: SE Michigan

Post by GTIspirit »

Ok, so I tried this, and no "unspecified error":

Code: Select all

setTickRate&#40;15&#41;

function onTick&#40;&#41; 
	setPwmDutyCycle&#40;0, 25&#41;
	setPwmDutyCycle&#40;1, 50&#41;
	setPwmDutyCycle&#40;2, 75&#41; 
end
I thought the big block comment was possible based on this, but either it doesn't like it or I didn't get it right.
http://luatut.com/crash_course.html
But maybe I'm still doing something wrong because even with the above code FreqOut1, 2, 3 are 100% according to sensor monitoring. So the lights are completely off. :( I unplugged and re-plugged the unit, which I thought should reboot and run the script automatically, but it doesn't look like the script runs :(

I have to be able to do something simple, and get it working before I start something complicated and don't know which end is up when it doesn't work....

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

Post by brentp »

We're working on getting the new MK1 firmware up today (happy new year!) - it has a ton of fixes, including a bunch for the Lua runtime. You should wait for that before you bang your head further. Hold tight!
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

GTIspirit
Posts: 233
Joined: Wed Jan 09, 2013 11:20 am
Location: SE Michigan

Post by GTIspirit »

Yes, Happy New Year! This is my hobby for fun, sitting in a cold garage tinkering with the RCPro in my car.

I've been banging my head on this quite a bit, even got to writing a "bug report" for the functionality not working as expected.
http://www.autosportlabs.org/viewtopic. ... 1965#21965

I am running the RaceAnalyzer 1.1.15 and Firmware 1.2.7 on the original Mk1 hardware.

I wasn't sure if the firmware v2.0.8 available for download is the beta version, or latest release. (Website was a little confusing to me on this.)

I'm also running the latest RaceAnalyzer. It looks like the RaceCapture App replaces RaceAnalyzer? I was reluctant to make the change until I at least got my script working as expected.

toga94m
Posts: 127
Joined: Wed Jun 05, 2013 1:57 am
Location: Upstate NY

Post by toga94m »

I've got my embedded geek hat on today for work.. here's a thought. Trim down the total amount of text in a single comment, so the whole thing is less than 250 characters (think txt message). Right now you're at 277, including the begin/end flags. For example - just take out the first full line "RPM is pin 20 / FreqIn channel 0" and retry it. That gets you down to 239 characters.

It might not matter once the new release is up, but sometimes it's still interesting to learn new ways that things can break.
------------
Learning Race Capture Pro... on someone else's car
Learning Python/Kivy on my own PC

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

Post by brentp »

You actually hit it on the head. The older firmware sometimes had a problem writing more than a page's (256) worth of script. That's been fixed in the latest firmware.

Speaking of which, still fixing a number of little bugs in the latest release, which we'll provide in lock-step with the MK1 and MK2 firmware updates. We're set up to do simultaneous firmware releases for MK1 and MK2!

Working on it for today, hopefully.

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

Post by brentp »

Updated V2 firmware for MK1 announced here http://www.autosportlabs.org/viewtopic.php?t=4323

You should find that the Lua scripting will work better with this version. Enjoy!
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

Post Reply