# HG changeset patch # User mkanning@CL-ENS241-10.cedarville.edu # Date 2013-02-26 14:32:50 # Node ID bd55ba5f4fde7023a338660c820f004ad6b4ff2a # Parent 61b779113422493d064a11e1ac3c93ae6bf39a46 data display is 'finished'. charts are working. minor fixes also done diff --git a/Demo.WindowsForms/Forms/MainForm.Designer.cs b/Demo.WindowsForms/Forms/MainForm.Designer.cs --- a/Demo.WindowsForms/Forms/MainForm.Designer.cs +++ b/Demo.WindowsForms/Forms/MainForm.Designer.cs @@ -63,7 +63,7 @@ this.tboxCameraBoardTemp = new System.Windows.Forms.TextBox(); this.label27 = new System.Windows.Forms.Label(); this.label28 = new System.Windows.Forms.Label(); - this.textBox15 = new System.Windows.Forms.TextBox(); + this.tboxGeigerRads = new System.Windows.Forms.TextBox(); this.label25 = new System.Windows.Forms.Label(); this.tboxGeigerBatteryLevel = new System.Windows.Forms.TextBox(); this.label24 = new System.Windows.Forms.Label(); @@ -72,7 +72,7 @@ this.label22 = new System.Windows.Forms.Label(); this.tboxAtmoAltitude = new System.Windows.Forms.TextBox(); this.label21 = new System.Windows.Forms.Label(); - this.textBox11 = new System.Windows.Forms.TextBox(); + this.tboxAtmoAirTemp = new System.Windows.Forms.TextBox(); this.label19 = new System.Windows.Forms.Label(); this.tboxAtmoHumidity = new System.Windows.Forms.TextBox(); this.label18 = new System.Windows.Forms.Label(); @@ -100,6 +100,8 @@ this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.tboxMasterSatellites = new System.Windows.Forms.TextBox(); this.label29 = new System.Windows.Forms.Label(); + this.tboxMasterHDOP = new System.Windows.Forms.TextBox(); + this.label30 = new System.Windows.Forms.Label(); this.MainMap = new Demo.WindowsForms.Map(); this.splitter1 = new BSE.Windows.Forms.Splitter(); this.panelMenu = new BSE.Windows.Forms.Panel(); @@ -174,8 +176,8 @@ this.label13 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label(); this.button17 = new System.Windows.Forms.Button(); - this.tboxMasterHDOP = new System.Windows.Forms.TextBox(); - this.label30 = new System.Windows.Forms.Label(); + this.tboxAtmoLight = new System.Windows.Forms.TextBox(); + this.label31 = new System.Windows.Forms.Label(); this.tabMap.SuspendLayout(); this.panel4.SuspendLayout(); this.panel2.SuspendLayout(); @@ -275,7 +277,7 @@ this.tabControl.Location = new System.Drawing.Point(0, 0); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; - this.tabControl.Size = new System.Drawing.Size(871, 451); + this.tabControl.Size = new System.Drawing.Size(871, 516); this.tabControl.TabIndex = 45; // // tabGraphs @@ -555,19 +557,21 @@ this.tabData.Location = new System.Drawing.Point(4, 22); this.tabData.Name = "tabData"; this.tabData.Padding = new System.Windows.Forms.Padding(10); - this.tabData.Size = new System.Drawing.Size(863, 425); + this.tabData.Size = new System.Drawing.Size(863, 490); this.tabData.TabIndex = 3; this.tabData.Text = "Data"; this.tabData.UseVisualStyleBackColor = true; // // gboxSlaveData // + this.gboxSlaveData.Controls.Add(this.tboxAtmoLight); + this.gboxSlaveData.Controls.Add(this.label31); this.gboxSlaveData.Controls.Add(this.tboxCameraBatteryLevel); this.gboxSlaveData.Controls.Add(this.label26); this.gboxSlaveData.Controls.Add(this.tboxCameraBoardTemp); this.gboxSlaveData.Controls.Add(this.label27); this.gboxSlaveData.Controls.Add(this.label28); - this.gboxSlaveData.Controls.Add(this.textBox15); + this.gboxSlaveData.Controls.Add(this.tboxGeigerRads); this.gboxSlaveData.Controls.Add(this.label25); this.gboxSlaveData.Controls.Add(this.tboxGeigerBatteryLevel); this.gboxSlaveData.Controls.Add(this.label24); @@ -576,7 +580,7 @@ this.gboxSlaveData.Controls.Add(this.label22); this.gboxSlaveData.Controls.Add(this.tboxAtmoAltitude); this.gboxSlaveData.Controls.Add(this.label21); - this.gboxSlaveData.Controls.Add(this.textBox11); + this.gboxSlaveData.Controls.Add(this.tboxAtmoAirTemp); this.gboxSlaveData.Controls.Add(this.label19); this.gboxSlaveData.Controls.Add(this.tboxAtmoHumidity); this.gboxSlaveData.Controls.Add(this.label18); @@ -597,7 +601,7 @@ // // tboxCameraBatteryLevel // - this.tboxCameraBatteryLevel.Location = new System.Drawing.Point(146, 378); + this.tboxCameraBatteryLevel.Location = new System.Drawing.Point(146, 403); this.tboxCameraBatteryLevel.Name = "tboxCameraBatteryLevel"; this.tboxCameraBatteryLevel.ReadOnly = true; this.tboxCameraBatteryLevel.Size = new System.Drawing.Size(100, 20); @@ -606,7 +610,7 @@ // label26 // this.label26.AutoSize = true; - this.label26.Location = new System.Drawing.Point(40, 381); + this.label26.Location = new System.Drawing.Point(40, 406); this.label26.Margin = new System.Windows.Forms.Padding(30, 7, 5, 7); this.label26.Name = "label26"; this.label26.Size = new System.Drawing.Size(69, 13); @@ -615,7 +619,7 @@ // // tboxCameraBoardTemp // - this.tboxCameraBoardTemp.Location = new System.Drawing.Point(146, 351); + this.tboxCameraBoardTemp.Location = new System.Drawing.Point(146, 376); this.tboxCameraBoardTemp.Name = "tboxCameraBoardTemp"; this.tboxCameraBoardTemp.ReadOnly = true; this.tboxCameraBoardTemp.Size = new System.Drawing.Size(100, 20); @@ -624,7 +628,7 @@ // label27 // this.label27.AutoSize = true; - this.label27.Location = new System.Drawing.Point(40, 354); + this.label27.Location = new System.Drawing.Point(40, 379); this.label27.Margin = new System.Windows.Forms.Padding(30, 7, 5, 7); this.label27.Name = "label27"; this.label27.Size = new System.Drawing.Size(98, 13); @@ -634,25 +638,25 @@ // label28 // this.label28.AutoSize = true; - this.label28.Location = new System.Drawing.Point(15, 327); + this.label28.Location = new System.Drawing.Point(15, 352); this.label28.Margin = new System.Windows.Forms.Padding(5, 7, 5, 7); this.label28.Name = "label28"; this.label28.Size = new System.Drawing.Size(81, 13); this.label28.TabIndex = 37; this.label28.Text = "Camera Module"; // - // textBox15 + // tboxGeigerRads // - this.textBox15.Location = new System.Drawing.Point(146, 297); - this.textBox15.Name = "textBox15"; - this.textBox15.ReadOnly = true; - this.textBox15.Size = new System.Drawing.Size(100, 20); - this.textBox15.TabIndex = 36; + this.tboxGeigerRads.Location = new System.Drawing.Point(146, 322); + this.tboxGeigerRads.Name = "tboxGeigerRads"; + this.tboxGeigerRads.ReadOnly = true; + this.tboxGeigerRads.Size = new System.Drawing.Size(100, 20); + this.tboxGeigerRads.TabIndex = 36; // // label25 // this.label25.AutoSize = true; - this.label25.Location = new System.Drawing.Point(40, 300); + this.label25.Location = new System.Drawing.Point(40, 325); this.label25.Margin = new System.Windows.Forms.Padding(30, 7, 5, 7); this.label25.Name = "label25"; this.label25.Size = new System.Drawing.Size(52, 13); @@ -661,7 +665,7 @@ // // tboxGeigerBatteryLevel // - this.tboxGeigerBatteryLevel.Location = new System.Drawing.Point(146, 270); + this.tboxGeigerBatteryLevel.Location = new System.Drawing.Point(146, 295); this.tboxGeigerBatteryLevel.Name = "tboxGeigerBatteryLevel"; this.tboxGeigerBatteryLevel.ReadOnly = true; this.tboxGeigerBatteryLevel.Size = new System.Drawing.Size(100, 20); @@ -670,7 +674,7 @@ // label24 // this.label24.AutoSize = true; - this.label24.Location = new System.Drawing.Point(40, 273); + this.label24.Location = new System.Drawing.Point(40, 298); this.label24.Margin = new System.Windows.Forms.Padding(30, 7, 5, 7); this.label24.Name = "label24"; this.label24.Size = new System.Drawing.Size(69, 13); @@ -679,7 +683,7 @@ // // tboxGeigerBoardTemp // - this.tboxGeigerBoardTemp.Location = new System.Drawing.Point(146, 243); + this.tboxGeigerBoardTemp.Location = new System.Drawing.Point(146, 268); this.tboxGeigerBoardTemp.Name = "tboxGeigerBoardTemp"; this.tboxGeigerBoardTemp.ReadOnly = true; this.tboxGeigerBoardTemp.Size = new System.Drawing.Size(100, 20); @@ -688,7 +692,7 @@ // label23 // this.label23.AutoSize = true; - this.label23.Location = new System.Drawing.Point(40, 246); + this.label23.Location = new System.Drawing.Point(40, 271); this.label23.Margin = new System.Windows.Forms.Padding(30, 7, 5, 7); this.label23.Name = "label23"; this.label23.Size = new System.Drawing.Size(98, 13); @@ -698,7 +702,7 @@ // label22 // this.label22.AutoSize = true; - this.label22.Location = new System.Drawing.Point(15, 219); + this.label22.Location = new System.Drawing.Point(15, 244); this.label22.Margin = new System.Windows.Forms.Padding(5, 7, 5, 7); this.label22.Name = "label22"; this.label22.Size = new System.Drawing.Size(76, 13); @@ -707,7 +711,7 @@ // // tboxAtmoAltitude // - this.tboxAtmoAltitude.Location = new System.Drawing.Point(146, 189); + this.tboxAtmoAltitude.Location = new System.Drawing.Point(146, 214); this.tboxAtmoAltitude.Name = "tboxAtmoAltitude"; this.tboxAtmoAltitude.ReadOnly = true; this.tboxAtmoAltitude.Size = new System.Drawing.Size(100, 20); @@ -716,20 +720,20 @@ // label21 // this.label21.AutoSize = true; - this.label21.Location = new System.Drawing.Point(40, 192); + this.label21.Location = new System.Drawing.Point(40, 217); this.label21.Margin = new System.Windows.Forms.Padding(30, 7, 5, 7); this.label21.Name = "label21"; this.label21.Size = new System.Drawing.Size(42, 13); this.label21.TabIndex = 28; this.label21.Text = "Altitude"; // - // textBox11 + // tboxAtmoAirTemp // - this.textBox11.Location = new System.Drawing.Point(146, 108); - this.textBox11.Name = "textBox11"; - this.textBox11.ReadOnly = true; - this.textBox11.Size = new System.Drawing.Size(100, 20); - this.textBox11.TabIndex = 27; + this.tboxAtmoAirTemp.Location = new System.Drawing.Point(146, 108); + this.tboxAtmoAirTemp.Name = "tboxAtmoAirTemp"; + this.tboxAtmoAirTemp.ReadOnly = true; + this.tboxAtmoAirTemp.Size = new System.Drawing.Size(100, 20); + this.tboxAtmoAirTemp.TabIndex = 27; // // label19 // @@ -744,7 +748,7 @@ // tboxAtmoHumidity // this.tboxAtmoHumidity.BackColor = System.Drawing.SystemColors.Control; - this.tboxAtmoHumidity.Location = new System.Drawing.Point(146, 135); + this.tboxAtmoHumidity.Location = new System.Drawing.Point(146, 160); this.tboxAtmoHumidity.Name = "tboxAtmoHumidity"; this.tboxAtmoHumidity.ReadOnly = true; this.tboxAtmoHumidity.Size = new System.Drawing.Size(100, 20); @@ -753,7 +757,7 @@ // label18 // this.label18.AutoSize = true; - this.label18.Location = new System.Drawing.Point(40, 138); + this.label18.Location = new System.Drawing.Point(40, 163); this.label18.Margin = new System.Windows.Forms.Padding(30, 7, 5, 7); this.label18.Name = "label18"; this.label18.Size = new System.Drawing.Size(47, 13); @@ -762,7 +766,7 @@ // // tboxAtmoPressure // - this.tboxAtmoPressure.Location = new System.Drawing.Point(146, 162); + this.tboxAtmoPressure.Location = new System.Drawing.Point(146, 187); this.tboxAtmoPressure.Name = "tboxAtmoPressure"; this.tboxAtmoPressure.ReadOnly = true; this.tboxAtmoPressure.Size = new System.Drawing.Size(100, 20); @@ -771,7 +775,7 @@ // label17 // this.label17.AutoSize = true; - this.label17.Location = new System.Drawing.Point(40, 165); + this.label17.Location = new System.Drawing.Point(40, 190); this.label17.Margin = new System.Windows.Forms.Padding(30, 7, 5, 7); this.label17.Name = "label17"; this.label17.Size = new System.Drawing.Size(48, 13); @@ -971,7 +975,7 @@ this.tboxMessageBox.Name = "tboxMessageBox"; this.tboxMessageBox.ReadOnly = true; this.tboxMessageBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.tboxMessageBox.Size = new System.Drawing.Size(868, 69); + this.tboxMessageBox.Size = new System.Drawing.Size(868, 81); this.tboxMessageBox.TabIndex = 30; // // splitContainer1 @@ -990,8 +994,8 @@ // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.tboxMessageBox); - this.splitContainer1.Size = new System.Drawing.Size(871, 526); - this.splitContainer1.SplitterDistance = 450; + this.splitContainer1.Size = new System.Drawing.Size(871, 603); + this.splitContainer1.SplitterDistance = 515; this.splitContainer1.TabIndex = 46; // // tboxMasterSatellites @@ -1012,6 +1016,24 @@ this.label29.TabIndex = 18; this.label29.Text = "Satellites in View"; // + // tboxMasterHDOP + // + this.tboxMasterHDOP.Location = new System.Drawing.Point(120, 214); + this.tboxMasterHDOP.Name = "tboxMasterHDOP"; + this.tboxMasterHDOP.ReadOnly = true; + this.tboxMasterHDOP.Size = new System.Drawing.Size(100, 20); + this.tboxMasterHDOP.TabIndex = 21; + // + // label30 + // + this.label30.AutoSize = true; + this.label30.Location = new System.Drawing.Point(14, 217); + this.label30.Margin = new System.Windows.Forms.Padding(5, 7, 5, 7); + this.label30.Name = "label30"; + this.label30.Size = new System.Drawing.Size(38, 13); + this.label30.TabIndex = 20; + this.label30.Text = "HDOP"; + // // MainMap // this.MainMap.Bearing = 0F; @@ -2038,30 +2060,31 @@ this.button17.Text = "Open cache location"; this.button17.UseVisualStyleBackColor = true; // - // tboxMasterHDOP + // tboxAtmoLight // - this.tboxMasterHDOP.Location = new System.Drawing.Point(120, 214); - this.tboxMasterHDOP.Name = "tboxMasterHDOP"; - this.tboxMasterHDOP.ReadOnly = true; - this.tboxMasterHDOP.Size = new System.Drawing.Size(100, 20); - this.tboxMasterHDOP.TabIndex = 21; + this.tboxAtmoLight.BackColor = System.Drawing.SystemColors.Control; + this.tboxAtmoLight.Location = new System.Drawing.Point(146, 134); + this.tboxAtmoLight.Name = "tboxAtmoLight"; + this.tboxAtmoLight.ReadOnly = true; + this.tboxAtmoLight.Size = new System.Drawing.Size(100, 20); + this.tboxAtmoLight.TabIndex = 43; // - // label30 + // label31 // - this.label30.AutoSize = true; - this.label30.Location = new System.Drawing.Point(14, 217); - this.label30.Margin = new System.Windows.Forms.Padding(5, 7, 5, 7); - this.label30.Name = "label30"; - this.label30.Size = new System.Drawing.Size(38, 13); - this.label30.TabIndex = 20; - this.label30.Text = "HDOP"; + this.label31.AutoSize = true; + this.label31.Location = new System.Drawing.Point(40, 137); + this.label31.Margin = new System.Windows.Forms.Padding(30, 7, 5, 7); + this.label31.Name = "label31"; + this.label31.Size = new System.Drawing.Size(71, 13); + this.label31.TabIndex = 42; + this.label31.Text = "Ambient Light"; // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.AliceBlue; - this.ClientSize = new System.Drawing.Size(895, 550); + this.ClientSize = new System.Drawing.Size(895, 627); this.Controls.Add(this.splitContainer1); this.KeyPreview = true; this.MinimumSize = new System.Drawing.Size(554, 105); @@ -2256,7 +2279,7 @@ private System.Windows.Forms.TextBox tboxCameraBoardTemp; private System.Windows.Forms.Label label27; private System.Windows.Forms.Label label28; - private System.Windows.Forms.TextBox textBox15; + private System.Windows.Forms.TextBox tboxGeigerRads; private System.Windows.Forms.Label label25; private System.Windows.Forms.TextBox tboxGeigerBatteryLevel; private System.Windows.Forms.Label label24; @@ -2265,7 +2288,7 @@ private System.Windows.Forms.Label label22; private System.Windows.Forms.TextBox tboxAtmoAltitude; private System.Windows.Forms.Label label21; - private System.Windows.Forms.TextBox textBox11; + private System.Windows.Forms.TextBox tboxAtmoAirTemp; private System.Windows.Forms.Label label19; private System.Windows.Forms.TextBox tboxAtmoHumidity; private System.Windows.Forms.Label label18; @@ -2282,6 +2305,8 @@ private System.Windows.Forms.Label label29; private System.Windows.Forms.TextBox tboxMasterHDOP; private System.Windows.Forms.Label label30; + private System.Windows.Forms.TextBox tboxAtmoLight; + private System.Windows.Forms.Label label31; } diff --git a/Demo.WindowsForms/Forms/MainForm.cs b/Demo.WindowsForms/Forms/MainForm.cs --- a/Demo.WindowsForms/Forms/MainForm.cs +++ b/Demo.WindowsForms/Forms/MainForm.cs @@ -2423,9 +2423,7 @@ namespace Demo.WindowsForms #endregion - #region graph and map functions - - #region chart coloring + #region chart click events //this method clears the background of all charts private void ResetChartColors() { @@ -2489,6 +2487,12 @@ namespace Demo.WindowsForms #endregion + #region transmission handling + //variable declarations + string latitude; + string longitude; + bool firstTransmissionDatum = false; + //runs on init public void PrepareGraphs(){ @@ -2517,7 +2521,7 @@ namespace Demo.WindowsForms System.Windows.Forms.DataVisualization.Charting.AxisName.Y.Equals("Altitude"); ///required initial value - chrtTopLeft.Series["altitudeTrend"].Points.AddXY(0, 0); + chrtTopLeft.Series["altitudeTrend"].Points.AddXY(0, 140); //---------prep altitude area END @@ -2528,7 +2532,7 @@ namespace Demo.WindowsForms System.Windows.Forms.DataVisualization.Charting.AxisName.Y.Equals("Humidity"); ///required initial value - chrtTopRight.Series["humidityTrend"].Points.AddXY(0, 0); + chrtTopRight.Series["humidityTrend"].Points.AddXY(0, 50); //-----------prep humidity area END @@ -2539,7 +2543,7 @@ namespace Demo.WindowsForms System.Windows.Forms.DataVisualization.Charting.AxisName.Y.Equals("Pressure"); ///required initial value - chrtBottomLeft.Series["pressureTrend"].Points.AddXY(0, 0); + chrtBottomLeft.Series["pressureTrend"].Points.AddXY(0, 100000); //-----------prep pressure area END @@ -2557,16 +2561,18 @@ namespace Demo.WindowsForms ResetChartColors(); } - string latitude; - string longitude; - //parses transmissions and saves data to CSV file public void ParseIncomingData(string rawDataReceived) { //check to see if data should be processed - if (!cboxCollectData.Checked && rawDataReceived.StartsWith("KD8TDF")) + if (!cboxCollectData.Checked ) { - AddTextDelegate("Bad transmission: " + rawDataReceived +"\r\n"); + AddTextDelegate("Transmission not saved: " + rawDataReceived +"\r\n"); + return; + } + else if (!rawDataReceived.StartsWith("KD8TDF")) + { + AddTextDelegate("Foreign transmission: " + rawDataReceived + "\r\n"); return; } @@ -2590,18 +2596,28 @@ namespace Demo.WindowsForms //place each datum in its own variable string[] dataTransmission; - dataTransmission = transmissionCommentField.Split(' '); + dataTransmission = transmissionCommentField.Split('~'); //variables for processing datums string typeCode; - double data; + string data; string csvData = ""; + string testString = ""; //loop through all datums in the transmission and send them to the chart builder - for (int i = 1; i < dataTransmission.Length; i++) + for (int i = 0; i < dataTransmission.Length; i++) { + if (i == 0) + { + firstTransmissionDatum = true; + } + else + { + firstTransmissionDatum = false; + } + //remove unwanted characters - dataTransmission[i] = dataTransmission[i].Trim('\r'); + dataTransmission[i] = dataTransmission[i].Trim(); //zero not always trasmitted properly so add '0.0' to any transmission with no data if (dataTransmission[i].Length == 1) @@ -2611,11 +2627,19 @@ namespace Demo.WindowsForms //pull out data and data type and send to processing function typeCode = dataTransmission[i].Substring(0, 1); - data = double.Parse(dataTransmission[i].Substring(1)); - processTransmissionDatum(typeCode, data); - - //append data to string for CSV write - csvData += typeCode + data + ","; + if (typeCode != "e") + { + testString = dataTransmission[i].Substring(1); + data = dataTransmission[i].Substring(1); + processTransmissionDatum(typeCode, data); + + //append data to string for CSV write + csvData += typeCode + data + ","; + } + else + { + AddTextDelegate("Error Message: " + dataTransmission[i].Substring(1) + "\r\n"); + } } //handle case of no GPS fix @@ -2636,6 +2660,16 @@ namespace Demo.WindowsForms WriteToCSV(csvData); } + //method to process data from transmissions (usually chart inserts) + private void processTransmissionDatum(string dataType, string data) + { + //TODO: add inserts for all charts. altitude is finished and is a template + ///data types organized by listing in google doc + //MASTER MODULE DATA VALUES + ChartDelegate(dataType, data); + + } + //write the data to CSV file private void WriteToCSV(string data) { @@ -2647,15 +2681,6 @@ namespace Demo.WindowsForms } } - //method to process data from transmissions (usually chart inserts) - private void processTransmissionDatum(string dataType, double data) - { - //TODO: add inserts for all charts. altitude is finished and is a template - ///data types organized by listing in google doc - //MASTER MODULE DATA VALUES - ChartDelegate(dataType, data); - - } //must change lat/long coords to properly place map marker float conv_coords(float in_coords) @@ -2700,25 +2725,11 @@ namespace Demo.WindowsForms objects.Markers.Add(m); } - - private void ClearTboxColor() - { - //tboxAtmoHumidity.BorderStyle = BorderStyle.FixedSingle; - tboxAtmoHumidity.BackColor = Color.White; - tboxAtmoPressure.BackColor = Color.White; - tboxAtmoAltitude.BackColor = Color.White; - tboxMasterVelocity.BackColor = Color.White; - tboxCameraBoardTemp.BackColor = Color.White; - tboxGeigerBoardTemp.BackColor = Color.White; - tboxAtmoBoardTemp.BackColor = Color.White; - tboxMasterBoardTemp.BackColor = Color.White; - return; - } #endregion #region cross theading - /// + //places text in the message box delegate void SetTextDelegate(string value); public void AddTextDelegate(string value) { @@ -2733,8 +2744,9 @@ namespace Demo.WindowsForms } } - delegate void ChartDataDelegate(string dataType, double data); - public void ChartDelegate(string dataType, double data) + //this is where most of the transmission processing is done + delegate void ChartDataDelegate(string dataType, string data); + public void ChartDelegate(string dataType, string data) { if (InvokeRequired) { @@ -2742,28 +2754,30 @@ namespace Demo.WindowsForms } else { - ClearTboxColor(); - + if (firstTransmissionDatum) + { + ClearTboxColor(); + } ///UNIVERSAL DATA TYPES if (dataType.Equals("t")) //board temperature { string dataString = data.ToString(); - if (dataString.StartsWith("9")) + if (dataString.StartsWith("9")) //Master Module { tboxMasterBoardTemp.Text = dataString.Substring(1); tboxMasterBoardTemp.BackColor = Color.Chartreuse; } - else if (dataString.StartsWith("0")) + else if (dataString.StartsWith("0")) //Atmo Module { tboxAtmoBoardTemp.Text = dataString.Substring(1); tboxAtmoBoardTemp.BackColor = Color.Chartreuse; } - else if (dataString.StartsWith("1")) + else if (dataString.StartsWith("1")) //Geiger Module { tboxGeigerBoardTemp.Text = dataString.Substring(1); tboxGeigerBoardTemp.BackColor = Color.Chartreuse; } - else if (dataString.StartsWith("2")) + else if (dataString.StartsWith("2")) //Camera Module { tboxCameraBoardTemp.Text = dataString.Substring(1); tboxCameraBoardTemp.BackColor = Color.Chartreuse; @@ -2772,101 +2786,99 @@ namespace Demo.WindowsForms else if (dataType.Equals("l")) //battery level { string dataString = data.ToString(); - if (dataString.StartsWith("9")) + if (dataString.StartsWith("9")) //Master Module { tboxMasterBatteryLevel.Text = dataString.Substring(1); tboxMasterBatteryLevel.BackColor = Color.Chartreuse; } - else if (dataString.StartsWith("0")) + else if (dataString.StartsWith("0")) //Atmo Module { tboxAtmoBatteryLevel.Text = dataString.Substring(1); tboxAtmoBatteryLevel.BackColor = Color.Chartreuse; } - else if (dataString.StartsWith("1")) + else if (dataString.StartsWith("1")) //Geiger Module { tboxGeigerBatteryLevel.Text = dataString.Substring(1); tboxGeigerBatteryLevel.BackColor = Color.Chartreuse; } - else if (dataString.StartsWith("2")) + else if (dataString.StartsWith("2")) //Camera Module { tboxCameraBatteryLevel.Text = dataString.Substring(1); tboxCameraBatteryLevel.BackColor = Color.Chartreuse; } } - else if (dataType.Equals("i")) //Info/error Message + else if (dataType.Equals("i")) //Info Message { AddTextDelegate("Info: " + data + "\r\n"); } - + ///MASTER MODULE DATA TYPES - //TODO: lat/long multi calls not needed; streamline + else if (dataType.Equals("_")) //latitude + { + //TODO: check math and decimal placement + latitude += data.ToString(); + tboxMasterLatitude.Text = latitude; + tboxMasterLatitude.BackColor = Color.Chartreuse; + } + else if (dataType.Equals("|")) //longitude + { + //TODO: check math and decimal placement + longitude += data.ToString(); + tboxMasterLongitude.Text = longitude; + tboxMasterLongitude.BackColor = Color.Chartreuse; + } else if (dataType.Equals("h")) //HDOP { tboxMasterHDOP.Text = data.ToString(); tboxMasterHDOP.BackColor = Color.Chartreuse; } + else if (dataType.Equals("v")) //Velocity + { + chrtBottomRight.Series.FindByName("velocityTrend").Points.AddY(double.Parse(data)); + tboxMasterVelocity.Text = data.ToString(); + tboxMasterVelocity.BackColor = Color.Chartreuse; + } else if (dataType.Equals("s")) //satellites in view { tboxMasterSatellites.Text = data.ToString(); tboxMasterSatellites.BackColor = Color.Chartreuse; } - else if (dataType.Equals("x")) //Latitude - { - - } - else if (dataType.Equals("y")) //Longitude - { - - } - else if (dataType.Equals("v")) //Velocity - { - chrtBottomRight.Series.FindByName("velocityTrend").Points.AddY(data); - tboxMasterVelocity.Text = data.ToString(); - tboxMasterVelocity.BackColor = Color.Chartreuse; - } - else if (dataType.Equals("_")) //extra latitude decimals - { - //TODO: check math and decimal placement - latitude += data.ToString(); - tboxMasterLatitude.Text = latitude; - tboxMasterLatitude.BackColor = Color.Chartreuse; - } - else if (dataType.Equals("|")) //extra longitude decimals - { - //TODO: check math and decimal placement - longitude += data.ToString(); - tboxMasterLongitude.Text = longitude; - tboxMasterLongitude.BackColor = Color.Chartreuse; - } ///ATMOSPHERIC MODULE DATA VALUES else if (dataType.Equals("C")) //Air Temperature { - + tboxAtmoAirTemp.Text = data.ToString(); + tboxAtmoAirTemp.BackColor = Color.Chartreuse; + } + else if (dataType.Equals("L")) //Ambient Light + { + tboxAtmoLight.Text = data.ToString(); + tboxAtmoLight.BackColor = Color.Chartreuse; } else if (dataType.Equals("H")) //Humidity { - chrtTopRight.Series.FindByName("humidityTrend").Points.AddY(data); + chrtTopRight.Series.FindByName("humidityTrend").Points.AddY(double.Parse(data)); tboxAtmoHumidity.Text = data.ToString(); tboxAtmoHumidity.BackColor = Color.Chartreuse; } else if (dataType.Equals("P")) //Pressure { - chrtBottomLeft.Series.FindByName("pressureTrend").Points.AddY(data); + chrtBottomLeft.Series.FindByName("pressureTrend").Points.AddY(double.Parse(data)); tboxAtmoPressure.Text = data.ToString(); tboxAtmoPressure.BackColor = Color.Chartreuse; } else if (dataType.Equals("A")) //Altitude { - chrtTopLeft.Series.FindByName("altitudeTrend").Points.AddY(data); + chrtTopLeft.Series.FindByName("altitudeTrend").Points.AddY(double.Parse(data)); tboxAtmoAltitude.Text = data.ToString(); tboxAtmoAltitude.BackColor = Color.Chartreuse; } - + ///GEIGER MODULE DATA VALUES else if (dataType.Equals("R")) //radiation (CPM) { - + tboxGeigerRads.Text = data.ToString(); + tboxGeigerRads.BackColor = Color.Chartreuse; } /// CAMERA MODULE DATA VALUES @@ -2874,11 +2886,36 @@ namespace Demo.WindowsForms //INVALID DATA TYPE else { - + AddTextDelegate("Info: " + data + "\r\n"); } } } + private void ClearTboxColor() + { + //tboxAtmoHumidity.BorderStyle = BorderStyle.FixedSingle; + tboxMasterBoardTemp.BackColor = Color.White; + tboxAtmoBoardTemp.BackColor = Color.White; + tboxGeigerBoardTemp.BackColor = Color.White; + tboxCameraBoardTemp.BackColor = Color.White; + tboxMasterBatteryLevel.BackColor = Color.White; + tboxAtmoBatteryLevel.BackColor = Color.White; + tboxGeigerBatteryLevel.BackColor = Color.White; + tboxCameraBatteryLevel.BackColor = Color.White; + tboxMasterLatitude.BackColor = Color.White; + tboxMasterLongitude.BackColor = Color.White; + tboxMasterHDOP.BackColor = Color.White; + tboxMasterVelocity.BackColor = Color.White; + tboxMasterSatellites.BackColor = Color.White; + tboxAtmoAirTemp.BackColor = Color.White; + tboxAtmoLight.BackColor = Color.White; + tboxAtmoHumidity.BackColor = Color.White; + tboxAtmoPressure.BackColor = Color.White; + tboxAtmoAltitude.BackColor = Color.White; + tboxGeigerRads.BackColor = Color.White; + return; + } + #endregion #region testing