ajustes nos comandos

This commit is contained in:
Diego Freitas 2026-03-23 21:47:53 -03:00
parent de5f1440f2
commit 903ab7f9a0
9 changed files with 204 additions and 172 deletions

View File

@ -33,19 +33,18 @@
this.lblOperacao = new System.Windows.Forms.Label(); this.lblOperacao = new System.Windows.Forms.Label();
this.gpbModulos = new System.Windows.Forms.GroupBox(); this.gpbModulos = new System.Windows.Forms.GroupBox();
this.gpbP_Knt = new System.Windows.Forms.GroupBox(); this.gpbP_Knt = new System.Windows.Forms.GroupBox();
this.chbSegmentacao = new System.Windows.Forms.CheckBox(); this.chbMatrizCusto = new System.Windows.Forms.CheckBox();
this.chbKnt_Desvio = new System.Windows.Forms.CheckBox(); this.chbImuParadaInclinacao = new System.Windows.Forms.CheckBox();
this.chbKnt_Ativado = new System.Windows.Forms.CheckBox(); this.chbOakParadaObstaculo = new System.Windows.Forms.CheckBox();
this.chbO_Knt = new System.Windows.Forms.CheckBox(); this.chbO_Snr = new System.Windows.Forms.CheckBox();
this.gpbP_Gps = new System.Windows.Forms.GroupBox(); this.gpbP_Gps = new System.Windows.Forms.GroupBox();
this.chbD_Knt = new System.Windows.Forms.CheckBox(); this.chbD_Snr = new System.Windows.Forms.CheckBox();
this.gpbP_Sen = new System.Windows.Forms.GroupBox(); this.gpbP_Sen = new System.Windows.Forms.GroupBox();
this.btnA05 = new System.Windows.Forms.Button(); this.btnA05 = new System.Windows.Forms.Button();
this.lblTemposalvarlogU = new System.Windows.Forms.Label(); this.lblTemposalvarlogU = new System.Windows.Forms.Label();
this.nudTemposalvarlog = new System.Windows.Forms.NumericUpDown(); this.nudTemposalvarlog = new System.Windows.Forms.NumericUpDown();
this.lblTemposalvarlog = new System.Windows.Forms.Label(); this.lblTemposalvarlog = new System.Windows.Forms.Label();
this.gpbP_Atu = new System.Windows.Forms.GroupBox(); this.gpbP_Atu = new System.Windows.Forms.GroupBox();
this.cmbScriptErvas = new System.Windows.Forms.ComboBox();
this.nudAtuarem = new System.Windows.Forms.NumericUpDown(); this.nudAtuarem = new System.Windows.Forms.NumericUpDown();
this.lblAtuarem = new System.Windows.Forms.Label(); this.lblAtuarem = new System.Windows.Forms.Label();
this.nudQtdCameras = new System.Windows.Forms.NumericUpDown(); this.nudQtdCameras = new System.Windows.Forms.NumericUpDown();
@ -86,6 +85,9 @@
this.nudCapacidadereservatorio = new System.Windows.Forms.NumericUpDown(); this.nudCapacidadereservatorio = new System.Windows.Forms.NumericUpDown();
this.lblUnCapcaidadereservatorio = new System.Windows.Forms.Label(); this.lblUnCapcaidadereservatorio = new System.Windows.Forms.Label();
this.lblCapacidadereservatorio = new System.Windows.Forms.Label(); this.lblCapacidadereservatorio = new System.Windows.Forms.Label();
this.chbPulverizadorAutomatico = new System.Windows.Forms.CheckBox();
this.chbDirecionalAutomatico = new System.Windows.Forms.CheckBox();
this.chbMovimentacaoAutomatica = new System.Windows.Forms.CheckBox();
this.gpbModulos.SuspendLayout(); this.gpbModulos.SuspendLayout();
this.gpbP_Knt.SuspendLayout(); this.gpbP_Knt.SuspendLayout();
this.gpbP_Sen.SuspendLayout(); this.gpbP_Sen.SuspendLayout();
@ -131,9 +133,9 @@
// gpbModulos // gpbModulos
// //
this.gpbModulos.Controls.Add(this.gpbP_Knt); this.gpbModulos.Controls.Add(this.gpbP_Knt);
this.gpbModulos.Controls.Add(this.chbO_Knt); this.gpbModulos.Controls.Add(this.chbO_Snr);
this.gpbModulos.Controls.Add(this.gpbP_Gps); this.gpbModulos.Controls.Add(this.gpbP_Gps);
this.gpbModulos.Controls.Add(this.chbD_Knt); this.gpbModulos.Controls.Add(this.chbD_Snr);
this.gpbModulos.Controls.Add(this.gpbP_Sen); this.gpbModulos.Controls.Add(this.gpbP_Sen);
this.gpbModulos.Controls.Add(this.gpbP_Atu); this.gpbModulos.Controls.Add(this.gpbP_Atu);
this.gpbModulos.Controls.Add(this.gpbP_Dir); this.gpbModulos.Controls.Add(this.gpbP_Dir);
@ -153,93 +155,93 @@
this.gpbModulos.Margin = new System.Windows.Forms.Padding(6); this.gpbModulos.Margin = new System.Windows.Forms.Padding(6);
this.gpbModulos.Name = "gpbModulos"; this.gpbModulos.Name = "gpbModulos";
this.gpbModulos.Padding = new System.Windows.Forms.Padding(6); this.gpbModulos.Padding = new System.Windows.Forms.Padding(6);
this.gpbModulos.Size = new System.Drawing.Size(1187, 289); this.gpbModulos.Size = new System.Drawing.Size(1187, 319);
this.gpbModulos.TabIndex = 3; this.gpbModulos.TabIndex = 3;
this.gpbModulos.TabStop = false; this.gpbModulos.TabStop = false;
this.gpbModulos.Text = "Módulos necessários para executar a operação"; this.gpbModulos.Text = "Módulos necessários para executar a operação";
// //
// gpbP_Knt // gpbP_Knt
// //
this.gpbP_Knt.Controls.Add(this.chbSegmentacao); this.gpbP_Knt.Controls.Add(this.chbMatrizCusto);
this.gpbP_Knt.Controls.Add(this.chbKnt_Desvio); this.gpbP_Knt.Controls.Add(this.chbImuParadaInclinacao);
this.gpbP_Knt.Controls.Add(this.chbKnt_Ativado); this.gpbP_Knt.Controls.Add(this.chbOakParadaObstaculo);
this.gpbP_Knt.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.gpbP_Knt.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gpbP_Knt.Location = new System.Drawing.Point(988, 105); this.gpbP_Knt.Location = new System.Drawing.Point(988, 105);
this.gpbP_Knt.Name = "gpbP_Knt"; this.gpbP_Knt.Name = "gpbP_Knt";
this.gpbP_Knt.Size = new System.Drawing.Size(190, 168); this.gpbP_Knt.Size = new System.Drawing.Size(190, 187);
this.gpbP_Knt.TabIndex = 15; this.gpbP_Knt.TabIndex = 15;
this.gpbP_Knt.TabStop = false; this.gpbP_Knt.TabStop = false;
this.gpbP_Knt.Text = "Ajustes"; this.gpbP_Knt.Text = "Ajustes";
// //
// chbSegmentacao // chbMatrizCusto
// //
this.chbSegmentacao.AutoSize = true; this.chbMatrizCusto.AutoSize = true;
this.chbSegmentacao.Location = new System.Drawing.Point(10, 94); this.chbMatrizCusto.Location = new System.Drawing.Point(10, 94);
this.chbSegmentacao.Margin = new System.Windows.Forms.Padding(6); this.chbMatrizCusto.Margin = new System.Windows.Forms.Padding(6);
this.chbSegmentacao.Name = "chbSegmentacao"; this.chbMatrizCusto.Name = "chbMatrizCusto";
this.chbSegmentacao.Size = new System.Drawing.Size(128, 24); this.chbMatrizCusto.Size = new System.Drawing.Size(139, 24);
this.chbSegmentacao.TabIndex = 13; this.chbMatrizCusto.TabIndex = 13;
this.chbSegmentacao.Text = "Segmentação"; this.chbMatrizCusto.Text = "Matriz de Custo";
this.chbSegmentacao.UseVisualStyleBackColor = true; this.chbMatrizCusto.UseVisualStyleBackColor = true;
// //
// chbKnt_Desvio // chbImuParadaInclinacao
// //
this.chbKnt_Desvio.AutoSize = true; this.chbImuParadaInclinacao.AutoSize = true;
this.chbKnt_Desvio.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.chbImuParadaInclinacao.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.chbKnt_Desvio.Location = new System.Drawing.Point(10, 66); this.chbImuParadaInclinacao.Location = new System.Drawing.Point(10, 66);
this.chbKnt_Desvio.Margin = new System.Windows.Forms.Padding(6); this.chbImuParadaInclinacao.Margin = new System.Windows.Forms.Padding(6);
this.chbKnt_Desvio.Name = "chbKnt_Desvio"; this.chbImuParadaInclinacao.Name = "chbImuParadaInclinacao";
this.chbKnt_Desvio.Size = new System.Drawing.Size(152, 22); this.chbImuParadaInclinacao.Size = new System.Drawing.Size(170, 22);
this.chbKnt_Desvio.TabIndex = 9; this.chbImuParadaInclinacao.TabIndex = 9;
this.chbKnt_Desvio.Text = "Desvio Automático"; this.chbImuParadaInclinacao.Text = "Parada por inclinação";
this.chbKnt_Desvio.UseVisualStyleBackColor = true; this.chbImuParadaInclinacao.UseVisualStyleBackColor = true;
// //
// chbKnt_Ativado // chbOakParadaObstaculo
// //
this.chbKnt_Ativado.AutoSize = true; this.chbOakParadaObstaculo.AutoSize = true;
this.chbKnt_Ativado.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.chbOakParadaObstaculo.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.chbKnt_Ativado.Location = new System.Drawing.Point(10, 32); this.chbOakParadaObstaculo.Location = new System.Drawing.Point(10, 32);
this.chbKnt_Ativado.Margin = new System.Windows.Forms.Padding(6); this.chbOakParadaObstaculo.Margin = new System.Windows.Forms.Padding(6);
this.chbKnt_Ativado.Name = "chbKnt_Ativado"; this.chbOakParadaObstaculo.Name = "chbOakParadaObstaculo";
this.chbKnt_Ativado.Size = new System.Drawing.Size(119, 22); this.chbOakParadaObstaculo.Size = new System.Drawing.Size(169, 22);
this.chbKnt_Ativado.TabIndex = 8; this.chbOakParadaObstaculo.TabIndex = 8;
this.chbKnt_Ativado.Text = "Sonar Ativado"; this.chbOakParadaObstaculo.Text = "Parada por obstáculo";
this.chbKnt_Ativado.UseVisualStyleBackColor = true; this.chbOakParadaObstaculo.UseVisualStyleBackColor = true;
// //
// chbO_Knt // chbO_Snr
// //
this.chbO_Knt.AutoSize = true; this.chbO_Snr.AutoSize = true;
this.chbO_Knt.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.chbO_Snr.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.chbO_Knt.Location = new System.Drawing.Point(998, 74); this.chbO_Snr.Location = new System.Drawing.Point(998, 74);
this.chbO_Knt.Margin = new System.Windows.Forms.Padding(6); this.chbO_Snr.Margin = new System.Windows.Forms.Padding(6);
this.chbO_Knt.Name = "chbO_Knt"; this.chbO_Snr.Name = "chbO_Snr";
this.chbO_Knt.Size = new System.Drawing.Size(86, 22); this.chbO_Snr.Size = new System.Drawing.Size(86, 22);
this.chbO_Knt.TabIndex = 14; this.chbO_Snr.TabIndex = 14;
this.chbO_Knt.Text = "Opcional"; this.chbO_Snr.Text = "Opcional";
this.chbO_Knt.UseVisualStyleBackColor = true; this.chbO_Snr.UseVisualStyleBackColor = true;
this.chbO_Knt.CheckedChanged += new System.EventHandler(this.chbO_CheckedChanged); this.chbO_Snr.CheckedChanged += new System.EventHandler(this.chbO_CheckedChanged);
// //
// gpbP_Gps // gpbP_Gps
// //
this.gpbP_Gps.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.gpbP_Gps.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gpbP_Gps.Location = new System.Drawing.Point(792, 105); this.gpbP_Gps.Location = new System.Drawing.Point(792, 105);
this.gpbP_Gps.Name = "gpbP_Gps"; this.gpbP_Gps.Name = "gpbP_Gps";
this.gpbP_Gps.Size = new System.Drawing.Size(190, 168); this.gpbP_Gps.Size = new System.Drawing.Size(190, 187);
this.gpbP_Gps.TabIndex = 12; this.gpbP_Gps.TabIndex = 12;
this.gpbP_Gps.TabStop = false; this.gpbP_Gps.TabStop = false;
this.gpbP_Gps.Text = "Ajustes"; this.gpbP_Gps.Text = "Ajustes";
// //
// chbD_Knt // chbD_Snr
// //
this.chbD_Knt.AutoSize = true; this.chbD_Snr.AutoSize = true;
this.chbD_Knt.Location = new System.Drawing.Point(998, 34); this.chbD_Snr.Location = new System.Drawing.Point(998, 34);
this.chbD_Knt.Margin = new System.Windows.Forms.Padding(6); this.chbD_Snr.Margin = new System.Windows.Forms.Padding(6);
this.chbD_Knt.Name = "chbD_Knt"; this.chbD_Snr.Name = "chbD_Snr";
this.chbD_Knt.Size = new System.Drawing.Size(81, 28); this.chbD_Snr.Size = new System.Drawing.Size(79, 28);
this.chbD_Knt.TabIndex = 13; this.chbD_Snr.TabIndex = 13;
this.chbD_Knt.Text = "Kinect"; this.chbD_Snr.Text = "Sonar";
this.chbD_Knt.UseVisualStyleBackColor = true; this.chbD_Snr.UseVisualStyleBackColor = true;
this.chbD_Knt.CheckedChanged += new System.EventHandler(this.chbD_CheckedChanged); this.chbD_Snr.CheckedChanged += new System.EventHandler(this.chbD_CheckedChanged);
// //
// gpbP_Sen // gpbP_Sen
// //
@ -250,7 +252,7 @@
this.gpbP_Sen.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.gpbP_Sen.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gpbP_Sen.Location = new System.Drawing.Point(596, 105); this.gpbP_Sen.Location = new System.Drawing.Point(596, 105);
this.gpbP_Sen.Name = "gpbP_Sen"; this.gpbP_Sen.Name = "gpbP_Sen";
this.gpbP_Sen.Size = new System.Drawing.Size(190, 168); this.gpbP_Sen.Size = new System.Drawing.Size(190, 187);
this.gpbP_Sen.TabIndex = 12; this.gpbP_Sen.TabIndex = 12;
this.gpbP_Sen.TabStop = false; this.gpbP_Sen.TabStop = false;
this.gpbP_Sen.Text = "Ajustes"; this.gpbP_Sen.Text = "Ajustes";
@ -306,7 +308,7 @@
// //
// gpbP_Atu // gpbP_Atu
// //
this.gpbP_Atu.Controls.Add(this.cmbScriptErvas); this.gpbP_Atu.Controls.Add(this.chbPulverizadorAutomatico);
this.gpbP_Atu.Controls.Add(this.nudAtuarem); this.gpbP_Atu.Controls.Add(this.nudAtuarem);
this.gpbP_Atu.Controls.Add(this.lblAtuarem); this.gpbP_Atu.Controls.Add(this.lblAtuarem);
this.gpbP_Atu.Controls.Add(this.nudQtdCameras); this.gpbP_Atu.Controls.Add(this.nudQtdCameras);
@ -316,20 +318,11 @@
this.gpbP_Atu.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.gpbP_Atu.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gpbP_Atu.Location = new System.Drawing.Point(400, 105); this.gpbP_Atu.Location = new System.Drawing.Point(400, 105);
this.gpbP_Atu.Name = "gpbP_Atu"; this.gpbP_Atu.Name = "gpbP_Atu";
this.gpbP_Atu.Size = new System.Drawing.Size(190, 168); this.gpbP_Atu.Size = new System.Drawing.Size(190, 187);
this.gpbP_Atu.TabIndex = 12; this.gpbP_Atu.TabIndex = 12;
this.gpbP_Atu.TabStop = false; this.gpbP_Atu.TabStop = false;
this.gpbP_Atu.Text = "Ajustes"; this.gpbP_Atu.Text = "Ajustes";
// //
// cmbScriptErvas
//
this.cmbScriptErvas.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbScriptErvas.FormattingEnabled = true;
this.cmbScriptErvas.Location = new System.Drawing.Point(6, 129);
this.cmbScriptErvas.Name = "cmbScriptErvas";
this.cmbScriptErvas.Size = new System.Drawing.Size(178, 28);
this.cmbScriptErvas.TabIndex = 15;
//
// nudAtuarem // nudAtuarem
// //
this.nudAtuarem.Location = new System.Drawing.Point(130, 97); this.nudAtuarem.Location = new System.Drawing.Point(130, 97);
@ -386,6 +379,7 @@
// //
// gpbP_Dir // gpbP_Dir
// //
this.gpbP_Dir.Controls.Add(this.chbDirecionalAutomatico);
this.gpbP_Dir.Controls.Add(this.lblAngulomax); this.gpbP_Dir.Controls.Add(this.lblAngulomax);
this.gpbP_Dir.Controls.Add(this.nudAnguloMinimo); this.gpbP_Dir.Controls.Add(this.nudAnguloMinimo);
this.gpbP_Dir.Controls.Add(this.nudVelocidadeMP); this.gpbP_Dir.Controls.Add(this.nudVelocidadeMP);
@ -395,7 +389,7 @@
this.gpbP_Dir.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.gpbP_Dir.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gpbP_Dir.Location = new System.Drawing.Point(204, 105); this.gpbP_Dir.Location = new System.Drawing.Point(204, 105);
this.gpbP_Dir.Name = "gpbP_Dir"; this.gpbP_Dir.Name = "gpbP_Dir";
this.gpbP_Dir.Size = new System.Drawing.Size(190, 168); this.gpbP_Dir.Size = new System.Drawing.Size(190, 187);
this.gpbP_Dir.TabIndex = 12; this.gpbP_Dir.TabIndex = 12;
this.gpbP_Dir.TabStop = false; this.gpbP_Dir.TabStop = false;
this.gpbP_Dir.Text = "Ajustes"; this.gpbP_Dir.Text = "Ajustes";
@ -476,6 +470,7 @@
// //
// gpbP_Mov // gpbP_Mov
// //
this.gpbP_Mov.Controls.Add(this.chbMovimentacaoAutomatica);
this.gpbP_Mov.Controls.Add(this.nudVelocidadeComErvas); this.gpbP_Mov.Controls.Add(this.nudVelocidadeComErvas);
this.gpbP_Mov.Controls.Add(this.lblKmhCErvas); this.gpbP_Mov.Controls.Add(this.lblKmhCErvas);
this.gpbP_Mov.Controls.Add(this.lblVelocidadeComErvas); this.gpbP_Mov.Controls.Add(this.lblVelocidadeComErvas);
@ -485,7 +480,7 @@
this.gpbP_Mov.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.gpbP_Mov.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gpbP_Mov.Location = new System.Drawing.Point(8, 105); this.gpbP_Mov.Location = new System.Drawing.Point(8, 105);
this.gpbP_Mov.Name = "gpbP_Mov"; this.gpbP_Mov.Name = "gpbP_Mov";
this.gpbP_Mov.Size = new System.Drawing.Size(190, 168); this.gpbP_Mov.Size = new System.Drawing.Size(190, 187);
this.gpbP_Mov.TabIndex = 10; this.gpbP_Mov.TabIndex = 10;
this.gpbP_Mov.TabStop = false; this.gpbP_Mov.TabStop = false;
this.gpbP_Mov.Text = "Ajustes"; this.gpbP_Mov.Text = "Ajustes";
@ -714,9 +709,9 @@
this.gpbConfiguracoesgerais.Controls.Add(this.nudCapacidadereservatorio); this.gpbConfiguracoesgerais.Controls.Add(this.nudCapacidadereservatorio);
this.gpbConfiguracoesgerais.Controls.Add(this.lblUnCapcaidadereservatorio); this.gpbConfiguracoesgerais.Controls.Add(this.lblUnCapcaidadereservatorio);
this.gpbConfiguracoesgerais.Controls.Add(this.lblCapacidadereservatorio); this.gpbConfiguracoesgerais.Controls.Add(this.lblCapacidadereservatorio);
this.gpbConfiguracoesgerais.Location = new System.Drawing.Point(15, 381); this.gpbConfiguracoesgerais.Location = new System.Drawing.Point(15, 411);
this.gpbConfiguracoesgerais.Name = "gpbConfiguracoesgerais"; this.gpbConfiguracoesgerais.Name = "gpbConfiguracoesgerais";
this.gpbConfiguracoesgerais.Size = new System.Drawing.Size(1187, 286); this.gpbConfiguracoesgerais.Size = new System.Drawing.Size(1187, 256);
this.gpbConfiguracoesgerais.TabIndex = 8; this.gpbConfiguracoesgerais.TabIndex = 8;
this.gpbConfiguracoesgerais.TabStop = false; this.gpbConfiguracoesgerais.TabStop = false;
this.gpbConfiguracoesgerais.Text = "Gerais"; this.gpbConfiguracoesgerais.Text = "Gerais";
@ -778,6 +773,39 @@
this.lblCapacidadereservatorio.TabIndex = 9; this.lblCapacidadereservatorio.TabIndex = 9;
this.lblCapacidadereservatorio.Text = "Capacidade reservatório"; this.lblCapacidadereservatorio.Text = "Capacidade reservatório";
// //
// chbPulverizadorAutomatico
//
this.chbPulverizadorAutomatico.AutoSize = true;
this.chbPulverizadorAutomatico.Location = new System.Drawing.Point(10, 155);
this.chbPulverizadorAutomatico.Margin = new System.Windows.Forms.Padding(6);
this.chbPulverizadorAutomatico.Name = "chbPulverizadorAutomatico";
this.chbPulverizadorAutomatico.Size = new System.Drawing.Size(109, 24);
this.chbPulverizadorAutomatico.TabIndex = 14;
this.chbPulverizadorAutomatico.Text = "Automático";
this.chbPulverizadorAutomatico.UseVisualStyleBackColor = true;
//
// chbDirecionalAutomatico
//
this.chbDirecionalAutomatico.AutoSize = true;
this.chbDirecionalAutomatico.Location = new System.Drawing.Point(9, 155);
this.chbDirecionalAutomatico.Margin = new System.Windows.Forms.Padding(6);
this.chbDirecionalAutomatico.Name = "chbDirecionalAutomatico";
this.chbDirecionalAutomatico.Size = new System.Drawing.Size(109, 24);
this.chbDirecionalAutomatico.TabIndex = 15;
this.chbDirecionalAutomatico.Text = "Automático";
this.chbDirecionalAutomatico.UseVisualStyleBackColor = true;
//
// chbMovimentacaoAutomatica
//
this.chbMovimentacaoAutomatica.AutoSize = true;
this.chbMovimentacaoAutomatica.Location = new System.Drawing.Point(6, 155);
this.chbMovimentacaoAutomatica.Margin = new System.Windows.Forms.Padding(6);
this.chbMovimentacaoAutomatica.Name = "chbMovimentacaoAutomatica";
this.chbMovimentacaoAutomatica.Size = new System.Drawing.Size(109, 24);
this.chbMovimentacaoAutomatica.TabIndex = 16;
this.chbMovimentacaoAutomatica.Text = "Automático";
this.chbMovimentacaoAutomatica.UseVisualStyleBackColor = true;
//
// frmParametrizacaoOperacao // frmParametrizacaoOperacao
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F); this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
@ -876,14 +904,16 @@
private System.Windows.Forms.Label lblCapacidadereservatorio; private System.Windows.Forms.Label lblCapacidadereservatorio;
private System.Windows.Forms.NumericUpDown nudAtuarem; private System.Windows.Forms.NumericUpDown nudAtuarem;
private System.Windows.Forms.Label lblAtuarem; private System.Windows.Forms.Label lblAtuarem;
private System.Windows.Forms.ComboBox cmbScriptErvas;
private System.Windows.Forms.Label lblAngulomax; private System.Windows.Forms.Label lblAngulomax;
private System.Windows.Forms.Button btnA05; private System.Windows.Forms.Button btnA05;
private System.Windows.Forms.CheckBox chbSegmentacao; private System.Windows.Forms.CheckBox chbMatrizCusto;
private System.Windows.Forms.GroupBox gpbP_Knt; private System.Windows.Forms.GroupBox gpbP_Knt;
private System.Windows.Forms.CheckBox chbO_Knt; private System.Windows.Forms.CheckBox chbO_Snr;
private System.Windows.Forms.CheckBox chbD_Knt; private System.Windows.Forms.CheckBox chbD_Snr;
private System.Windows.Forms.CheckBox chbKnt_Desvio; private System.Windows.Forms.CheckBox chbImuParadaInclinacao;
private System.Windows.Forms.CheckBox chbKnt_Ativado; private System.Windows.Forms.CheckBox chbOakParadaObstaculo;
private System.Windows.Forms.CheckBox chbPulverizadorAutomatico;
private System.Windows.Forms.CheckBox chbDirecionalAutomatico;
private System.Windows.Forms.CheckBox chbMovimentacaoAutomatica;
} }
} }

View File

@ -1,5 +1,4 @@
using AgroBase.Models; using AgroBase.Models;
using AgroBase.Services;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
@ -20,8 +19,6 @@ namespace AgroBase.Forms.Operacoes
private void frmParametrizacaoOperacao_Load(object sender, EventArgs e) private void frmParametrizacaoOperacao_Load(object sender, EventArgs e)
{ {
cmbScriptErvas.Items.Clear();
cmbScriptErvas.Items.AddRange(new string[] { PythonService.ScriptWeedDetector.Replace(".py", ""), PythonService.ScriptGreenDetector.Replace(".py", "") });
CarregarParametros(); CarregarParametros();
} }
@ -52,6 +49,7 @@ namespace AgroBase.Forms.Operacoes
} }
}); });
chbMovimentacaoAutomatica.Checked = _Parametros.Controle.MovimentoAutomatico;
nudVelocidadeComErvas.Minimum = 0; nudVelocidadeComErvas.Minimum = 0;
nudVelocidadeComErvas.Maximum = 100; nudVelocidadeComErvas.Maximum = 100;
nudVelocidadeComErvas.Value = Convert.ToInt32(_Parametros.Controle.MovVelocidadeCErvasPercent); nudVelocidadeComErvas.Value = Convert.ToInt32(_Parametros.Controle.MovVelocidadeCErvasPercent);
@ -62,6 +60,8 @@ namespace AgroBase.Forms.Operacoes
lblKmhCErvas.Text = FuncoesMatematicas.ConverteMsParaKmh(FuncoesMatematicas.CalculaVelocidadeMsPercentual(_Parametros.Controle.MovVelocidadeCErvasPercent)).ToString("0.00") + " Km/h"; lblKmhCErvas.Text = FuncoesMatematicas.ConverteMsParaKmh(FuncoesMatematicas.CalculaVelocidadeMsPercentual(_Parametros.Controle.MovVelocidadeCErvasPercent)).ToString("0.00") + " Km/h";
lblKmhSErvas.Text = FuncoesMatematicas.ConverteMsParaKmh(FuncoesMatematicas.CalculaVelocidadeMsPercentual(_Parametros.Controle.MovVelocidadeSErvasPercent)).ToString("0.00") + " Km/h"; lblKmhSErvas.Text = FuncoesMatematicas.ConverteMsParaKmh(FuncoesMatematicas.CalculaVelocidadeMsPercentual(_Parametros.Controle.MovVelocidadeSErvasPercent)).ToString("0.00") + " Km/h";
chbDirecionalAutomatico.Checked = _Parametros.Controle.DirecionalAutomatico;
nudAnguloMaximo.Value = Convert.ToInt32(_Parametros.Controle.DirAnguloMaximo); nudAnguloMaximo.Value = Convert.ToInt32(_Parametros.Controle.DirAnguloMaximo);
nudAnguloMinimo.Value = Convert.ToInt32(-_Parametros.Controle.DirAnguloMaximo); nudAnguloMinimo.Value = Convert.ToInt32(-_Parametros.Controle.DirAnguloMaximo);
nudVelocidadeMP.Value = Convert.ToInt32(_Parametros.Controle.DirVelocidadeMovimento); nudVelocidadeMP.Value = Convert.ToInt32(_Parametros.Controle.DirVelocidadeMovimento);
@ -70,8 +70,12 @@ namespace AgroBase.Forms.Operacoes
nudQtdCameras.Value = _Parametros.QtdCamerasSolo ?? VariaveisEquipamento.QuantidadeCamerasSolo; nudQtdCameras.Value = _Parametros.QtdCamerasSolo ?? VariaveisEquipamento.QuantidadeCamerasSolo;
nudCapacidadereservatorio.Value = Convert.ToInt32(_Parametros.CapacidadeReservatorio); nudCapacidadereservatorio.Value = Convert.ToInt32(_Parametros.CapacidadeReservatorio);
txtDensidadeherbicida.Text = Variaveis.OperacaoEmAndamento.DispAtu.Dados.DensidadeHerbicida.ToString("0.00"); txtDensidadeherbicida.Text = Variaveis.OperacaoEmAndamento.DispAtu.Dados.DensidadeHerbicida.ToString("0.00");
chbPulverizadorAutomatico.Checked = _Parametros.Controle.PulverizadorAutomatico;
nudAtuarem.Value = Convert.ToInt32(_Parametros.Controle.AtuPercentualInicioPulverizacao); nudAtuarem.Value = Convert.ToInt32(_Parametros.Controle.AtuPercentualInicioPulverizacao);
cmbScriptErvas.SelectedIndex = cmbScriptErvas.Items.IndexOf(Variaveis.OperacaoEmAndamento.DispAtu.Dados.ScriptDeteccaoErvas.Replace(".py", ""));
chbImuParadaInclinacao.Checked = _Parametros.Controle.ImuParadaPorInclinacao;
chbOakParadaObstaculo.Checked = _Parametros.Controle.OakParadaPorObstaculo;
} }
private void chbD_CheckedChanged(object sender, EventArgs e) private void chbD_CheckedChanged(object sender, EventArgs e)
@ -126,9 +130,16 @@ namespace AgroBase.Forms.Operacoes
void SalvarOperacao() void SalvarOperacao()
{ {
Variaveis.OperacaoEmAndamento.Parametros.Controle.ImuParadaPorInclinacao = chbImuParadaInclinacao.Checked;
Variaveis.OperacaoEmAndamento.Parametros.Controle.OakParadaPorObstaculo = chbOakParadaObstaculo.Checked;
Variaveis.OperacaoEmAndamento.Parametros.ModulosMandatorios = ModulosMandatorios.Where(x => x.Utilizar).ToList(); Variaveis.OperacaoEmAndamento.Parametros.ModulosMandatorios = ModulosMandatorios.Where(x => x.Utilizar).ToList();
Variaveis.OperacaoEmAndamento.Parametros.Controle.PulverizadorAutomatico = chbPulverizadorAutomatico.Checked;
Variaveis.OperacaoEmAndamento.Parametros.Controle.AtuPercentualInicioPulverizacao = (double)(nudAtuarem.Value / 100);
Variaveis.OperacaoEmAndamento.Parametros.Controle.MovimentoAutomatico = chbMovimentacaoAutomatica.Checked;
Variaveis.OperacaoEmAndamento.Parametros.Controle.MovVelocidadeSErvasPercent = (int)(nudVelocidadeSemErvas.Value); Variaveis.OperacaoEmAndamento.Parametros.Controle.MovVelocidadeSErvasPercent = (int)(nudVelocidadeSemErvas.Value);
Variaveis.OperacaoEmAndamento.Parametros.Controle.MovVelocidadeCErvasPercent = (int)(nudVelocidadeComErvas.Value); Variaveis.OperacaoEmAndamento.Parametros.Controle.MovVelocidadeCErvasPercent = (int)(nudVelocidadeComErvas.Value);
Variaveis.OperacaoEmAndamento.Parametros.Controle.DirecionalAutomatico = chbDirecionalAutomatico.Checked;
Variaveis.OperacaoEmAndamento.Parametros.Controle.DirAnguloMaximo = (int)(nudAnguloMaximo.Value); Variaveis.OperacaoEmAndamento.Parametros.Controle.DirAnguloMaximo = (int)(nudAnguloMaximo.Value);
Variaveis.OperacaoEmAndamento.Parametros.Controle.DirVelocidadeMovimento = (int)(nudVelocidadeMP.Value); Variaveis.OperacaoEmAndamento.Parametros.Controle.DirVelocidadeMovimento = (int)(nudVelocidadeMP.Value);
Variaveis.OperacaoEmAndamento.tmrLogsInterval = (double)(nudTemposalvarlog.Value * 1000); Variaveis.OperacaoEmAndamento.tmrLogsInterval = (double)(nudTemposalvarlog.Value * 1000);
@ -136,9 +147,7 @@ namespace AgroBase.Forms.Operacoes
Variaveis.OperacaoEmAndamento.Parametros.QtdCamerasSolo = (int)nudQtdCameras.Value; Variaveis.OperacaoEmAndamento.Parametros.QtdCamerasSolo = (int)nudQtdCameras.Value;
Variaveis.OperacaoEmAndamento.Parametros.CapacidadeReservatorio = (double)nudCapacidadereservatorio.Value; Variaveis.OperacaoEmAndamento.Parametros.CapacidadeReservatorio = (double)nudCapacidadereservatorio.Value;
Variaveis.OperacaoEmAndamento.DispAtu.Dados.DensidadeHerbicida = Convert.ToDouble(txtDensidadeherbicida.Text.Replace(".", ",")); Variaveis.OperacaoEmAndamento.DispAtu.Dados.DensidadeHerbicida = Convert.ToDouble(txtDensidadeherbicida.Text.Replace(".", ","));
Variaveis.OperacaoEmAndamento.Parametros.Controle.AtuPercentualInicioPulverizacao = (double)(nudAtuarem.Value / 100);
//Variaveis.OperacaoEmAndamento.Parametros.DispAtu.Dados.ScriptDeteccaoErvas = cmbScriptErvas.Text + ".py";
if (chbSalvar.Checked) if (chbSalvar.Checked)
{ {
//OperacaoModel.SalvarOperacaoPersonalizada(Variaveis.OperacaoEmAndamento); //OperacaoModel.SalvarOperacaoPersonalizada(Variaveis.OperacaoEmAndamento);

View File

@ -263,6 +263,8 @@ namespace AgroBase.Forms
{ {
GPSModel novaPosicao = null; GPSModel novaPosicao = null;
velocidadeCarroMs = FuncoesMatematicas.CalculaVelocidadeMsPercentual(Variaveis.OperacaoEmAndamento.SimulacaoRpmControle); velocidadeCarroMs = FuncoesMatematicas.CalculaVelocidadeMsPercentual(Variaveis.OperacaoEmAndamento.SimulacaoRpmControle);
if (Variaveis.OperacaoEmAndamento.Controle.TiposControle.FirstOrDefault(x => x.Tipo == T_Code.Mov).DirecaoAtual == Direcao.Tras)
velocidadeCarroMs *= -1;
//Console.WriteLine($"RPM SP: {Variaveis.OperacaoEmAndamento.SimulacaoRpmControle} ({velocidadeCarroMs:F2} ms)"); //Console.WriteLine($"RPM SP: {Variaveis.OperacaoEmAndamento.SimulacaoRpmControle} ({velocidadeCarroMs:F2} ms)");
Variaveis.OperacaoEmAndamento.DispMvd.Dados.VelocidadeMedia = velocidadeCarroMs; Variaveis.OperacaoEmAndamento.DispMvd.Dados.VelocidadeMedia = velocidadeCarroMs;

View File

@ -515,13 +515,13 @@ namespace AgroBase
.ToList(); .ToList();
botoes_pressionados_g.ForEach(botao => botoes_pressionados_g.ForEach(botao =>
{ {
ProcessarDadosControle(botao.botao, false, valorJoy: botao.dados?.LastOrDefault()?.valor ?? 0); ProcessarDadosControle(botao.botao, false, valorJoy: botao.dados?.LastOrDefault()?.valor ?? 0, ForcarComando: true);
//Console.WriteLine($"Botao pressionado: {botao.botao}, Valor: {string.Join(", ", botao.dados.Select(y => y.valor))}"); //Console.WriteLine($"Botao pressionado: {botao.botao}, Valor: {string.Join(", ", botao.dados.Select(y => y.valor))}");
BotoesJoyPressionados.Add(botao.botao); BotoesJoyPressionados.Add(botao.botao);
}); });
_botoesSoltos.ForEach(botao => _botoesSoltos.ForEach(botao =>
{ {
ProcessarDadosControle(botao, true, valorJoy: 0); ProcessarDadosControle(botao, true, valorJoy: 0, ForcarComando: true);
//Console.WriteLine($"Botao solto: {botao}"); //Console.WriteLine($"Botao solto: {botao}");
BotoesJoyPressionados.Remove(botao); BotoesJoyPressionados.Remove(botao);
}); });
@ -537,16 +537,20 @@ namespace AgroBase
private static void EnviarComandoMotorAtualizado(DeParaComandos Comando, string ID = "", bool ForcarComando = false) private static void EnviarComandoMotorAtualizado(DeParaComandos Comando, string ID = "", bool ForcarComando = false)
{ {
bool bloqueioAutomatico =
(Variaveis.OperacaoEmAndamento.Parametros.Controle.MovimentoAutomatico && Comando.Dispositivo == T_Code.Mov) ||
(Variaveis.OperacaoEmAndamento.Parametros.Controle.DirecionalAutomatico && Comando.Dispositivo == T_Code.Dir);
bool bloqueioOperacional =
Variaveis.OperacaoEmAndamento.Calibrando ||
!Variaveis.OperacaoEmAndamento.OperacaoLiberada ||
!Variaveis.OperacaoEmAndamento.Iniciado;
bool deveInterromper = bool deveInterromper =
!Forms.IHM.frmDiagnosticos.Diagnosticando && !ForcarComando && bloqueioAutomatico ||
( !VerificaComandoValidoSonar(Comando.key) ||
Variaveis.OperacaoEmAndamento.Modo == ModoOperacao.Manual && ( (!ForcarComando && bloqueioOperacional);
Variaveis.OperacaoEmAndamento.Calibrando ||
!Variaveis.OperacaoEmAndamento.OperacaoLiberada ||
!Variaveis.OperacaoEmAndamento.Iniciado ||
!VerificaComandoValidoSonar(Comando.key)
)
);
if (deveInterromper) return; if (deveInterromper) return;
var _Controle = Variaveis.OperacaoEmAndamento.Controle; var _Controle = Variaveis.OperacaoEmAndamento.Controle;
@ -907,32 +911,11 @@ namespace AgroBase
{ {
List<Keys> ComandosImpedidos = new List<Keys>(); List<Keys> ComandosImpedidos = new List<Keys>();
var Sonar = Variaveis.OperacaoEmAndamento.Sensoriamento.OperadorVisual; var Sonar = Variaveis.OperacaoEmAndamento.Sensoriamento.OperadorVisual;
var DeveParar = Sonar?.Resumo?.DeveParar ?? false; var DeveParar = (Sonar?.Iniciado ?? false) && (Sonar?.Resumo?.DeveParar ?? false);
if (DeveParar) if (DeveParar)
{ {
ComandosImpedidos.Add(Keys.Up); ComandosImpedidos.Add(Keys.Up);
} }
if (UltrasonicA05Service.Iniciado)
{
if (UltrasonicA05Service.DadosLeitura.Configuracao._paradaFrontal)
{
ComandosImpedidos.Add(Keys.Up);
}
if (UltrasonicA05Service.DadosLeitura.Configuracao._paradaTraseira)
{
ComandosImpedidos.Add(Keys.Down);
}
if (UltrasonicA05Service.DadosLeitura.Configuracao._paradaEsquerda)
{
ComandosImpedidos.Add(Keys.Left);
}
if (UltrasonicA05Service.DadosLeitura.Configuracao._paradaDireita)
{
ComandosImpedidos.Add(Keys.Right);
}
}
return !ComandosImpedidos.Any(x => x == Comando); return !ComandosImpedidos.Any(x => x == Comando);
} }
@ -985,7 +968,7 @@ namespace AgroBase
if (!solto && valorJoy.Value < centro - deadzone) if (!solto && valorJoy.Value < centro - deadzone)
percent = (centro - valorJoy.Value) / centro; percent = (centro - valorJoy.Value) / centro;
percent = FuncoesMatematicas.Clamp(percent, 0, 1); percent = FuncoesMatematicas.Clamp(percent, 0, 1);
valorSaida = solto ? 0 : pControle.DirAnguloMaximo * percent; valorSaida = solto ? 0 : -pControle.DirAnguloMaximo * percent;
} }
else if (valorDesejado != null) else if (valorDesejado != null)
{ {
@ -1020,6 +1003,9 @@ namespace AgroBase
// DIREÇÃO DIGITAL // DIREÇÃO DIGITAL
// ========================================================= // =========================================================
case BotoesJoystick.SEsquerda: case BotoesJoystick.SEsquerda:
valorSaida = solto ? 0 : valorDesejado ?? -pControle.DirAnguloMaximo;
break;
case BotoesJoystick.SDireita: case BotoesJoystick.SDireita:
valorSaida = solto ? 0 : valorDesejado ?? pControle.DirAnguloMaximo; valorSaida = solto ? 0 : valorDesejado ?? pControle.DirAnguloMaximo;
break; break;

View File

@ -1474,26 +1474,26 @@ namespace AgroBase.Models
{ {
Variaveis.MostrarLog("[OperacaoModel] Deve enviar o comando de parada em tmrLeituras_Tick"); Variaveis.MostrarLog("[OperacaoModel] Deve enviar o comando de parada em tmrLeituras_Tick");
//GeneralJoystick.EnviaComandoMotor(Keys.Escape, Disp: T_Code.Mov, ForcarComando: true); //GeneralJoystick.EnviaComandoMotor(Keys.Escape, Disp: T_Code.Mov, ForcarComando: true);
GeneralJoystick.ProcessarDadosControle(BotoesJoystick.Xis, true); GeneralJoystick.ProcessarDadosControle(BotoesJoystick.Xis, true, ForcarComando: true);
if (Variaveis.OperacaoEmAndamento.Parametros?.Controle?.FrenagemAutomaticaAoParar ?? false) if (Variaveis.OperacaoEmAndamento.Parametros?.Controle?.FrenagemAutomaticaAoParar ?? false)
{ {
Variaveis.MostrarLog("[OperacaoModel] Deve enviar o comando de freio em tmrLeituras_Tick"); Variaveis.MostrarLog("[OperacaoModel] Deve enviar o comando de freio em tmrLeituras_Tick");
GeneralJoystick.ProcessarDadosControle(BotoesJoystick.Bolinha, false); GeneralJoystick.ProcessarDadosControle(BotoesJoystick.Bolinha, false, ForcarComando: true);
} }
} }
if (!Variaveis.OperacaoEmAndamento.OperacaoLiberada) if (!Variaveis.OperacaoEmAndamento.OperacaoLiberada)
{ {
var _Controle = Variaveis.OperacaoEmAndamento.Controle; var _Controle = Variaveis.OperacaoEmAndamento.Controle;
if ((_Controle.TiposControle?.FirstOrDefault(x => x?.Tipo == T_Code.Mov)?.UltimaDirecao ?? Direcao.Parado) != Direcao.Parado) if (_Controle.TiposControle?.FirstOrDefault(x => x?.Tipo == T_Code.Mov)?.DirecaoAtual != Direcao.Parado)
{ {
//GeneralJoystick.EnviaComandoMotor(Keys.Escape, Disp: T_Code.Mov, ForcarComando: true); //GeneralJoystick.EnviaComandoMotor(Keys.Escape, Disp: T_Code.Mov, ForcarComando: true);
GeneralJoystick.ProcessarDadosControle(BotoesJoystick.Xis, true); GeneralJoystick.ProcessarDadosControle(BotoesJoystick.Xis, true, ForcarComando: true);
} }
if ((_Controle.TiposControle?.FirstOrDefault(x => x?.Tipo == T_Code.Dir)?.UltimaDirecao ?? Direcao.Parado) != Direcao.Parado) if (_Controle.TiposControle?.FirstOrDefault(x => x?.Tipo == T_Code.Dir)?.UltimaDirecao != Direcao.Parado)
{ {
//GeneralJoystick.EnviaComandoMotor(Keys.Escape, Disp: T_Code.Dir, ForcarComando: true); //GeneralJoystick.EnviaComandoMotor(Keys.Escape, Disp: T_Code.Dir, ForcarComando: true);
GeneralJoystick.ProcessarDadosControle(BotoesJoystick.SEsquerda, true); GeneralJoystick.ProcessarDadosControle(BotoesJoystick.SEsquerda, true, ForcarComando: true);
} }
} }
} }

View File

@ -20,8 +20,8 @@ namespace OperationControl.Controls
{ {
public ObservableCollection<string> MoveModes { get; } = new(); public ObservableCollection<string> MoveModes { get; } = new();
private HashSet<Key> _pressedKeys = new(); private HashSet<Key> _pressedKeys = new();
private AgroBase.Models.Enums.Direcao _lastMovKey = AgroBase.Models.Enums.Direcao.Parado; private AgroBase.Models.Enums.BotoesJoystick _lastMovKey = AgroBase.Models.Enums.BotoesJoystick.Vazio;
private AgroBase.Models.Enums.Direcao _lastDirKey = AgroBase.Models.Enums.Direcao.Parado; private AgroBase.Models.Enums.BotoesJoystick _lastDirKey = AgroBase.Models.Enums.BotoesJoystick.Vazio;
public ManualControlPad() public ManualControlPad()
{ {
@ -336,25 +336,25 @@ namespace OperationControl.Controls
private void ManualControlPad_CommandChanged(object? sender, EventArgs e) private void ManualControlPad_CommandChanged(object? sender, EventArgs e)
{ {
AgroBase.Models.Enums.Direcao dir = AgroBase.Models.Enums.BotoesJoystick dir =
_steerCmd < 0 ? AgroBase.Models.Enums.Direcao.Esquerda : _steerCmd < 0 ? AgroBase.Models.Enums.BotoesJoystick.SEsquerda :
_steerCmd > 0 ? AgroBase.Models.Enums.Direcao.Direita : _steerCmd > 0 ? AgroBase.Models.Enums.BotoesJoystick.SDireita :
AgroBase.Models.Enums.Direcao.Parado; AgroBase.Models.Enums.BotoesJoystick.Vazio;
if (_lastDirKey != dir) if (_lastDirKey != dir)
{ {
//VariaveisControleOperacao.EnviarComandoDirecional(dir, Convert.ToInt32(AngleControl), MoveTypeControl); //VariaveisControleOperacao.EnviarComandoDirecional(dir, Convert.ToInt32(AngleControl), MoveTypeControl);
VariaveisControleOperacao.EnviarComandoDirecionalUDP(dir, Convert.ToInt32(AngleControl), MoveTypeControl); VariaveisControleOperacao.EnviarComandoDirecionalUDP(dir, dir == AgroBase.Models.Enums.BotoesJoystick.Vazio, Convert.ToInt32(AngleControl), MoveTypeControl);
_lastDirKey = dir; _lastDirKey = dir;
} }
AgroBase.Models.Enums.Direcao mov = AgroBase.Models.Enums.BotoesJoystick mov =
_throttleCmd < 0 ? AgroBase.Models.Enums.Direcao.Baixo : _throttleCmd < 0 ? AgroBase.Models.Enums.BotoesJoystick.Quadrado :
_throttleCmd > 0 ? AgroBase.Models.Enums.Direcao.Cima : _throttleCmd > 0 ? AgroBase.Models.Enums.BotoesJoystick.Xis :
AgroBase.Models.Enums.Direcao.Parado; AgroBase.Models.Enums.BotoesJoystick.Vazio;
if (_lastMovKey != mov) if (_lastMovKey != mov)
{ {
//VariaveisControleOperacao.EnviarComandoMovimentacao(mov, Convert.ToInt32(SpeedControl)); //VariaveisControleOperacao.EnviarComandoMovimentacao(mov, Convert.ToInt32(SpeedControl));
VariaveisControleOperacao.EnviarComandoMovimentacaoUDP(mov, Convert.ToInt32(SpeedControl), false); VariaveisControleOperacao.EnviarComandoMovimentacaoUDP(mov, mov == AgroBase.Models.Enums.BotoesJoystick.Vazio, Convert.ToInt32(SpeedControl), false);
_lastMovKey = mov; _lastMovKey = mov;
} }
} }

View File

@ -23,8 +23,8 @@ namespace OperationControl.ViewModels.Views.Operacao.Monitoramento
private readonly HashSet<Key> _pressedKeys = new(); private readonly HashSet<Key> _pressedKeys = new();
private Direcao _lastMovKey = Direcao.Parado; private BotoesJoystick _lastMovKey = BotoesJoystick.Vazio;
private Direcao _lastDirKey = Direcao.Parado; private BotoesJoystick _lastDirKey = BotoesJoystick.Vazio;
private bool _lastFreio = false; private bool _lastFreio = false;
public bool Habilitado public bool Habilitado
@ -287,65 +287,68 @@ namespace OperationControl.ViewModels.Views.Operacao.Monitoramento
private void RecalcularComandos() private void RecalcularComandos()
{ {
var dir = ObterDirecaoDirecional(); (BotoesJoystick dir, bool ds) = ObterDirecaoDirecional();
var mov = ObterDirecaoMovimentacao(); (BotoesJoystick mov, bool ms) = ObterDirecaoMovimentacao();
var freio = FPressionado; var freio = FPressionado;
if (_lastDirKey != dir) if (_lastDirKey != dir || ds)
{ {
VariaveisControleOperacao.EnviarComandoDirecionalUDP(dir, Convert.ToInt32(AnguloDirecional), TipoMovimentoSelecionado); VariaveisControleOperacao.EnviarComandoDirecionalUDP(dir, ds, Convert.ToInt32(AnguloDirecional), TipoMovimentoSelecionado);
_lastDirKey = dir; _lastDirKey = ds ? BotoesJoystick.Vazio : dir;
} }
if (_lastMovKey != mov || _lastFreio != freio) if (_lastMovKey != mov || _lastFreio != freio || ms)
{ {
VariaveisControleOperacao.EnviarComandoMovimentacaoUDP(mov, Convert.ToInt32(VelocidadePercentual), freio); VariaveisControleOperacao.EnviarComandoMovimentacaoUDP(mov, ms, Convert.ToInt32(VelocidadePercentual), freio);
_lastMovKey = mov; _lastMovKey = ms ? BotoesJoystick.Vazio : mov;
_lastFreio = freio; _lastFreio = freio;
} }
} }
private Direcao ObterDirecaoDirecional() private (BotoesJoystick, bool) ObterDirecaoDirecional()
{ {
if (APressionado && !DPressionado) if (APressionado && !DPressionado)
return Direcao.Esquerda; return (BotoesJoystick.SEsquerda, false);
if (DPressionado && !APressionado) if (DPressionado && !APressionado)
return Direcao.Direita; return (BotoesJoystick.SDireita, false);
return Direcao.Parado; return (_lastDirKey, _lastDirKey != BotoesJoystick.Vazio);
} }
private Direcao ObterDirecaoMovimentacao() private (BotoesJoystick, bool) ObterDirecaoMovimentacao()
{ {
if (FPressionado) if (FPressionado)
return Direcao.Parado; return (BotoesJoystick.Bolinha, false);
if (WPressionado && !SPressionado) if (WPressionado && !SPressionado)
return Direcao.Cima; return (BotoesJoystick.Xis, false);
if (SPressionado && !WPressionado) if (SPressionado && !WPressionado)
return Direcao.Baixo; return (BotoesJoystick.Quadrado, false);
return Direcao.Parado; if (_lastFreio)
return (BotoesJoystick.Bolinha, true);
else
return (_lastMovKey, _lastMovKey != BotoesJoystick.Vazio);
} }
private void EnviarNeutros() private void EnviarNeutros()
{ {
if (_lastDirKey != Direcao.Parado) if (_lastDirKey != BotoesJoystick.Vazio)
{ {
VariaveisControleOperacao.EnviarComandoDirecionalUDP(Direcao.Parado, Convert.ToInt32(AnguloDirecional), TipoMovimentoSelecionado); VariaveisControleOperacao.EnviarComandoDirecionalUDP(BotoesJoystick.SEsquerda, true, Convert.ToInt32(AnguloDirecional), TipoMovimentoSelecionado);
_lastDirKey = Direcao.Parado; _lastDirKey = BotoesJoystick.Vazio;
} }
if (_lastMovKey != Direcao.Parado || _lastFreio) if (_lastMovKey != BotoesJoystick.Vazio || _lastFreio)
{ {
VariaveisControleOperacao.EnviarComandoMovimentacaoUDP(Direcao.Parado, 0, false); VariaveisControleOperacao.EnviarComandoMovimentacaoUDP(BotoesJoystick.Xis, true, 0, false);
_lastMovKey = Direcao.Parado; _lastMovKey = BotoesJoystick.Vazio;
_lastFreio = false; _lastFreio = false;
} }
} }

View File

@ -786,7 +786,8 @@ namespace OperationControl.ViewModels.Views.Operacao.Monitoramento.Diagnostico
private void DirMovimentar() private void DirMovimentar()
{ {
if (_itemAtual?.Modulo != T_Code.Dir) return; if (_itemAtual?.Modulo != T_Code.Dir) return;
VariaveisControleOperacao.EnviarComandoDirecional(DirDirecaoSelecionada, DirAngulo, DirMovimentoSelecionado, mod_id: _itemAtual.LabelModulo); var b = AgroBase.GeneralJoystick.DeParaComandos.FirstOrDefault(x => x.direcao == DirDirecaoSelecionada);
VariaveisControleOperacao.EnviarComandoDirecional(b?.botaoJoy ?? BotoesJoystick.Vazio, DirDirecaoSelecionada == Direcao.Parado, DirAngulo, DirMovimentoSelecionado, mod_id: _itemAtual.LabelModulo);
} }
private void GpsSalvar() private void GpsSalvar()

View File

@ -1463,7 +1463,8 @@ namespace OperationControl.Windows
AgroBase.Models.Enums.Direcao direcao = (AgroBase.Models.Enums.Direcao)Enum.Parse(typeof(AgroBase.Models.Enums.Direcao), cmbDir_Direcao.Text); AgroBase.Models.Enums.Direcao direcao = (AgroBase.Models.Enums.Direcao)Enum.Parse(typeof(AgroBase.Models.Enums.Direcao), cmbDir_Direcao.Text);
double angulo = Convert.ToInt32(sldDir_Angulo.Value); double angulo = Convert.ToInt32(sldDir_Angulo.Value);
VariaveisControleOperacao.EnviarComandoDirecional(direcao, angulo, tipo, mod_id: label); var b = AgroBase.GeneralJoystick.DeParaComandos.FirstOrDefault(x => x.direcao == direcao);
VariaveisControleOperacao.EnviarComandoDirecional(b?.botaoJoy ?? AgroBase.Models.Enums.BotoesJoystick.Vazio, direcao == AgroBase.Models.Enums.Direcao.Parado, angulo, tipo, mod_id: label);
} }
private void sldDir_Angulo_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) private void sldDir_Angulo_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)