Hi all,
my Teensy 3.2 was resetting and i couldn't figure out why. The Teensy is being used to run 4 clocks for modular synths which all have various settings. One of the functions i've built is for one clock to reset another when it gets back to the start of its loop. This will keep clocks in time with each other over longer periods if required. I realised that i was creating an infinite loop when i was adjusting clock 1 to be reset by clock 2 which was already set up to be reset by clock 1. I've realised that when i make an adjustment to a clock, i need a way to recursively check each clock and see if by making that adjustment i am going to create an infinite loop. I already have it set up so that each clock is unable to use itself to reset but i need to expand that.
For example, if i set up clock 1 to reset clock 2 which resets clock 3 which resets clock 4 which resets clock 1, then an infinite loop conflict will occur, but i can't just check that by checking if clock 2 is set to reset clock 1. I need to follow the chain of clocks resetting each other to the end.
I'm looking for help from anyone who has a good idea about how to turn this idea into code. When i have to build up recursive loops i end up in a muddle and find it hard to understand what is going on.
Any help would be greatly appreciated since all i can come up with is an idea for a huge amount of code to check through the clock reset settings in a manual way and not an elegant way like i know can be done, just not by me.
Cheers
NM
my Teensy 3.2 was resetting and i couldn't figure out why. The Teensy is being used to run 4 clocks for modular synths which all have various settings. One of the functions i've built is for one clock to reset another when it gets back to the start of its loop. This will keep clocks in time with each other over longer periods if required. I realised that i was creating an infinite loop when i was adjusting clock 1 to be reset by clock 2 which was already set up to be reset by clock 1. I've realised that when i make an adjustment to a clock, i need a way to recursively check each clock and see if by making that adjustment i am going to create an infinite loop. I already have it set up so that each clock is unable to use itself to reset but i need to expand that.
For example, if i set up clock 1 to reset clock 2 which resets clock 3 which resets clock 4 which resets clock 1, then an infinite loop conflict will occur, but i can't just check that by checking if clock 2 is set to reset clock 1. I need to follow the chain of clocks resetting each other to the end.
I'm looking for help from anyone who has a good idea about how to turn this idea into code. When i have to build up recursive loops i end up in a muddle and find it hard to understand what is going on.
Any help would be greatly appreciated since all i can come up with is an idea for a huge amount of code to check through the clock reset settings in a manual way and not an elegant way like i know can be done, just not by me.
Cheers
NM