I am running out of things to say, other than this simple analogy:
If 10 basketball players are crammed into a closet, even if one left, you would likely STILL feel crowded.
I know you don’t want to hear this, but you are way too close to the maximum piston size. The more complex the piston is, the more ‘elbow room’ I would recommend. Yes, I believe you could get this piston running, but the moment you needed to tweak your code, or add another device, you would be back in the same boat you are in now.
The only two choices I see is to (A) simplify the code, or (B) split it into two pistons.
Personally I like (B) better because that gives you more options and more room for growth… but that is just me. Either way, keep us posted.