So, I had the idea of using the octopi to control a camera shutter. So I setup the plugin that allows g-code to run a script. Then I setup a script that will toggle a GPIO pin of then on, which is connected to a relay.
When I then pass "OCTO1" in the gcode it does toggle the relay on and off. So far so good.
Then I setup a post processing script to, on every layer change, add a move to the corner of my printer (G0 X400 Y400 F12000), and the OCTO1.
In testing this with a simple gcode file that will move 100mm one way, trigger, move back, trigger, repeat...
I find that it just toggles off and on the relay over and over, and then is still moving back and forth long after it has finished toggling off and on.
I think this is because it's reading in, and sending the gcode several moves ahead of where the printer is actually interpreting them. Is there a way to get around this. I want the printer to move to X400 Y400, stop, take a picture, then move back. This way it will just look like the object is growing out of the build plate of its own volition, in the final time lapse.