very detailed description but confusing.
my personal experience is:
In 90% of all cases presenting parts of code does not help.
Your not presented code can have zillion ways to make it not work.
And this is the reason why the complete sketch must be analysed.
A lot of problems can be narrowed down by serial printing of
- names and values of variables
- code printing I am about to execute line ....
or
code printing I have right before executed line ....
where each and every of these printings has some kind of a unique identifier to make very clear it is this single particular line of code
The best thing These fritzy pictures can do is look fancy.
Fritzy pictures are bad about being focused on the real important information.
You shold hand-draw schematics that show that IO-pins that are relevant.
As you are using so looong wires there might be a problem with ground-loops
best regards Stefan