From 0a48ca11b91b62fa344aa07024130731be180a44 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 24 May 2022 21:51:22 +0100 Subject: [PATCH] Added live view mode, fixed minor bugs like USB Voltage readout --- Hardware/OSRTT_Full_Code/OSRTT_Full_Code.ino | 80 ++- OSRTT Launcher/OSRTT Launcher/Heatmaps.cs | 3 + .../OSRTT Launcher/LiveView.Designer.cs | 594 ++++++++++++++++++ OSRTT Launcher/OSRTT Launcher/LiveView.cs | 444 +++++++++++++ OSRTT Launcher/OSRTT Launcher/LiveView.resx | 126 ++++ .../OSRTT Launcher/Main.Designer.cs | 53 +- OSRTT Launcher/OSRTT Launcher/Main.cs | 138 ++-- .../OSRTT Launcher/OSRTT Launcher.csproj | 16 +- .../OSRTT Launcher/Properties/AssemblyInfo.cs | 6 +- OSRTT Launcher/OSRTT Launcher/ResultsView.cs | 11 +- OSRTT Launcher/OSRTT Launcher/packages.config | 1 + 11 files changed, 1396 insertions(+), 76 deletions(-) create mode 100644 OSRTT Launcher/OSRTT Launcher/LiveView.Designer.cs create mode 100644 OSRTT Launcher/OSRTT Launcher/LiveView.cs create mode 100644 OSRTT Launcher/OSRTT Launcher/LiveView.resx diff --git a/Hardware/OSRTT_Full_Code/OSRTT_Full_Code.ino b/Hardware/OSRTT_Full_Code/OSRTT_Full_Code.ino index dec2138..faa2803 100644 --- a/Hardware/OSRTT_Full_Code/OSRTT_Full_Code.ino +++ b/Hardware/OSRTT_Full_Code/OSRTT_Full_Code.ino @@ -1,5 +1,5 @@ -#include "Keyboard.h" -#include "Mouse.h" +#include +#include #include #include #define INPUT_SIZE 2 @@ -36,7 +36,7 @@ SPISettings settingsA(10000000, MSBFIRST, SPI_MODE0); //Serial connection values bool connected = false; -String firmware = "2.4"; +String firmware = "2.5"; int testRuns = 4; bool vsync = true; bool extendedGamma = true; @@ -234,6 +234,7 @@ int checkUSBVoltage(int l) // Check USB voltage is between 4.8V and 5.2V Serial.print(","); } Serial.println(); + Serial.println(); ADC1->SWTRIG.bit.START = 0; //Stop ADC return 1; } @@ -791,5 +792,78 @@ void loop() { digitalPotWrite(0x80); } } + else if (input[0] == 'O') + { + // Brightness Calibration screen + Serial.setTimeout(200); + int mod = input[1] - '0'; + int potVal = 165 + mod; + digitalPotWrite(potVal); + Serial.println("LIVE VIEW"); + delay(200); + while (input[0] != 'X') + { + for (int i = 0; i < INPUT_SIZE + 1; i++) + { + input[i] = ' '; + } + byte sized = Serial.readBytes(input, INPUT_SIZE); + input[sized] = 0; + if (input[0] == 'P') + { + + long startTime = micros(); + long currentTime = micros(); + long times[16000]; + int count = 0; + while (currentTime < (startTime + 3000000)) + { + ADC0->SWTRIG.bit.START = 1; //Start ADC + while(!ADC0->INTFLAG.bit.RESRDY); //wait for ADC to have a new value + currentTime = micros(); + times[count] = currentTime - startTime; + adcBuff[count] = ADC0->RESULT.reg; + delayMicroseconds(250); + count++; + } + Serial.print("LiveData:"); + for (int i = 0; i < count; i++) + { + Serial.print(times[i]); + Serial.print(":"); + Serial.print(adcBuff[i]); + Serial.print(","); + } + Serial.println(); + Serial.println("End"); + } + int in = 0; + if (input[0] <= 57) + { + in = input[0] - '0'; // Convert char to int + } + else + { + in = input[0] - 55; + } + + if (in >= 1 && in <= 15) + { + // Increment potentiometer value by multiples of 10 up to 220 + int add = 3 * in; + potVal = 165 + add; + digitalPotWrite(potVal); + Serial.print("pot val:"); + Serial.println(potVal); + } + else if (in == 0) + { + potVal = 165; + digitalPotWrite(potVal); + Serial.print("pot val:"); + Serial.println(potVal); + } + } + } delay(100); } diff --git a/OSRTT Launcher/OSRTT Launcher/Heatmaps.cs b/OSRTT Launcher/OSRTT Launcher/Heatmaps.cs index d7fe054..7c0e3da 100644 --- a/OSRTT Launcher/OSRTT Launcher/Heatmaps.cs +++ b/OSRTT Launcher/OSRTT Launcher/Heatmaps.cs @@ -81,6 +81,9 @@ public void hideText(bool state) osSubTitle.Visible = state; vrrTitle.Visible = state; vrrSubTitle.Visible = state; + label1.Visible = state; + label5.Visible = state; + label11.Visible = state; } public Heatmaps() { diff --git a/OSRTT Launcher/OSRTT Launcher/LiveView.Designer.cs b/OSRTT Launcher/OSRTT Launcher/LiveView.Designer.cs new file mode 100644 index 0000000..ac5dbb1 --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/LiveView.Designer.cs @@ -0,0 +1,594 @@ + +namespace OSRTT_Launcher +{ + partial class LiveView + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.recordToolStripBtn = new System.Windows.Forms.ToolStripButton(); + this.clearDataToolStripBtn = new System.Windows.Forms.ToolStripButton(); + this.zoomToFitToolStripBtn = new System.Windows.Forms.ToolStripButton(); + this.saveAsPNGToolStripBtn = new System.Windows.Forms.ToolStripButton(); + this.graphViewPanel = new System.Windows.Forms.Panel(); + this.mainLabel = new System.Windows.Forms.Label(); + this.zoomToFitBtn = new System.Windows.Forms.Button(); + this.potValPanel = new System.Windows.Forms.Panel(); + this.label1 = new System.Windows.Forms.Label(); + this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); + this.clearBtn = new System.Windows.Forms.Button(); + this.osPanel = new System.Windows.Forms.Panel(); + this.cleanVSpanBtn = new System.Windows.Forms.Button(); + this.label3 = new System.Windows.Forms.Label(); + this.osStartLbl = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.verticalSpanBtn = new System.Windows.Forms.Button(); + this.osEndLbl = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.osMeasureLbl = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); + this.rtPanel = new System.Windows.Forms.Panel(); + this.clearHSpanBtn = new System.Windows.Forms.Button(); + this.label5 = new System.Windows.Forms.Label(); + this.startLabel = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.addRemoveSpanBtn = new System.Windows.Forms.Button(); + this.endLabel = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.rtLabel = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.saveGraphNoHSpanBtn = new System.Windows.Forms.Button(); + this.saveAsPNGBtn = new System.Windows.Forms.Button(); + this.startStopBtn = new System.Windows.Forms.Button(); + this.graphedData = new ScottPlot.FormsPlot(); + this.toolStrip1.SuspendLayout(); + this.graphViewPanel.SuspendLayout(); + this.potValPanel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); + this.osPanel.SuspendLayout(); + this.rtPanel.SuspendLayout(); + this.SuspendLayout(); + // + // toolStrip1 + // + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.recordToolStripBtn, + this.clearDataToolStripBtn, + this.zoomToFitToolStripBtn, + this.saveAsPNGToolStripBtn}); + this.toolStrip1.Location = new System.Drawing.Point(0, 0); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Size = new System.Drawing.Size(1646, 25); + this.toolStrip1.TabIndex = 3; + this.toolStrip1.Text = "toolStrip1"; + // + // recordToolStripBtn + // + this.recordToolStripBtn.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.recordToolStripBtn.ImageTransparentColor = System.Drawing.Color.Magenta; + this.recordToolStripBtn.Name = "recordToolStripBtn"; + this.recordToolStripBtn.Size = new System.Drawing.Size(75, 22); + this.recordToolStripBtn.Text = "Record Data"; + this.recordToolStripBtn.Click += new System.EventHandler(this.recordToolStripBtn_Click); + // + // clearDataToolStripBtn + // + this.clearDataToolStripBtn.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.clearDataToolStripBtn.ImageTransparentColor = System.Drawing.Color.Magenta; + this.clearDataToolStripBtn.Name = "clearDataToolStripBtn"; + this.clearDataToolStripBtn.Size = new System.Drawing.Size(73, 22); + this.clearDataToolStripBtn.Text = "Clear Graph"; + this.clearDataToolStripBtn.Click += new System.EventHandler(this.clearDataToolStripBtn_Click); + // + // zoomToFitToolStripBtn + // + this.zoomToFitToolStripBtn.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.zoomToFitToolStripBtn.ImageTransparentColor = System.Drawing.Color.Magenta; + this.zoomToFitToolStripBtn.Name = "zoomToFitToolStripBtn"; + this.zoomToFitToolStripBtn.Size = new System.Drawing.Size(73, 22); + this.zoomToFitToolStripBtn.Text = "Zoom to Fit"; + this.zoomToFitToolStripBtn.Click += new System.EventHandler(this.zoomToFitToolStripBtn_Click); + // + // saveAsPNGToolStripBtn + // + this.saveAsPNGToolStripBtn.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.saveAsPNGToolStripBtn.ImageTransparentColor = System.Drawing.Color.Magenta; + this.saveAsPNGToolStripBtn.Name = "saveAsPNGToolStripBtn"; + this.saveAsPNGToolStripBtn.Size = new System.Drawing.Size(76, 22); + this.saveAsPNGToolStripBtn.Text = "Save as PNG"; + this.saveAsPNGToolStripBtn.Click += new System.EventHandler(this.saveAsPNGToolStripBtn_Click); + // + // graphViewPanel + // + this.graphViewPanel.Controls.Add(this.mainLabel); + this.graphViewPanel.Controls.Add(this.zoomToFitBtn); + this.graphViewPanel.Controls.Add(this.potValPanel); + this.graphViewPanel.Controls.Add(this.clearBtn); + this.graphViewPanel.Controls.Add(this.osPanel); + this.graphViewPanel.Controls.Add(this.rtPanel); + this.graphViewPanel.Controls.Add(this.saveGraphNoHSpanBtn); + this.graphViewPanel.Controls.Add(this.saveAsPNGBtn); + this.graphViewPanel.Controls.Add(this.startStopBtn); + this.graphViewPanel.Controls.Add(this.graphedData); + this.graphViewPanel.Location = new System.Drawing.Point(3, 28); + this.graphViewPanel.Name = "graphViewPanel"; + this.graphViewPanel.Size = new System.Drawing.Size(1641, 813); + this.graphViewPanel.TabIndex = 4; + // + // mainLabel + // + this.mainLabel.BackColor = System.Drawing.Color.Transparent; + this.mainLabel.Font = new System.Drawing.Font("Calibri", 40F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.mainLabel.ForeColor = System.Drawing.Color.White; + this.mainLabel.Location = new System.Drawing.Point(55, 362); + this.mainLabel.Name = "mainLabel"; + this.mainLabel.Size = new System.Drawing.Size(1260, 69); + this.mainLabel.TabIndex = 36; + this.mainLabel.Text = "Press RECORD or F10 to capture 3s of data"; + this.mainLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // zoomToFitBtn + // + this.zoomToFitBtn.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.zoomToFitBtn.FlatAppearance.BorderSize = 0; + this.zoomToFitBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.zoomToFitBtn.Font = new System.Drawing.Font("Consolas", 16F, System.Drawing.FontStyle.Bold); + this.zoomToFitBtn.Location = new System.Drawing.Point(1326, 698); + this.zoomToFitBtn.Name = "zoomToFitBtn"; + this.zoomToFitBtn.Size = new System.Drawing.Size(303, 37); + this.zoomToFitBtn.TabIndex = 35; + this.zoomToFitBtn.Text = "Zoom To Fit Data"; + this.zoomToFitBtn.UseVisualStyleBackColor = false; + this.zoomToFitBtn.Click += new System.EventHandler(this.zoomToFitBtn_Click); + // + // potValPanel + // + this.potValPanel.BackColor = System.Drawing.Color.Transparent; + this.potValPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.potValPanel.Controls.Add(this.label1); + this.potValPanel.Controls.Add(this.numericUpDown1); + this.potValPanel.Location = new System.Drawing.Point(1326, 563); + this.potValPanel.Name = "potValPanel"; + this.potValPanel.Size = new System.Drawing.Size(303, 57); + this.potValPanel.TabIndex = 34; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label1.Location = new System.Drawing.Point(16, 10); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(179, 37); + this.label1.TabIndex = 30; + this.label1.Text = "Sensitivity:"; + // + // numericUpDown1 + // + this.numericUpDown1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.numericUpDown1.Font = new System.Drawing.Font("Consolas", 22F, System.Drawing.FontStyle.Bold); + this.numericUpDown1.Location = new System.Drawing.Point(201, 9); + this.numericUpDown1.Maximum = new decimal(new int[] { + 15, + 0, + 0, + 0}); + this.numericUpDown1.Name = "numericUpDown1"; + this.numericUpDown1.ReadOnly = true; + this.numericUpDown1.Size = new System.Drawing.Size(82, 38); + this.numericUpDown1.TabIndex = 29; + this.numericUpDown1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged); + // + // clearBtn + // + this.clearBtn.BackColor = System.Drawing.Color.Orange; + this.clearBtn.FlatAppearance.BorderSize = 0; + this.clearBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.clearBtn.Font = new System.Drawing.Font("Consolas", 26F, System.Drawing.FontStyle.Bold); + this.clearBtn.ForeColor = System.Drawing.Color.White; + this.clearBtn.Location = new System.Drawing.Point(1498, 626); + this.clearBtn.Name = "clearBtn"; + this.clearBtn.Size = new System.Drawing.Size(131, 66); + this.clearBtn.TabIndex = 33; + this.clearBtn.Text = "Clear"; + this.clearBtn.UseVisualStyleBackColor = false; + this.clearBtn.Click += new System.EventHandler(this.clearBtn_Click); + // + // osPanel + // + this.osPanel.BackColor = System.Drawing.Color.Transparent; + this.osPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.osPanel.Controls.Add(this.cleanVSpanBtn); + this.osPanel.Controls.Add(this.label3); + this.osPanel.Controls.Add(this.osStartLbl); + this.osPanel.Controls.Add(this.label8); + this.osPanel.Controls.Add(this.verticalSpanBtn); + this.osPanel.Controls.Add(this.osEndLbl); + this.osPanel.Controls.Add(this.label11); + this.osPanel.Controls.Add(this.osMeasureLbl); + this.osPanel.Controls.Add(this.label13); + this.osPanel.Location = new System.Drawing.Point(1326, 308); + this.osPanel.Name = "osPanel"; + this.osPanel.Size = new System.Drawing.Size(303, 250); + this.osPanel.TabIndex = 32; + // + // cleanVSpanBtn + // + this.cleanVSpanBtn.BackColor = System.Drawing.Color.Orange; + this.cleanVSpanBtn.FlatAppearance.BorderSize = 0; + this.cleanVSpanBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cleanVSpanBtn.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Bold); + this.cleanVSpanBtn.ForeColor = System.Drawing.Color.White; + this.cleanVSpanBtn.Location = new System.Drawing.Point(205, 200); + this.cleanVSpanBtn.Name = "cleanVSpanBtn"; + this.cleanVSpanBtn.Size = new System.Drawing.Size(87, 34); + this.cleanVSpanBtn.TabIndex = 34; + this.cleanVSpanBtn.Text = "Clear"; + this.cleanVSpanBtn.UseVisualStyleBackColor = false; + this.cleanVSpanBtn.Click += new System.EventHandler(this.cleanVSpanBtn_Click); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label3.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label3.Location = new System.Drawing.Point(2, 10); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(298, 31); + this.label3.TabIndex = 32; + this.label3.Text = "Height Measurements"; + // + // osStartLbl + // + this.osStartLbl.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.osStartLbl.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.osStartLbl.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.osStartLbl.Location = new System.Drawing.Point(16, 75); + this.osStartLbl.Name = "osStartLbl"; + this.osStartLbl.Size = new System.Drawing.Size(123, 39); + this.osStartLbl.TabIndex = 31; + this.osStartLbl.Text = "0"; + this.osStartLbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label8.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label8.Location = new System.Drawing.Point(43, 49); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(70, 26); + this.label8.TabIndex = 30; + this.label8.Text = "Start:"; + // + // verticalSpanBtn + // + this.verticalSpanBtn.BackColor = System.Drawing.Color.LimeGreen; + this.verticalSpanBtn.FlatAppearance.BorderSize = 0; + this.verticalSpanBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.verticalSpanBtn.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Bold); + this.verticalSpanBtn.ForeColor = System.Drawing.Color.White; + this.verticalSpanBtn.Location = new System.Drawing.Point(8, 200); + this.verticalSpanBtn.Name = "verticalSpanBtn"; + this.verticalSpanBtn.Size = new System.Drawing.Size(190, 34); + this.verticalSpanBtn.TabIndex = 29; + this.verticalSpanBtn.Text = "Add Measuring Block"; + this.verticalSpanBtn.UseVisualStyleBackColor = false; + this.verticalSpanBtn.Click += new System.EventHandler(this.verticalSpanBtn_Click); + // + // osEndLbl + // + this.osEndLbl.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.osEndLbl.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.osEndLbl.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.osEndLbl.Location = new System.Drawing.Point(164, 75); + this.osEndLbl.Name = "osEndLbl"; + this.osEndLbl.Size = new System.Drawing.Size(123, 39); + this.osEndLbl.TabIndex = 12; + this.osEndLbl.Text = "0"; + this.osEndLbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label11.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label11.Location = new System.Drawing.Point(194, 49); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(61, 26); + this.label11.TabIndex = 11; + this.label11.Text = "End:"; + // + // osMeasureLbl + // + this.osMeasureLbl.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.osMeasureLbl.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.osMeasureLbl.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.osMeasureLbl.Location = new System.Drawing.Point(62, 142); + this.osMeasureLbl.Name = "osMeasureLbl"; + this.osMeasureLbl.Size = new System.Drawing.Size(179, 50); + this.osMeasureLbl.TabIndex = 10; + this.osMeasureLbl.Text = "0%"; + this.osMeasureLbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label13.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label13.Location = new System.Drawing.Point(66, 116); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(163, 26); + this.label13.TabIndex = 9; + this.label13.Text = "Measurement:"; + // + // rtPanel + // + this.rtPanel.BackColor = System.Drawing.Color.Transparent; + this.rtPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.rtPanel.Controls.Add(this.clearHSpanBtn); + this.rtPanel.Controls.Add(this.label5); + this.rtPanel.Controls.Add(this.startLabel); + this.rtPanel.Controls.Add(this.label10); + this.rtPanel.Controls.Add(this.addRemoveSpanBtn); + this.rtPanel.Controls.Add(this.endLabel); + this.rtPanel.Controls.Add(this.label7); + this.rtPanel.Controls.Add(this.rtLabel); + this.rtPanel.Controls.Add(this.label2); + this.rtPanel.Location = new System.Drawing.Point(1326, 31); + this.rtPanel.Name = "rtPanel"; + this.rtPanel.Size = new System.Drawing.Size(303, 264); + this.rtPanel.TabIndex = 31; + // + // clearHSpanBtn + // + this.clearHSpanBtn.BackColor = System.Drawing.Color.Orange; + this.clearHSpanBtn.FlatAppearance.BorderSize = 0; + this.clearHSpanBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.clearHSpanBtn.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Bold); + this.clearHSpanBtn.ForeColor = System.Drawing.Color.White; + this.clearHSpanBtn.Location = new System.Drawing.Point(205, 217); + this.clearHSpanBtn.Name = "clearHSpanBtn"; + this.clearHSpanBtn.Size = new System.Drawing.Size(87, 34); + this.clearHSpanBtn.TabIndex = 33; + this.clearHSpanBtn.Text = "Clear"; + this.clearHSpanBtn.UseVisualStyleBackColor = false; + this.clearHSpanBtn.Click += new System.EventHandler(this.clearHSpanBtn_Click); + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label5.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label5.Location = new System.Drawing.Point(13, 9); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(277, 31); + this.label5.TabIndex = 32; + this.label5.Text = "Time Measurements"; + // + // startLabel + // + this.startLabel.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.startLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.startLabel.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.startLabel.Location = new System.Drawing.Point(15, 81); + this.startLabel.Name = "startLabel"; + this.startLabel.Size = new System.Drawing.Size(123, 39); + this.startLabel.TabIndex = 31; + this.startLabel.Text = "0"; + this.startLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label10.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label10.Location = new System.Drawing.Point(42, 55); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(70, 26); + this.label10.TabIndex = 30; + this.label10.Text = "Start:"; + // + // addRemoveSpanBtn + // + this.addRemoveSpanBtn.BackColor = System.Drawing.Color.LimeGreen; + this.addRemoveSpanBtn.FlatAppearance.BorderSize = 0; + this.addRemoveSpanBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.addRemoveSpanBtn.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Bold); + this.addRemoveSpanBtn.ForeColor = System.Drawing.Color.White; + this.addRemoveSpanBtn.Location = new System.Drawing.Point(8, 217); + this.addRemoveSpanBtn.Name = "addRemoveSpanBtn"; + this.addRemoveSpanBtn.Size = new System.Drawing.Size(190, 34); + this.addRemoveSpanBtn.TabIndex = 29; + this.addRemoveSpanBtn.Text = "Add Measuring Block"; + this.addRemoveSpanBtn.UseVisualStyleBackColor = false; + this.addRemoveSpanBtn.Click += new System.EventHandler(this.addRemoveSpanBtn_Click); + // + // endLabel + // + this.endLabel.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.endLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.endLabel.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.endLabel.Location = new System.Drawing.Point(163, 81); + this.endLabel.Name = "endLabel"; + this.endLabel.Size = new System.Drawing.Size(123, 39); + this.endLabel.TabIndex = 12; + this.endLabel.Text = "0"; + this.endLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label7.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label7.Location = new System.Drawing.Point(193, 55); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(61, 26); + this.label7.TabIndex = 11; + this.label7.Text = "End:"; + // + // rtLabel + // + this.rtLabel.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.rtLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.rtLabel.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.rtLabel.Location = new System.Drawing.Point(62, 159); + this.rtLabel.Name = "rtLabel"; + this.rtLabel.Size = new System.Drawing.Size(179, 50); + this.rtLabel.TabIndex = 10; + this.rtLabel.Text = "0 ms"; + this.rtLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label2.Location = new System.Drawing.Point(66, 133); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(163, 26); + this.label2.TabIndex = 9; + this.label2.Text = "Measurement:"; + // + // saveGraphNoHSpanBtn + // + this.saveGraphNoHSpanBtn.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.saveGraphNoHSpanBtn.FlatAppearance.BorderSize = 0; + this.saveGraphNoHSpanBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.saveGraphNoHSpanBtn.Font = new System.Drawing.Font("Consolas", 14F, System.Drawing.FontStyle.Bold); + this.saveGraphNoHSpanBtn.Location = new System.Drawing.Point(1464, 741); + this.saveGraphNoHSpanBtn.Name = "saveGraphNoHSpanBtn"; + this.saveGraphNoHSpanBtn.Size = new System.Drawing.Size(165, 67); + this.saveGraphNoHSpanBtn.TabIndex = 25; + this.saveGraphNoHSpanBtn.Text = "Save as PNG\r\nWithout Blocks"; + this.saveGraphNoHSpanBtn.UseVisualStyleBackColor = false; + this.saveGraphNoHSpanBtn.Click += new System.EventHandler(this.saveGraphNoHSpanBtn_Click); + // + // saveAsPNGBtn + // + this.saveAsPNGBtn.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.saveAsPNGBtn.FlatAppearance.BorderSize = 0; + this.saveAsPNGBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.saveAsPNGBtn.Font = new System.Drawing.Font("Consolas", 16F, System.Drawing.FontStyle.Bold); + this.saveAsPNGBtn.Location = new System.Drawing.Point(1326, 741); + this.saveAsPNGBtn.Name = "saveAsPNGBtn"; + this.saveAsPNGBtn.Size = new System.Drawing.Size(132, 67); + this.saveAsPNGBtn.TabIndex = 24; + this.saveAsPNGBtn.Text = "Save as PNG"; + this.saveAsPNGBtn.UseVisualStyleBackColor = false; + this.saveAsPNGBtn.Click += new System.EventHandler(this.saveAsPNGBtn_Click); + // + // startStopBtn + // + this.startStopBtn.BackColor = System.Drawing.Color.LimeGreen; + this.startStopBtn.FlatAppearance.BorderSize = 0; + this.startStopBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.startStopBtn.Font = new System.Drawing.Font("Consolas", 26F, System.Drawing.FontStyle.Bold); + this.startStopBtn.ForeColor = System.Drawing.Color.White; + this.startStopBtn.Location = new System.Drawing.Point(1326, 626); + this.startStopBtn.Name = "startStopBtn"; + this.startStopBtn.Size = new System.Drawing.Size(165, 66); + this.startStopBtn.TabIndex = 8; + this.startStopBtn.Text = "RECORD"; + this.startStopBtn.UseVisualStyleBackColor = false; + this.startStopBtn.Click += new System.EventHandler(this.startStopBtn_Click); + // + // graphedData + // + this.graphedData.Location = new System.Drawing.Point(3, 3); + this.graphedData.Name = "graphedData"; + this.graphedData.Size = new System.Drawing.Size(1334, 801); + this.graphedData.TabIndex = 0; + // + // LiveView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.ControlDark; + this.ClientSize = new System.Drawing.Size(1646, 844); + this.Controls.Add(this.graphViewPanel); + this.Controls.Add(this.toolStrip1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.Name = "LiveView"; + this.Text = "Live View"; + this.Load += new System.EventHandler(this.ResultsView_Load); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); + this.graphViewPanel.ResumeLayout(false); + this.potValPanel.ResumeLayout(false); + this.potValPanel.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); + this.osPanel.ResumeLayout(false); + this.osPanel.PerformLayout(); + this.rtPanel.ResumeLayout(false); + this.rtPanel.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.ToolStrip toolStrip1; + private System.Windows.Forms.Panel graphViewPanel; + private ScottPlot.FormsPlot graphedData; + private System.Windows.Forms.Button startStopBtn; + private System.Windows.Forms.Label rtLabel; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button saveAsPNGBtn; + private System.Windows.Forms.Button saveGraphNoHSpanBtn; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.NumericUpDown numericUpDown1; + private System.Windows.Forms.Panel osPanel; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label osStartLbl; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Button verticalSpanBtn; + private System.Windows.Forms.Label osEndLbl; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Label osMeasureLbl; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Panel rtPanel; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label startLabel; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Button addRemoveSpanBtn; + private System.Windows.Forms.Label endLabel; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Button clearBtn; + private System.Windows.Forms.Panel potValPanel; + private System.Windows.Forms.Button clearHSpanBtn; + private System.Windows.Forms.Button cleanVSpanBtn; + private System.Windows.Forms.Button zoomToFitBtn; + private System.Windows.Forms.Label mainLabel; + private System.Windows.Forms.ToolStripButton recordToolStripBtn; + private System.Windows.Forms.ToolStripButton clearDataToolStripBtn; + private System.Windows.Forms.ToolStripButton zoomToFitToolStripBtn; + private System.Windows.Forms.ToolStripButton saveAsPNGToolStripBtn; + } +} \ No newline at end of file diff --git a/OSRTT Launcher/OSRTT Launcher/LiveView.cs b/OSRTT Launcher/OSRTT Launcher/LiveView.cs new file mode 100644 index 0000000..4efbd7e --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/LiveView.cs @@ -0,0 +1,444 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ScottPlot; +using System.Drawing.Drawing2D; +using System.Drawing.Text; +using System.Resources; +using System.Diagnostics; +using System.Threading; +using System.Drawing.Imaging; +using Newtonsoft.Json; +using GlobalHotKey; +using System.Windows.Input; + +namespace OSRTT_Launcher +{ + // TODO List // + // Fix graph length, fill data by popping + + public partial class LiveView : Form + { + public class LiveData + { + public double result { get; set; } + public double time { get; set; } + } + public List liveData = new List(); + string path = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase; + string resultsFolderPath = ""; + public ProcessData.runSettings runSettings; + public List graphData = new List(); + private bool running = false; + private ResourceManager rm = OSRTT_Launcher.Properties.Resources.ResourceManager; + double[] xData = new double[16000]; + double[] yData = new double[16000]; + List xDataList = new List(); + List yDataList = new List(); + int counter = 0; + public Main m; + HotKeyManager hotKeys = new HotKeyManager(); + List hotKeyList = new List(); + + public void addData(LiveData d) + { + xDataList.Add(d.time); + yDataList.Add(d.result); + } + public void copyListToArray() + { + try + { + //changeArraySize(xDataList.Count); + xData = xDataList.ToArray(); + yData = yDataList.ToArray(); + //Array.Copy(xDataList.ToArray(), xData, xDataList.Count); + //Array.Copy(yDataList.ToArray(), yData, yDataList.Count); + //yData[yData.Length] = 1000; + } + catch + { + Console.WriteLine("Array length probably exceeded."); + } + } + delegate void renderGraphCallback(); + public void renderGraph() + { + if (this.InvokeRequired) + { + var del = new renderGraphCallback(renderGraph); + this.Invoke(del); + } + drawGraph(); + //graphedData.Plot.AxisAuto(0,0.1); + //graphedData.Render(false, true); + //graphedData.Refresh(); + //mainLabel.Visible = false; + } + + public void clearData() + { + xDataList.Clear(); + yDataList.Clear(); + for (int i = 0; i < xData.Length; i++) + { + xData[i] = 0; + yData[i] = 0; + } + graphedData.Plot.Clear(typeof(ScottPlot.Plottable.HSpan)); + graphedData.Plot.Clear(typeof(ScottPlot.Plottable.VSpan)); + graphedData.Render(); + counter = 0; + } + delegate void changeStateCallback(bool state); + + public void changeState(bool state) + { + if (this.InvokeRequired) + { + var del = new changeStateCallback(changeState); + this.Invoke(del, state); + } + rtPanel.Enabled = state; + osPanel.Enabled = state; + potValPanel.Enabled = state; + saveAsPNGBtn.Enabled = state; + saveGraphNoHSpanBtn.Enabled = state; + startStopBtn.Enabled = state; + graphedData.Enabled = state; + } + + public LiveView() + { + InitializeComponent(); + this.FormClosing += LiveView_Closing; + this.Icon = (Icon)rm.GetObject("osrttIcon"); + path = new Uri(System.IO.Path.GetDirectoryName(path)).LocalPath; + path += @"\Results\Live Data"; + if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } + Size = new Size(1662, 883); + this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); + this.BackColor = System.Drawing.ColorTranslator.FromHtml("#2e3440"); + } + private void ResultsView_Load(object sender, EventArgs e) + { + xDataList.Add(0); + yDataList.Add(0); + drawGraph(); + //m.sendText("X"); + hotKeys.KeyPressed += HotKeyPressed; + var k = hotKeys.Register(Key.F10, System.Windows.Input.ModifierKeys.None); + hotKeyList.Add(k); + } + + + private void changeArraySize(int s) + { + Array.Resize(ref xData, s); + Array.Resize(ref yData, s); + } + private void drawGraph() + { + graphedData.Plot.Clear(); + graphedData.Plot.Palette = ScottPlot.Palette.OneHalfDark; + graphedData.Plot.AxisAuto(0, 0.1); + + //graphedData.Plot.SetOuterViewLimits(0, xMax, yMin, yMax); + graphedData.Plot.Style(ScottPlot.Style.Gray1); + //var bnColor = System.Drawing.ColorTranslator.FromHtml("#2e3440"); + var bnColor = Color.Transparent; + graphedData.Plot.Style(figureBackground: bnColor, dataBackground: bnColor); + graphedData.Plot.Title("Live Data View"); + graphedData.Plot.YLabel("Light level (16 bit integer)"); + graphedData.Plot.XLabel("Time (ms)"); + graphedData.Plot.AddScatter(xData, yData, lineWidth: 3, markerSize: 4); + //graphedData.Plot.SetAxisLimits(0, (timeData.Length + 100), 0, (resultData.Max() + 100)); + graphedData.Plot.Render(); + graphedData.Refresh(); + //showProcessedData(); + } + private void onSpanDrag(object sender, EventArgs e) + { + var hSpan = sender as ScottPlot.Plottable.HSpan; + double startTime = hSpan.X1; + double endTime = hSpan.X2; + double newTime = endTime - startTime; + if (startTime > 100) + { + startTime = Math.Round(startTime, 0); + } + else + { + startTime = Math.Round(startTime, 1); + } + if (endTime > 100) + { + endTime = Math.Round(endTime, 0); + } + else + { + endTime = Math.Round(endTime, 1); + } + if (newTime > 100) + { + newTime = Math.Round(newTime, 0); + } + else + { + newTime = Math.Round(newTime, 1); + } + startLabel.Text = startTime.ToString(); + endLabel.Text = endTime.ToString(); + rtLabel.Text = newTime.ToString() + " ms"; + + Console.WriteLine(hSpan.X1 + "," + hSpan.X2); + } + private void onVSpanDrag(object sender, EventArgs e) + { + var vSpan = sender as ScottPlot.Plottable.VSpan; + double startTime = vSpan.Y1; + double endTime = vSpan.Y2; + double newTime = endTime - startTime; + newTime /= startTime; + newTime *= 100; + if (startTime > 100) + { + startTime = Math.Round(startTime, 0); + } + else + { + startTime = Math.Round(startTime, 1); + } + if (endTime > 100) + { + endTime = Math.Round(endTime, 0); + } + else + { + endTime = Math.Round(endTime, 1); + } + if (newTime > 100) + { + newTime = Math.Round(newTime, 0); + } + else + { + newTime = Math.Round(newTime, 1); + } + osStartLbl.Text = startTime.ToString(); + osEndLbl.Text = endTime.ToString(); + osMeasureLbl.Text = newTime.ToString() + "%"; + + Console.WriteLine(vSpan.Y1 + "," + vSpan.Y2); + } + + private void saveAsPNGBtn_Click(object sender, EventArgs e) + { + /*if (runSelectBox.SelectedIndex != null) + { + run = runSelectBox.Items[runSelectBox.SelectedIndex].ToString(); + } + if (transSelect1.SelectedIndex != null) + { + result = transSelect1.Items[transSelect1.SelectedIndex].ToString(); + }*/ + Color bnColor = BackColor; + DateTime d = DateTime.Now; + graphedData.Plot.Style(figureBackground: Color.Transparent, dataBackground: Color.Transparent); + graphedData.Plot.SaveFig(path + "\\" + d.ToString("yyMMdd-HHmmss") + "-Live-OSRTT.png", 1920, 1080, false); + graphedData.Plot.Style(figureBackground: bnColor, dataBackground: bnColor); + Process.Start("explorer.exe", resultsFolderPath); + } + + private void saveGraphNoHSpanBtn_Click(object sender, EventArgs e) + { + //if (runSelectBox.SelectedIndex != null) + //{ + // run = runSelectBox.Items[runSelectBox.SelectedIndex].ToString(); + //} + //if (transSelect1.SelectedIndex != null) + //{ + // result = transSelect1.Items[transSelect1.SelectedIndex].ToString(); + //} + var plots = graphedData.Plot.GetPlottables(); + foreach (var i in plots) + { + if (i.ToString().Contains("span")) + { + i.IsVisible = false; + } + } + Color bnColor = BackColor; + DateTime d = DateTime.Now; + graphedData.Plot.Style(figureBackground: Color.Transparent, dataBackground: Color.Transparent); + graphedData.Plot.SaveFig(path + "\\" + d.ToString("yyMMdd-HHmmss") + "-Live-OSRTT.png", 1920, 1080, false); + graphedData.Plot.Style(figureBackground: bnColor, dataBackground: bnColor); + Process.Start("explorer.exe", resultsFolderPath); + + foreach (var i in plots) + { + if (i.ToString().Contains("span")) + { + i.IsVisible = true; + } + } + } + + private void numericUpDown1_ValueChanged(object sender, EventArgs e) + { + NumericUpDown n = sender as NumericUpDown; + if (n.Focused) + { + var v = numericUpDown1.Value; + int vInt = Convert.ToInt32(v); // doesn't like converting to hex from decimal. Ironically. + string potVal = vInt.ToString("X"); + m.sendText(potVal); + } + } + + public void startStopBtn_Click(object sender, EventArgs e) + { + running = !running; + string t = "RECORD"; + string lblT = "Press RECORD or F10 to capture 3s of data"; + bool showLabel = false; + Color c = Color.LimeGreen; + // change state + changeState(!running); + if (running) + { + t = "RUNNING"; + lblT = "Capturing data..."; + showLabel = true; + c = Color.IndianRed; + clearData(); + m.sendText("P"); // start the testing + } + else + { + t = "RECORD"; + showLabel = false; + lblT = "Press RECORD or F10 to capture 3s of data"; + c = Color.LimeGreen; + // m.sendText("P"); // stop the testing + } + if (startStopBtn.InvokeRequired || mainLabel.InvokeRequired) + { + startStopBtn.Invoke((MethodInvoker)(() => startStopBtn.Text = t)); + startStopBtn.Invoke((MethodInvoker)(() => startStopBtn.BackColor = c)); + mainLabel.Invoke((MethodInvoker)(() => mainLabel.Text = lblT)); + mainLabel.Invoke((MethodInvoker)(() => mainLabel.Visible = showLabel)); + } + else + { + startStopBtn.Text = t; + startStopBtn.BackColor = c; + mainLabel.Text = lblT; + mainLabel.Visible = showLabel; + } + + } + private void clearBtn_Click(object sender, EventArgs e) + { + clearData(); + } + + private void LiveView_Closing(object sender, FormClosingEventArgs e) + { + m.sendText("X"); + foreach (HotKey h in hotKeyList) + { hotKeys.Unregister(h); } + hotKeys.Dispose(); + m.exitLiveView(); + } + + private void HotKeyPressed(object sender, KeyPressedEventArgs e) + { + if (e.HotKey.Key == Key.F10) + { + if (!running) + { + startStopBtn_Click(null, null); + } + } + } + + private void verticalSpanBtn_Click(object sender, EventArgs e) + { + double max = yData.Max(); + double min = yData.Min(); + + double start = max - min; + double end = max - min; + start /= 2.2; + start = Math.Round(start, 2); + end /= 1.8; + end = Math.Round(end, 2); + var vSpan = graphedData.Plot.AddVerticalSpan(start, end); + // graphedData.Plot.AddHorizontalSpan(start, end); + vSpan.DragEnabled = true; + vSpan.Dragged += new EventHandler(onVSpanDrag); + graphedData.Plot.Render(); + graphedData.Refresh(); + } + + private void addRemoveSpanBtn_Click(object sender, EventArgs e) + { + double start = (xData.Max() - xData.Min()) / 2.2; + double end = (xData.Max() - xData.Min()) / 1.8; + start = Math.Round(start, 2); + end = Math.Round(end, 2); + var hSpan = graphedData.Plot.AddHorizontalSpan(start, end); + // graphedData.Plot.AddHorizontalSpan(start, end); + hSpan.DragEnabled = true; + hSpan.Dragged += new EventHandler(onSpanDrag); + graphedData.Plot.Render(); + graphedData.Refresh(); + } + + private void clearHSpanBtn_Click(object sender, EventArgs e) + { + graphedData.Plot.Clear(typeof(ScottPlot.Plottable.HSpan)); + graphedData.Render(); + } + + private void cleanVSpanBtn_Click(object sender, EventArgs e) + { + graphedData.Plot.Clear(typeof(ScottPlot.Plottable.VSpan)); + graphedData.Render(); + } + + private void zoomToFitBtn_Click(object sender, EventArgs e) + { + graphedData.Plot.AxisAuto(0, 0.1); + graphedData.Refresh(); + } + + private void recordToolStripBtn_Click(object sender, EventArgs e) + { + startStopBtn_Click(sender, e); + } + + private void clearDataToolStripBtn_Click(object sender, EventArgs e) + { + clearBtn_Click(sender, e); + } + + private void zoomToFitToolStripBtn_Click(object sender, EventArgs e) + { + zoomToFitBtn_Click(sender, e); + } + + private void saveAsPNGToolStripBtn_Click(object sender, EventArgs e) + { + saveAsPNGBtn_Click(sender, e); + } + } +} diff --git a/OSRTT Launcher/OSRTT Launcher/LiveView.resx b/OSRTT Launcher/OSRTT Launcher/LiveView.resx new file mode 100644 index 0000000..3034f75 --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/LiveView.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 132, 17 + + + 54 + + \ No newline at end of file diff --git a/OSRTT Launcher/OSRTT Launcher/Main.Designer.cs b/OSRTT Launcher/OSRTT Launcher/Main.Designer.cs index e6286d0..3c0075e 100644 --- a/OSRTT Launcher/OSRTT Launcher/Main.Designer.cs +++ b/OSRTT Launcher/OSRTT Launcher/Main.Designer.cs @@ -44,7 +44,6 @@ private void InitializeComponent() this.saveUSBOutputToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.updateDeviceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.testButtonMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.devStat = new System.Windows.Forms.Label(); this.controlsPanel = new System.Windows.Forms.Panel(); this.testSettingsBtn = new System.Windows.Forms.Button(); @@ -100,6 +99,7 @@ private void InitializeComponent() this.checkImg = new System.Windows.Forms.PictureBox(); this.monitorPanel = new System.Windows.Forms.Panel(); this.mainPanel = new System.Windows.Forms.Panel(); + this.LiveViewBtn = new System.Windows.Forms.Button(); this.resultsFolderBtn = new System.Windows.Forms.Button(); this.resultsViewBtn = new System.Windows.Forms.Button(); this.progressBar1 = new System.Windows.Forms.ProgressBar(); @@ -152,11 +152,10 @@ private void InitializeComponent() this.settingsMenuItem, this.programSettingsToolStripMenuItem, this.BrightnessCalBtn, - this.deviceToolStripMenuItem, - this.toolStripMenuItem1}); + this.deviceToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(5, 5); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(2093, 24); + this.menuStrip1.Size = new System.Drawing.Size(1914, 24); this.menuStrip1.TabIndex = 0; this.menuStrip1.Text = "menuStrip1"; // @@ -276,11 +275,6 @@ private void InitializeComponent() this.testButtonMenuItem.Text = "Test Button"; this.testButtonMenuItem.Click += new System.EventHandler(this.testButtonToolStripMenuItemToolStripMenuItem_Click); // - // toolStripMenuItem1 - // - this.toolStripMenuItem1.Name = "toolStripMenuItem1"; - this.toolStripMenuItem1.Size = new System.Drawing.Size(12, 20); - // // devStat // this.devStat.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -813,21 +807,20 @@ private void InitializeComponent() this.inputLagPanel.Controls.Add(this.numberOfClicksSlider); this.inputLagPanel.Controls.Add(this.label16); this.inputLagPanel.Controls.Add(this.timeBetweenSlider); - this.inputLagPanel.Location = new System.Drawing.Point(303, 118); + this.inputLagPanel.Location = new System.Drawing.Point(303, 154); this.inputLagPanel.Name = "inputLagPanel"; - this.inputLagPanel.Size = new System.Drawing.Size(350, 235); + this.inputLagPanel.Size = new System.Drawing.Size(350, 199); this.inputLagPanel.TabIndex = 30; // // inputLagButton // this.inputLagButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(105)))), ((int)(((byte)(180)))), ((int)(((byte)(76))))); this.inputLagButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.inputLagButton.Font = new System.Drawing.Font("Consolas", 20F, System.Drawing.FontStyle.Bold); + this.inputLagButton.Font = new System.Drawing.Font("Consolas", 15F, System.Drawing.FontStyle.Bold); this.inputLagButton.ForeColor = System.Drawing.Color.White; this.inputLagButton.Location = new System.Drawing.Point(-1, -1); this.inputLagButton.Name = "inputLagButton"; - this.inputLagButton.Padding = new System.Windows.Forms.Padding(20, 0, 10, 0); - this.inputLagButton.Size = new System.Drawing.Size(350, 74); + this.inputLagButton.Size = new System.Drawing.Size(350, 45); this.inputLagButton.TabIndex = 1; this.inputLagButton.Text = "Start System Latency Testing"; this.toolTipController.SetToolTip(this.inputLagButton, "Start Total System Latency Testing"); @@ -838,7 +831,7 @@ private void InitializeComponent() // this.numberOfClicksLabel.AutoSize = true; this.numberOfClicksLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.numberOfClicksLabel.Location = new System.Drawing.Point(240, 163); + this.numberOfClicksLabel.Location = new System.Drawing.Point(240, 125); this.numberOfClicksLabel.Name = "numberOfClicksLabel"; this.numberOfClicksLabel.Size = new System.Drawing.Size(20, 24); this.numberOfClicksLabel.TabIndex = 31; @@ -848,7 +841,7 @@ private void InitializeComponent() // this.label20.AutoSize = true; this.label20.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label20.Location = new System.Drawing.Point(77, 163); + this.label20.Location = new System.Drawing.Point(77, 125); this.label20.Name = "label20"; this.label20.Size = new System.Drawing.Size(158, 24); this.label20.TabIndex = 30; @@ -858,7 +851,7 @@ private void InitializeComponent() // this.timeBetweenLabel.AutoSize = true; this.timeBetweenLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.timeBetweenLabel.Location = new System.Drawing.Point(248, 88); + this.timeBetweenLabel.Location = new System.Drawing.Point(248, 50); this.timeBetweenLabel.Name = "timeBetweenLabel"; this.timeBetweenLabel.Size = new System.Drawing.Size(44, 24); this.timeBetweenLabel.TabIndex = 28; @@ -869,7 +862,7 @@ private void InitializeComponent() this.numberOfClicksSlider.BackColor = System.Drawing.Color.White; this.numberOfClicksSlider.Cursor = System.Windows.Forms.Cursors.SizeWE; this.numberOfClicksSlider.LargeChange = 1; - this.numberOfClicksSlider.Location = new System.Drawing.Point(17, 185); + this.numberOfClicksSlider.Location = new System.Drawing.Point(17, 147); this.numberOfClicksSlider.Maximum = 50; this.numberOfClicksSlider.Minimum = 1; this.numberOfClicksSlider.Name = "numberOfClicksSlider"; @@ -884,7 +877,7 @@ private void InitializeComponent() // this.label16.AutoSize = true; this.label16.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label16.Location = new System.Drawing.Point(44, 88); + this.label16.Location = new System.Drawing.Point(44, 50); this.label16.Name = "label16"; this.label16.Size = new System.Drawing.Size(191, 24); this.label16.TabIndex = 27; @@ -893,7 +886,7 @@ private void InitializeComponent() // timeBetweenSlider // this.timeBetweenSlider.Cursor = System.Windows.Forms.Cursors.SizeWE; - this.timeBetweenSlider.Location = new System.Drawing.Point(17, 110); + this.timeBetweenSlider.Location = new System.Drawing.Point(17, 72); this.timeBetweenSlider.Minimum = 1; this.timeBetweenSlider.Name = "timeBetweenSlider"; this.timeBetweenSlider.Size = new System.Drawing.Size(310, 45); @@ -938,6 +931,7 @@ private void InitializeComponent() // // mainPanel // + this.mainPanel.Controls.Add(this.LiveViewBtn); this.mainPanel.Controls.Add(this.resultsFolderBtn); this.mainPanel.Controls.Add(this.resultsViewBtn); this.mainPanel.Controls.Add(this.inputLagPanel); @@ -950,6 +944,21 @@ private void InitializeComponent() this.mainPanel.Size = new System.Drawing.Size(662, 364); this.mainPanel.TabIndex = 32; // + // LiveViewBtn + // + this.LiveViewBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(105)))), ((int)(((byte)(180)))), ((int)(((byte)(76))))); + this.LiveViewBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.LiveViewBtn.Font = new System.Drawing.Font("Consolas", 15F, System.Drawing.FontStyle.Bold); + this.LiveViewBtn.ForeColor = System.Drawing.Color.White; + this.LiveViewBtn.Location = new System.Drawing.Point(303, 118); + this.LiveViewBtn.Name = "LiveViewBtn"; + this.LiveViewBtn.Size = new System.Drawing.Size(350, 30); + this.LiveViewBtn.TabIndex = 34; + this.LiveViewBtn.Text = "Launch Live View Mode"; + this.toolTipController.SetToolTip(this.LiveViewBtn, "Launch the live view mode"); + this.LiveViewBtn.UseVisualStyleBackColor = false; + this.LiveViewBtn.Click += new System.EventHandler(this.LiveViewBtn_Click); + // // resultsFolderBtn // this.resultsFolderBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(197)))), ((int)(((byte)(230))))); @@ -997,7 +1006,7 @@ private void InitializeComponent() this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180))))); - this.ClientSize = new System.Drawing.Size(2103, 808); + this.ClientSize = new System.Drawing.Size(1924, 808); this.Controls.Add(this.progressBar1); this.Controls.Add(this.mainPanel); this.Controls.Add(this.debugPanel); @@ -1053,7 +1062,6 @@ private void InitializeComponent() private System.Windows.Forms.NumericUpDown testCount; private System.Windows.Forms.ComboBox fpsLimitList; private System.Windows.Forms.Label label4; - private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem BrightnessCalBtn; private System.Windows.Forms.Label rawValText; private System.Windows.Forms.Label label5; @@ -1113,6 +1121,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolTip toolTipController; private System.Windows.Forms.Label boardSerialLbl; private System.Windows.Forms.Label label13; + private System.Windows.Forms.Button LiveViewBtn; } } diff --git a/OSRTT Launcher/OSRTT Launcher/Main.cs b/OSRTT Launcher/OSRTT Launcher/Main.cs index 6dabd18..7516d04 100644 --- a/OSRTT Launcher/OSRTT Launcher/Main.cs +++ b/OSRTT Launcher/OSRTT Launcher/Main.cs @@ -22,9 +22,9 @@ namespace OSRTT_Launcher public partial class Main : Form { // CHANGE THESE VALUES WHEN ISSUING A NEW RELEASE - private double boardVersion = 2.4; - private double downloadedFirmwareVersion = 2.4; - private string softwareVersion = "2.8"; + private double boardVersion = 2.5; + private double downloadedFirmwareVersion = 2.5; + private string softwareVersion = "2.9"; // TODO // // @@ -53,6 +53,7 @@ public partial class Main : Form private bool testStarted = false; private bool triggerNextResult = false; private bool vsyncTrigger = false; + private bool liveView = false; private List RGBArr = new List{0, 51, 102, 153, 204, 255}; private int currentStart = 0; @@ -113,6 +114,8 @@ public class FPS private MenuItem openTrayBtn = new MenuItem(); private MenuItem closeTrayBtn = new MenuItem(); + LiveView LiveViewObject; + public void UpdateMe() { AutoUpdater.InstalledVersion = new Version(softwareVersion); @@ -305,39 +308,6 @@ private void initialSetup() process.WaitForExit(); } } - /* - string documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); - var keyLib = documents + "\\Arduino\\libraries\\Keyboard"; - var mouseLib = documents + "\\Arduino\\libraries\\Mouse"; - if (!Directory.Exists(keyLib) || !Directory.Exists(mouseLib)) - { - DialogResult d = MessageBox.Show("Some libraries appear to be missing or not installed. Would you like to try and install them now?", "Missing Libraries", MessageBoxButtons.YesNo, MessageBoxIcon.Question); - if (d == DialogResult.Yes) - { - System.Diagnostics.Process process = new System.Diagnostics.Process(); - //process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; - process.StartInfo.FileName = "cmd.exe"; - process.StartInfo.Arguments = "/C .\\arduinoCLI\\arduino-cli.exe lib install Keyboard && .\\arduinoCLI\\arduino-cli.exe lib install Mouse"; - //process.StartInfo.UseShellExecute = false; - //process.StartInfo.RedirectStandardOutput = true; - //process.StartInfo.CreateNoWindow = true; - process.Start(); - //string output = process.StandardOutput.ReadToEnd(); - process.WaitForExit(); - //Console.WriteLine(output); - } - if (!Directory.Exists(keyLib) || !Directory.Exists(mouseLib)) - { - DialogResult diag = MessageBox.Show("It looks like the libraries still aren't installed. You can install them manually by downloading and extracting the folder to \\Documents. " + - "Would you like to open the download page?", "Missing Libraries", MessageBoxButtons.YesNo, MessageBoxIcon.Question); - if (diag == DialogResult.Yes) - { - Process.Start("https://github.com/andymanic/OSRTT/raw/main/Arduino.zip"); - //Process.Start("https://downloads.arduino.cc/libraries/github.com/arduino-libraries/Mouse-1.0.1.zip"); - //Process.Start("https://downloads.arduino.cc/libraries/github.com/arduino-libraries/Keyboard-1.0.3.zip"); - } - } - }*/ RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\excel.exe"); if (key != null) { @@ -663,7 +633,7 @@ private void findAndConnectToBoard() } private void connectToBoard(string comPort) - { + { System.ComponentModel.IContainer components = new System.ComponentModel.Container(); port = new System.IO.Ports.SerialPort(components); @@ -672,7 +642,7 @@ private void connectToBoard(string comPort) port.DtrEnable = true; port.ReadTimeout = 5000; port.WriteTimeout = 5000; - port.ReadBufferSize = 512000; + port.ReadBufferSize = 1048576; Console.WriteLine("Port details set"); try { port.Open(); } @@ -740,12 +710,14 @@ private void ControlDeviceButtons(bool state) this.launchBtn.Invoke((MethodInvoker)(() => launchBtn.Enabled = state)); this.menuStrip1.Invoke((MethodInvoker)(() => BrightnessCalBtn.Visible = state)); this.inputLagButton.Invoke((MethodInvoker)(() => inputLagButton.Enabled = state)); + this.LiveViewBtn.Invoke((MethodInvoker)(() => LiveViewBtn.Enabled = state)); } else { this.launchBtn.Enabled = state; this.BrightnessCalBtn.Visible = state; this.inputLagButton.Enabled = state; + this.LiveViewBtn.Enabled = state; } } @@ -829,6 +801,8 @@ private void SetDeviceStatus(int state) this.inputLagPanel.Invoke((MethodInvoker)(() => this.inputLagPanel.Enabled = active)); this.launchBtn.Invoke((MethodInvoker)(() => this.launchBtn.BackColor = btnBg)); this.inputLagButton.Invoke((MethodInvoker)(() => this.inputLagButton.BackColor = btnBg)); + this.LiveViewBtn.Invoke((MethodInvoker)(() => LiveViewBtn.Enabled = active)); + this.LiveViewBtn.Invoke((MethodInvoker)(() => LiveViewBtn.BackColor = btnBg)); } else { @@ -844,6 +818,8 @@ private void SetDeviceStatus(int state) this.inputLagPanel.Enabled = active; this.launchBtn.BackColor = btnBg; this.inputLagButton.BackColor = btnBg; + this.LiveViewBtn.Enabled = active; + this.LiveViewBtn.BackColor = btnBg; } this.statusTrayBtn.Text = text; this.notifyIcon.Text = text; @@ -942,6 +918,47 @@ public void Read() try { string message = port.ReadLine(); + if (liveView) + { + if (message.Contains("pot")) + { + // update sensitivity + } + else if (message.Contains("LIVE VIEW")) + { + // catch this so it doesn't wreck the rest + } + else if (message.Contains("End")) + { + + } + else if (message.Contains("LiveData:")) + { + string newMessage = message.Remove(0, 9); + // send to live view window + string[] splitMessage = newMessage.Split(','); + List dataList = new List(); + foreach (string s in splitMessage) + { + if (s.Contains(":")) + { + string[] stringArr = s.Split(':'); + double t = double.Parse(stringArr[0]); + LiveView.LiveData d = new LiveView.LiveData + { + time = t / 1000, + result = double.Parse(stringArr[1]) + }; + LiveViewObject.addData(d); + } + } + Thread.Sleep(5); + LiveViewObject.copyListToArray(); + LiveViewObject.renderGraph(); + LiveViewObject.startStopBtn_Click(null, null); + + } + } Console.WriteLine(message); if (debugMode) { @@ -1226,7 +1243,8 @@ public void Read() else if (message.Contains("USB V:")) { String newMessage = message.Remove(0, 6); - if (Properties.Settings.Default.USBOutput && newMessage.Length < 4999) + Console.WriteLine("USB Output: " + Properties.Settings.Default.USBOutput); + if (Properties.Settings.Default.USBOutput && newMessage.Length > 49999) { // search /Results folder for existing file names, pick new name string[] existingUSBFile = Directory.GetFiles(path, "USB-Voltage-Output.csv"); @@ -1242,7 +1260,7 @@ public void Read() USBOutputString.AppendLine(newMessage); File.WriteAllText(USBOutputPath, USBOutputString.ToString()); } - else + else if (Properties.Settings.Default.USBOutput) { port.Write("U"); } @@ -2411,11 +2429,19 @@ private void testCount_ValueChanged(object sender, EventArgs e) } private void saveUSBOutputToolStripMenuItem_Click(object sender, EventArgs e) { - Properties.Settings.Default.USBOutput = saveUSBOutputToolStripMenuItem.Checked; - Properties.Settings.Default.Save(); - if (port != null) + if (Properties.Settings.Default.USBOutput) + { + Properties.Settings.Default.USBOutput = false; + Properties.Settings.Default.Save(); + } + else { - port.Write("U"); + Properties.Settings.Default.USBOutput = true; + Properties.Settings.Default.Save(); + if (port != null) + { + port.Write("U"); + } } } @@ -2816,8 +2842,11 @@ private void setProgressBar(bool on) private void testButtonToolStripMenuItemToolStripMenuItem_Click(object sender, EventArgs e) { - DataUpload ds = new DataUpload(); - ds.ShareResults(results, gamma, testLatency, runSettings); + liveView = true; + LiveViewObject = new LiveView(); + port.Write("O"); + LiveViewObject.m = this; + LiveViewObject.Show(); } private void resultsViewBtn_Click(object sender, EventArgs e) @@ -3069,6 +3098,23 @@ private void initRtOsMethods() rangePercent = Properties.Settings.Default.osRangePercent }; } + + private void LiveViewBtn_Click(object sender, EventArgs e) + { + liveView = true; + ControlDeviceButtons(false); + LiveViewObject = new LiveView(); + port.Write("O"); + LiveViewObject.m = this; + LiveViewObject.Show(); + + } + + public void exitLiveView() + { + liveView = false; + ControlDeviceButtons(true); + } } } diff --git a/OSRTT Launcher/OSRTT Launcher/OSRTT Launcher.csproj b/OSRTT Launcher/OSRTT Launcher/OSRTT Launcher.csproj index f3fc5d3..d984c54 100644 --- a/OSRTT Launcher/OSRTT Launcher/OSRTT Launcher.csproj +++ b/OSRTT Launcher/OSRTT Launcher/OSRTT Launcher.csproj @@ -69,7 +69,8 @@ 15B3F83EC07532CE2A5C4F085A479E96EF1109E1 - OSRTT Launcher_1_TemporaryKey.pfx + + true @@ -84,6 +85,9 @@ ..\packages\Autoupdater.NET.Official.1.7.0\lib\net45\AutoUpdater.NET.dll + + ..\packages\GlobalHotKey.1.1.0\lib\GlobalHotKey.dll + False C:\Program Files (x86)\Reference Assemblies\Microsoft\WMI\v1.0\Microsoft.Management.Infrastructure.dll @@ -173,6 +177,12 @@ ResultsSettings.cs + + Form + + + LiveView.cs + Form @@ -218,10 +228,14 @@ ResultsSettings.cs + + LiveView.cs + ResultsView.cs + diff --git a/OSRTT Launcher/OSRTT Launcher/Properties/AssemblyInfo.cs b/OSRTT Launcher/OSRTT Launcher/Properties/AssemblyInfo.cs index 48076e1..f0d5144 100644 --- a/OSRTT Launcher/OSRTT Launcher/Properties/AssemblyInfo.cs +++ b/OSRTT Launcher/OSRTT Launcher/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("TechteamGB")] [assembly: AssemblyProduct("OSRTT Launcher")] -[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.0.0.8")] -[assembly: AssemblyFileVersion("2.0.0.8")] +[assembly: AssemblyVersion("2.0.0.9")] +[assembly: AssemblyFileVersion("2.0.0.9")] diff --git a/OSRTT Launcher/OSRTT Launcher/ResultsView.cs b/OSRTT Launcher/OSRTT Launcher/ResultsView.cs index 256c2c6..9a1ddec 100644 --- a/OSRTT Launcher/OSRTT Launcher/ResultsView.cs +++ b/OSRTT Launcher/OSRTT Launcher/ResultsView.cs @@ -429,6 +429,8 @@ private void standardView() heatmaps1.setRunSettings(runSettings); } heatmaps1.standardView(); + rtViewMenuList.Visible = false; + denoiseToolStripBtn.Visible = false; } private void graphView() { @@ -628,6 +630,8 @@ private void graphViewMenuBtn_Click(object sender, EventArgs e) { try { + handleRunsList(); + handleResultsList(0); graphView(); } catch (Exception ex) @@ -1235,7 +1239,7 @@ private void asTransparentPNGToolStripMenuItem_Click(object sender, EventArgs e) resultsFolderPath = path; } Bitmap heatmaps = new Bitmap(this.Width, this.Height); - //BackColor = Color.FromArgb(255,240,240,240); + BackColor = Color.FromArgb(255,240,240,240); heatmaps1.hideText(false); this.DrawToBitmap(heatmaps, new Rectangle(0, 0, heatmaps.Width, heatmaps.Height)); @@ -1308,6 +1312,7 @@ private void asTransparentPNGToolStripMenuItem_Click(object sender, EventArgs e) FontFamily ff = new FontFamily("Calibri"); Font f = new Font(ff, 20f, FontStyle.Bold); Font fi = new Font(ff, 16f, FontStyle.Italic); + Font fk = new Font(ff, 16f, FontStyle.Bold); g.DrawString(rtTitle, f, Brushes.Black, rt, sf); g.DrawString(rtSubTitle, fi, Brushes.Black, rtSub, sf); g.DrawString(osTitle, f, Brushes.Black, os, sf); @@ -1320,6 +1325,10 @@ private void asTransparentPNGToolStripMenuItem_Click(object sender, EventArgs e) g.DrawString("To", fi, Brushes.Black, new Point(556, 106)); g.DrawString("To", fi, Brushes.Black, new Point(1132, 106)); g.DrawString("To", fi, Brushes.Black, new Point(1717, 106)); + // DRAW key text too + g.DrawString("Response Time Key", fk, Brushes.Black, new Point(642, 818)); + g.DrawString("Overshoot Key", fk, Brushes.Black, new Point(978, 819)); + g.DrawString("Response Rating Key", fk, Brushes.Black, new Point(1258, 817)); } finalHeatmaps.Save(resultsFolderPath + "\\" + fileName); diff --git a/OSRTT Launcher/OSRTT Launcher/packages.config b/OSRTT Launcher/OSRTT Launcher/packages.config index 8aa0ebd..c7c0a08 100644 --- a/OSRTT Launcher/OSRTT Launcher/packages.config +++ b/OSRTT Launcher/OSRTT Launcher/packages.config @@ -1,6 +1,7 @@  +