Gcode_button and logic

An implementation like this might be helpful: Trying to implement a loop using delayed gcode