예제 #1
0
파일: laser.cs 프로젝트: sukhoonjang/sirius
        public bool CtlPower(IRtc rtc, Pen pen)
        {
            if (this.IsBusy)
            {
                return(false);
            }
            if (this.IsError)
            {
                return(false);
            }
            bool success = true;

            if (pen.Power == CurrentPowerWatt)
            {
                return(true);
            }
            /// powerWatt 출력을 내기 위한  x factor (normalPowerX) 검색
            this.LookUpPowerX(pen.Power, out float powerX);
            if (this.PowerXFactor == PowerXFactor.ByUser)
            {
                ///do it yourself
                ///vary the laser power by communcation betweeen laser source
            }
            else
            {
                success = rtc.CtlLaserControl(this.PowerXFactor, powerX);
            }

            if (success)
            {
                this.CurrentPowerWatt = pen.Power;
                this.CurrentPowerX    = powerX;
                this.CurrentPen       = pen;
                Logger.Log(Logger.Type.Warn, $"set laser power to {pen.Power}W");
            }
            return(success);
        }