-
When you use true/false or HIGH/LOW it is difficult for us to grasp what you are doing.
A Macro that documents what’s happening is what you should be using. -
When you do diagnostic Serial prints on variables is anything out of the norm ?
-
Serial prints will confirm variables are what you think they are.
-
At 1st thought, a State Machine approach may be the way you should structure this sketch.