IEnumerator <ITask> UpdateCompass()
        {
            var sensorOrFault = _simulatedCompassPort.Get();

            yield return(sensorOrFault.Choice());

            if (!HasError(sensorOrFault))
            {
                analogsensor.AnalogSensorState sensorState = (analogsensor.AnalogSensorState)sensorOrFault;
                WinFormsServicePort.Post(new FormInvoke(() =>
                {
                    _imageProcessingForm.SetCompassReadingValue(sensorState.RawMeasurement);
                }));
            }
        }
Exemple #2
0
        public float get()
        {
            bool  flag     = false;
            float retvalue = 0.0f;

            Arbiter.Activate(DssEnvironment.TaskQueue,
                             Arbiter.Receive <analog.AnalogSensorState>(false, sensorPort.Get(),
                                                                        delegate(analog.AnalogSensorState state)
            {
                retvalue = (float)state.RawMeasurement;
                flag     = true;
            }
                                                                        ));

            while (!flag)
            {
                ;
            }
            return(retvalue);
        }