Fix test finali x restart

This commit is contained in:
Samuele E. Locatelli
2021-02-20 17:38:14 +01:00
parent 59eb4b2357
commit 274cfdfc6b
3 changed files with 182 additions and 98 deletions
+121 -67
View File
@@ -41,8 +41,16 @@
this.lblStats = new System.Windows.Forms.ToolStripStatusLabel();
this.pBoxA = new System.Windows.Forms.PictureBox();
this.panelCmd = new System.Windows.Forms.Panel();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.txtSPeriod = new System.Windows.Forms.TextBox();
this.chkSaveAll = new System.Windows.Forms.CheckBox();
this.chkLive = new System.Windows.Forms.CheckBox();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.btnDeleteOlder = new System.Windows.Forms.Button();
this.txtMaxHours = new System.Windows.Forms.TextBox();
this.btnLoad = new System.Windows.Forms.Button();
this.btnSave = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.btnResetPoint = new System.Windows.Forms.Button();
this.lblMaxTemp = new System.Windows.Forms.Label();
@@ -64,25 +72,23 @@
this.lblOrigC = new System.Windows.Forms.Label();
this.lblOrigB = new System.Windows.Forms.Label();
this.chkPointSetup = new System.Windows.Forms.CheckBox();
this.chkLive = new System.Windows.Forms.CheckBox();
this.btnSave = new System.Windows.Forms.Button();
this.labelTitle = new System.Windows.Forms.Label();
this.lblPoint = new System.Windows.Forms.Label();
this.pBoxB = new System.Windows.Forms.PictureBox();
this.lblImgA = new System.Windows.Forms.Label();
this.lblImgB = new System.Windows.Forms.Label();
this.chkShowTransfBig = new System.Windows.Forms.CheckBox();
this.timerUI = new System.Windows.Forms.Timer(this.components);
this.lstView = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.txtMaxDays = new System.Windows.Forms.TextBox();
this.btnDeleteOlder = new System.Windows.Forms.Button();
this.timerUI = new System.Windows.Forms.Timer(this.components);
this.menuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pBoxA)).BeginInit();
this.panelCmd.SuspendLayout();
this.groupBox5.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
@@ -180,41 +186,121 @@
this.panelCmd.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.panelCmd.BackColor = System.Drawing.SystemColors.ControlDark;
this.panelCmd.Controls.Add(this.btnDeleteOlder);
this.panelCmd.Controls.Add(this.txtMaxDays);
this.panelCmd.Controls.Add(this.chkSaveAll);
this.panelCmd.Controls.Add(this.btnLoad);
this.panelCmd.Controls.Add(this.groupBox5);
this.panelCmd.Controls.Add(this.groupBox4);
this.panelCmd.Controls.Add(this.groupBox3);
this.panelCmd.Controls.Add(this.groupBox2);
this.panelCmd.Controls.Add(this.groupBox1);
this.panelCmd.Controls.Add(this.chkLive);
this.panelCmd.Controls.Add(this.btnSave);
this.panelCmd.Controls.Add(this.labelTitle);
this.panelCmd.Location = new System.Drawing.Point(0, 23);
this.panelCmd.Name = "panelCmd";
this.panelCmd.Size = new System.Drawing.Size(192, 647);
this.panelCmd.TabIndex = 6;
//
// groupBox5
//
this.groupBox5.Controls.Add(this.txtSPeriod);
this.groupBox5.Controls.Add(this.chkSaveAll);
this.groupBox5.Controls.Add(this.chkLive);
this.groupBox5.Location = new System.Drawing.Point(8, 24);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(177, 64);
this.groupBox5.TabIndex = 19;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Acquire";
//
// txtSPeriod
//
this.txtSPeriod.Location = new System.Drawing.Point(120, 37);
this.txtSPeriod.Name = "txtSPeriod";
this.txtSPeriod.Size = new System.Drawing.Size(49, 20);
this.txtSPeriod.TabIndex = 21;
this.txtSPeriod.Text = "100";
this.txtSPeriod.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// chkSaveAll
//
this.chkSaveAll.AutoSize = true;
this.chkSaveAll.Location = new System.Drawing.Point(107, 27);
this.chkSaveAll.Location = new System.Drawing.Point(8, 39);
this.chkSaveAll.Name = "chkSaveAll";
this.chkSaveAll.Size = new System.Drawing.Size(73, 17);
this.chkSaveAll.TabIndex = 13;
this.chkSaveAll.Text = "Save ALL";
this.chkSaveAll.Size = new System.Drawing.Size(96, 17);
this.chkSaveAll.TabIndex = 20;
this.chkSaveAll.Text = "Save every ms";
this.chkSaveAll.UseVisualStyleBackColor = true;
//
// chkLive
//
this.chkLive.AutoSize = true;
this.chkLive.Location = new System.Drawing.Point(8, 16);
this.chkLive.Name = "chkLive";
this.chkLive.Size = new System.Drawing.Size(80, 17);
this.chkLive.TabIndex = 19;
this.chkLive.Text = "Live stream";
this.chkLive.UseVisualStyleBackColor = true;
this.chkLive.Click += new System.EventHandler(this.checkLive_CheckedChanged);
//
// groupBox4
//
this.groupBox4.Controls.Add(this.label2);
this.groupBox4.Controls.Add(this.btnDeleteOlder);
this.groupBox4.Controls.Add(this.txtMaxHours);
this.groupBox4.Controls.Add(this.btnLoad);
this.groupBox4.Controls.Add(this.btnSave);
this.groupBox4.Location = new System.Drawing.Point(8, 397);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(177, 87);
this.groupBox4.TabIndex = 16;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "File";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(82, 59);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(22, 13);
this.label2.TabIndex = 18;
this.label2.Text = "> h";
//
// btnDeleteOlder
//
this.btnDeleteOlder.Location = new System.Drawing.Point(6, 54);
this.btnDeleteOlder.Name = "btnDeleteOlder";
this.btnDeleteOlder.Size = new System.Drawing.Size(75, 23);
this.btnDeleteOlder.TabIndex = 17;
this.btnDeleteOlder.Text = "Delete old";
this.btnDeleteOlder.UseVisualStyleBackColor = true;
this.btnDeleteOlder.Click += new System.EventHandler(this.btnDeleteOlder_Click);
//
// txtMaxHours
//
this.txtMaxHours.Location = new System.Drawing.Point(120, 56);
this.txtMaxHours.Name = "txtMaxHours";
this.txtMaxHours.Size = new System.Drawing.Size(51, 20);
this.txtMaxHours.TabIndex = 16;
this.txtMaxHours.Text = "24";
this.txtMaxHours.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// btnLoad
//
this.btnLoad.Location = new System.Drawing.Point(102, 50);
this.btnLoad.Location = new System.Drawing.Point(96, 19);
this.btnLoad.Name = "btnLoad";
this.btnLoad.Size = new System.Drawing.Size(81, 23);
this.btnLoad.Size = new System.Drawing.Size(75, 23);
this.btnLoad.TabIndex = 12;
this.btnLoad.Text = "Load";
this.btnLoad.Text = "Load Img";
this.btnLoad.UseVisualStyleBackColor = true;
this.btnLoad.Click += new System.EventHandler(this.btnLoad_Click);
//
// btnSave
//
this.btnSave.Location = new System.Drawing.Point(6, 19);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(75, 23);
this.btnSave.TabIndex = 1;
this.btnSave.Text = "Save Img";
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.btnResetPoint);
@@ -225,7 +311,7 @@
this.groupBox3.Controls.Add(this.label7);
this.groupBox3.Controls.Add(this.txtMinScale);
this.groupBox3.Controls.Add(this.chkReadTemp);
this.groupBox3.Location = new System.Drawing.Point(8, 269);
this.groupBox3.Location = new System.Drawing.Point(8, 272);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(175, 119);
this.groupBox3.TabIndex = 5;
@@ -321,7 +407,7 @@
this.groupBox2.Controls.Add(this.txtBC);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.txtAB);
this.groupBox2.Location = new System.Drawing.Point(8, 187);
this.groupBox2.Location = new System.Drawing.Point(8, 190);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(175, 76);
this.groupBox2.TabIndex = 5;
@@ -374,7 +460,7 @@
this.groupBox1.Controls.Add(this.lblOrigC);
this.groupBox1.Controls.Add(this.lblOrigB);
this.groupBox1.Controls.Add(this.chkPointSetup);
this.groupBox1.Location = new System.Drawing.Point(8, 91);
this.groupBox1.Location = new System.Drawing.Point(8, 94);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(175, 90);
this.groupBox1.TabIndex = 4;
@@ -442,27 +528,6 @@
this.chkPointSetup.UseVisualStyleBackColor = true;
this.chkPointSetup.CheckedChanged += new System.EventHandler(this.chkPointSetup_CheckedChanged);
//
// chkLive
//
this.chkLive.AutoSize = true;
this.chkLive.Location = new System.Drawing.Point(8, 27);
this.chkLive.Name = "chkLive";
this.chkLive.Size = new System.Drawing.Size(42, 17);
this.chkLive.TabIndex = 2;
this.chkLive.Text = "live";
this.chkLive.UseVisualStyleBackColor = true;
this.chkLive.CheckedChanged += new System.EventHandler(this.checkLive_CheckedChanged);
//
// btnSave
//
this.btnSave.Location = new System.Drawing.Point(6, 50);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(81, 23);
this.btnSave.TabIndex = 1;
this.btnSave.Text = "Save";
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// labelTitle
//
this.labelTitle.AutoSize = true;
@@ -526,10 +591,6 @@
this.chkShowTransfBig.UseVisualStyleBackColor = true;
this.chkShowTransfBig.CheckedChanged += new System.EventHandler(this.chkShowOrig_CheckedChanged);
//
// timerUI
//
this.timerUI.Tick += new System.EventHandler(this.timerUI_Tick);
//
// lstView
//
this.lstView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
@@ -560,24 +621,9 @@
this.columnHeader3.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.columnHeader3.Width = 150;
//
// txtMaxDays
// timerUI
//
this.txtMaxDays.Location = new System.Drawing.Point(128, 403);
this.txtMaxDays.Name = "txtMaxDays";
this.txtMaxDays.Size = new System.Drawing.Size(49, 20);
this.txtMaxDays.TabIndex = 14;
this.txtMaxDays.Text = "1";
this.txtMaxDays.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// btnDeleteOlder
//
this.btnDeleteOlder.Location = new System.Drawing.Point(6, 401);
this.btnDeleteOlder.Name = "btnDeleteOlder";
this.btnDeleteOlder.Size = new System.Drawing.Size(94, 23);
this.btnDeleteOlder.TabIndex = 15;
this.btnDeleteOlder.Text = "Delete > days";
this.btnDeleteOlder.UseVisualStyleBackColor = true;
this.btnDeleteOlder.Click += new System.EventHandler(this.btnDeleteOlder_Click);
this.timerUI.Tick += new System.EventHandler(this.timerUI_Tick);
//
// MainForm
//
@@ -607,6 +653,10 @@
((System.ComponentModel.ISupportInitialize)(this.pBoxA)).EndInit();
this.panelCmd.ResumeLayout(false);
this.panelCmd.PerformLayout();
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox2.ResumeLayout(false);
@@ -632,7 +682,6 @@
private System.Windows.Forms.PictureBox pBoxA;
private System.Windows.Forms.Panel panelCmd;
private System.Windows.Forms.Label labelTitle;
private System.Windows.Forms.CheckBox chkLive;
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label lblOrigD;
@@ -660,17 +709,22 @@
private System.Windows.Forms.CheckBox chkShowTransfBig;
private System.Windows.Forms.Button btnReset;
private System.Windows.Forms.Button btnLoad;
private System.Windows.Forms.CheckBox chkSaveAll;
private System.Windows.Forms.Label lblMaxTemp;
private System.Windows.Forms.Label lblMinTemp;
private System.Windows.Forms.Timer timerUI;
private System.Windows.Forms.Button btnResetPoint;
private System.Windows.Forms.ListView lstView;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.ColumnHeader columnHeader3;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.TextBox txtSPeriod;
private System.Windows.Forms.CheckBox chkSaveAll;
private System.Windows.Forms.CheckBox chkLive;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnDeleteOlder;
private System.Windows.Forms.TextBox txtMaxDays;
private System.Windows.Forms.TextBox txtMaxHours;
private System.Windows.Forms.Timer timerUI;
}
}
+50 -24
View File
@@ -49,7 +49,7 @@ namespace Thermo.Cam.Setup
setRangeTemp();
// calcolo i currConf.destPoints
updateDestPt();
timerUI.Interval = 200;
setTimerInterval();
timerUI.Start();
// cerco camera
TCamCtrl.discoveryCamera();
@@ -161,6 +161,20 @@ namespace Thermo.Cam.Setup
}
}
protected int SamplePeriod
{
get
{
int answ = 100;
int.TryParse(txtSPeriod.Text, out answ);
return answ;
}
set
{
txtSPeriod.Text = $"{value}";
}
}
protected bool saveEnabled
{
get
@@ -191,9 +205,9 @@ namespace Thermo.Cam.Setup
private void btnDeleteOlder_Click(object sender, EventArgs e)
{
int maxDays = 90;
int.TryParse(txtMaxDays.Text, out maxDays);
TCamCtrl.cleanDataDir(maxDays);
int maxHours = 90 * 24;
int.TryParse(txtMaxHours.Text, out maxHours);
TCamCtrl.cleanDataDir(maxHours);
}
private void btnLoad_Click(object sender, EventArgs e)
@@ -274,11 +288,17 @@ namespace Thermo.Cam.Setup
{
if (TCamCtrl.Thermal != null)
{
lblImgA.Text = showTransfBig ? "FINAL image" : "ORIGINAL image";
lblImgB.Text = showTransfBig ? "ORIGINAL image" : "FINAL image";
pBoxA.Image = showTransfBig ? TCamCtrl.ColorTransf : TCamCtrl.Decorated;
pBoxB.Image = showTransfBig ? TCamCtrl.Decorated : TCamCtrl.ColorTransf;
try
{
lblImgA.Text = showTransfBig ? "FINAL image" : "ORIGINAL image";
lblImgB.Text = showTransfBig ? "ORIGINAL image" : "FINAL image";
pBoxA.Image = showTransfBig ? TCamCtrl.ColorTransf : TCamCtrl.Decorated;
pBoxB.Image = showTransfBig ? TCamCtrl.Decorated : TCamCtrl.ColorTransf;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION displayImage: {Environment.NewLine}{exc}");
}
}
}
@@ -443,10 +463,8 @@ namespace Thermo.Cam.Setup
private void setTimerInterval()
{
timerUI.Stop();
// cambio periodo timer!
timerUI.Interval = chkLive.Checked ? 100 : 500;
timerUI.Start();
timerUI.Interval = chkLive.Checked ? SamplePeriod : SamplePeriod * 4;
}
private void timerUI_Tick(object sender, EventArgs e)
@@ -521,28 +539,32 @@ namespace Thermo.Cam.Setup
private void updateDisplay()
{
lblOrigA.Text = "A";
lblOrigB.Text = "B";
lblOrigC.Text = "C";
lblOrigD.Text = "D";
string textA = "A";
string textB = "B";
string textC = "C";
string textD = "D";
// popolo
if (TCamCtrl.currConf.OrigPoints.Coords.Count > 0)
{
lblOrigA.Text = $"A: ({TCamCtrl.currConf.OrigPoints.Coords[0].X},{TCamCtrl.currConf.OrigPoints.Coords[0].Y})";
textA = $"A: ({TCamCtrl.currConf.OrigPoints.Coords[0].X},{TCamCtrl.currConf.OrigPoints.Coords[0].Y})";
}
if (TCamCtrl.currConf.OrigPoints.Coords.Count > 1)
{
lblOrigB.Text = $"B: ({TCamCtrl.currConf.OrigPoints.Coords[1].X},{TCamCtrl.currConf.OrigPoints.Coords[1].Y})";
textB = $"B: ({TCamCtrl.currConf.OrigPoints.Coords[1].X},{TCamCtrl.currConf.OrigPoints.Coords[1].Y})";
}
if (TCamCtrl.currConf.OrigPoints.Coords.Count > 2)
{
lblOrigC.Text = $"C: ({TCamCtrl.currConf.OrigPoints.Coords[2].X},{TCamCtrl.currConf.OrigPoints.Coords[2].Y})";
textC = $"C: ({TCamCtrl.currConf.OrigPoints.Coords[2].X},{TCamCtrl.currConf.OrigPoints.Coords[2].Y})";
}
if (TCamCtrl.currConf.OrigPoints.Coords.Count > 3)
{
lblOrigD.Text = $"D: ({TCamCtrl.currConf.OrigPoints.Coords[3].X},{TCamCtrl.currConf.OrigPoints.Coords[3].Y})";
textD = $"D: ({TCamCtrl.currConf.OrigPoints.Coords[3].X},{TCamCtrl.currConf.OrigPoints.Coords[3].Y})";
TCamCtrl.calculateTarget();
}
lblOrigA.Text = textA;
lblOrigB.Text = textB;
lblOrigC.Text = textC;
lblOrigD.Text = textD;
}
private void updateForm()
@@ -570,8 +592,10 @@ namespace Thermo.Cam.Setup
{
lblStats.Text = $"Camera: {TCamCtrl.lastStatTime("ImageAcquisition")}ms | Color + Persp {TCamCtrl.lastStatTime("ImageColor")}ms | Points {TCamCtrl.lastStatTime("AddPoints")}ms | Measures {TCamCtrl.lastStatTime("GetAllTemperatures")}ms";
}
catch
{ }
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION updateStatDisplay{Environment.NewLine}{exc}");
}
}
}
@@ -597,8 +621,10 @@ namespace Thermo.Cam.Setup
lblMinTemp.Text = $"{TCamCtrl.lastTempRange.Minimum:N2}";
lblMaxTemp.Text = $"{TCamCtrl.lastTempRange.Maximum:N2}";
}
catch
{ }
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION updateTempDisplay{Environment.NewLine}{exc}");
}
}
}
}