This is a second, separate branch addressing this ticket, and these changes should only be in develop (for testing) at this point. Eventually, this branch should replace the branch you reverted out of staging.
stopDialysis() almost exactly mirrors the four lines I commented out, except the pump "hardstop" routines also manage the control variables that start and stop the PI controllers. This should still make zero difference to the case Nick is investigating since these changes are local to a saline bolus, which is not run at all while active ultra filtration is being run, and only affect the initial bolus state (0), while stopping the pumps. State 1, puts the pumps back into closed loop control, once the valves separate the patient, the blood and the dialysate from the dialyzer.
I don't think the "|=" is accomplishing anything useful here - this is effectively setting result to TRUE in all cases. And I don't think we should be setting result to TRUE here necessarily. If we set result to FALSE above, it should stay FALSE.