public StepperMotor(PcaPwmDriver pcaPwmDriver, uint steps = 200) { Check.IsNull(pcaPwmDriver); this.pcaPwmDriver = pcaPwmDriver; Steps = steps * MicroStepCount; SetSpeed(Rpm); fullStepControlPhases = ControlPhaseHelper.GetFullStepSequence(); // 마이크로 스테핑 제어 단계 및 선형 램프 microStepControlPhases = ControlPhaseHelper.GetMicroStepSequence(); microStepCurve = MicrosteppingHelper.GetLinearRamp(MicroStepCount); }
private StepperMotorPhase GetMicroStepControlPhase() { // mu_i var microStepIndex = (int)(CurrentStep % MicroStepCount); // nu_i var microStepPhaseIndex = (int)(CurrentStep % (MicroStepCount * fullStepControlPhases.Count)); // 풀 스텝 제어 단계 인덱스 var mainPhaseIndex = MicrosteppingHelper.GetPhaseIndex(microStepPhaseIndex, MicroStepCount); // AIn1, AIn2, BIn1, BIn2 신호의 제어 단계 var phase = microStepControlPhases[mainPhaseIndex]; // PwmA, PwmB 신호 MicrosteppingHelper.AdjustMicroStepPhase(phase, microStepCurve, MicroStepCount, microStepIndex, microStepPhaseIndex); return(phase); }