private bool StateMachine_ConnectionCheck(StepDefinition currentStep) { // it has been long enough, we need to test the connection if (CurrentConnection?.SendConnectionTest() == true) { if (IsConnected) { return(StepReturn.RepeatStep); } IsConnected = true; RunConnectionUpdate(); } else { if (IsConnected) { IsConnected = false; RunConnectionUpdate(); } if (TargetMode != ConnectionMode.PersistentPort) { currentStep.SkipDelayTime = true; MachineFunctions.JumpToFirst(currentStep); } else { // see if the port is still listed in the registry if (ComPortInfo.GetDescriptions().FirstOrDefault(x => x.Port == PortName) != null) { return(StepReturn.RepeatStep); } // if the port is no longer there, we know the port was removed from the system currentStep.SkipDelayTime = true; MachineFunctions.JumpToFirst(currentStep); } return(StepReturn.JumpCommandUsed); } // this step should never move on automatically return(StepReturn.RepeatStep); }