示例#1
0
        private void OnTimerElapsed(object state)
        {
            TempPlotModel = tempPlot;
            TempPlotModel.InvalidatePlot(true);

            PressurePlotModel = pressurePlot;
            PressurePlotModel.InvalidatePlot(true);

            AltPlotModel = altPlot;
            AltPlotModel.InvalidatePlot(true);

            AccelXPlotModel = accelXPlot;
            AccelXPlotModel.InvalidatePlot(true);

            //AccelYPlotModel = accelYPlot;
            //AccelYPlotModel.InvalidatePlot(true);

            //AccelZPlotModel = accelZPlot;
            //AccelZPlotModel.InvalidatePlot(true);

            //TempAverage = 0;
            //PressureAverage = 0;
            MaxAltitude = maxAlt;

            if (count > 0)
            {
                TempAverage     = tempSum / count;
                PressureAverage = pressureSum / count;
            }

            this.RaisePropertyChanged("TempAverage");
            this.RaisePropertyChanged("PressureAverage");
            this.RaisePropertyChanged("MaxAltitude");
        }
示例#2
0
        public void UpdateCharts(double t, double temp, double hum, double press)
        {
            LineSeries TemperatureLineSeries = TemperaturePlotModel.Series[0] as LineSeries;
            LineSeries HumidityLineSeries    = HumidityPlotModel.Series[0] as LineSeries;
            LineSeries PressureLineSeries    = PressurePlotModel.Series[0] as LineSeries;

            TemperatureLineSeries.Points.Add(new DataPoint(t, temp));
            HumidityLineSeries.Points.Add(new DataPoint(t, hum));
            PressureLineSeries.Points.Add(new DataPoint(t, press));

            if (TemperatureLineSeries.Points.Count > Config.MaxSamples || HumidityLineSeries.Points.Count > Config.MaxSamples || PressureLineSeries.Points.Count > Config.MaxSamples)
            {
                TemperatureLineSeries.Points.RemoveAt(0);
                HumidityLineSeries.Points.RemoveAt(0);
                PressureLineSeries.Points.RemoveAt(0);
            }

            if (t >= Config.XAxisMax)
            {
                TemperaturePlotModel.Axes[0].Minimum = (t - Config.XAxisMax);
                TemperaturePlotModel.Axes[0].Maximum = t + Config.SampleTime / 1000.0;

                HumidityPlotModel.Axes[0].Minimum = (t - Config.XAxisMax);
                HumidityPlotModel.Axes[0].Maximum = t + Config.SampleTime / 1000.0;

                PressurePlotModel.Axes[0].Minimum = (t - Config.XAxisMax);
                PressurePlotModel.Axes[0].Maximum = t + Config.SampleTime / 1000.0;
            }

            TemperaturePlotModel.InvalidatePlot(true);
            HumidityPlotModel.InvalidatePlot(true);
            PressurePlotModel.InvalidatePlot(true);
        }
示例#3
0
        private void StartTimer()
        {
            if (RequestTimer == null)
            {
                RequestTimer          = new Timer(Config.SampleTime);
                RequestTimer.Elapsed += new ElapsedEventHandler(RequestTimerElapsed);
                RequestTimer.Enabled  = true;

                TemperaturePlotModel.ResetAllAxes();
                HumidityPlotModel.ResetAllAxes();
                PressurePlotModel.ResetAllAxes();
            }
        }