A different idea relating to scripting (not LUA)
Re: A different idea relating to scripting (not LUA)
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.
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.
Re: A different idea relating to scripting (not LUA)
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.
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.
Re: A different idea relating to scripting (not LUA)
Ok, thanks. Didn't spend too much time looking at the timer thing.
Btw, do you know what typical mixer times you see?
Btw, do you know what typical mixer times you see?
Re: A different idea relating to scripting (not LUA)
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.
Re: A different idea relating to scripting (not LUA)
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.