How do I reverse the activation of Pistons with redstone automatically?

So basically, I want to make a hidden Piston door using Redstone that opens and shuts when I pull a lever.

As you can see, the door consists out of 14 sticky Pistons in total : 2 for the stairs, 4 in the middle to pull back and push out the stone in/outwards, and 4 on each side to pull back and push out the pistons with the stone. I'm going to call them S(Stairs), M(Middle), L(Left) and R(Right). I have ways and means to power each of those groups individually and with repeaters I can change when they activate.

For opening and closing the door, I'm using levers on both sides of the door combined with and XOR gate underground, so that the door will close/open no matter what lever I use or in what state the other lever is.

The basic order here is: When the door opens, M pulls the stone blocks back, after that L and R pull these pistons with the stone in the wall. When it closes, the order is reversed: L and R push M out, M then pushes the stone blocks. S here doesnt matter, since it doesn't interfere with the others.

The problem here is : How do I REVERSE the order of activation for the components L, R and M for when it closes and shuts? So Opening : M, L+R | Closing : L+R, M
Or: Do you know a different way to make this work?

Because of the way the door works, simply executing the same order will break the door : M won't retract at the right time and will simply stay in the 'closed' position and will retract and extend, but not be moved by L and R.

Sorry for the length of this and thanks in advance.


Solution 1:

If you watch at about 2:50, you can see most of the left half of the circuit. The part for the stairs looks like it isn't shown very well but that is less important timing wise. Watch carefully over and over and see if you can replicate it this way. It looks like the repeaters for the middle activate and deactivate immediately. So the order (from a circuit standpoint) for both directions is M, L+R. This works for closing because the middle repeaters don't have anything to activate until the blocks are pushed into the middle. When opening, they will retract the middle immediately.

Breaking it down:

Opening

  1. Middle repeaters deactivate (middle pistons retract)
  2. Delay
  3. Left and Right redstones deactivate (left and right pistons retract)

Closing

  1. Middle repeaters activate (nothing happens because the middle pistons are not in position)
  2. Delay
  3. Left and Right redstones activate (left and right pistons extend)
  4. Now the middle pistons have been pushed into position and are activated by the middle repeaters

Solution 2:

There was a video posted to Reddit's /r/minecraft section which showed how to make a hidden door that works both ways.

Solution 3:

You need a ABBA switch/latch for this, it's basically this shape:

image

Wire L+R to the top right and wire M to the lower right, the input lever must be to the left.