コード例 #1
0
        private void getCurrentConfig()
        {
            // get the micro-stepping modes from the controller

            byte headstepper1microsteppingmode   = usbController.getHeadStepper1MicrosteppingMode();
            byte headstepper2microsteppingmode   = usbController.getHeadStepper2MicrosteppingMode();
            byte solderstepper1microsteppingmode = usbController.getSolderStepper1MicrosteppingMode();
            byte solderstepper2microsteppingmode = usbController.getSolderStepper2MicrosteppingMode();
            byte caddysteppermicrosteppingmode   = usbController.getCaddyStepperMicrosteppingMode();

            switch (headstepper1microsteppingmode)
            {
            case 0x01:
                radio_HeadStepper1_Microstepping1.IsChecked = true;
                break;

            case 0x02:
                radio_HeadStepper1_Microstepping2.IsChecked = true;
                break;

            case 0x04:
                radio_HeadStepper1_Microstepping4.IsChecked = true;
                break;

            case 0x08:
                radio_HeadStepper1_Microstepping8.IsChecked = true;
                break;

            case 0x16:
                radio_HeadStepper1_Microstepping16.IsChecked = true;
                break;

            case 0x32:
                radio_HeadStepper1_Microstepping32.IsChecked = true;
                break;

            default:
                this.lblStatus.Content = "Error getting status for Head Stepper 1 Micro-stepping";
                break;
            }

            switch (headstepper2microsteppingmode)
            {
            case 0x01:
                radio_HeadStepper2_Microstepping1.IsChecked = true;
                break;

            case 0x02:
                radio_HeadStepper2_Microstepping2.IsChecked = true;
                break;

            case 0x04:
                radio_HeadStepper2_Microstepping4.IsChecked = true;
                break;

            case 0x08:
                radio_HeadStepper2_Microstepping8.IsChecked = true;
                break;

            case 0x16:
                radio_HeadStepper2_Microstepping16.IsChecked = true;
                break;

            case 0x32:
                radio_HeadStepper2_Microstepping32.IsChecked = true;
                break;

            default:
                this.lblStatus.Content = "Error getting status for Head Stepper 2 Micro-stepping";
                break;
            }

            switch (solderstepper1microsteppingmode)
            {
            case 0x01:
                radio_SolderStepper1_Microstepping1.IsChecked = true;
                break;

            case 0x02:
                radio_SolderStepper1_Microstepping2.IsChecked = true;
                break;

            case 0x04:
                radio_SolderStepper1_Microstepping4.IsChecked = true;
                break;

            case 0x08:
                radio_SolderStepper1_Microstepping8.IsChecked = true;
                break;

            case 0x16:
                radio_SolderStepper1_Microstepping16.IsChecked = true;
                break;

            case 0x32:
                radio_SolderStepper1_Microstepping32.IsChecked = true;
                break;

            default:
                this.lblStatus.Content = "Error getting status for Solder Stepper 1 Micro-stepping";
                break;
            }

            switch (solderstepper2microsteppingmode)
            {
            case 0x01:
                radio_SolderStepper2_Microstepping1.IsChecked = true;
                break;

            case 0x02:
                radio_SolderStepper2_Microstepping2.IsChecked = true;
                break;

            case 0x04:
                radio_SolderStepper2_Microstepping4.IsChecked = true;
                break;

            case 0x08:
                radio_SolderStepper2_Microstepping8.IsChecked = true;
                break;

            case 0x16:
                radio_SolderStepper2_Microstepping16.IsChecked = true;
                break;

            case 0x32:
                radio_SolderStepper2_Microstepping32.IsChecked = true;
                break;

            default:
                this.lblStatus.Content = "Error getting status for Solder Stepper 2 Micro-stepping";
                break;
            }

            switch (caddysteppermicrosteppingmode)
            {
            case 0x01:
                radio_CaddyStepper_Microstepping1.IsChecked = true;
                break;

            case 0x02:
                radio_CaddyStepper_Microstepping2.IsChecked = true;
                break;

            case 0x04:
                radio_CaddyStepper_Microstepping4.IsChecked = true;
                break;

            case 0x08:
                radio_CaddyStepper_Microstepping8.IsChecked = true;
                break;

            case 0x16:
                radio_CaddyStepper_Microstepping16.IsChecked = true;
                break;

            case 0x32:
                radio_CaddyStepper_Microstepping32.IsChecked = true;
                break;

            default:
                this.lblStatus.Content = "Error getting status for Caddy Stepper Micro-stepping";
                break;
            }

            // Get the default current settings from the controller

            byte headstepper1current   = usbController.getHeadStepper1Current();
            byte headstepper2current   = usbController.getHeadStepper2Current();
            byte solderstepper1current = usbController.getSolderStepper1Current();
            byte solderstepper2current = usbController.getSolderStepper2Current();
            byte caddysteppercurrent   = usbController.getCaddyStepperCurrent();

            slider_HeadStepper1_Current.Value = headstepper1current;
            lbl_HeadStepper1_Current.Content  = calculateCurrent_mA(headstepper1current).ToString("0.00 A");

            slider_HeadStepper2_Current.Value = headstepper2current;
            lbl_HeadStepper2_Current.Content  = calculateCurrent_mA(headstepper2current).ToString("0.00 A");

            slider_SolderStepper1_Current.Value = solderstepper1current;
            lbl_SolderStepper1_Current.Content  = calculateCurrent_mA(solderstepper1current).ToString("0.00 A");

            slider_SolderStepper2_Current.Value = solderstepper2current;
            lbl_SolderStepper2_Current.Content  = calculateCurrent_mA(solderstepper2current).ToString("0.00 A");

            slider_CaddyStepper_Current.Value = caddysteppercurrent;
            lbl_CaddyStepper_Current.Content  = calculateCurrent_mA(caddysteppercurrent).ToString("0.00 A");

            // get the soldering iron status

            double solderingiron1temperature = usbController.getSolderingIron1Temperature();

            lbl_iron1_currenttemperature.Content = solderingiron1temperature.ToString("0.00°C");

            double solderingiron2temperature = usbController.getSolderingIron2Temperature();

            lbl_iron2_currenttemperature.Content = solderingiron2temperature.ToString("0.00°C");

            double solderingiron1targettemperature = usbController.getSolderingIron1TargetTemperature();

            txt_iron1_targettemperature.Text = solderingiron1targettemperature.ToString("0.00");

            Double solderingiron2targettemperature = usbController.getSolderingIron2TargetTemperature();

            txt_iron2_targettemperature.Text = solderingiron2targettemperature.ToString("0.00");

            bool solderingiron1status = usbController.getSolderingIron1Status();
            bool solderingiron2status = usbController.getSolderingIron2Status();

            if (solderingiron1status)
            {
                lbl_iron1_status.Content = "Heating";
            }
            else
            {
                lbl_iron1_status.Content = "Off";
            }

            if (solderingiron2status)
            {
                lbl_iron2_status.Content = "Heating";
            }
            else
            {
                lbl_iron2_status.Content = "Off";
            }

            bool solderingiron1activation = usbController.getSolderingIron1ActivationStatus();
            bool solderingiron2activation = usbController.getSolderingIron2ActivationStatus();

            if (solderingiron1activation)
            {
                cb_solderingiron1active.IsChecked = true;
            }
            else
            {
                cb_solderingiron1active.IsChecked = false;
            }
            if (solderingiron2activation)
            {
                cb_solderingiron2active.IsChecked = true;
            }
            else
            {
                cb_solderingiron2active.IsChecked = false;
            }

            ConfigLoaded = true;

            // start the timer to update the temperatures
            System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            dispatcherTimer.Tick    += dispatcherTimer_Tick;
            dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
            dispatcherTimer.Start();
        }
コード例 #2
0
        private void getCurrentConfig()
        {
            // get the micro-stepping modes from the controller



            byte headstepper1microsteppingmode   = usbController.getHeadStepper1MicrosteppingMode();
            byte headstepper2microsteppingmode   = usbController.getHeadStepper2MicrosteppingMode();
            byte solderstepper1microsteppingmode = usbController.getSolderStepper1MicrosteppingMode();
            byte solderstepper2microsteppingmode = usbController.getSolderStepper2MicrosteppingMode();
            byte caddysteppermicrosteppingmode   = usbController.getCaddyStepperMicrosteppingMode();

            switch (headstepper1microsteppingmode)
            {
            case 0x01:
                radio_HeadStepper1_Microstepping1.IsChecked = true;
                break;

            case 0x02:
                radio_HeadStepper1_Microstepping2.IsChecked = true;
                break;

            case 0x04:
                radio_HeadStepper1_Microstepping4.IsChecked = true;
                break;

            case 0x08:
                radio_HeadStepper1_Microstepping8.IsChecked = true;
                break;

            case 0x16:
                radio_HeadStepper1_Microstepping16.IsChecked = true;
                break;

            case 0x32:
                radio_HeadStepper1_Microstepping32.IsChecked = true;
                break;

            default:
                this.lblStatus.Content = "Error getting status for Head Stepper 1 Micro-stepping";
                break;
            }

            switch (headstepper2microsteppingmode)
            {
            case 0x01:
                radio_HeadStepper2_Microstepping1.IsChecked = true;
                break;

            case 0x02:
                radio_HeadStepper2_Microstepping2.IsChecked = true;
                break;

            case 0x04:
                radio_HeadStepper2_Microstepping4.IsChecked = true;
                break;

            case 0x08:
                radio_HeadStepper2_Microstepping8.IsChecked = true;
                break;

            case 0x16:
                radio_HeadStepper2_Microstepping16.IsChecked = true;
                break;

            case 0x32:
                radio_HeadStepper2_Microstepping32.IsChecked = true;
                break;

            default:
                this.lblStatus.Content = "Error getting status for Head Stepper 2 Micro-stepping";
                break;
            }

            switch (solderstepper1microsteppingmode)
            {
            case 0x01:
                radio_SolderStepper1_Microstepping1.IsChecked = true;
                break;

            case 0x02:
                radio_SolderStepper1_Microstepping2.IsChecked = true;
                break;

            case 0x04:
                radio_SolderStepper1_Microstepping4.IsChecked = true;
                break;

            case 0x08:
                radio_SolderStepper1_Microstepping8.IsChecked = true;
                break;

            case 0x16:
                radio_SolderStepper1_Microstepping16.IsChecked = true;
                break;

            case 0x32:
                radio_SolderStepper1_Microstepping32.IsChecked = true;
                break;

            default:
                this.lblStatus.Content = "Error getting status for Solder Stepper 1 Micro-stepping";
                break;
            }

            switch (solderstepper2microsteppingmode)
            {
            case 0x01:
                radio_SolderStepper2_Microstepping1.IsChecked = true;
                break;

            case 0x02:
                radio_SolderStepper2_Microstepping2.IsChecked = true;
                break;

            case 0x04:
                radio_SolderStepper2_Microstepping4.IsChecked = true;
                break;

            case 0x08:
                radio_SolderStepper2_Microstepping8.IsChecked = true;
                break;

            case 0x16:
                radio_SolderStepper2_Microstepping16.IsChecked = true;
                break;

            case 0x32:
                radio_SolderStepper2_Microstepping32.IsChecked = true;
                break;

            default:
                this.lblStatus.Content = "Error getting status for Solder Stepper 2 Micro-stepping";
                break;
            }

            switch (caddysteppermicrosteppingmode)
            {
            case 0x01:
                radio_CaddyStepper_Microstepping1.IsChecked = true;
                break;

            case 0x02:
                radio_CaddyStepper_Microstepping2.IsChecked = true;
                break;

            case 0x04:
                radio_CaddyStepper_Microstepping4.IsChecked = true;
                break;

            case 0x08:
                radio_CaddyStepper_Microstepping8.IsChecked = true;
                break;

            case 0x16:
                radio_CaddyStepper_Microstepping16.IsChecked = true;
                break;

            case 0x32:
                radio_CaddyStepper_Microstepping32.IsChecked = true;
                break;

            default:
                this.lblStatus.Content = "Error getting status for Caddy Stepper Micro-stepping";
                break;
            }

            // Get the default current settings from the controller

            byte headstepper1current   = usbController.getHeadStepper1Current();
            byte headstepper2current   = usbController.getHeadStepper2Current();
            byte solderstepper1current = usbController.getSolderStepper1Current();
            byte solderstepper2current = usbController.getSolderStepper2Current();
            byte caddysteppercurrent   = usbController.getCaddyStepperCurrent();

            slider_HeadStepper1_Current.Value = headstepper1current;
            lbl_HeadStepper1_Current.Content  = calculateCurrent_mA(headstepper1current).ToString("0.00 A");

            slider_HeadStepper2_Current.Value = headstepper2current;
            lbl_HeadStepper2_Current.Content  = calculateCurrent_mA(headstepper2current).ToString("0.00 A");

            slider_SolderStepper1_Current.Value = solderstepper1current;
            lbl_SolderStepper1_Current.Content  = calculateCurrent_mA(solderstepper1current).ToString("0.00 A");

            slider_SolderStepper2_Current.Value = solderstepper2current;
            lbl_SolderStepper2_Current.Content  = calculateCurrent_mA(solderstepper2current).ToString("0.00 A");

            slider_CaddyStepper_Current.Value = caddysteppercurrent;
            lbl_CaddyStepper_Current.Content  = calculateCurrent_mA(caddysteppercurrent).ToString("0.00 A");

            // get the soldering iron status

            solderingControllerStatus = usbController.getSolderingGlobalStatus();

            lbl_iron1_currenttemperature.Content = solderingControllerStatus.Iron1_Temperature.ToString("0.00°C");

            lbl_iron2_currenttemperature.Content = solderingControllerStatus.Iron2_Temperature.ToString("0.00°C");

            txt_iron1_targettemperature.Text = solderingControllerStatus.Iron1_Target_Temperature.ToString("0.00");

            txt_iron2_targettemperature.Text = solderingControllerStatus.Iron2_Target_Temperature.ToString("0.00");

            bool solderingiron1status = solderingControllerStatus.Iron1_Running;
            bool solderingiron2status = solderingControllerStatus.Iron2_Running;

            if (solderingiron1status)
            {
                lbl_iron1_status.Content = "Heating";
            }
            else
            {
                lbl_iron1_status.Content = "Off";
            }

            if (solderingiron2status)
            {
                lbl_iron2_status.Content = "Heating";
            }
            else
            {
                lbl_iron2_status.Content = "Off";
            }

            bool solderingiron1activation = solderingControllerStatus.Iron1_Activate;
            bool solderingiron2activation = solderingControllerStatus.Iron2_Activate;

            if (solderingiron1activation)
            {
                cb_solderingiron1active.IsChecked = true;
            }
            else
            {
                cb_solderingiron1active.IsChecked = false;
            }
            if (solderingiron2activation)
            {
                cb_solderingiron2active.IsChecked = true;
            }
            else
            {
                cb_solderingiron2active.IsChecked = false;
            }

            ConfigLoaded = true;

            // start the timer to update the temperatures

            dispatcherTimer.Start();
        }