Exemple #1
0
 void cbxSolderEmulsion_SelectedIndexChanged(object sender, EventArgs e)
 {
     this.emulsionSolderMask = (EmulsionType)this.cbxSolderEmulsion.SelectedIndex;
     if (this.solderMask)
     {
         this.chkInvert.Checked = !this.chkInvert.Checked;
     }
 }
Exemple #2
0
            public void SetShutterMode(EmulsionType emulsionType)
            {
                int cameraShutterSpeed = 0;

                switch (emulsionType)
                {
                case EmulsionType.ThinType:
                    cameraShutterSpeed = 3;
                    break;

                case EmulsionType.ThickType:
                    cameraShutterSpeed = 5;
                    break;

                default:
                    // 該当なし
                    throw new Exception("Emulsion type value is not correct.");
                }
                VP910Define.SetShutterSpeed(deviceId, cameraShutterSpeed);
            }
Exemple #3
0
        /// <summary>
        /// 渡された値が適切かどうかを判定し,LEDの明るさをその値にします.
        /// <para>成功した場合はTrueを返し,そうでない場合はFalseを返します.</para>
        /// </summary>
        /// <param name="lightStrength">明るさ</param>
        /// <param name="parameterManager">ParameterManagerのインスタンス</param>
        /// <exception cref="System.ArgumentException">要求された明るさが不正な場合</exception>
        public void DAout(int lightStrength, ParameterManager parameterManager)
        {
            EmulsionType emulsionType = parameterManager.EmulsionType;
            int          t            = 0;

            if (!isLightStrengthCorrect(lightStrength))
            {
                // 光の強さが不適切な値の場合は例外を返す
                throw new ArgumentException("Requested led light strength is not correct.");
            }
            // 光の強さ適切な場合
            if (emulsionType == EmulsionType.ThinType)
            {
                t = 3;
            }
            else if (emulsionType == EmulsionType.ThickType)
            {
                t = parameterManager.LedParameter;
            }

            PulsePower(t, lightStrength);
            lastLightVoltage = lightStrength;
        }
Exemple #4
0
        public UserUI(string[] args)
        {
            InitializeComponent();
            this.FormClosed               += new FormClosedEventHandler(OnExit);
            this.btnStart.Click           += new EventHandler(btnStart_Click);
            this.btnCancel.Click          += new EventHandler(btnCancel_Click);
            this.btnMotors.Click          += new EventHandler(btnMotors_Click);
            this.DragEnter                += new DragEventHandler(UserUI_DragEnter);
            this.DragDrop                 += new DragEventHandler(UserUI_DragDrop);
            this.zFocus.Scroll            += new EventHandler(zFocus_Scrolled);
            this.zFocus.MouseDown         += new MouseEventHandler(zFocus_MouseDown);
            this.zFocus.MouseUp           += new MouseEventHandler(zFocus_MouseUp);
            this.zPower.Scroll            += new EventHandler(zPower_Scrolled);
            this.zPower.MouseDown         += new MouseEventHandler(zPower_MouseDown);
            this.zPower.MouseUp           += new MouseEventHandler(zPower_MouseUp);
            this.zOn.Click                += new EventHandler(zOn_Click);
            this.btnHome.Click            += new EventHandler(btnHome_Click);
            this.chkMirror.CheckedChanged += new EventHandler(chkMirror_CheckedChanged);
            this.aboutMenuItem.Click      += new EventHandler(aboutMenuItem_Click);
            this.exitMenuItem.Click       += new EventHandler(exitMenuItem_Click);

            // default to KiCad v5 file name endings
            this.fileEnding.topCopper    = "F_Cu";
            this.fileEnding.bottomCopper = "B_Cu";
            this.fileEnding.topMask      = "F_Mask";
            this.fileEnding.bottomMask   = "B_Mask";

            int    p       = 0;
            string ininame = "PCBLaser.config";

            while (p < args.GetLength(0))
            {
                switch (args[p++])
                {
                case "-inifile":
                    ininame = GetArg(args, p++);
                    break;
                }
            }

            try
            {
                XmlDocument config = new XmlDocument();

                config.Load(Application.StartupPath + "\\" + ininame);

                foreach (XmlNode N in config.SelectNodes("PCBConfig/*"))
                {
                    switch (N.Name)
                    {
                    case "PortParams":
                        this.PortParams = N.InnerText;
                        break;

                    case "DefaultPower":
                        this.zPower.Value = int.Parse(N.InnerText);
                        break;

                    case "XOffset":
                        this.Xoffset = int.Parse(N.InnerText);
                        break;

                    case "YOffset":
                        this.Yoffset = int.Parse(N.InnerText);
                        break;

                    case "EtchMaskEmulsion":
                        this.emulsionEtchMask = this.parseEmulsionType(N.InnerText);
                        break;

                    case "SolderMaskEmulsion":
                        this.emulsionSolderMask = this.parseEmulsionType(N.InnerText);
                        break;

                    case "BacklashCompensation":
                        this.XBacklashComp = int.Parse(N.InnerText);
                        break;
                    }
                }

                foreach (XmlNode N in config.SelectNodes("PCBConfig/FileNameEnding/*"))
                {
                    switch (N.Name)
                    {
                    case "TopCopper":
                        this.fileEnding.topCopper = N.InnerText;
                        break;

                    case "BottomCopper":
                        this.fileEnding.bottomCopper = N.InnerText;
                        break;

                    case "TopMask":
                        this.fileEnding.topMask = N.InnerText;
                        break;

                    case "BottomMask":
                        this.fileEnding.bottomMask = N.InnerText;
                        break;
                    }
                }
            }
            catch
            {
                MessageBox.Show("Config file not found or invalid.", ininame);
                System.Environment.Exit(1);
            }

#if USEELTIMA
            try
            {
                this.SerialPort = new SPortLib.SPortAx();
            }
            catch
            {
                MessageBox.Show("Failed to load serial port driver.", this.Text);
                System.Environment.Exit(1);
            }

            this.SerialPort.InitString(PortParams.Substring(PortParams.IndexOf(":") + 1));
            this.SerialPort.HandShake   = 0x08;
            this.SerialPort.FlowReplace = 0x80;
            this.SerialPort.CharEvent   = 10;
            this.SerialPort.BlockMode   = false;
            this.SerialPort.OnRxFlag   += new SPortLib._ISPortAxEvents_OnRxFlagEventHandler(this.SerialRead);

            this.SerialPort.Open(PortParams.Substring(0, PortParams.IndexOf(":")));
#else
            string[] parameter = PortParams.Substring(PortParams.IndexOf(":") + 1).Split(',');

            if (parameter.Count() < 4)
            {
                this.disableUI();
                MessageBox.Show("Unable to open printer: " + PortParams, this.Text);
                System.Environment.Exit(2);
            }

            this.SerialPort          = new SerialPort();
            this.SerialPort.PortName = PortParams.Substring(0, PortParams.IndexOf(":"));
            this.SerialPort.BaudRate = int.Parse(parameter[0]);
            this.SerialPort.Parity   = ParseParity(parameter[1]);
            this.SerialPort.DataBits = int.Parse(parameter[2]);
            this.SerialPort.StopBits = int.Parse(parameter[3]) == 1 ? StopBits.One : StopBits.Two;
            if (parameter.Count() > 4)
            {
                this.SerialPort.Handshake = parameter[4] == "X" ? Handshake.XOnXOff : Handshake.RequestToSend;
            }
            this.SerialPort.ReceivedBytesThreshold = 1;
            this.SerialPort.NewLine         = "\r\n";
            this.SerialPort.WriteBufferSize = TXBUFFERSIZE;
            this.SerialPort.DataReceived   += new SerialDataReceivedEventHandler(SerialPort_DataReceived);
            try
            {
                this.SerialPort.Open();
            }
            catch
            {
            }
#endif

            if (this.SerialOpen)
            {
                this.SerialOut("?");

                this.pollTimer                     = new System.Timers.Timer();
                this.pollTimer.Interval            = this.PollInterval;
                this.pollTimer.Elapsed            += new System.Timers.ElapsedEventHandler(RenderRow);
                this.pollTimer.SynchronizingObject = this;

                this.motorTimer                     = new System.Timers.Timer();
                this.motorTimer.Interval            = 60 * 1000; // 1 minute
                this.motorTimer.Elapsed            += new System.Timers.ElapsedEventHandler(MotorOff);
                this.motorTimer.SynchronizingObject = this;

                this.SerialOut("XHome:" + this.Xoffset.ToString());
                this.SerialOut("YHome:" + this.Yoffset.ToString());
                this.setLaserPower(false);
            }
            else
            {
                this.disableUI();
                MessageBox.Show("Unable to open printer: " + PortParams, this.Text);
                System.Environment.Exit(2);
            }

            this.enableUI();

            this.zFocus.Value = this.z;
            this.cbxEtchEmulsion.SelectedIndex   = (int)this.emulsionEtchMask;
            this.cbxSolderEmulsion.SelectedIndex = (int)this.emulsionSolderMask;
            this.chkInvert.Checked = solderMask ? this.emulsionSolderMask == EmulsionType.Negative : this.emulsionEtchMask == EmulsionType.Positive;

            this.cbxEtchEmulsion.SelectedIndexChanged   += new EventHandler(cbxEtchEmulsion_SelectedIndexChanged);
            this.cbxSolderEmulsion.SelectedIndexChanged += new EventHandler(cbxSolderEmulsion_SelectedIndexChanged);

            this.Visible = true;
        }
Exemple #5
0
 public EmulsionEventArgs(EmulsionType emulsionType)
 {
     this.EmulsionType = emulsionType;
 }