loop efficiency help needed

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
icabjeff
Posts: 34
Joined: Thu Jul 27, 2006 11:00 pm
Location: Newton, NJ, USA
Contact:

loop efficiency help needed

Post 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?
Attachments
autofireoutputBETA.fcf
(42.83 KiB) Downloaded 265 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: loop efficiency help needed

Post 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.

icabjeff
Posts: 34
Joined: Thu Jul 27, 2006 11:00 pm
Location: Newton, NJ, USA
Contact:

Re: loop efficiency help needed

Post 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

Post Reply