Beispiel #1
0
        private void StartNewMission()
        {
            int tempBytes = 0;
            int humdBytes = 0;

            if (enableTemperatureSampling.Checked)
            {
                tempBytes++;
                if (temperatureResolution.Text.IndexOf("High") >= 0)
                {
                    tempBytes++;
                }
            }

            if (enableHumiditySampling.Checked)
            {
                humdBytes++;
                if (humidityResolution.Text.IndexOf("High") >= 0)
                {
                    humdBytes++;
                }
            }

            if (tempBytes == 1)
            {
                owc41.setMissionResolution(0, owc41.getMissionResolutions(0)[0]);
            }
            else
            {
                owc41.setMissionResolution(0, owc41.getMissionResolutions(0)[1]);
            }
            if (humdBytes == 1)
            {
                owc41.setMissionResolution(1, owc41.getMissionResolutions(1)[0]);
            }
            else
            {
                owc41.setMissionResolution(1, owc41.getMissionResolutions(1)[1]);
            }


            if (enableTempHighAlarm.Checked)
            {
                owc41.setMissionAlarm(
                    OneWireContainer41.TEMPERATURE_CHANNEL,
                    1, //TemperatureContainer.ALARM_HIGH,
                    (double)temperatureHighAlarm.Value);
                owc41.setMissionAlarmEnable(
                    OneWireContainer41.TEMPERATURE_CHANNEL,
                    1, //TemperatureContainer.ALARM_HIGH,
                    true);
            }
            else
            {
                owc41.setMissionAlarmEnable(
                    OneWireContainer41.TEMPERATURE_CHANNEL,
                    1, //TemperatureContainer.ALARM_HIGH,
                    false);
            }

            if (enableTempLowAlarm.Checked)
            {
                owc41.setMissionAlarm(
                    OneWireContainer41.TEMPERATURE_CHANNEL,
                    0, //TemperatureContainer.ALARM_LOW,
                    (double)temperatureLowAlarm.Value);
                owc41.setMissionAlarmEnable(
                    OneWireContainer41.TEMPERATURE_CHANNEL,
                    0, //TemperatureContainer.ALARM_LOW,
                    true);
            }
            else
            {
                owc41.setMissionAlarmEnable(
                    OneWireContainer41.TEMPERATURE_CHANNEL,
                    0, //TemperatureContainer.ALARM_LOW,
                    false);
            }

            if (enableHumdHighAlarm.Checked)
            {
                owc41.setMissionAlarm(
                    OneWireContainer41.DATA_CHANNEL,
                    1, //ADContainer.ALARM_HIGH,
                    (double)humidityHighAlarm.Value);
                owc41.setMissionAlarmEnable(
                    OneWireContainer41.DATA_CHANNEL,
                    1, //ADContainer.ALARM_HIGH,
                    true);
            }
            else
            {
                owc41.setMissionAlarmEnable(
                    OneWireContainer41.DATA_CHANNEL,
                    1, //ADContainer.ALARM_HIGH,
                    false);
            }

            if (enableHumdLowAlarm.Checked)
            {
                owc41.setMissionAlarm(
                    OneWireContainer41.DATA_CHANNEL,
                    0, //ADContainer.ALARM_LOW,
                    (double)humidityLowAlarm.Value);
                owc41.setMissionAlarmEnable(
                    OneWireContainer41.DATA_CHANNEL,
                    0, //ADContainer.ALARM_LOW,
                    true);
            }
            else
            {
                owc41.setMissionAlarmEnable(
                    OneWireContainer41.DATA_CHANNEL,
                    0, //ADContainer.ALARM_LOW,
                    false);
            }

            owc41.setStartUponTemperatureAlarmEnable(suta.Checked);

            owc41.startNewMission((int)sampleRate.Value, (int)startDelay.Value,
                                  enableRolloverCheckBox.Checked, syncClockCheckBox.Checked,
                                  new bool[] { tempBytes > 0, humdBytes > 0 });

            counter++;
        }