Example #1
0
        public void StartMotorPattern(ulong pMacAdress, ushort pDurationMs, float pIntensity, ushort pSleepMs, int pPatternIterations)
        {
            // Cancel the Previous Task if Any.
            if (_motorPatternCancellationToken != null)
            {
                _motorPatternCancellationToken.Cancel();
            }

            // Run the new Task.
            _motorPatternCancellationToken = new CancellationTokenSource();
            Task.Run(() =>
            {
                IMetaWearBoard board = _mwBoardsManager.GetBoard(pMacAdress);
                if (board != null)
                {
                    IHaptic haptic = board.GetModule <IHaptic>();
                    if (haptic != null)
                    {
                        // Set 120ms as the minimal duration between Bluetooth' stream of successives commands.
                        // Below this value, pattern can be broken by pushing too frequently on the BLE connection.
                        // Better solution should be to implement the vibration pattern directly on the MetaWearBoard.
                        int sleep = Math.Max((int)pSleepMs, 120) + pDurationMs;
                        while (pPatternIterations-- > 0)
                        {
                            haptic.StartMotor(pDurationMs, pIntensity);
                            Thread.Sleep(sleep);
                        }
                    }
                }
            }, _motorPatternCancellationToken.Token);
        }
Example #2
0
        private async void _OnBLEDeviceFound(BluetoothLEAdvertisementReceivedEventArgs pBLEAdvertisement)
        {
            // Treats BLE devices one after the other to avoid issues with async tasks.
            _bleScanner.StopScanning();

            if (!_connectedMWBoards.Keys.Contains(pBLEAdvertisement.BluetoothAddress))
            {
                BluetoothLEDevice bleDevice = await BluetoothLEDevice.FromBluetoothAddressAsync(pBLEAdvertisement.BluetoothAddress);

                if (bleDevice != null)
                {
                    IMetaWearBoard mwBoard = MbientLab.MetaWear.Win10.Application.GetMetaWearBoard(bleDevice);
                    //mwBoard.TimeForResponse = 2000;
                    await mwBoard.InitializeAsync();

                    if (mwBoard.IsConnected)
                    {
                        // board is connected.
                        Console.WriteLine(string.Format("[MetaWearBoardsManager] MetaWear board {0} {1}.",
                                                        Global.MacToString(bleDevice.BluetoothAddress), bleDevice.ConnectionStatus));
                        // Add board.
                        _connectedMWBoards.Add(bleDevice.BluetoothAddress, new Tuple <IMetaWearBoard, BluetoothLEDevice>(mwBoard, bleDevice));
                        bleDevice.ConnectionStatusChanged += _OnConnectionStatusChanged;
                    }
                }
            }

            // Check for restarting Scan.
            _CheckForScanning();
        }
Example #3
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            var samples = 0;
            var model   = (DataContext as MainViewModel).MyModel;

            metawear      = MbientLab.MetaWear.Win10.Application.GetMetaWearBoard(e.Parameter as BluetoothLEDevice);
            accelerometer = metawear.GetModule <IAccelerometer>();
            accelerometer.Configure(odr: 100f, range: 8f);

            await accelerometer.PackedAcceleration.AddRouteAsync(source => source.Stream(async data => {
                var value = data.Value <Acceleration>();
                await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
                    (model.Series[0] as LineSeries).Points.Add(new DataPoint(samples, value.X));
                    (model.Series[1] as LineSeries).Points.Add(new DataPoint(samples, value.Y));
                    (model.Series[2] as LineSeries).Points.Add(new DataPoint(samples, value.Z));
                    samples++;

                    model.InvalidatePlot(true);
                    if (samples > MainViewModel.MAX_DATA_SAMPLES)
                    {
                        model.Axes[1].Reset();
                        model.Axes[1].Maximum = samples;
                        model.Axes[1].Minimum = (samples - MainViewModel.MAX_DATA_SAMPLES);
                        model.Axes[1].Zoom(model.Axes[1].Minimum, model.Axes[1].Maximum);
                    }
                });
            }));
        }
Example #4
0
        internal static void Start(IMetaWearBoard metawear)
        {
            var acc = metawear.GetModule <IAccelerometer>();

            // Start the acceleration data
            acc.Acceleration.Start();
            // Put accelerometer in active mode
            acc.Start();
        }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            var samples  = 0;
            var samples2 = 0;
            var model    = (DataContext as MainViewModel).MyModel;
            var model2   = (DataContext as MainViewModel).MyLocal;


            //Sensor Configuration
            metawear     = MbientLab.MetaWear.Win10.Application.GetMetaWearBoard(e.Parameter as BluetoothLEDevice);
            sensorfusion = metawear.GetModule <ISensorFusionBosch>();
            sensorfusion.Configure(mode: Mode.Ndof, ar: AccRange._2g, gr: GyroRange._500dps);
            //-----------------------

            //await sensorfusion.Quaternion.AddRouteAsync(source => source.Stream(async data => {
            //    var value = data.Value<Quaternion>();
            //    await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.High, () => {

            //        (model.Series[0] as LineSeries).Points.Add(new DataPoint(samples, value.W));
            //        (model.Series[1] as LineSeries).Points.Add(new DataPoint(samples, value.Z));
            //        samples++;

            //        model.InvalidatePlot(true);
            //        if (samples > MainViewModel.MAX_DATA_SAMPLES) {
            //            model.Axes[1].Reset();
            //            model.Axes[1].Maximum = samples;
            //            model.Axes[1].Minimum = (samples - MainViewModel.MAX_DATA_SAMPLES);
            //            model.Axes[1].Zoom(model.Axes[1].Minimum, model.Axes[1].Maximum);
            //        }
            //    });
            //}));

            //===== This is for the Linear Acceleration =====

            await sensorfusion.LinearAcceleration.AddRouteAsync(source => source.Stream(async data =>
            {
                var value2 = data.Value <CorrectedAcceleration>();
                await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
                {
                    (model2.Series[0] as LineSeries).Points.Add(new DataPoint(samples2, value2.X));
                    (model2.Series[1] as LineSeries).Points.Add(new DataPoint(samples2, value2.Y));
                    (model2.Series[2] as LineSeries).Points.Add(new DataPoint(samples2, value2.Z));
                    samples2++;

                    model2.InvalidatePlot(true);
                    if (samples > MainViewModel.MAX_DATA_SAMPLES)
                    {
                        model2.Axes[1].Reset();
                        model2.Axes[1].Maximum = samples2;
                        model2.Axes[1].Minimum = (samples2 - MainViewModel.MAX_DATA_SAMPLES);
                        model2.Axes[1].Zoom(model2.Axes[1].Minimum, model2.Axes[1].Maximum);
                    }
                });
            }));
        }
Example #6
0
        public byte GetBatteryLevel(ulong pMacAdress)
        {
            IMetaWearBoard board = _mwBoardsManager.GetBoard(pMacAdress);

            if ((board != null) && !board.InMetaBootMode)
            {
                return(board.ReadBatteryLevelAsync().RunSynchronously <byte>());
            }
            return(0);
        }
Example #7
0
        public string GetBoardModel(ulong pMacAdress)
        {
            IMetaWearBoard board = _mwBoardsManager.GetBoard(pMacAdress);

            if ((board != null) && !board.InMetaBootMode)
            {
                return(board.ModelString);
            }
            return(string.Empty);
        }
Example #8
0
        internal static Task Stop(IMetaWearBoard metawear)
        {
            var acc = metawear.GetModule <IAccelerometer>();

            // Put accelerometer back into standby mode
            acc.Stop();
            // Stop accelerationi data
            acc.Acceleration.Stop();

            // Have remote device close the connection
            return(metawear.GetModule <IDebug>().DisconnectAsync());
        }
Example #9
0
        static async Task SetupLogger(IMetaWearBoard metawear)
        {
            var acc = metawear.GetModule <IAccelerometer>();
            await acc.Acceleration.AddRouteAsync(source => source.Log(_ => {
                Console.WriteLine($"{_.FormattedTimestamp} -> {_.Value<Acceleration>()}");
            }));

            // Tell firmware to start logging
            metawear.GetModule <ILogging>().Start();
            acc.Acceleration.Start();
            acc.Start();
        }
Example #10
0
        public void StartBuzzer(ulong pMacAdress, ushort pDurationMs)
        {
            IMetaWearBoard board = _mwBoardsManager.GetBoard(pMacAdress);

            if (board != null)
            {
                IHaptic haptic = board.GetModule <IHaptic>();
                if (haptic != null)
                {
                    haptic.StartBuzzer(pDurationMs);
                }
            }
        }
Example #11
0
        static async Task <IScheduledTask> Setup(IMetaWearBoard metawear)
        {
            var temperature = metawear.GetModule <ITemperature>();
            var thermistor  = temperature.FindSensors(SensorType.PresetThermistor)[0];

            await thermistor.AddRouteAsync(source => source.Stream(_ => {
                Console.WriteLine($"{_.FormattedTimestamp} -> {_.Value<float>()}");
            }));

            // Temperature is classified as a forced data producer
            // Schedule periodic `Read` calls in the firmware, do it after route is setup
            return(await metawear.ScheduleAsync(1000, false, () => thermistor.Read()));
        }
Example #12
0
        internal static async Task Setup(IMetaWearBoard metawear, Dictionary <IMetaWearBoard, uint> samples)
        {
            var acc = metawear.GetModule <IAccelerometer>();

            // Set the data rate to 100Hz and data range to +/-16g, or closest valid values
            acc.Configure(odr: 100f, range: 16f);
            // Use data route framework to tell the MetaMotion to stream accelerometer data to the host device
            // https://mbientlab.com/csdocs/latest/data_route.html#stream
            await acc.Acceleration.AddRouteAsync(source => source.Stream(data => {
                Console.WriteLine($"{metawear.MacAddress} -> {data.Value<Acceleration>()}");
                samples[metawear]++;
            }));
        }
Example #13
0
        static async Task DownloadData(IMetaWearBoard metawear)
        {
            var logging = metawear.GetModule <ILogging>();
            var acc     = metawear.GetModule <IAccelerometer>();

            acc.Stop();
            acc.Acceleration.Stop();
            logging.Stop();

            metawear.GetModule <ISettings>().EditBleConnParams(maxConnInterval: 7.5f);
            await Task.Delay(1500);

            await logging.DownloadAsync();
        }
        protected async void OnNavigatedTo2(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            var samples = 0;
            var model   = (DataContext as MainViewModel).MyModel;

            metawear = MbientLab.MetaWear.Win10.Application.GetMetaWearBoard(e.Parameter as BluetoothLEDevice);
            //accelerometer = metawear.GetModule<IAccelerometer>();
            //gyro = metawear.GetModule<IGyroBmi160>();
            //gyro.Configure();

            //accelerometer.Configure(odr: 100f, range: 8f);
            m_SensorFusion = metawear.GetModule <ISensorFusionBosch>();
            gyro           = metawear.GetModule <IGyroBmi160>();
            gyro.Configure(OutputDataRate._100Hz);
            accelerometer = metawear.GetModule <IAccelerometer>();
            accelerometer.Configure(odr: 100f, range: 8f);

            m_SensorFusion.Configure();
            await m_SensorFusion.EulerAngles.AddRouteAsync(source =>
            {
                source.Stream(async data =>
                {
                    await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        var value = data.Value <EulerAngles>();
                        (model.Series[0] as LineSeries).Points.Add(new DataPoint(samples, value.Pitch));
                        (model.Series[1] as LineSeries).Points.Add(new DataPoint(samples, value.Roll));
                        (model.Series[2] as LineSeries).Points.Add(new DataPoint(samples, value.Yaw));
                        samples++;

                        model.InvalidatePlot(true);
                        if (samples > MainViewModel.MAX_DATA_SAMPLES)
                        {
                            model.Axes[1].Reset();
                            model.Axes[1].Maximum = samples;
                            model.Axes[1].Minimum = (samples - MainViewModel.MAX_DATA_SAMPLES);
                            model.Axes[1].Zoom(model.Axes[1].Minimum, model.Axes[1].Maximum);
                        }
                        GyroText.Text = value.ToString();
                    });
                });
            });

            m_SensorFusion.Start();
            m_SensorFusion.EulerAngles.Start();
        }
Example #15
0
        private async Task Disconnect()
        {
            if (m_Metaware != null)
            {
                var led = m_Metaware.GetModule <ILed>();
                led.Stop(true);
                await m_Metaware.DisconnectAsync();

                m_Metaware.TearDown();
                m_Metaware  = null;
                m_Connected = false;
            }

            //Scanner.Start();
            btnConnect.Content = "Connect";
        }
Example #16
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            metawear = MbientLab.MetaWear.Win10.Application.GetMetaWearBoard(e.Parameter as BluetoothLEDevice);

            var accelerometer = metawear.GetModule <IAccelerometer>();

            accelerometer.Configure(odr: 50f);
            await accelerometer.Acceleration.AddRouteAsync(source =>
                                                           source.Map(Function1.Rss).LowPass(4).Find(Threshold.Binary, 0.5f)
                                                           .Multicast()
                                                           .To().Filter(Comparison.Eq, -1).Log(data => System.Diagnostics.Debug.WriteLine("In FreeFall"))
                                                           .To().Filter(Comparison.Eq, 1).Log(data => System.Diagnostics.Debug.WriteLine("Not in FreeFall"))
                                                           );
        }
Example #17
0
        private async void _CloseBoard(IMetaWearBoard pBoard, BluetoothLEDevice pBLEDevice, bool pTearDown)
        {
            pBLEDevice.ConnectionStatusChanged -= _OnConnectionStatusChanged;

            if (!pBoard.InMetaBootMode)
            {
                if (pTearDown)
                {
                    pBoard.TearDown();
                }
                await pBoard.GetModule <IDebug>().DisconnectAsync();
            }

            if (pTearDown)
            {
                MbientLab.MetaWear.Win10.Application.RemoveMetaWearBoard(pBLEDevice, true);
            }
        }
Example #18
0
        internal static async Task Setup(IMetaWearBoard metawear)
        {
            var mwSwitch = metawear.GetModule <ISwitch>();
            await mwSwitch.State.AddRouteAsync(source => {
                var led   = metawear.GetModule <ILed>();
                var count = source.Filter(Comparison.Eq, 1).Count().Name("press-count");

                var colors = Enum.GetValues(typeof(Color)).Cast <Color>();
                count.Filter(Comparison.Eq, colors.Count() + 1).React(token => {
                    led.Stop(true);
                    metawear.GetModule <IDataProcessor>().Edit <ICounterEditor>("press-count").Reset();
                });
                foreach (var c in colors)
                {
                    count.Filter(Comparison.Eq, ((int)c) + 1).React(token => {
                        led.Stop(true);
                        led.EditPattern(c, Pattern.Solid);
                        led.Play();
                    });
                }
            });
        }
Example #19
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            metawear = MbientLab.MetaWear.Win10.Application.GetMetaWearBoard(e.Parameter as BluetoothLEDevice);
        }
Example #20
0
 public ConnectedDevicePage(IMetaWearBoard board)
     : base()
 {
     InitializeComponent();
     ViewModel.SetBoard(board);
 }
        static async Task Main(string[] args)
        {
            IMetaWearBoard board   = null;
            bool           succeed = false;
            int            retries = 5;
            //while (!succeed && retries > 0)
            {
                //try
                {
                    board = MbientLab.MetaWear.NetStandard.Application.GetMetaWearBoard(args[0]);
                    //var board = BLEMetawear.Application.GetMetaWearBoard(args[0]);
                    board.TimeForResponse         = 100000;
                    board.OnUnexpectedDisconnect += OnDisconneted;
                    await board.InitializeAsync();

                    succeed = true;
                }
                //catch
                {
                    retries--;
                }
            }

            ILed led = null;
            ISensorFusionBosch sensor = null;

            if (board.IsConnected)
            {
                led = board.GetModule <ILed>();
                led.EditPattern(MbientLab.MetaWear.Peripheral.Led.Color.Green, MbientLab.MetaWear.Peripheral.Led.Pattern.Solid);
                led.Play();

                sensor = board.GetModule <ISensorFusionBosch>();
                sensor.Configure();

                var rout = await sensor.EulerAngles.AddRouteAsync(source =>
                {
                    try
                    {
                        source.Stream(data =>
                        {
                            var value       = data.Value <EulerAngles>();
                            var AngularRead = (int)value.Roll;
                            var OrbitalRead = (int)value.Pitch;
                            //Console.Clear();
                            Console.Write($"\rroll: {value.Roll} pitch:{value.Pitch} Yaw:{value.Yaw}      ");



                            //Rotate(-value.Pitch, 0 , -value.Yaw);
                        });
                    }
                    catch (Exception ex)
                    {
                        Console.Write(ex.Message);
                        //LogException(LoggerCategory, ex, "Could not initialize IMU stream callback");
                        throw;
                    }
                });

                sensor.EulerAngles.Start();
                sensor.Start();
            }
            ConsoleKeyInfo key = new ConsoleKeyInfo();

            while (key.Key != ConsoleKey.Q)
            {
                key = Console.ReadKey();
            }
            if (board.IsConnected)
            {
                if (led != null)
                {
                    led.Stop(true);
                }
                if (sensor != null)
                {
                    sensor.EulerAngles.Stop();
                    sensor.Stop();
                }

                await board.DisconnectAsync();

                //board.TearDown();
            }
        }
Example #22
0
        private async void OnConnect(object sender, RoutedEventArgs e)
        {
            var item = lst.SelectedItem as BLEDevice;

            if (item != null)
            {
                if (m_Metaware == null)
                {
                    await MbientLab.MetaWear.NetStandard.Application.ClearDeviceCacheAsync(item.Mac);

                    m_Metaware = MbientLab.MetaWear.NetStandard.Application.GetMetaWearBoard(item.Mac);
                    m_Metaware.TimeForResponse = 100000;
                }
                if (m_Metaware.IsConnected)
                {
                    await Disconnect();
                }
                else
                {
                    try
                    {
                        int retries = 5;
                        do
                        {
                            try
                            {
                                btnConnect.Content   = "Connecting...";
                                btnConnect.IsEnabled = false;
                                m_Metaware.OnUnexpectedDisconnect += OnDisconneted;
                                await m_Metaware.InitializeAsync();

                                retries = -1;
                            }
                            catch
                            {
                                retries--;
                            }
                        } while (retries > 0);
                        btnConnect.IsEnabled = true;
                        if (m_Metaware.IsConnected)
                        {
                            var batteryLevel = await m_Metaware.ReadBatteryLevelAsync();

                            var led = m_Metaware.GetModule <ILed>();
                            led.EditPattern(MbientLab.MetaWear.Peripheral.Led.Color.Green, MbientLab.MetaWear.Peripheral.Led.Pattern.Solid);
                            led.Play();
                            item.BatteryLevel  = batteryLevel;
                            BatteryText.Text   = $" Battery:{batteryLevel}";
                            btnConnect.Content = "Disconnect";
                            m_Connected        = true;

                            //m_Metaware.GetModule<IMagnetometerBmm150>();
                            //m_Gyro = m_Metaware.GetModule<IGyroBmi160>();
                            //m_Gyro.Configure(OutputDataRate._100Hz);
                            //m_Accelerometer = m_Metaware.GetModule<IAccelerometer>();
                            //m_Accelerometer.Configure(odr: 100f, range: 8f);
                            m_SensorFusion = m_Metaware.GetModule <ISensorFusionBosch>();
                            m_SensorFusion.Configure();

                            var rout = await m_SensorFusion.EulerAngles.AddRouteAsync(source =>
                            {
                                try
                                {
                                    source.Stream(async data =>
                                    {
                                        await Dispatcher.InvokeAsync(() =>
                                        {
                                            var value      = data.Value <EulerAngles>();
                                            AngleText.Text = value.ToString();
                                            Rotate(-value.Roll, -value.Pitch, -value.Yaw);
                                            //Rotate(-value.Pitch, 0 , -value.Yaw);
                                        });
                                    });
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                }
                            });

                            if (!rout.Valid)
                            {
                                MessageBox.Show("rout invalid");
                            }
                            await m_SensorFusion.Gravity.AddRouteAsync(source =>
                            {
                                source.Stream(async data =>
                                {
                                    await Dispatcher.InvokeAsync(() =>
                                    {
                                        var value        = data.Value <Acceleration>();
                                        GravityText.Text = value.ToString();
                                        //Rotate(-value.Roll, -value.Pitch, -value.Yaw);
                                        //Rotate(-value.Pitch, 0 , -value.Yaw);
                                    });
                                });
                            });

                            //var calib = await m_SensorFusion.ReadCalibrationStateAsync();
                            m_SensorFusion.Gravity.Start();
                            m_SensorFusion.EulerAngles.Start();
                            m_SensorFusion.Start();


                            //Scanner.Stop();
                        }
                        else
                        {
                            throw new InvalidOperationException("Could not connect");
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        btnConnect.Content = "Connect";
                        m_Connected        = false;
                    }
                }
            }
        }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            var samples = 0;
            var model   = (DataContext as MainViewModel).MyModel;

            metawear = MbientLab.MetaWear.Win10.Application.GetMetaWearBoard(e.Parameter as BluetoothLEDevice);
            //accelerometer = metawear.GetModule<IAccelerometer>();
            //gyro = metawear.GetModule<IGyroBmi160>();
            //gyro.Configure();

            //accelerometer.Configure(odr: 100f, range: 8f);
            m_SensorFusion = metawear.GetModule <ISensorFusionBosch>();
            m_SensorFusion.Configure();
            await m_SensorFusion.EulerAngles.AddRouteAsync(source =>
            {
                source.Stream(async data =>
                {
                    await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        var value = data.Value <EulerAngles>();
                        (model.Series[0] as LineSeries).Points.Add(new DataPoint(samples, value.Pitch));
                        (model.Series[1] as LineSeries).Points.Add(new DataPoint(samples, value.Roll));
                        (model.Series[2] as LineSeries).Points.Add(new DataPoint(samples, value.Yaw));
                        samples++;

                        model.InvalidatePlot(true);
                        if (samples > MainViewModel.MAX_DATA_SAMPLES)
                        {
                            model.Axes[1].Reset();
                            model.Axes[1].Maximum = samples;
                            model.Axes[1].Minimum = (samples - MainViewModel.MAX_DATA_SAMPLES);
                            model.Axes[1].Zoom(model.Axes[1].Minimum, model.Axes[1].Maximum);
                        }
                    });
                });
            });

            //await accelerometer.PackedAcceleration.AddRouteAsync(source => source.Stream(async data =>
            //{
            //    var value = data.Value<Acceleration>();
            //    await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            //    {

            //        (model.Series[0] as LineSeries).Points.Add(new DataPoint(samples, value.X));
            //        (model.Series[1] as LineSeries).Points.Add(new DataPoint(samples, value.Y));
            //        (model.Series[2] as LineSeries).Points.Add(new DataPoint(samples, value.Z));
            //        samples++;

            //        model.InvalidatePlot(true);
            //        if (samples > MainViewModel.MAX_DATA_SAMPLES)
            //        {
            //            model.Axes[1].Reset();
            //            model.Axes[1].Maximum = samples;
            //            model.Axes[1].Minimum = (samples - MainViewModel.MAX_DATA_SAMPLES);
            //            model.Axes[1].Zoom(model.Axes[1].Minimum, model.Axes[1].Maximum);
            //        }
            //    });
            //}));

            //await gyro.AngularVelocity.AddRouteAsync(source =>
            //        {
            //            source.Stream(async data=>
            //            {
            //                var dt = data.Value<AngularVelocity>();
            //                 await Dispatcher.RunAsync(CoreDispatcherPriority.High, async () =>
            //                 {
            //                     GyroText.Text = dt.ToString();//=$" X = {dt.X}";
            //                 });
            //            }
            //            );
            //        });
            //await gyro.PullConfigAsync();
            //gyro.Start();
            //gyro.AngularVelocity.Start();
            m_SensorFusion.Start();
            m_SensorFusion.EulerAngles.Start();
        }