Rocket engine throttling help

From a reliability and safety standpoint, I'd make the code one-shot - add a while (1) {;} infinite loop at the bottom of the if block (after "close valve") so that a bad input (noise, or that floating input from the no-longer connected GSE) doesn't try and make the sequence run again.

Even that may not be reliable - any inadvertent reset could cause the processor to reset and cycle again!