Пример #1
0
        private void LiveUpdate(SimpleLineChart chart, MavlinkLog currentFlightLog, LogItemSchema schema)
        {
            // this method is running on a background task and it's job is to read an infinite stream of
            // data values from the log and show them in the live scrolling chart.

            CancellationTokenSource canceller = new CancellationTokenSource();

            chart.Closed += (s, e) =>
            {
                canceller.Cancel();
            };

            var query = currentFlightLog.LiveQuery(schema, canceller.Token);

            foreach (DataValue item in query)
            {
                if (item == null)
                {
                    return;
                }
                chart.SetCurrentValue(item);
            }

            chart.Closed += (sender, e) =>
            {
                canceller.Cancel();
            };

            Debug.WriteLine("LiveUpdate terminating on schema item " + schema.Name);
        }
Пример #2
0
        private async Task LoadMavlinkFile(string file)
        {
            try
            {
                UiDispatcher.RunOnUIThread(() =>
                {
                    SystemConsole.Show();
                });
                AppendMessage("Loading " + file);
                ShowStatus("Loading " + file);

                MavlinkLog data = new MavlinkLog();
                await data.Load(file, progress);

                logs.Add(data);
                ShowSchema();

                Debug.WriteLine(data.StartTime.ToString());
                LoadFlights(data);

                // remember successfully loaded log file.
                Settings settings = await((App)App.Current).LoadSettings();
                settings.LastLogFile = file;
                await settings.SaveAsync();
            }
            catch (Exception ex)
            {
                AppendMessage("### Error loading log: " + ex.Message);
            }
            ShowStatus("Done Loading " + file);
            UpdateButtons();
        }
Пример #3
0
        private async Task LoadMavlinkFile(string file)
        {
            try
            {
                UiDispatcher.RunOnUIThread(() =>
                {
                    SystemConsole.Show();
                });
                AppendMessage("Loading " + file);
                ShowStatus("Loading " + file);

                MavlinkLog data = new MavlinkLog();
                await data.Load(file, progress);

                logs.Add(data);
                ShowSchema();

                Debug.WriteLine(data.StartTime.ToString());

                UiDispatcher.RunOnUIThread(() =>
                {
                    foreach (var flight in data.GetFlights())
                    {
                        flight.Name = "Flight " + allFlights.Count;
                        allFlights.Add(flight);
                        AppendMessage("Motor started at {0} and ran for {1} ", flight.StartTime, flight.Duration);
                    }

                    if (myMap.Visibility == Visibility.Visible)
                    {
                        ShowMap();
                    }

                    foreach (var text in data.GetStatusMessages())
                    {
                        SystemConsole.Write(text + "\n");
                    }

                    ShowTotalFlightTime();
                });



                // remember successfully loaded log file.
                Settings settings = await((App)App.Current).LoadSettings();
                settings.LastLogFile = file;
                await settings.SaveAsync();
            }
            catch (Exception ex)
            {
                AppendMessage("### Error loading log: " + ex.Message);
            }
            ShowStatus("Done Loading " + file);
            UpdateButtons();
        }
Пример #4
0
 void StartRecording()
 {
     if (currentFlightLog == null)
     {
         currentFlightLog = new MavlinkLog();
         currentFlightLog.SchemaChanged += (s, args) =>
         {
             ShowSchema();
         };
     }
     pauseRecording = false;
     foreach (var chart in liveScrolling)
     {
         chart.LiveScrolling = true;
         // the X values are in milliseconds (s0 the numerator is the speed of scrolling).
         chart.LiveScrollingXScale = 5.0 / 1000.0;
     }
 }
        private void BUT_log2kml_Click(object sender, EventArgs e)
        {
            if (DialogResult.Cancel == Common.MessageShowAgain("Tlog to KML Firmware Version", "When converting logs, ensure your Firmware version is set correctly.\n(Near your com port selection.)"))
            {
                return;
            }

            Form frm = new MavlinkLog();
            ThemeManager.ApplyThemeTo(frm);
            frm.ShowDialog();
        }
Пример #6
0
 private void BUT_log2kml_Click(object sender, EventArgs e)
 {
     Form frm = new MavlinkLog();
     ThemeManager.ApplyThemeTo(frm);
     frm.ShowDialog();
 }
        private void LiveUpdate(SimpleLineChart chart, MavlinkLog currentFlightLog, LogItemSchema schema)
        {
            // this method is running on a background task and it's job is to read an infinite stream of
            // data values from the log and show them in the live scrolling chart.

            CancellationTokenSource canceller = new CancellationTokenSource();

            chart.Closed += (s,e) =>
            {
                canceller.Cancel();
            };

            var query = currentFlightLog.LiveQuery(schema, canceller.Token);
            foreach (DataValue item in query)
            {
                if (item == null)
                {
                    return;
                }
                chart.SetCurrentValue(item);
            }
        }
        private async Task LoadMavlinkFile(string file)
        {
            try
            {
                AppendMessage("Loading " + file);
                ShowStatus("Loading " + file);

                MavlinkLog data = new MavlinkLog();
                await data.Load(file, progress);

                logs.Add(data);
                ShowSchema();

                Debug.WriteLine(data.StartTime.ToString());

                UiDispatcher.RunOnUIThread(() =>
                {
                    foreach (var flight in data.GetFlights())
                    {
                        flight.Name = "Flight " + allFlights.Count;
                        allFlights.Add(flight);
                        AppendMessage("Motor started at {0} and ran for {1} ", flight.StartTime, flight.Duration);
                    }

                    if (myMap.Visibility == Visibility.Visible)
                    {
                        ShowMap();
                    }
                });

                // remember successfully loaded log file.
                Settings settings = await ((App)App.Current).LoadSettings();
                settings.LastLogFile = file;
                await settings.SaveAsync();
            }
            catch (Exception ex)
            {
                AppendMessage("### Error loading log: " + ex.Message);
            }
            ShowStatus("Done Loading " + file);
            UpdateButtons();
        }
 void StartRecording()
 {
     if (currentFlightLog == null)
     {
         currentFlightLog = new MavlinkLog();
         currentFlightLog.SchemaChanged += (s, args) =>
         {
             ShowSchema();
         };
     }
     pauseRecording = false;
 }
Пример #10
0
 private void BUT_log2kml_Click(object sender, EventArgs e)
 {
     Form frm = new MavlinkLog();
     MainV2.fixtheme(frm);
     frm.ShowDialog();
 }