Esempio n. 1
0
        private void buttonDebugDataRecTask_Click(object sender, EventArgs e)
        {
            byte ch;
            byte op;
            uint prescaler;
            uint targetPoints;

            // Parse input fields
            try
            {
                ch           = InputValidatorHelperClass.GetChModeFromComboBox(comboBoxDebugDataRecTaskCh);
                op           = InputValidatorHelperClass.GetOperationModeFromComboBox(comboBoxDebugDataRecTaskOpMode);
                prescaler    = Convert.ToUInt32(textBoxDebugPrescaler.Text);
                targetPoints = Convert.ToUInt32(textBoxDebugTargetPoints.Text);
            }
            catch (Exception)
            {
                MessageBox.Show("Wrong Values for Data Recorder!");
                return;
            }

            // Values are valid, add command to the list
            com.AppendDataRecorderTask(ch, op, prescaler, targetPoints, DateTime.Now);

            // Append to display
            textBoxDebugInstructionPool.Text += "DataRecTask(" + comboBoxDebugDataRecTaskCh.Text + ", " + comboBoxDebugDataRecTaskOpMode.Text + " ," + prescaler +
                                                ", " + targetPoints + ") \r\n";
            FormCustomConsole.WriteLine("DataRecTask(" + comboBoxDebugDataRecTaskCh.Text + ", " + comboBoxDebugDataRecTaskOpMode.Text + " ," + prescaler +
                                        ", " + targetPoints + ")");
        }
Esempio n. 2
0
        private void buttonDebugSetCriticalLow_Click(object sender, EventArgs e)
        {
            byte  ch;
            float value, gain;

            if (checkBoxDebugUseDefGain.Checked)
            {
                // Use gain that is inferred from configuration file
                try
                {
                    ch    = InputValidatorHelperClass.GetChModeFromComboBox(comboBoxDebugSetCritLow);
                    value = float.Parse(textBoxDebugSetCriticalLow.Text);
                    if (ch == 0)
                    {
                        gain = ConfigClass.deviceGainCH0;
                    }
                    else
                    {
                        gain = ConfigClass.deviceGainCH1;
                    }
                    value = value / gain;
                }
                catch (Exception)
                {
                    MessageBox.Show("Insert valid values!");
                    return;
                }
            }
            else
            {
                // Use gain that is parsed from textbox
                try
                {
                    ch    = InputValidatorHelperClass.GetChModeFromComboBox(comboBoxDebugSetCritLow);
                    value = float.Parse(textBoxDebugSetCriticalLow.Text);
                    gain  = float.Parse(textBoxDebugSetCriticalLowGain.Text);
                    value = value / gain;
                }
                catch (Exception)
                {
                    MessageBox.Show("Insert valid values!");
                    return;
                }
            }


            com.AppendSetCriticalLow(value, ch);
            textBoxDebugInstructionPool.Text += "SetCriticalLow(" + value + ", " + comboBoxDebugSetCritLow.Text + ")\r\n";
            FormCustomConsole.WriteLine("SetCriticalLow(" + value + ", " + comboBoxDebugSetCritLow.Text + ")");
        }
Esempio n. 3
0
        private void buttonDebugDiasbleCriticalHigh_Click(object sender, EventArgs e)
        {
            byte ch;

            try
            {
                ch = InputValidatorHelperClass.GetChModeFromComboBox(comboBoxDebugDisableCritHigh);
            }
            catch (Exception)
            {
                MessageBox.Show("Insert valid values!");
                return;
            }
            UInt16 temp = 0x8000;

            com.AppendSetCriticalHigh(temp, ch);
            textBoxDebugInstructionPool.Text += "DisableCriticalHigh(" + comboBoxDebugDisableCritHigh.Text + ")\r\n";
            FormCustomConsole.WriteLine("DisableCriticalHigh()\r\n");
        }
Esempio n. 4
0
        private void buttonDebugWaitForValueFalling_Click(object sender, EventArgs e)
        {
            byte   ch;
            UInt16 latency;
            float  value, gain;

            if (checkBoxDebugUseDefGain.Checked)
            {
                // Use gain that is inferred from configuration file
                try
                {
                    ch = InputValidatorHelperClass.GetChModeFromComboBox(comboBoxDebugWaitForValueFalling);
                    string corectedValue = textBoxDebugWaitForValueFallingValue.Text;
                    string correctedGain = textBoxDebugWaitForValueFallingGain.Text;
                    value = float.Parse(corectedValue);
                    if (ch == 0)
                    {
                        gain = ConfigClass.deviceGainCH0;
                    }
                    else
                    {
                        gain = ConfigClass.deviceGainCH1;
                    }
                    value = value / gain;
                }
                catch (Exception)
                {
                    MessageBox.Show("Insert valid values!");
                    return;
                }
            }
            else
            {
                // Use gain that is parsed from textbox
                try
                {
                    ch = InputValidatorHelperClass.GetChModeFromComboBox(comboBoxDebugWaitForValueFalling);
                    string corectedValue = textBoxDebugWaitForValueFallingValue.Text;
                    string correctedGain = textBoxDebugWaitForValueFallingGain.Text;
                    value = float.Parse(corectedValue);
                    gain  = float.Parse(correctedGain);
                    value = value / gain;
                }
                catch (Exception)
                {
                    MessageBox.Show("Insert valid values!");
                    return;
                }
            }

            // parse latency
            try
            {
                latency = Convert.ToUInt16(textBoxDebugWaitForValueFallingLatency.Text);
            }
            catch (Exception)
            {
                MessageBox.Show("Insert valid value for latency!");
                return;
            }

            com.AppendWaitForValueFalling(ch, latency, value);
            textBoxDebugInstructionPool.Text += "WaitForValueFalling(" + comboBoxDebugWaitForValueFalling.Text + ", " + latency +
                                                ", " + value.ToString() + ")\r\n";
            FormCustomConsole.WriteLine("WaitForValueFalling(" + comboBoxDebugWaitForValueFalling.Text + ", " + latency +
                                        ", " + value.ToString() + ")");
        }