Page 1 of 1

Error writing script: An unspecified error occured, why?

Posted: Wed Dec 31, 2014 8:20 pm
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

--[[--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
--]]--

setTickRate(15)

function onTick() 
	setPwmDutyCycle(0, 25)
	setPwmDutyCycle(1, 50)
	setPwmDutyCycle(2, 75) 
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. :(

Posted: Thu Jan 01, 2015 12:28 am
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!

Posted: Thu Jan 01, 2015 7:52 pm
by GTIspirit
Ok, so I tried this, and no "unspecified error":

Code: Select all

setTickRate(15)

function onTick() 
	setPwmDutyCycle(0, 25)
	setPwmDutyCycle(1, 50)
	setPwmDutyCycle(2, 75) 
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....

Posted: Thu Jan 01, 2015 7:59 pm
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!

Posted: Thu Jan 01, 2015 9:42 pm
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.

Posted: Fri Jan 02, 2015 5:29 pm
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.

Posted: Fri Jan 02, 2015 5:33 pm
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.

Posted: Sun Jan 04, 2015 7:59 am
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!