A different idea relating to scripting (not LUA)

openTx has introduced a range of new features, ideas and bling. It is fast becoming the firmware of choice for many users. openTx will run on ALL current hardware platforms, including the gruvin9x and sky9x boards. Work has already started to support the new FrSky X9D radio!
nischris
Posts: 48
Joined: Sat Feb 08, 2014 10:39 pm
Country: -

Re: A different idea relating to scripting (not LUA)

Post by nischris »

Ta

nischris
Posts: 48
Joined: Sat Feb 08, 2014 10:39 pm
Country: -

Re: A different idea relating to scripting (not LUA)

Post by nischris »

Ok, thought I might report on my recent progress. A few things I noticed along the way. .
If I understand the code correctly, getTmr2MHz () always returns 0. I scratched around a bit, and I think I've managed to set up a new timer running at 1MHz, copying what was done by a delay_01us () function . I'm using that timer to do my measuring.
It appears that cli () and sei () both do nothing, although first impressions led me to think they might disable/enable interrupts.
Why do I want to disable interrupts you ask? Well, when trying to measure execution times of some of my code, I was apparently getting times that were far longer than expected. It wasn't until I disabled ints I got times more like I expected.
Here's an example of a measured time to run a 'real world' program. This program outputs a value that can be referenced as a source by mixers. The value sweeps from -100 to 100% and back over a couple of seconds, and repeats continuously. The program required a grand total of 7 logic blocks. Anyway, with ints disabled, execution time for a single scan was around 50us. With ints enabled measured time for a single scan rose to around 300us. There's obviously an interrupt somewhere taking up a lot of cpu time.
anyway, I think 50us (assuming I have my timer set up correctly) to perform that task seems pretty reasonable. Nb, scan frequency is ~100Hz.
User avatar
Kilrah
Posts: 11109
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: A different idea relating to scripting (not LUA)

Post by Kilrah »

cli() and sei() are what you think but only for AVR platforms.
getTmr2MHz () should work as it is used to display mixer time, which works. Could be that it's only there if compiled with DEBUG=YES, haven't checked.
nischris
Posts: 48
Joined: Sat Feb 08, 2014 10:39 pm
Country: -

Re: A different idea relating to scripting (not LUA)

Post by nischris »

Ok, thanks. Didn't spend too much time looking at the timer thing.
Btw, do you know what typical mixer times you see?
User avatar
Kilrah
Posts: 11109
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: A different idea relating to scripting (not LUA)

Post by Kilrah »

I don't have very complicated models, but a standard 7-channel airplane with flight modes will take about 200us in steady state and double of that during flight mode transitions (we calculate both the before and after and mix them together). That's on next BTW.

nischris
Posts: 48
Joined: Sat Feb 08, 2014 10:39 pm
Country: -

Re: A different idea relating to scripting (not LUA)

Post by nischris »

Ok, thanks.. I'll have to build and run next some time, and time some lua scripts to see what their execution times are. I see about the same sort of time with my basic average 6 channel setup on master.

Post Reply

Return to “openTx”