Page 1 of 1

loop efficiency help needed

Posted: Thu Mar 20, 2008 1:39 am
by icabjeff
I put together flowcode that reads input from an atari type joystick and one extra fire button. I've made it so each input can be programed to output to any of 14 different outputs. My code works quickly if I'm only pressing one button at a time, but if I press two or three at a time there is a noticeable lag. Is there a way I can get my switches to respond faster and have the same response time?

Re: loop efficiency help needed

Posted: Thu Mar 20, 2008 11:24 am
by Benj
Hello

Your program is running with a lag as each new switch introduces delay icons. I would change the program so that all of the overall control structure runs without delays. Then I would have a number of variables that represent the states of the outputs which get updated by the control structure. I would then use a timer based interrupt to collect the variables and process the outputs. As the timer interrupt will interrupt at a fixed rate you can use this to process all of your variables that need to change on a timed basis without having to introduce delay icons, eg for your auto fire function.

I would build up the program a piece at a time. eg get two switches working together nicely and then add more when you are confidant that your program will run correctly.

Re: loop efficiency help needed

Posted: Sun Apr 06, 2008 9:28 pm
by icabjeff
I now have all of my switches running at a fixed rate. I could use some advice on how to get my multi-click feature to run at maximum efficiency. I want to be able to click four different switches up to three times each for up to three different outputs per switch. I also am making the click speed adjustable. So really what I'm doing is just like the double-click of a mouse. Here's a jpeg of my multi-click flowcode segment. Thanks, Jeff
multi-click.JPG
(55.56 KiB) Downloaded 768 times