Пример #1
0
        private void buttonHideSettings_Click(object sender, EventArgs e)
        {
            if (windowSize == settingsWindowSizeE.cameraOff)
            {
                return;
            }

            if (windowSize == settingsWindowSizeE.cameraOnFullOptions)
            {
                windowSize = settingsWindowSizeE.cameraOnNoOptions;
            }
            else
            {
                windowSize = settingsWindowSizeE.cameraOnFullOptions;
            }
            setupWindowSize();

            Camera.settingsWindowSizeState      = windowSize;
            Camera.settingsWindowSizeStateDirty = true;
        }
Пример #2
0
        private void SetupDialogForm_Shown(object sender, EventArgs e)
        {
            labelVersionInformation.Text  = "CAM86 " + "v=" + Camera.driverVersion + ", LL=" + Camera.driverLLversion;
            backuplabelVersionInformation = labelVersionInformation.Text;

            // should we show all camera parameters or only some
            windowSize = Camera.settingsWindowSizeState;

            if (cameraConnected)
            {
                // make sure the value is valid
                if (windowSize == settingsWindowSizeE.cameraOff)
                {
                    windowSize = settingsWindowSizeE.cameraOnNoOptions;
                }

                setupWindowSize();

                // add firmware label
                labelVersionInformation.Text += ", FW=" + Camera.driverFirmwareVersion; // will always be zero unless read after initial camera connection
                backuplabelVersionInformation = labelVersionInformation.Text;
            }
            else
            {
                // make sure the value is valid
                if (windowSize != settingsWindowSizeE.cameraOff)
                {
                    windowSize = settingsWindowSizeE.cameraOff;
                }

                setupWindowSize();

                // Get info about the connected FTDI Cam86 devices
                UInt32         ftdiDeviceCount = 0;
                FTDI.FT_STATUS ftStatus        = FTDI.FT_STATUS.FT_OK;
                // Create new instance of the FTDI device class
                FTDI tempFtdiDevice = new FTDI();
                // Determine the number of FTDI devices connected to the machine
                ftStatus = tempFtdiDevice.GetNumberOfDevices(ref ftdiDeviceCount);
                // Check status
                if (ftStatus == FTDI.FT_STATUS.FT_OK)
                {
                    AvailableDevicesListBox.Items.Add("# of FTDI devices = " + ftdiDeviceCount.ToString());
                }
                else
                {
                    throw new ASCOM.InvalidValueException("Error getting count FTDI devices");
                }
                if (ftdiDeviceCount > 0)
                {
                    // Allocate storage for device info list
                    FTDI.FT_DEVICE_INFO_NODE[] ftdiDeviceList = new FTDI.FT_DEVICE_INFO_NODE[ftdiDeviceCount];
                    // Populate our device list
                    ftStatus = tempFtdiDevice.GetDeviceList(ftdiDeviceList);
                    //Show device properties
                    if (ftStatus == FTDI.FT_STATUS.FT_OK)
                    {
                        for (UInt32 i = 0; i < ftdiDeviceCount; i++)
                        {
                            if (ftdiDeviceList[i].SerialNumber.Contains("CAM86"))
                            {
                                AvailableDevicesListBox.Items.Add("Device Index: " + i.ToString());
                                AvailableDevicesListBox.Items.Add("Flags: " + String.Format("{0:x}", ftdiDeviceList[i].Flags));
                                AvailableDevicesListBox.Items.Add("Type: " + ftdiDeviceList[i].Type.ToString());
                                AvailableDevicesListBox.Items.Add("ID: " + String.Format("{0:x}", ftdiDeviceList[i].ID));
                                AvailableDevicesListBox.Items.Add("Location ID: " + String.Format("{0:x}", ftdiDeviceList[i].LocId));
                                AvailableDevicesListBox.Items.Add("Serial Number: " + ftdiDeviceList[i].SerialNumber.ToString());
                                AvailableDevicesListBox.Items.Add("Description: " + ftdiDeviceList[i].Description.ToString());
                                AvailableDevicesListBox.Items.Add("");
                            }
                        }
                    }
                    else
                    {
                        throw new ASCOM.InvalidValueException("Error getting parameters from FTDI devices");
                    }
                }
                //Close device
                ftStatus = tempFtdiDevice.Close();

                // Initialise current values of user settings from the ASCOM Profile
                chkTrace.Checked = Camera.traceState;
            }

            // Initialise current values of user settings from the ASCOM Profile
            checkBoxNightMode.Checked                 = Camera.nightModeSettingsState;
            checkBoxOnTop.Checked                     = Camera.onTopState;
            checkBoxTEConDuringRead.Checked           = Camera.coolerDuringReadingState;
            checkBoxMono.Checked                      = Camera.monoSensorState;
            slowCoolingCheckBox.Checked               = Camera.slowCoolingEnabledState;
            slowCoolingNumUpDown.Value                = (decimal)(Camera.slowCoolingSpeedState / 10.0);
            numericUpDownSensorClearTime.Value        = Camera.sensorClearBeforeExposureTimeState;
            numericUpDownTECstartupPowerPercent.Value = Camera.coolingStartingPowerPercentState;
            numericUpDownTECmaximumPowerPercent.Value = Camera.coolingMaxPowerPercentState;
            checkBoxOpenSettingsOnConnect.Checked     = Camera.settingsWindowOpenOnConnectState;

            gainNumUpDown.Value            = Camera.gainState;
            offsetNumUpDown.Value          = Camera.offsetState;
            numericUpDownReadingTime.Value = Camera.readingTimeState;
            numericUpDownPIDKp.Value       = (decimal)Camera.PIDproportionalGainState;
            numericUpDownPIDKi.Value       = (decimal)Camera.PIDintegralGainState;
            numericUpDownPIDKd.Value       = (decimal)Camera.PIDderivativeGainState;

            checkBoxDHT22.Checked = Camera.DHT22presentState;
            if (!checkBoxDHT22.Checked)
            {
                labelDHTinfo.Text           = "DHT: no sensor";
                labelDHTinfo.Visible        = false;
                buttonHideSettings.Location = new Point(86, buttonHideSettings.Location.Y); // shift the button to left
            }
            else
            {
                labelDHTinfo.Visible        = true;
                buttonHideSettings.Location = new Point(6, buttonHideSettings.Location.Y); // center the button
            }

            // check date for the April Fools' Day joke
            if (DateTime.Now.Day == 1 && DateTime.Now.Month == 4)
            {
                buttonCloudsOffAprilFoolsDay.Visible = true;
            }
            else
            {
                buttonCloudsOffAprilFoolsDay.Visible = false;
            }
        }