loop efficiency help needed
loop efficiency help needed
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
- 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
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: loop efficiency help needed
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