inclusao dados ultrassom

This commit is contained in:
Diego Freitas 2024-11-12 09:48:21 -03:00
parent ffc9ed8af5
commit 1af09acc9e
39 changed files with 40467 additions and 72965 deletions

Binary file not shown.

View File

@ -28,30 +28,30 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea10 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend10 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series10 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea11 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend11 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series11 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea12 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend12 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series12 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea13 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend13 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series13 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea9 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend9 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series9 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea14 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend14 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series14 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea15 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend15 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series15 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea16 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend16 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series16 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea17 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend17 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series17 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea18 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend18 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series18 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea19 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend19 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series19 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea20 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend20 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series20 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea21 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend21 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series21 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea22 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend22 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series22 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea23 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend23 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series23 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea24 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend24 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series24 = new System.Windows.Forms.DataVisualization.Charting.Series();
this.trbMomento = new System.Windows.Forms.TrackBar();
this.panel1 = new System.Windows.Forms.Panel();
this.tabControl4 = new System.Windows.Forms.TabControl();
@ -87,8 +87,7 @@
this.pnlOrientacaoGPS = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabCodFalhas = new System.Windows.Forms.TabPage();
this.tvwFalhas = new System.Windows.Forms.TreeView();
this.tabSituacao = new System.Windows.Forms.TabPage();
this.tabDirecional = new System.Windows.Forms.TabPage();
this.txtDIR_Controlar_ET = new System.Windows.Forms.TextBox();
this.label39 = new System.Windows.Forms.Label();
@ -299,18 +298,7 @@
this.cmbSen_Filtro = new System.Windows.Forms.ComboBox();
this.label63 = new System.Windows.Forms.Label();
this.chartSensoriamento = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.tabSinaleiros = new System.Windows.Forms.TabPage();
this.lblU1 = new System.Windows.Forms.Label();
this.lblU2 = new System.Windows.Forms.Label();
this.lblU3 = new System.Windows.Forms.Label();
this.lblU4 = new System.Windows.Forms.Label();
this.picRoboSuperior = new System.Windows.Forms.PictureBox();
this.lblManual = new System.Windows.Forms.Label();
this.lblOperacao = new System.Windows.Forms.Label();
this.pnlManual = new System.Windows.Forms.Panel();
this.pnlOperacao = new System.Windows.Forms.Panel();
this.lblAutomatico = new System.Windows.Forms.Label();
this.pnlAutomatico = new System.Windows.Forms.Panel();
this.tabUltrassom = new System.Windows.Forms.TabPage();
this.tabOrientacao = new System.Windows.Forms.TabPage();
this.pnlInclinacao = new System.Windows.Forms.Panel();
this.pnl3D = new System.Windows.Forms.Panel();
@ -406,6 +394,28 @@
this.label36 = new System.Windows.Forms.Label();
this.txtMomento = new System.Windows.Forms.TextBox();
this.btnPlay = new System.Windows.Forms.Button();
this.tvwFalhas = new System.Windows.Forms.TreeView();
this.lblManual = new System.Windows.Forms.Label();
this.lblOperacao = new System.Windows.Forms.Label();
this.pnlManual = new System.Windows.Forms.Panel();
this.pnlOperacao = new System.Windows.Forms.Panel();
this.lblAutomatico = new System.Windows.Forms.Label();
this.pnlAutomatico = new System.Windows.Forms.Panel();
this.label117 = new System.Windows.Forms.Label();
this.pnlUltrassom = new System.Windows.Forms.Panel();
this.pnlP_10 = new System.Windows.Forms.Panel();
this.pnlP_11 = new System.Windows.Forms.Panel();
this.pnlP_7 = new System.Windows.Forms.Panel();
this.pnlP_12 = new System.Windows.Forms.Panel();
this.pnlP_8 = new System.Windows.Forms.Panel();
this.pnlP_9 = new System.Windows.Forms.Panel();
this.pnlP_6 = new System.Windows.Forms.Panel();
this.pnlP_3 = new System.Windows.Forms.Panel();
this.pnlP_5 = new System.Windows.Forms.Panel();
this.pnlP_2 = new System.Windows.Forms.Panel();
this.pnlP_4 = new System.Windows.Forms.Panel();
this.pnlP_1 = new System.Windows.Forms.Panel();
this.picRobo = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.trbMomento)).BeginInit();
this.panel1.SuspendLayout();
this.tabControl4.SuspendLayout();
@ -413,7 +423,7 @@
this.tabMapaDinamico.SuspendLayout();
this.panel2.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabCodFalhas.SuspendLayout();
this.tabSituacao.SuspendLayout();
this.tabDirecional.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picDIR_DT)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picDIR_DF)).BeginInit();
@ -454,8 +464,7 @@
this.groupBox1.SuspendLayout();
this.gpbSEN_Filtro.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.chartSensoriamento)).BeginInit();
this.tabSinaleiros.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picRoboSuperior)).BeginInit();
this.tabUltrassom.SuspendLayout();
this.tabOrientacao.SuspendLayout();
this.tabSonar.SuspendLayout();
this.tabControl3.SuspendLayout();
@ -471,6 +480,8 @@
((System.ComponentModel.ISupportInitialize)(this.chartCpu)).BeginInit();
this.panel6.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picCameraCaminho)).BeginInit();
this.pnlUltrassom.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picRobo)).BeginInit();
this.SuspendLayout();
//
// trbMomento
@ -849,13 +860,13 @@
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabCodFalhas);
this.tabControl1.Controls.Add(this.tabSituacao);
this.tabControl1.Controls.Add(this.tabDirecional);
this.tabControl1.Controls.Add(this.tabMovimentacao);
this.tabControl1.Controls.Add(this.tabAtuador);
this.tabControl1.Controls.Add(this.tabErvas);
this.tabControl1.Controls.Add(this.tabSensoriamento);
this.tabControl1.Controls.Add(this.tabSinaleiros);
this.tabControl1.Controls.Add(this.tabUltrassom);
this.tabControl1.Controls.Add(this.tabOrientacao);
this.tabControl1.Controls.Add(this.tabSonar);
this.tabControl1.Controls.Add(this.tabSegmentacao);
@ -867,26 +878,23 @@
this.tabControl1.Size = new System.Drawing.Size(504, 548);
this.tabControl1.TabIndex = 0;
//
// tabCodFalhas
// tabSituacao
//
this.tabCodFalhas.Controls.Add(this.tvwFalhas);
this.tabCodFalhas.Location = new System.Drawing.Point(4, 22);
this.tabCodFalhas.Name = "tabCodFalhas";
this.tabCodFalhas.Padding = new System.Windows.Forms.Padding(3);
this.tabCodFalhas.Size = new System.Drawing.Size(496, 522);
this.tabCodFalhas.TabIndex = 9;
this.tabCodFalhas.Text = "Código de Falhas";
this.tabCodFalhas.UseVisualStyleBackColor = true;
//
// tvwFalhas
//
this.tvwFalhas.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tvwFalhas.Location = new System.Drawing.Point(6, 6);
this.tvwFalhas.Name = "tvwFalhas";
this.tvwFalhas.Size = new System.Drawing.Size(484, 510);
this.tvwFalhas.TabIndex = 0;
this.tabSituacao.Controls.Add(this.label117);
this.tabSituacao.Controls.Add(this.tvwFalhas);
this.tabSituacao.Controls.Add(this.lblManual);
this.tabSituacao.Controls.Add(this.lblOperacao);
this.tabSituacao.Controls.Add(this.pnlManual);
this.tabSituacao.Controls.Add(this.pnlOperacao);
this.tabSituacao.Controls.Add(this.lblAutomatico);
this.tabSituacao.Controls.Add(this.pnlAutomatico);
this.tabSituacao.Location = new System.Drawing.Point(4, 22);
this.tabSituacao.Name = "tabSituacao";
this.tabSituacao.Padding = new System.Windows.Forms.Padding(3);
this.tabSituacao.Size = new System.Drawing.Size(496, 522);
this.tabSituacao.TabIndex = 9;
this.tabSituacao.Text = "Situação";
this.tabSituacao.UseVisualStyleBackColor = true;
//
// tabDirecional
//
@ -1558,17 +1566,17 @@
//
// chartMovVelocidade
//
chartArea10.Name = "ChartArea1";
this.chartMovVelocidade.ChartAreas.Add(chartArea10);
legend10.Name = "Legend1";
this.chartMovVelocidade.Legends.Add(legend10);
chartArea17.Name = "ChartArea1";
this.chartMovVelocidade.ChartAreas.Add(chartArea17);
legend17.Name = "Legend1";
this.chartMovVelocidade.Legends.Add(legend17);
this.chartMovVelocidade.Location = new System.Drawing.Point(4, 4);
this.chartMovVelocidade.Margin = new System.Windows.Forms.Padding(2);
this.chartMovVelocidade.Name = "chartMovVelocidade";
series10.ChartArea = "ChartArea1";
series10.Legend = "Legend1";
series10.Name = "Series1";
this.chartMovVelocidade.Series.Add(series10);
series17.ChartArea = "ChartArea1";
series17.Legend = "Legend1";
series17.Name = "Series1";
this.chartMovVelocidade.Series.Add(series17);
this.chartMovVelocidade.Size = new System.Drawing.Size(474, 356);
this.chartMovVelocidade.TabIndex = 96;
this.chartMovVelocidade.Text = "chart1";
@ -1977,17 +1985,17 @@
//
// chartMovTemperatura
//
chartArea11.Name = "ChartArea1";
this.chartMovTemperatura.ChartAreas.Add(chartArea11);
legend11.Name = "Legend1";
this.chartMovTemperatura.Legends.Add(legend11);
chartArea18.Name = "ChartArea1";
this.chartMovTemperatura.ChartAreas.Add(chartArea18);
legend18.Name = "Legend1";
this.chartMovTemperatura.Legends.Add(legend18);
this.chartMovTemperatura.Location = new System.Drawing.Point(4, 4);
this.chartMovTemperatura.Margin = new System.Windows.Forms.Padding(2);
this.chartMovTemperatura.Name = "chartMovTemperatura";
series11.ChartArea = "ChartArea1";
series11.Legend = "Legend1";
series11.Name = "Series1";
this.chartMovTemperatura.Series.Add(series11);
series18.ChartArea = "ChartArea1";
series18.Legend = "Legend1";
series18.Name = "Series1";
this.chartMovTemperatura.Series.Add(series18);
this.chartMovTemperatura.Size = new System.Drawing.Size(474, 336);
this.chartMovTemperatura.TabIndex = 95;
this.chartMovTemperatura.Text = "chart1";
@ -2395,17 +2403,17 @@
//
// chartMovTensao
//
chartArea12.Name = "ChartArea1";
this.chartMovTensao.ChartAreas.Add(chartArea12);
legend12.Name = "Legend1";
this.chartMovTensao.Legends.Add(legend12);
chartArea19.Name = "ChartArea1";
this.chartMovTensao.ChartAreas.Add(chartArea19);
legend19.Name = "Legend1";
this.chartMovTensao.Legends.Add(legend19);
this.chartMovTensao.Location = new System.Drawing.Point(4, 4);
this.chartMovTensao.Margin = new System.Windows.Forms.Padding(2);
this.chartMovTensao.Name = "chartMovTensao";
series12.ChartArea = "ChartArea1";
series12.Legend = "Legend1";
series12.Name = "Series1";
this.chartMovTensao.Series.Add(series12);
series19.ChartArea = "ChartArea1";
series19.Legend = "Legend1";
series19.Name = "Series1";
this.chartMovTensao.Series.Add(series19);
this.chartMovTensao.Size = new System.Drawing.Size(474, 336);
this.chartMovTensao.TabIndex = 131;
this.chartMovTensao.Text = "chart1";
@ -2904,17 +2912,17 @@
//
// chartMovGeral
//
chartArea13.Name = "ChartArea1";
this.chartMovGeral.ChartAreas.Add(chartArea13);
legend13.Name = "Legend1";
this.chartMovGeral.Legends.Add(legend13);
chartArea20.Name = "ChartArea1";
this.chartMovGeral.ChartAreas.Add(chartArea20);
legend20.Name = "Legend1";
this.chartMovGeral.Legends.Add(legend20);
this.chartMovGeral.Location = new System.Drawing.Point(4, 4);
this.chartMovGeral.Margin = new System.Windows.Forms.Padding(2);
this.chartMovGeral.Name = "chartMovGeral";
series13.ChartArea = "ChartArea1";
series13.Legend = "Legend1";
series13.Name = "Series1";
this.chartMovGeral.Series.Add(series13);
series20.ChartArea = "ChartArea1";
series20.Legend = "Legend1";
series20.Name = "Series1";
this.chartMovGeral.Series.Add(series20);
this.chartMovGeral.Size = new System.Drawing.Size(474, 311);
this.chartMovGeral.TabIndex = 94;
this.chartMovGeral.Text = "chart1";
@ -2949,17 +2957,17 @@
//
// chartAtuador
//
chartArea9.Name = "ChartArea1";
this.chartAtuador.ChartAreas.Add(chartArea9);
legend9.Name = "Legend1";
this.chartAtuador.Legends.Add(legend9);
chartArea21.Name = "ChartArea1";
this.chartAtuador.ChartAreas.Add(chartArea21);
legend21.Name = "Legend1";
this.chartAtuador.Legends.Add(legend21);
this.chartAtuador.Location = new System.Drawing.Point(4, 276);
this.chartAtuador.Margin = new System.Windows.Forms.Padding(2);
this.chartAtuador.Name = "chartAtuador";
series9.ChartArea = "ChartArea1";
series9.Legend = "Legend1";
series9.Name = "Series1";
this.chartAtuador.Series.Add(series9);
series21.ChartArea = "ChartArea1";
series21.Legend = "Legend1";
series21.Name = "Series1";
this.chartAtuador.Series.Add(series21);
this.chartAtuador.Size = new System.Drawing.Size(489, 241);
this.chartAtuador.TabIndex = 95;
this.chartAtuador.Text = "chart1";
@ -3006,16 +3014,16 @@
//
// chartErvas
//
chartArea14.Name = "ChartArea1";
this.chartErvas.ChartAreas.Add(chartArea14);
legend14.Name = "Legend1";
this.chartErvas.Legends.Add(legend14);
chartArea22.Name = "ChartArea1";
this.chartErvas.ChartAreas.Add(chartArea22);
legend22.Name = "Legend1";
this.chartErvas.Legends.Add(legend22);
this.chartErvas.Location = new System.Drawing.Point(6, 6);
this.chartErvas.Name = "chartErvas";
series14.ChartArea = "ChartArea1";
series14.Legend = "Legend1";
series14.Name = "Series1";
this.chartErvas.Series.Add(series14);
series22.ChartArea = "ChartArea1";
series22.Legend = "Legend1";
series22.Name = "Series1";
this.chartErvas.Series.Add(series22);
this.chartErvas.Size = new System.Drawing.Size(484, 510);
this.chartErvas.TabIndex = 0;
this.chartErvas.Text = "chart1";
@ -3278,142 +3286,31 @@
//
// chartSensoriamento
//
chartArea15.Name = "ChartArea1";
this.chartSensoriamento.ChartAreas.Add(chartArea15);
legend15.Name = "Legend1";
this.chartSensoriamento.Legends.Add(legend15);
chartArea23.Name = "ChartArea1";
this.chartSensoriamento.ChartAreas.Add(chartArea23);
legend23.Name = "Legend1";
this.chartSensoriamento.Legends.Add(legend23);
this.chartSensoriamento.Location = new System.Drawing.Point(2, 4);
this.chartSensoriamento.Margin = new System.Windows.Forms.Padding(2);
this.chartSensoriamento.Name = "chartSensoriamento";
series15.ChartArea = "ChartArea1";
series15.Legend = "Legend1";
series15.Name = "Series1";
this.chartSensoriamento.Series.Add(series15);
series23.ChartArea = "ChartArea1";
series23.Legend = "Legend1";
series23.Name = "Series1";
this.chartSensoriamento.Series.Add(series23);
this.chartSensoriamento.Size = new System.Drawing.Size(491, 389);
this.chartSensoriamento.TabIndex = 95;
this.chartSensoriamento.Text = "chart1";
//
// tabSinaleiros
// tabUltrassom
//
this.tabSinaleiros.Controls.Add(this.lblU1);
this.tabSinaleiros.Controls.Add(this.lblU2);
this.tabSinaleiros.Controls.Add(this.lblU3);
this.tabSinaleiros.Controls.Add(this.lblU4);
this.tabSinaleiros.Controls.Add(this.picRoboSuperior);
this.tabSinaleiros.Controls.Add(this.lblManual);
this.tabSinaleiros.Controls.Add(this.lblOperacao);
this.tabSinaleiros.Controls.Add(this.pnlManual);
this.tabSinaleiros.Controls.Add(this.pnlOperacao);
this.tabSinaleiros.Controls.Add(this.lblAutomatico);
this.tabSinaleiros.Controls.Add(this.pnlAutomatico);
this.tabSinaleiros.Location = new System.Drawing.Point(4, 22);
this.tabSinaleiros.Name = "tabSinaleiros";
this.tabSinaleiros.Padding = new System.Windows.Forms.Padding(3);
this.tabSinaleiros.Size = new System.Drawing.Size(496, 522);
this.tabSinaleiros.TabIndex = 4;
this.tabSinaleiros.Text = "Sinaleiros";
this.tabSinaleiros.UseVisualStyleBackColor = true;
//
// lblU1
//
this.lblU1.AutoSize = true;
this.lblU1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
this.lblU1.Location = new System.Drawing.Point(77, 467);
this.lblU1.Name = "lblU1";
this.lblU1.Size = new System.Drawing.Size(68, 17);
this.lblU1.TabIndex = 9;
this.lblU1.Text = "U1: 0 mm";
//
// lblU2
//
this.lblU2.AutoSize = true;
this.lblU2.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
this.lblU2.Location = new System.Drawing.Point(372, 467);
this.lblU2.Name = "lblU2";
this.lblU2.Size = new System.Drawing.Size(68, 17);
this.lblU2.TabIndex = 8;
this.lblU2.Text = "U2: 0 mm";
//
// lblU3
//
this.lblU3.AutoSize = true;
this.lblU3.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
this.lblU3.Location = new System.Drawing.Point(77, 206);
this.lblU3.Name = "lblU3";
this.lblU3.Size = new System.Drawing.Size(68, 17);
this.lblU3.TabIndex = 7;
this.lblU3.Text = "U3: 0 mm";
//
// lblU4
//
this.lblU4.AutoSize = true;
this.lblU4.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
this.lblU4.Location = new System.Drawing.Point(372, 206);
this.lblU4.Name = "lblU4";
this.lblU4.Size = new System.Drawing.Size(68, 17);
this.lblU4.TabIndex = 5;
this.lblU4.Text = "U4: 0 mm";
//
// picRoboSuperior
//
this.picRoboSuperior.Image = global::AgroBase.Properties.Resources.robo_superior;
this.picRoboSuperior.Location = new System.Drawing.Point(147, 206);
this.picRoboSuperior.Name = "picRoboSuperior";
this.picRoboSuperior.Size = new System.Drawing.Size(219, 278);
this.picRoboSuperior.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picRoboSuperior.TabIndex = 4;
this.picRoboSuperior.TabStop = false;
//
// lblManual
//
this.lblManual.AutoSize = true;
this.lblManual.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
this.lblManual.Location = new System.Drawing.Point(393, 24);
this.lblManual.Name = "lblManual";
this.lblManual.Size = new System.Drawing.Size(65, 17);
this.lblManual.TabIndex = 3;
this.lblManual.Text = "MANUAL";
//
// lblOperacao
//
this.lblOperacao.AutoSize = true;
this.lblOperacao.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
this.lblOperacao.Location = new System.Drawing.Point(212, 24);
this.lblOperacao.Name = "lblOperacao";
this.lblOperacao.Size = new System.Drawing.Size(85, 17);
this.lblOperacao.TabIndex = 3;
this.lblOperacao.Text = "OPERAÇÃO";
//
// pnlManual
//
this.pnlManual.Location = new System.Drawing.Point(375, 44);
this.pnlManual.Name = "pnlManual";
this.pnlManual.Size = new System.Drawing.Size(100, 100);
this.pnlManual.TabIndex = 2;
//
// pnlOperacao
//
this.pnlOperacao.Location = new System.Drawing.Point(204, 44);
this.pnlOperacao.Name = "pnlOperacao";
this.pnlOperacao.Size = new System.Drawing.Size(100, 100);
this.pnlOperacao.TabIndex = 2;
//
// lblAutomatico
//
this.lblAutomatico.AutoSize = true;
this.lblAutomatico.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
this.lblAutomatico.Location = new System.Drawing.Point(18, 24);
this.lblAutomatico.Name = "lblAutomatico";
this.lblAutomatico.Size = new System.Drawing.Size(99, 17);
this.lblAutomatico.TabIndex = 1;
this.lblAutomatico.Text = "AUTOMÁTICO";
//
// pnlAutomatico
//
this.pnlAutomatico.Location = new System.Drawing.Point(18, 44);
this.pnlAutomatico.Name = "pnlAutomatico";
this.pnlAutomatico.Size = new System.Drawing.Size(100, 100);
this.pnlAutomatico.TabIndex = 0;
this.tabUltrassom.Controls.Add(this.pnlUltrassom);
this.tabUltrassom.Location = new System.Drawing.Point(4, 22);
this.tabUltrassom.Name = "tabUltrassom";
this.tabUltrassom.Padding = new System.Windows.Forms.Padding(3);
this.tabUltrassom.Size = new System.Drawing.Size(496, 522);
this.tabUltrassom.TabIndex = 4;
this.tabUltrassom.Text = "Ultrassom";
this.tabUltrassom.UseVisualStyleBackColor = true;
//
// tabOrientacao
//
@ -3986,17 +3883,17 @@
//
// chartCpu
//
chartArea16.Name = "ChartArea1";
this.chartCpu.ChartAreas.Add(chartArea16);
legend16.Name = "Legend1";
this.chartCpu.Legends.Add(legend16);
chartArea24.Name = "ChartArea1";
this.chartCpu.ChartAreas.Add(chartArea24);
legend24.Name = "Legend1";
this.chartCpu.Legends.Add(legend24);
this.chartCpu.Location = new System.Drawing.Point(2, 3);
this.chartCpu.Margin = new System.Windows.Forms.Padding(2);
this.chartCpu.Name = "chartCpu";
series16.ChartArea = "ChartArea1";
series16.Legend = "Legend1";
series16.Name = "Series1";
this.chartCpu.Series.Add(series16);
series24.ChartArea = "ChartArea1";
series24.Legend = "Legend1";
series24.Name = "Series1";
this.chartCpu.Series.Add(series24);
this.chartCpu.Size = new System.Drawing.Size(491, 389);
this.chartCpu.TabIndex = 134;
this.chartCpu.Text = "chart1";
@ -4453,6 +4350,206 @@
this.btnPlay.UseVisualStyleBackColor = true;
this.btnPlay.Click += new System.EventHandler(this.btnPlay_Click);
//
// tvwFalhas
//
this.tvwFalhas.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tvwFalhas.Location = new System.Drawing.Point(6, 161);
this.tvwFalhas.Name = "tvwFalhas";
this.tvwFalhas.Size = new System.Drawing.Size(484, 355);
this.tvwFalhas.TabIndex = 18;
//
// lblManual
//
this.lblManual.AutoSize = true;
this.lblManual.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
this.lblManual.Location = new System.Drawing.Point(393, 6);
this.lblManual.Name = "lblManual";
this.lblManual.Size = new System.Drawing.Size(65, 17);
this.lblManual.TabIndex = 16;
this.lblManual.Text = "MANUAL";
//
// lblOperacao
//
this.lblOperacao.AutoSize = true;
this.lblOperacao.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
this.lblOperacao.Location = new System.Drawing.Point(212, 6);
this.lblOperacao.Name = "lblOperacao";
this.lblOperacao.Size = new System.Drawing.Size(85, 17);
this.lblOperacao.TabIndex = 17;
this.lblOperacao.Text = "OPERAÇÃO";
//
// pnlManual
//
this.pnlManual.Location = new System.Drawing.Point(375, 26);
this.pnlManual.Name = "pnlManual";
this.pnlManual.Size = new System.Drawing.Size(100, 100);
this.pnlManual.TabIndex = 14;
//
// pnlOperacao
//
this.pnlOperacao.Location = new System.Drawing.Point(204, 26);
this.pnlOperacao.Name = "pnlOperacao";
this.pnlOperacao.Size = new System.Drawing.Size(100, 100);
this.pnlOperacao.TabIndex = 15;
//
// lblAutomatico
//
this.lblAutomatico.AutoSize = true;
this.lblAutomatico.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
this.lblAutomatico.Location = new System.Drawing.Point(18, 6);
this.lblAutomatico.Name = "lblAutomatico";
this.lblAutomatico.Size = new System.Drawing.Size(99, 17);
this.lblAutomatico.TabIndex = 13;
this.lblAutomatico.Text = "AUTOMÁTICO";
//
// pnlAutomatico
//
this.pnlAutomatico.Location = new System.Drawing.Point(18, 26);
this.pnlAutomatico.Name = "pnlAutomatico";
this.pnlAutomatico.Size = new System.Drawing.Size(100, 100);
this.pnlAutomatico.TabIndex = 12;
//
// label117
//
this.label117.AutoSize = true;
this.label117.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
this.label117.Location = new System.Drawing.Point(6, 141);
this.label117.Name = "label117";
this.label117.Size = new System.Drawing.Size(118, 17);
this.label117.TabIndex = 19;
this.label117.Text = "Código de Falhas";
//
// pnlUltrassom
//
this.pnlUltrassom.Controls.Add(this.pnlP_10);
this.pnlUltrassom.Controls.Add(this.pnlP_11);
this.pnlUltrassom.Controls.Add(this.pnlP_7);
this.pnlUltrassom.Controls.Add(this.pnlP_12);
this.pnlUltrassom.Controls.Add(this.pnlP_8);
this.pnlUltrassom.Controls.Add(this.pnlP_9);
this.pnlUltrassom.Controls.Add(this.pnlP_6);
this.pnlUltrassom.Controls.Add(this.pnlP_3);
this.pnlUltrassom.Controls.Add(this.pnlP_5);
this.pnlUltrassom.Controls.Add(this.pnlP_2);
this.pnlUltrassom.Controls.Add(this.pnlP_4);
this.pnlUltrassom.Controls.Add(this.pnlP_1);
this.pnlUltrassom.Controls.Add(this.picRobo);
this.pnlUltrassom.Location = new System.Drawing.Point(6, 6);
this.pnlUltrassom.Name = "pnlUltrassom";
this.pnlUltrassom.Size = new System.Drawing.Size(484, 510);
this.pnlUltrassom.TabIndex = 19;
//
// pnlP_10
//
this.pnlP_10.BackColor = System.Drawing.Color.Red;
this.pnlP_10.Location = new System.Drawing.Point(346, 77);
this.pnlP_10.Name = "pnlP_10";
this.pnlP_10.Size = new System.Drawing.Size(30, 30);
this.pnlP_10.TabIndex = 6;
//
// pnlP_11
//
this.pnlP_11.BackColor = System.Drawing.Color.Red;
this.pnlP_11.Location = new System.Drawing.Point(346, 191);
this.pnlP_11.Name = "pnlP_11";
this.pnlP_11.Size = new System.Drawing.Size(30, 30);
this.pnlP_11.TabIndex = 5;
//
// pnlP_7
//
this.pnlP_7.BackColor = System.Drawing.Color.Red;
this.pnlP_7.Location = new System.Drawing.Point(99, 77);
this.pnlP_7.Name = "pnlP_7";
this.pnlP_7.Size = new System.Drawing.Size(30, 30);
this.pnlP_7.TabIndex = 3;
//
// pnlP_12
//
this.pnlP_12.BackColor = System.Drawing.Color.Red;
this.pnlP_12.Location = new System.Drawing.Point(346, 306);
this.pnlP_12.Name = "pnlP_12";
this.pnlP_12.Size = new System.Drawing.Size(30, 30);
this.pnlP_12.TabIndex = 4;
//
// pnlP_8
//
this.pnlP_8.BackColor = System.Drawing.Color.Red;
this.pnlP_8.Location = new System.Drawing.Point(99, 191);
this.pnlP_8.Name = "pnlP_8";
this.pnlP_8.Size = new System.Drawing.Size(30, 30);
this.pnlP_8.TabIndex = 3;
//
// pnlP_9
//
this.pnlP_9.BackColor = System.Drawing.Color.Red;
this.pnlP_9.Location = new System.Drawing.Point(99, 306);
this.pnlP_9.Name = "pnlP_9";
this.pnlP_9.Size = new System.Drawing.Size(30, 30);
this.pnlP_9.TabIndex = 2;
//
// pnlP_6
//
this.pnlP_6.BackColor = System.Drawing.Color.Red;
this.pnlP_6.Location = new System.Drawing.Point(286, 44);
this.pnlP_6.Name = "pnlP_6";
this.pnlP_6.Size = new System.Drawing.Size(30, 30);
this.pnlP_6.TabIndex = 5;
//
// pnlP_3
//
this.pnlP_3.BackColor = System.Drawing.Color.Red;
this.pnlP_3.Location = new System.Drawing.Point(286, 340);
this.pnlP_3.Name = "pnlP_3";
this.pnlP_3.Size = new System.Drawing.Size(30, 30);
this.pnlP_3.TabIndex = 2;
//
// pnlP_5
//
this.pnlP_5.BackColor = System.Drawing.Color.Red;
this.pnlP_5.Location = new System.Drawing.Point(223, 44);
this.pnlP_5.Name = "pnlP_5";
this.pnlP_5.Size = new System.Drawing.Size(30, 30);
this.pnlP_5.TabIndex = 4;
//
// pnlP_2
//
this.pnlP_2.BackColor = System.Drawing.Color.Red;
this.pnlP_2.Location = new System.Drawing.Point(223, 340);
this.pnlP_2.Name = "pnlP_2";
this.pnlP_2.Size = new System.Drawing.Size(30, 30);
this.pnlP_2.TabIndex = 2;
//
// pnlP_4
//
this.pnlP_4.BackColor = System.Drawing.Color.Red;
this.pnlP_4.Location = new System.Drawing.Point(159, 44);
this.pnlP_4.Name = "pnlP_4";
this.pnlP_4.Size = new System.Drawing.Size(30, 30);
this.pnlP_4.TabIndex = 3;
//
// pnlP_1
//
this.pnlP_1.BackColor = System.Drawing.Color.Red;
this.pnlP_1.Location = new System.Drawing.Point(159, 340);
this.pnlP_1.Name = "pnlP_1";
this.pnlP_1.Size = new System.Drawing.Size(30, 30);
this.pnlP_1.TabIndex = 1;
//
// picRobo
//
this.picRobo.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.picRobo.Image = global::AgroBase.Properties.Resources.robo_superior;
this.picRobo.Location = new System.Drawing.Point(3, 3);
this.picRobo.Name = "picRobo";
this.picRobo.Size = new System.Drawing.Size(478, 504);
this.picRobo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picRobo.TabIndex = 0;
this.picRobo.TabStop = false;
//
// frmResultadosOperacao
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -4479,7 +4576,8 @@
this.tabMapaDinamico.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.tabCodFalhas.ResumeLayout(false);
this.tabSituacao.ResumeLayout(false);
this.tabSituacao.PerformLayout();
this.tabDirecional.ResumeLayout(false);
this.tabDirecional.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picDIR_DT)).EndInit();
@ -4539,9 +4637,7 @@
this.gpbSEN_Filtro.ResumeLayout(false);
this.gpbSEN_Filtro.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.chartSensoriamento)).EndInit();
this.tabSinaleiros.ResumeLayout(false);
this.tabSinaleiros.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picRoboSuperior)).EndInit();
this.tabUltrassom.ResumeLayout(false);
this.tabOrientacao.ResumeLayout(false);
this.tabSonar.ResumeLayout(false);
this.tabSonar.PerformLayout();
@ -4562,6 +4658,8 @@
this.panel6.ResumeLayout(false);
this.panel6.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picCameraCaminho)).EndInit();
this.pnlUltrassom.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picRobo)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -4829,13 +4927,7 @@
private System.Windows.Forms.Label label95;
private System.Windows.Forms.Label label96;
public System.Windows.Forms.DataVisualization.Charting.Chart chartMovTensao;
private System.Windows.Forms.TabPage tabSinaleiros;
private System.Windows.Forms.Label lblManual;
private System.Windows.Forms.Label lblOperacao;
private System.Windows.Forms.Panel pnlManual;
private System.Windows.Forms.Panel pnlOperacao;
private System.Windows.Forms.Label lblAutomatico;
private System.Windows.Forms.Panel pnlAutomatico;
private System.Windows.Forms.TabPage tabUltrassom;
private System.Windows.Forms.TabPage tabOrientacao;
private System.Windows.Forms.Panel pnl3D;
private System.Windows.Forms.Panel pnlInclinacao;
@ -4861,11 +4953,6 @@
private System.Windows.Forms.TextBox txtDesvioNecessario;
private System.Windows.Forms.Label label99;
private System.Windows.Forms.CheckBox chbGrade;
private System.Windows.Forms.Label lblU1;
private System.Windows.Forms.Label lblU2;
private System.Windows.Forms.Label lblU3;
private System.Windows.Forms.Label lblU4;
private System.Windows.Forms.PictureBox picRoboSuperior;
private System.Windows.Forms.TabControl tabControl3;
private System.Windows.Forms.TabPage tabSonarRGB;
private System.Windows.Forms.TabPage tabSonarCalor;
@ -4916,12 +5003,33 @@
public System.Windows.Forms.DataVisualization.Charting.Chart chartCpu;
private System.Windows.Forms.TextBox txtDuracaoOperacao;
private System.Windows.Forms.Label label115;
private System.Windows.Forms.TabPage tabCodFalhas;
private System.Windows.Forms.TreeView tvwFalhas;
private System.Windows.Forms.TabPage tabSituacao;
private System.Windows.Forms.CheckBox chbDesenharErvas;
private System.Windows.Forms.TabPage tabErvas;
private System.Windows.Forms.DataVisualization.Charting.Chart chartErvas;
private System.Windows.Forms.TextBox txtErvasTerreno;
private System.Windows.Forms.Label label116;
private System.Windows.Forms.TreeView tvwFalhas;
private System.Windows.Forms.Label lblManual;
private System.Windows.Forms.Label lblOperacao;
private System.Windows.Forms.Panel pnlManual;
private System.Windows.Forms.Panel pnlOperacao;
private System.Windows.Forms.Label lblAutomatico;
private System.Windows.Forms.Panel pnlAutomatico;
private System.Windows.Forms.Label label117;
private System.Windows.Forms.Panel pnlUltrassom;
private System.Windows.Forms.Panel pnlP_10;
private System.Windows.Forms.Panel pnlP_11;
private System.Windows.Forms.Panel pnlP_7;
private System.Windows.Forms.Panel pnlP_12;
private System.Windows.Forms.Panel pnlP_8;
private System.Windows.Forms.Panel pnlP_9;
private System.Windows.Forms.Panel pnlP_6;
private System.Windows.Forms.Panel pnlP_3;
private System.Windows.Forms.Panel pnlP_5;
private System.Windows.Forms.Panel pnlP_2;
private System.Windows.Forms.Panel pnlP_4;
private System.Windows.Forms.Panel pnlP_1;
private System.Windows.Forms.PictureBox picRobo;
}
}

View File

@ -858,7 +858,7 @@ namespace AgroBase.Forms.Operacoes
{
var Log = LogsDirecional.Where(x => x.Modulo_ID == ID).FirstOrDefault(x => x.Momento == MomentoAtual);
double Angulo = Log?.Angulo ?? 0;
double Angulo = Math.Abs(Log?.Angulo ?? 0);
double Multiplicador = (Log?.Sentido ?? Enums.Sentido.Parado) == Enums.Sentido.Horario ? 1 : -1;
Image img = Resources.roda_superior;
if (ID.StartsWith("D"))
@ -973,7 +973,7 @@ namespace AgroBase.Forms.Operacoes
visualizador3D.AtualizarAngulos(LogWit.AngleX, LogWit.AngleY, LogWit.AngleZ);
txtTemperatura.Text = LogWit.Temperatura.ToString("0.00");
txtAltitude.Text = LogWit.Altitude.ToString("0.00");
txtPressao.Text = LogWit.Pressao.ToString("0.00");
txtPressao.Text = LogWit.Pressao + " Pa (" + (LogWit.Pressao / 101300.0).ToString("0.00") + " atm)";
var LogSen = LogsSensoriamento.FirstOrDefault(x => x.Momento == MomentoAtual);
pnlManual.BackColor = LogSen.StatusSinaleiroMN == Enums.StatusLED.Aceso ? Color.Yellow : Color.Gold;
@ -981,10 +981,46 @@ namespace AgroBase.Forms.Operacoes
pnlOperacao.BackColor = LogSen.StatusSinaleiroOP == Enums.StatusLED.Aceso ? Color.Green : Color.DarkGreen;
var LogA05 = LogsA05.FirstOrDefault(x => x.Momento == MomentoAtual);
lblU1.Text = "U1: " + LogA05.U1.ToString() + " mm";
lblU2.Text = "U2: " + LogA05.U2.ToString() + " mm";
lblU3.Text = "U3: " + LogA05.U3.ToString() + " mm";
lblU4.Text = "U4: " + LogA05.U4.ToString() + " mm";
foreach (var pnl in pnlUltrassom.Controls.OfType<Panel>().OrderBy(x => x.Name))
{
int id = int.Parse(pnl.Name.Replace("pnlP_", ""));
var _Sensor = LogA05.Configuracao.Sensores.FirstOrDefault(x => (int)x.Posicao == id);
pnl.Visible = _Sensor != null;
pnl.BackColor = LogA05.Conectado && _Sensor != null && _Sensor.SensorAtuado ? Color.Red : Color.Gray;
pnl.Tag = _Sensor != null ? $"{_Sensor.ID:00};{_Sensor.LeituraCm:F2}" : null; // Armazena o ID e a Leitura no Tag do Panel
pnl.Paint += (s, _e) =>
{
// Pega o ID e a leitura armazenados no Tag, se houver
string tag = pnl.Tag?.ToString();
if (!string.IsNullOrEmpty(tag))
{
var parts = tag.Split(';');
string sensorID = parts[0];
string leitura = parts.Length > 1 ? parts[1] : "";
Font font = new Font("Arial", 9, FontStyle.Bold);
// Calcula a posição para o ID do sensor (primeira linha)
SizeF idSize = _e.Graphics.MeasureString(sensorID, font);
float idX = (pnl.Width - idSize.Width) / 2;
float idY = (pnl.Height - idSize.Height) / 8; // Ajuste para centralizar no terço superior
_e.Graphics.DrawString(sensorID, font, Brushes.White, idX, idY);
// Calcula a posição para o valor de leitura (segunda linha)
Font fontLeitura = new Font("Arial", 7, FontStyle.Regular);
SizeF leituraSize = _e.Graphics.MeasureString(leitura, fontLeitura);
float leituraX = (pnl.Width - leituraSize.Width) / 2;
float leituraY = idY + idSize.Height + 1; // Posiciona logo abaixo do ID
_e.Graphics.DrawString(leitura, fontLeitura, Brushes.White, leituraX, leituraY);
}
};
pnl.Invalidate(); // Redesenha o Panel para aplicar as mudanças
}
}
private void AtualizarInformacoesKinect()
@ -1253,7 +1289,5 @@ namespace AgroBase.Forms.Operacoes
}
}
}
}
}

View File

@ -1,6 +1,4 @@
using AgroBase.Comum;
using AgroBase.Models;
using AgroBase.Models.Modules;
using AgroBase.Models;
using System;
using System.Data;
using System.Drawing;

View File

@ -549,7 +549,7 @@ namespace AgroBase.Forms
{
try
{
serialPort1.Write(data, start, length);
SerialService.EnviarDadosPortaSerial(serialPort1, data, start, length);
txDisplay();
}
catch

View File

@ -33,6 +33,7 @@ namespace AgroBase.Models
public byte Endereco { get; set; }
public byte[] Comando { get; set; }
public bool Enviado { get; set; } = false;
public bool ErroEnvio { get; set; } = false;
public int TamanhoEsperado { get; set; } = 3;
public int TimeoutResposta { get; set; } = 500;
public byte[] Resposta { get; set; }

View File

@ -1222,8 +1222,7 @@ namespace AgroBase.Models.Modules
await Task.Delay(500);
var Leitura = MKS057DService.DadosLeitura.FirstOrDefault(x => x.Endereco == Addr);
bool Sucesso = Leitura != null && Leitura.Entradas != null && Leitura.Entradas[0] == true;
bool Sucesso = ReferenciaEstaEmZero(Addr);
int _angulo = 45;
@ -1236,9 +1235,7 @@ namespace AgroBase.Models.Modules
DateTime Inicio = DateTime.Now;
while (!Sucesso && Inicio.AddSeconds(30) > DateTime.Now)
{
Leitura = MKS057DService.DadosLeitura.FirstOrDefault(x => x.Endereco == Addr);
Sucesso = Leitura != null && Leitura.Entradas != null && Leitura.Entradas[0] == true;
Sucesso = ReferenciaEstaEmZero(Addr);
if (Sucesso)
{
@ -1271,6 +1268,13 @@ namespace AgroBase.Models.Modules
}
}
private bool ReferenciaEstaEmZero(byte Addr)
{
var Leitura = MKS057DService.DadosLeitura.FirstOrDefault(x => x.Endereco == Addr);
bool Sucesso = Leitura != null && Leitura.Entradas != null && Leitura.Entradas[0] == true;
return Sucesso;
}
}
public class MvdMotorMOVSensorimanetoGrafico

View File

@ -708,13 +708,19 @@ namespace AgroBase.Models
OperacaoCarregar.AtualizaListaCameras(null, new List<Panel>(), false);
if (OperacaoCarregar.DispSen != null && OperacaoCarregar.DispSen.Dados.Conectado)
if (OperacaoCarregar.DispSen != null)
{
if (OperacaoCarregar.DispSen.Dados.ConfiguracaoSensorUltrassom == null)
{
OperacaoCarregar.DispSen.Dados.ConfiguracaoSensorUltrassom = UltrasonicA05Helper.CarregarConfiguracaoPadrao(ConfiguracaoSensorUltrassonico.NaoUtilizado);
}
if (OperacaoCarregar.DispSen.Dados.Conectado)
{
OperacaoCarregar.DispSen.Dados.Sinaleiros.ForEach(x => x.Comportamento = VariaveisEquipamento.ComportamentoPorStatus(StatusOperacao.NaoIniciado));
OperacaoCarregar.DispSen.Dados.Sinaleiros.First(x => x.ID == (Modo == ModoOperacao.Manual ? "LEDMN" : "LEDAT")).Comportamento.statusLED = StatusLED.Aceso;
OperacaoCarregar.DispSen.Dados.Sinaleiros.First(x => x.ID == "LEDOP").Comportamento = VariaveisEquipamento.ComportamentoPorStatus();
OperacaoCarregar.DispSen.Dados.ConfiguracaoSensorUltrassom = UltrasonicA05Helper.CarregarConfiguracaoPadrao(ConfiguracaoSensorUltrassonico.NaoUtilizado);
//OperacaoCarregar.DispSen.Dados.Sinaleiros.ForEach(x => OperacaoCarregar.DispSen.AdicionarMensagemFila(OperacaoCarregar.DispSen.Dados.Modulo_ID, x.ProtocoloComando(), true, false));
foreach (var Sinaleiro in OperacaoCarregar.DispSen.Dados.Sinaleiros)
@ -722,6 +728,7 @@ namespace AgroBase.Models
GeneralJoystick.EnviarComandoSensoriamento(S_Code.sLED, Sinaleiro.ID, Sinaleiro.Comportamento);
}
}
}
OperacaoCarregar.Controle.Angulo = OperacaoCarregar.Controle.Angulo_Max;
OperacaoCarregar.Controle.PercentualVelocidadeSP = OperacaoCarregar.Controle.PercentualVelocidadeMin;
@ -818,7 +825,7 @@ namespace AgroBase.Models
Directory.CreateDirectory(Variaveis.CaminhoOperacoes + ID + "/");
await RealizarCalibracaoInicialAsync();
await RealizarCalibragemInicialAsync();
Mapa.ReiniciarTrajetoriaDinamica();
Mapa.GerarTrajetoriaDinamica();
@ -857,8 +864,9 @@ namespace AgroBase.Models
Variaveis.OperacaoEmAndamento.Finalizando = false;
}
public async Task RealizarCalibracaoInicialAsync()
public async Task RealizarCalibragemInicialAsync()
{
var DispAtu = Variaveis.OperacaoEmAndamento.DispAtu;
if (DispAtu != null)
{
// Ligar bomba
@ -886,6 +894,16 @@ namespace AgroBase.Models
await Task.Delay(1000);
}
var DispMvd = Variaveis.OperacaoEmAndamento.DispMvd;
if (DispMvd != null)
{
// Referenciar motores de passo
if (DispMvd.Dados.Modulos.Any(x => x.DirMotor.Inicializado))
{
GeneralJoystick.EnviaComandoMotor(Keys.R);
}
}
if (KinectService.Iniciado)
{
KinectService.RecalibrarSubdivisoes();
@ -1980,10 +1998,12 @@ namespace AgroBase.Models
{
Momento = Agora,
Endereco = UltrasonicA05Service.slaveAddress,
Conectado = UltrasonicA05Service.Iniciado,
U1 = UltrasonicA05Service.DadosLeitura.U1,
U2 = UltrasonicA05Service.DadosLeitura.U2,
U3 = UltrasonicA05Service.DadosLeitura.U3,
U4 = UltrasonicA05Service.DadosLeitura.U4,
Configuracao = UltrasonicA05Service.DadosLeitura.Configuracao ?? Variaveis.OperacaoEmAndamento.DispSen.Dados.ConfiguracaoSensorUltrassom,
};
SalvarLog(T_Code.A05.ToString(), logA05, Fim);

View File

@ -1,5 +1,4 @@
using AgroBase.Services;
using OpenHardwareMonitor.Hardware;
using System;
using System.Collections.Generic;
using System.Linq;
@ -148,13 +147,13 @@ namespace AgroBase.Models
if (sensorEsquerdoFrente != null && sensorEsquerdoTras != null)
{
erroAlinhamento += (sensorEsquerdoFrente.Leitura - sensorEsquerdoTras.Leitura) * -1;
erroAlinhamento += (sensorEsquerdoFrente.LeituraCm - sensorEsquerdoTras.LeituraCm) * -1;
pesoTotal += 0.5; // Peso para o lado esquerdo
}
if (sensorDireitoFrente != null && sensorDireitoTras != null)
{
erroAlinhamento += (sensorDireitoFrente.Leitura - sensorDireitoTras.Leitura);
erroAlinhamento += (sensorDireitoFrente.LeituraCm - sensorDireitoTras.LeituraCm);
pesoTotal += 0.5; // Peso para o lado direito
}
@ -212,6 +211,7 @@ namespace AgroBase.Models
public class UltrasonicA05Model
{
public bool Conectado { get; set; }
public DateTime Momento { get; set; }
public byte Endereco { get; set; }
public int U1 { get; set; }
@ -252,7 +252,7 @@ namespace AgroBase.Models
}
}
public bool EmUso => LimiteMaximo || LimiteMinimo;
public double Leitura { get; set; }
public double LeituraCm { get; set; }
public bool SensorAtuado
{
get
@ -260,17 +260,17 @@ namespace AgroBase.Models
// Caso LimiteMinimo e LimiteMaximo estejam configurados
if (LimiteMinimo && LimiteMaximo)
{
return Leitura < (LimiteMinimoVal - MargemMinimo) || Leitura > (LimiteMaximoVal + MargemMaximo);
return LeituraCm < (LimiteMinimoVal - MargemMinimo) || LeituraCm > (LimiteMaximoVal + MargemMaximo);
}
// Caso apenas LimiteMinimo esteja configurado
else if (LimiteMinimo)
{
return Leitura < (LimiteMinimoVal - MargemMinimo);
return LeituraCm < (LimiteMinimoVal - MargemMinimo);
}
// Caso apenas LimiteMaximo esteja configurado
else if (LimiteMaximo)
{
return Leitura > (LimiteMaximoVal + MargemMaximo);
return LeituraCm > (LimiteMaximoVal + MargemMaximo);
}
return false;
}

View File

@ -21,6 +21,15 @@ namespace AgroBase.Services
}
if (_PortaBLD != null && !_PortaBLD.IsOpen)
{
if (!SerialPort.GetPortNames().Any(x => x == _PortaBLD.PortName))
{
_PortaBLD = null;
foreach (var d in SerialService.DispositivosMapeados.Where(x => x.Dispositivo == T_Code.Bld))
{
SerialService.DispositivosMapeados.Remove(d);
}
return false;
}
try
{
_PortaBLD.Open();
@ -207,6 +216,8 @@ namespace AgroBase.Services
public static async Task<bool> VerificaPortaBLD(SerialPort porta)
{
EnvioLiberado = false;
if (!Iniciado)
{
porta.Close();
@ -215,8 +226,6 @@ namespace AgroBase.Services
AtualizarPortaCOM(porta);
}
EnvioLiberado = false;
var Parametro = Parametros.First(x => x.Chave == "Versao");
List<string> Mod_IDs = new List<string>();
@ -240,7 +249,10 @@ namespace AgroBase.Services
var comando = ModbusService.ComandoGetParametro(Addr, Parametro);
EnviarComando(_PortaBLD, comando);
if (!EnviarComando(_PortaBLD, comando))
{
break;
}
var resposta = await SerialService.LerDadosDaPortaSerialAsync(_PortaBLD, 7, 1000);
DecifrarResposta(resposta, Parametro, Addr);
@ -250,18 +262,18 @@ namespace AgroBase.Services
}
}
if (Iniciado)
if (Mod_IDs.Any())
{
DefinirDispositivo(Mod_IDs);
}
else
if (!Iniciado)
{
_PortaBLD.Close();
_PortaBLD = null;
}
EnvioLiberado = true;
return Iniciado;
}
@ -354,7 +366,7 @@ namespace AgroBase.Services
((System.Timers.Timer)sender).Start();
}
private static void EnviarComando(SerialPort _Porta, byte[] Comando)
private static bool EnviarComando(SerialPort _Porta, byte[] Comando)
{
lock (FilaLock)
{
@ -368,7 +380,7 @@ namespace AgroBase.Services
}
if (_Porta.IsOpen)
{
_Porta.Write(Comando, 0, Comando.Length);
return SerialService.EnviarDadosPortaSerial(_Porta, Comando, 0, Comando.Length);
}
}
}
@ -376,6 +388,7 @@ namespace AgroBase.Services
{
throw ex;
}
return false;
}
}
@ -613,11 +626,11 @@ namespace AgroBase.Services
if (comando != null && comando.Length > 0)
{
//Console.WriteLine("Enviando comando para o endereço: " + Comando.Endereco);
EnviarComando(_PortaBLD, comando);
Comando.ErroEnvio = !EnviarComando(_PortaBLD, comando);
Comando.Enviado = true;
if (Comando.AguardaResposta)
if (Comando.AguardaResposta && !Comando.ErroEnvio)
{
byte[] resposta = await SerialService.LerDadosDaPortaSerialAsync(_PortaBLD, 7, Comando.TimeoutResposta);
bool Respondido = DecifrarResposta(resposta, Comando.Parametro, Comando.Endereco);
@ -750,6 +763,7 @@ namespace AgroBase.Services
{
public DateTime Momento { get; set; } = DateTime.Now;
public bool Enviado { get; set; } = false;
public bool ErroEnvio { get; set; } = false;
public byte Endereco { get; set; }
public ModbusParametrosModel Parametro { get; set; }
public float Valor { get; set; }

View File

@ -216,7 +216,7 @@ namespace AgroBase.Comum
try
{
_Porta.Write(Dados);
bool erroEnvio = !SerialService.EnviarDadosPortaSerial(_Porta, Dados);
//Console.WriteLine("Dados enviados: " + Dados);
lock (_logsLock)
{
@ -225,6 +225,7 @@ namespace AgroBase.Comum
Momento = DateTime.Now,
Enviado = true,
Protocolo = Dados,
ErroEnvio = erroEnvio,
});
}
}
@ -765,7 +766,7 @@ namespace AgroBase.Comum
string Recebido = "";
try
{
Recebido = _Porta.ReadLine();
Recebido = SerialService.ReadLineWithTimeout(_Porta, 2000);
}
catch (Exception ex)
{
@ -1043,6 +1044,7 @@ namespace AgroBase.Comum
public DateTime Momento { get; set; }
public string Protocolo { get; set; }
public bool Enviado { get; set; }
public bool ErroEnvio { get; set; }
}

View File

@ -7,7 +7,6 @@ using System.Globalization;
using System.IO.Ports;
using System.Linq;
using static AgroBase.Models.Enums;
using static AgroBase.Services.SerialService;
namespace AgroBase.Services
{
@ -66,7 +65,7 @@ namespace AgroBase.Services
{
if (Iniciado)
{
DispositivosMapeados.Add(new DispositivoDetalhesModel()
SerialService.DispositivosMapeados.Add(new SerialService.DispositivoDetalhesModel()
{
PortaCOM = PortaGPS.PortName,
Dispositivo = T_Code.Gps,
@ -80,7 +79,7 @@ namespace AgroBase.Services
{
if (PortaGPS.IsOpen)
{
string Recebido = PortaGPS.ReadLine();
string Recebido = SerialService.ReadLineWithTimeout(PortaGPS, 2000);
if (Recebido.Length > 2)
{
ProcessarStringNMEA(Recebido);

View File

@ -135,7 +135,11 @@ namespace AgroBase.Services
var comando = ComandoRequisitarParametros();
await AlterarStatusReleModo(Estado.Ligado);
EnviarComando(porta, comando);
if (!EnviarComando(porta, comando))
{
porta.Close();
return false;
}
await Task.Delay(1000);
var resposta = SerialService.VerificarRespostaPortasDesconhecidas(porta);
await AlterarStatusReleModo(Estado.Desligado);
@ -699,7 +703,7 @@ namespace AgroBase.Services
}
}
public static void EnviarComando(SerialPort _Porta, byte[] Comando)
public static bool EnviarComando(SerialPort _Porta, byte[] Comando)
{
if (_Porta != null)
{
@ -709,11 +713,12 @@ namespace AgroBase.Services
}
if (_Porta.IsOpen)
{
_Porta.Write(Comando, 0, Comando.Length);
Console.WriteLine($"Dados enviados LoRa: {Comando.Length}");
MensagensEnviadas++;
return SerialService.EnviarDadosPortaSerial(_Porta, Comando, 0, Comando.Length);
}
}
return false;
}
private static byte[] ComandoConfigurarModulo()

View File

@ -21,8 +21,19 @@ namespace AgroBase.Services
{
return false;
}
lock (_PortaLock)
{
if (_PortaMKS != null && !_PortaMKS.IsOpen)
{
if (!SerialPort.GetPortNames().Any(x => x == _PortaMKS.PortName))
{
_PortaMKS = null;
foreach (var d in SerialService.DispositivosMapeados.Where(x => x.Dispositivo == T_Code.Mks))
{
SerialService.DispositivosMapeados.Remove(d);
}
return false;
}
try
{
_PortaMKS.Open();
@ -31,17 +42,23 @@ namespace AgroBase.Services
{
RegisrarErrosComunicacao(0, $"Erro ao abrir porta {_PortaMKS.PortName}. Erro={ex.Message}");
//_PortaMKS = null;
AtualizarPortaCOM(new SerialPort() { PortName = _PortaMKS.PortName, BaudRate = _PortaMKS.BaudRate });
}
}
return _PortaMKS != null && _PortaMKS.IsOpen && DadosLeitura.Any(x => x.Iniciado);
}
}
}
public static int TaxaAmostragem { get; set; } = 1000;
public static SerialPort _PortaMKS = new SerialPort();
private static System.Timers.Timer tmrLoopComandos = new System.Timers.Timer() { Interval = 100, Enabled = false };
private static System.Timers.Timer tmrReceberDados = new System.Timers.Timer() { Interval = TaxaAmostragem, Enabled = false };
public static readonly object _PortaLock = new object();
public static async Task<bool> VerificaPortaMKS(SerialPort porta)
{
EnvioLiberado = false;
if (!Iniciado)
{
porta.Close();
@ -59,28 +76,42 @@ namespace AgroBase.Services
DataSended = Convert.ToByte("43");
await SendRelevantData(Addr, QueryCommand[DataSended]);
await Task.Delay(1000);
if (DadosLeitura.Any(x => x.Endereco == Addr && x.Iniciado))
bool respondido = false;
DateTime inicio = DateTime.Now;
while (!respondido && inicio.AddMilliseconds(1000) > DateTime.Now)
{
await Task.Delay(100);
respondido = DadosLeitura.Any(x => x.Endereco == Addr && x.Iniciado);
}
if (respondido)
{
Mod_IDs.Add(Modulo.Modulo_ID);
}
}
if (Mod_IDs.Any() || Iniciado)
if (Mod_IDs.Any())
{
DefinirDispositivo(Mod_IDs);
}
else
if (!Iniciado)
{
lock (_PortaLock)
{
_PortaMKS.Close();
_PortaMKS = null;
}
}
EnvioLiberado = true;
return Iniciado;
}
public static void AtualizarPortaCOM(SerialPort Porta)
{
lock (_PortaLock)
{
_PortaMKS = new SerialPort();
_PortaMKS.PortName = Porta.PortName;
@ -91,6 +122,7 @@ namespace AgroBase.Services
_PortaMKS.Open();
}
}
private static void DefinirDispositivo(List<string> Mod_IDs)
{
@ -287,6 +319,8 @@ namespace AgroBase.Services
}
private static void ReconectarPortaCOM()
{
lock (_PortaLock)
{
if (_PortaMKS == null)
{
@ -311,6 +345,7 @@ namespace AgroBase.Services
RegisrarErrosComunicacao(0, $"Erro ao reestabelecer conexão com a porta {_PortaMKS.PortName}");
}
}
}
@ -450,7 +485,6 @@ namespace AgroBase.Services
private static List<MKS057ComandoModel> FilaComandos = new List<MKS057ComandoModel>();
private static readonly object FilaLock = new object();
private static System.Timers.Timer tmrLoopComandos = new System.Timers.Timer() { Interval = 100, Enabled = false };
private static bool EnvioLiberado { get; set; } = true;
public static List<MKS057DModel> DadosLeitura = new List<MKS057DModel>();
@ -648,6 +682,8 @@ namespace AgroBase.Services
{
byte Addr = data[1];
lock (_PortaLock)
{
if (_PortaMKS == null)
{
RegisrarErrosComunicacao(Addr, "Porta serial não está definida");
@ -656,7 +692,7 @@ namespace AgroBase.Services
{
try
{
_PortaMKS.Write(data, start, length);
SerialService.EnviarDadosPortaSerial(_PortaMKS, data, start, length);
txDisplay();
}
catch
@ -669,6 +705,7 @@ namespace AgroBase.Services
RegisrarErrosComunicacao(Addr, "Porta serial não está aberta");
}
}
}
private static void port_DataReceived(object sender, SerialDataReceivedEventArgs e) // Evento de recebimento de dados da porta serial
{
@ -676,6 +713,8 @@ namespace AgroBase.Services
}
private static void ProcessarDadosRecebidos()
{
lock (_PortaLock)
{
if (_PortaMKS.IsOpen)
{
@ -691,6 +730,7 @@ namespace AgroBase.Services
}
}
}
}
private static async Task SendRelevantData(byte Addr, int data) // Verifica o tipo de dados e envia
{
@ -2283,17 +2323,19 @@ namespace AgroBase.Services
private static void rxDisplay()
{
rCHK = 0x00;
Console.Write("RX: ");
//Console.Write("RX: ");
for (int a = 0; a < Data_Number - 1; a++)
{
rCHK += SerialBuffer_RX[a];
Console.Write("{0:X2} ", SerialBuffer_RX[a]);
//Console.Write("{0:X2} ", SerialBuffer_RX[a]);
}
Console.WriteLine("{0:X2} rCHK: {1:X2} Length: {2}", SerialBuffer_RX[Data_Number > 0 ? Data_Number - 1 : Data_Number], (byte)rCHK, Data_Number);
//Console.WriteLine("{0:X2} rCHK: {1:X2} Length: {2}", SerialBuffer_RX[Data_Number > 0 ? Data_Number - 1 : Data_Number], (byte)rCHK, Data_Number);
}
private static void txDisplay()
{
return;
Console.Write("TX: ");
for (int a = 0; a < Buffer.Length; a++)
{

View File

@ -228,10 +228,14 @@ namespace AgroBase.Services
//await Task.Delay(100);
DescartarDadosBuffer();
_PortaModbus.Write(Comando.Comando, 0, Comando.Comando.Length);
Comando.ErroEnvio = !SerialService.EnviarDadosPortaSerial(_PortaModbus, Comando.Comando, 0, Comando.Comando.Length);
Comando.Enviado = true;
if (!Comando.ErroEnvio)
{
Comando.Resposta = await SerialService.LerDadosDaPortaSerialAsync(_PortaModbus, Comando.TamanhoEsperado, Comando.TimeoutResposta);
}
Comando.RespondidoEm = DateTime.Now;

View File

@ -97,7 +97,7 @@ namespace AgroBase.Services
{
try
{
if (!resposta.Any())
if (!resposta.Any() || resposta.Length < 16)
{
return false;
}

View File

@ -101,6 +101,150 @@ namespace AgroBase.Services
private static bool VarreduraEmAndamento = false;
public static bool EnviarDadosPortaSerial(SerialPort _porta, string Dados, bool DebugMode = false)
{
bool ForceDebug = false;
if (ForceDebug)
{
DebugMode = true;
}
// Verifica se a porta está definida
if (_porta == null)
{
Console.WriteLine("A porta serial não está definida.");
return false;
}
// Verifica se a porta está aberta
if (!_porta.IsOpen)
{
Console.WriteLine("A porta serial não está aberta.");
return false;
}
try
{
// Define o tempo de espera máximo para a operação de escrita
_porta.WriteTimeout = 2000; // 2 segundos de timeout para escrita (ajuste conforme necessário)
// Verifica se há dados para enviar
if (string.IsNullOrEmpty(Dados))
{
if (DebugMode)
Console.WriteLine("Nenhum dado para enviar.");
return false;
}
// Tenta enviar os dados na porta serial
_porta.Write(Dados);
if (DebugMode)
Console.WriteLine("Dados enviados com sucesso.");
return true;
}
catch (TimeoutException)
{
// Timeout ocorreu, o que significa que não foi possível escrever os dados no tempo estipulado
if (DebugMode)
Console.WriteLine("Erro: Timeout ao tentar enviar dados.");
return false;
}
catch (InvalidOperationException ex)
{
// A porta não estava aberta ou algo relacionado a uma falha de operação na porta
if (DebugMode)
Console.WriteLine("Erro: A porta serial não está aberta ou houve uma falha na operação. " + ex.Message);
return false;
}
catch (UnauthorizedAccessException ex)
{
// Caso a porta serial esteja sendo acessada por outro processo
if (DebugMode)
Console.WriteLine("Erro: Acesso negado à porta serial. " + ex.Message);
return false;
}
catch (Exception ex)
{
// Captura outros tipos de erro inesperados
if (DebugMode)
Console.WriteLine("Erro inesperado: " + ex.Message);
return false;
}
}
public static bool EnviarDadosPortaSerial(SerialPort _porta, byte[] Dados, int inicio, int comprimento, bool DebugMode = false)
{
bool ForceDebug = false;
if (ForceDebug)
{
DebugMode = true;
}
// Verifica se a porta está definida
if (_porta == null)
{
Console.WriteLine("A porta serial não está definida.");
return false;
}
// Verifica se a porta está aberta
if (!_porta.IsOpen)
{
Console.WriteLine("A porta serial não está aberta.");
return false;
}
try
{
// Define o tempo de espera máximo para a operação de escrita
_porta.WriteTimeout = 2000; // 2 segundos de timeout para escrita (ajuste conforme necessário)
// Verifica se há dados para enviar
if (Dados == null || Dados.Length == 0)
{
if (DebugMode)
Console.WriteLine("Nenhum dado para enviar.");
return false;
}
// Tenta enviar os dados na porta serial
_porta.Write(Dados, inicio, comprimento);
if (DebugMode)
Console.WriteLine("Dados enviados com sucesso.");
return true;
}
catch (TimeoutException)
{
// Timeout ocorreu, o que significa que não foi possível escrever os dados no tempo estipulado
if (DebugMode)
Console.WriteLine("Erro: Timeout ao tentar enviar dados.");
return false;
}
catch (InvalidOperationException ex)
{
// A porta não estava aberta ou algo relacionado a uma falha de operação na porta
if (DebugMode)
Console.WriteLine("Erro: A porta serial não está aberta ou houve uma falha na operação. " + ex.Message);
return false;
}
catch (UnauthorizedAccessException ex)
{
// Caso a porta serial esteja sendo acessada por outro processo
if (DebugMode)
Console.WriteLine("Erro: Acesso negado à porta serial. " + ex.Message);
return false;
}
catch (Exception ex)
{
// Captura outros tipos de erro inesperados
if (DebugMode)
Console.WriteLine("Erro inesperado: " + ex.Message);
return false;
}
}
public static async Task RealizarVarreduraPortasUSB(System.Timers.Timer tmr)
{
tmr.Interval = InteraloVerificacao;
@ -120,6 +264,7 @@ namespace AgroBase.Services
var Portas = SerialPort.GetPortNames();
var PortasNaoMapeadas = Portas.Where(x => !dispositivosMapeados.Select(y => y.PortaCOM).Contains(x)).ToList();
List<string> PortasSemResposta = new List<string>();
for (int i = 0; i < PortasNaoMapeadas.Count(); i++)
{
@ -170,7 +315,10 @@ namespace AgroBase.Services
ProtocoloCheck = Variaveis.OperacaoEmAndamento.DispAtu.Dados.ProtocoloVerificacao(true);
AtualizarConsole("Procurando dispositivo ATU");
_Porta.Write(ProtocoloCheck);
if (!EnviarDadosPortaSerial(_Porta, ProtocoloCheck))
{
continue;
}
await AguardaRespostaPorta(_Porta, 1000);
@ -185,7 +333,10 @@ namespace AgroBase.Services
ProtocoloCheck = Variaveis.OperacaoEmAndamento.DispSen.Dados.ProtocoloVerificacao(true);
AtualizarConsole("Procurando dispositivo SEN");
_Porta.Write(ProtocoloCheck);
if (!EnviarDadosPortaSerial(_Porta, ProtocoloCheck))
{
continue;
}
await AguardaRespostaPorta(_Porta, 1000);
@ -247,11 +398,17 @@ namespace AgroBase.Services
{
await ProcuraDispositivoModbus(ModbusService._PortaModbus, false);
}
if (MKS057DService.Iniciado)
lock (MKS057DService._PortaLock)
{
if (DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Mks) && MKS057DService._PortaMKS != null &&!PortasNaoMapeadas.Contains(MKS057DService._PortaMKS.PortName))
{
//await ProcuraDispositivoMKS(MKS057DService._PortaMKS);
Task.Run(async () => {
await ProcuraDispositivoMKS(MKS057DService._PortaMKS);
});
}
if (BLD300RService.Iniciado)
}
if (DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Bld) && !PortasNaoMapeadas.Contains(BLD300RService._PortaBLD.PortName))
{
await ProcuraDispositivoBLD(BLD300RService._PortaBLD);
}
@ -331,7 +488,7 @@ namespace AgroBase.Services
return false;
}
private static string ReadLineWithTimeout(SerialPort porta, int timeout)
public static string ReadLineWithTimeout(SerialPort porta, int timeout)
{
CancellationTokenSource cts = new CancellationTokenSource();
Task<string> task = Task.Run(() => porta.ReadLine(), cts.Token);
@ -472,7 +629,7 @@ namespace AgroBase.Services
{
string ProtocoloCheck = Modulo.ProtocoloVerificacao(true);
porta.Write(ProtocoloCheck);
EnviarDadosPortaSerial(porta, ProtocoloCheck);
await AguardaRespostaPorta(porta, 1000);
@ -577,11 +734,14 @@ namespace AgroBase.Services
}
private static async Task<bool> ProcuraDispositivoMKS(SerialPort porta)
{
lock (MKS057DService._PortaLock)
{
if (MKS057DService.Iniciado && porta.PortName != MKS057DService._PortaMKS.PortName)
{
return false;
}
}
if (!MKS057DService.Referenciando && (!MKS057DService.Iniciado || Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.Any(x => !x.DirMotor.MKS_Inicializado)))
{

View File

@ -125,7 +125,7 @@ namespace AgroBase.Services
for (int i = 0; i < Variaveis.OperacaoEmAndamento.DispSen.Dados.ConfiguracaoSensorUltrassom.Sensores.Count(); i++)
{
var sensor = Variaveis.OperacaoEmAndamento.DispSen.Dados.ConfiguracaoSensorUltrassom.Sensores[i];
sensor.Leitura = leituras[i];
sensor.LeituraCm = leituras[i] / 1000.0;
}
DadosLeitura.Configuracao = Variaveis.OperacaoEmAndamento.DispSen.Dados.ConfiguracaoSensorUltrassom;
}

File diff suppressed because it is too large Load Diff

View File

@ -3,3 +3,14 @@
12/09/2024 15:47:36:349 - Porta COM3 - 0: Erro ao processar fila de comandos. Erro=The port is closed.
12/09/2024 16:37:44:764 - Porta COM68 - 0: Erro ao processar fila de comandos. Erro=The port is closed.
12/09/2024 16:46:08:695 - Porta COM3 - 0: Erro ao processar fila de comandos. Erro=The port is closed.
11/11/2024 08:37:14:124 - Porta COM74 - 0: Erro ao processar fila de comandos. Erro=The port is closed.
11/11/2024 08:51:01:166 - Porta COM74 - 0: Erro ao processar fila de comandos. Erro=The port is closed.
11/11/2024 09:09:29:723 - Porta COM74 - 0: Erro ao processar fila de comandos. Erro=The port is closed.
11/11/2024 09:10:38:034 - Porta COM74 - 0: Erro ao processar fila de comandos. Erro=The port is closed.
11/11/2024 09:10:51:069 - Porta COM74 - 0: Erro ao processar fila de comandos. Erro=The port is closed.
11/11/2024 09:31:00:460 - Porta COM68 - 0: Erro ao processar fila de comandos. Erro=The port is closed.
11/11/2024 09:31:08:546 - Porta COM68 - 0: Erro ao processar fila de comandos. Erro=The port is closed.
11/11/2024 09:32:16:104 - Porta COM68 - 0: Erro ao processar fila de comandos. Erro=The port is closed.
11/11/2024 09:33:39:070 - Porta COM68 - 0: Erro ao processar fila de comandos. Erro=The port is closed.
11/11/2024 09:35:21:159 - Porta COM68 - 0: Erro ao processar fila de comandos. Erro=The port is closed.
11/11/2024 13:38:33:524 - Porta COM85 - 0: Erro ao processar fila de comandos. Erro=The port is closed.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,60 +1,60 @@
[
{
"timestamp": 1730223063.4357438,
"timestamp": 1730295218.2382877,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1730223063.4682589,
"timestamp": 1730295218.269745,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1730223063.4987152,
"timestamp": 1730295218.2992513,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1730223063.5311768,
"timestamp": 1730295218.3407083,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1730223063.5636268,
"timestamp": 1730295218.3711867,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1730223063.5956206,
"timestamp": 1730295218.40322,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1730223063.6291697,
"timestamp": 1730295218.434695,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1730223063.6596236,
"timestamp": 1730295218.4676962,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1730223063.6940958,
"timestamp": 1730295218.4993818,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1730223063.7330477,
"timestamp": 1730295218.535353,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []

View File

@ -25,7 +25,7 @@
<meta name="viewport" content="width=device-width,
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
#map_f874e23c9f6634fbbbee12e7268299a5 {
#map_bb24316082a755985574b8eccdf68f8d {
position: relative;
width: 100.0%;
height: 100.0%;
@ -39,14 +39,14 @@
<body>
<div class="folium-map" id="map_f874e23c9f6634fbbbee12e7268299a5" ></div>
<div class="folium-map" id="map_bb24316082a755985574b8eccdf68f8d" ></div>
</body>
<script>
var map_f874e23c9f6634fbbbee12e7268299a5 = L.map(
"map_f874e23c9f6634fbbbee12e7268299a5",
var map_bb24316082a755985574b8eccdf68f8d = L.map(
"map_bb24316082a755985574b8eccdf68f8d",
{
center: [0.0, 0.0],
crs: L.CRS.EPSG3857,
@ -60,13 +60,13 @@
var tile_layer_e5ecc91c27eadae77cb4743fe8d836e5 = L.tileLayer(
var tile_layer_ba7df28846484ea0aeeca5cdafc6169c = L.tileLayer(
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
{"attribution": "\u0026copy; \u003ca href=\"https://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e contributors", "detectRetina": false, "maxNativeZoom": 19, "maxZoom": 19, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}
);
tile_layer_e5ecc91c27eadae77cb4743fe8d836e5.addTo(map_f874e23c9f6634fbbbee12e7268299a5);
tile_layer_ba7df28846484ea0aeeca5cdafc6169c.addTo(map_bb24316082a755985574b8eccdf68f8d);
</script>
@ -87,7 +87,7 @@
}
trajeto_json_add({"features": []});
trajeto_json.addTo(map_f874e23c9f6634fbbbee12e7268299a5);
trajeto_json.addTo(map_bb24316082a755985574b8eccdf68f8d);
function adicionarGeometria(novaGeometria) {
trajeto_json.addData(novaGeometria);
@ -145,7 +145,7 @@
var marcadorDinamico = L.marker([0, 0], {
icon: customIcon
}).addTo(map_f874e23c9f6634fbbbee12e7268299a5);
}).addTo(map_bb24316082a755985574b8eccdf68f8d);
// Conectar ao broker MQTT
const client = mqtt.connect('ws://localhost:9001'); // Use wss para conexão segura
@ -183,7 +183,7 @@
marcadorDinamico.setRotationAngle(angulo);
adicionarCoordenada("Tj", [novaLongitude, novaLatitude]);
map_f874e23c9f6634fbbbee12e7268299a5.setView(novaPosicao, map_f874e23c9f6634fbbbee12e7268299a5.getZoom());
map_bb24316082a755985574b8eccdf68f8d.setView(novaPosicao, map_bb24316082a755985574b8eccdf68f8d.getZoom());
});
function calcularOrientacao(P1latitude, P1longitude, P2latitude, P2longitude) {

File diff suppressed because one or more lines are too long