Esempio n. 1
0
        public void Update()
        {
            if (CurrentDevice != null)
            {
                CurrentDevice.Update(this);
                if (!CurrentDevice.IsConnected)
                {
                    SendTargetData(new TargetData(0, 0, 0, 0));

                    if (drone.Data.State.AreMotorsRunning())
                    {
                        Log.Warning("Stopping because input device is disconnceted");
                        StopDrone();
                    }
                }

                // schauen ob sich Informationen vom Gerät geändert haben
                bool dirty = CurrentDevice.IsConnected != lastConnected || !CurrentDevice.Battery.Equals(lastBattery);
                if (dirty)
                {
                    OnDeviceInfoChanged?.Invoke(this, EventArgs.Empty);

                    lastConnected = CurrentDevice.IsConnected;
                    lastBattery   = CurrentDevice.Battery;
                }
            }
        }
Esempio n. 2
0
        public void Update()
        {
            if (CurrentDevice != null)
            {
                CurrentDevice.Update(this);
                if (!CurrentDevice.IsConnected)
                {
                    SendTargetData(new TargetData(0, 0, 0, 0));
                }

                // schauen ob sich Informationen vom Gerät geändert haben
                bool dirty = CurrentDevice.IsConnected != lastConnected || !CurrentDevice.Battery.Equals(lastBattery);
                if (dirty)
                {
                    if (OnDeviceInfoChanged != null)
                    {
                        OnDeviceInfoChanged(this, EventArgs.Empty);
                    }

                    lastConnected = CurrentDevice.IsConnected;
                    lastBattery   = CurrentDevice.Battery;
                }
            }
        }
Esempio n. 3
0
        public void Update()
        {
            if (CurrentDevice != null)
            {
                CurrentDevice.Update(this);
                if (!CurrentDevice.IsConnected)
                    SendTargetData(new TargetData(0, 0, 0, 0));

                // schauen ob sich Informationen vom Gerät geändert haben
                bool dirty = CurrentDevice.IsConnected != lastConnected || !CurrentDevice.Battery.Equals(lastBattery);
                if (dirty)
                {
                    if (OnDeviceInfoChanged != null)
                        OnDeviceInfoChanged(this, EventArgs.Empty);

                    lastConnected = CurrentDevice.IsConnected;
                    lastBattery = CurrentDevice.Battery;
                }
            }
        }