private void ExecuteProgramStepInternal(ProgramStep programStep) { _iteInteropService.WaitHandle.WaitOne(); int errNo = _iteInteropService.IteDC_WriteCmd(DeviceInfo.Address, $"VOLT {programStep.Volta}"); errNo = _iteInteropService.IteDC_WriteCmd(DeviceInfo.Address, $"CURR {programStep.Ampere}"); _iteInteropService.WaitHandle.Set(); }
public async ValueTask ExecuteProgramStepAsync(ProgramStep programStep) { CancellationTokenSource localTokenSource = _cancellationTokenSource; _stepRunningTimeStopwatch.Restart(); ExecuteProgramStepInternal(programStep); long durationMilliseconds = (long)programStep.Duration * 1000; long timeEnd = _stepRunningTimeStopwatch.ElapsedMilliseconds; int waitTime = (int)(durationMilliseconds - timeEnd); if (waitTime > 0) { await Task.Delay(waitTime, localTokenSource.Token); } }