Ajustado tela para parametrizar a comunicação

This commit is contained in:
Diego Freitas 2026-03-03 16:53:58 -03:00
parent 15c0bb29cd
commit ea78440695
5 changed files with 574 additions and 440 deletions

View File

@ -30,35 +30,34 @@
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmAjustes));
this.cmbCameraCaminho = new System.Windows.Forms.ComboBox();
this.lblComunicacao = new System.Windows.Forms.Label();
this.picVoltar = new System.Windows.Forms.PictureBox();
this.picSalvar = new System.Windows.Forms.PictureBox();
this.lblCanal = new System.Windows.Forms.Label();
this.txtCanal = new System.Windows.Forms.TextBox();
this.lblEndereco = new System.Windows.Forms.Label();
this.txtEndereco = new System.Windows.Forms.TextBox();
this.cmbPower = new System.Windows.Forms.ComboBox();
this.lblPotencia = new System.Windows.Forms.Label();
this.cmbWorCycle = new System.Windows.Forms.ComboBox();
this.lblWorCycle = new System.Windows.Forms.Label();
this.cmbTransmissao = new System.Windows.Forms.ComboBox();
this.lblTransmissao = new System.Windows.Forms.Label();
this.cmbPacketSize = new System.Windows.Forms.ComboBox();
this.lblTamanhoPacote = new System.Windows.Forms.Label();
this.cmbAirRate = new System.Windows.Forms.ComboBox();
this.lblAirRate = new System.Windows.Forms.Label();
this.cmbBaudRate = new System.Windows.Forms.ComboBox();
this.lblBaudRate = new System.Windows.Forms.Label();
this.lblPortaCaminho = new System.Windows.Forms.Label();
this.lblBaseIP = new System.Windows.Forms.Label();
this.txtBaseIP = new System.Windows.Forms.TextBox();
this.picLer = new System.Windows.Forms.PictureBox();
this.picGravar = new System.Windows.Forms.PictureBox();
this.picAtualizar = new System.Windows.Forms.PictureBox();
this.cmbComunicacao = new System.Windows.Forms.ComboBox();
this.btnCalibrarSonar = new System.Windows.Forms.Button();
this.chbSonarAtivado = new System.Windows.Forms.CheckBox();
this.gpbComunicacao = new System.Windows.Forms.GroupBox();
this.gpbCameras = new System.Windows.Forms.GroupBox();
this.picCaminho = new System.Windows.Forms.PictureBox();
this.flwCamerasSolo = new System.Windows.Forms.FlowLayoutPanel();
this.gpbBase = new System.Windows.Forms.GroupBox();
this.lblPortaErvas = new System.Windows.Forms.Label();
this.gpbEquipamento = new System.Windows.Forms.GroupBox();
this.txtEquipamentoIP = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.txtEquipamentoSerial = new System.Windows.Forms.TextBox();
this.lblEquipamentoSerial = new System.Windows.Forms.Label();
this.nudPortaCaminho = new System.Windows.Forms.NumericUpDown();
this.nudPortaErvas = new System.Windows.Forms.NumericUpDown();
this.cmbInterface = new System.Windows.Forms.ComboBox();
this.lblInterface = new System.Windows.Forms.Label();
this.txtEquipamentoSubmask = new System.Windows.Forms.TextBox();
this.txtEquipamentoGateway = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.picVoltar)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picSalvar)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picLer)).BeginInit();
@ -67,6 +66,10 @@
this.gpbComunicacao.SuspendLayout();
this.gpbCameras.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picCaminho)).BeginInit();
this.gpbBase.SuspendLayout();
this.gpbEquipamento.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudPortaCaminho)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudPortaErvas)).BeginInit();
this.SuspendLayout();
//
// cmbCameraCaminho
@ -79,16 +82,6 @@
this.cmbCameraCaminho.TabIndex = 8;
this.cmbCameraCaminho.SelectedIndexChanged += new System.EventHandler(this.cmbCameraCaminho_SelectedIndexChanged);
//
// lblComunicacao
//
this.lblComunicacao.AutoSize = true;
this.lblComunicacao.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblComunicacao.Location = new System.Drawing.Point(6, 28);
this.lblComunicacao.Name = "lblComunicacao";
this.lblComunicacao.Size = new System.Drawing.Size(126, 24);
this.lblComunicacao.TabIndex = 10;
this.lblComunicacao.Text = "DISPOSITIVO";
//
// picVoltar
//
this.picVoltar.Image = global::AgroBase.Properties.Resources.voltar;
@ -109,177 +102,37 @@
this.picSalvar.TabIndex = 12;
this.picSalvar.TabStop = false;
//
// lblCanal
// lblPortaCaminho
//
this.lblCanal.AutoSize = true;
this.lblCanal.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.25F);
this.lblCanal.Location = new System.Drawing.Point(690, 153);
this.lblCanal.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblCanal.Name = "lblCanal";
this.lblCanal.Size = new System.Drawing.Size(53, 17);
this.lblCanal.TabIndex = 32;
this.lblCanal.Text = "CANAL";
this.lblPortaCaminho.AutoSize = true;
this.lblPortaCaminho.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblPortaCaminho.Location = new System.Drawing.Point(14, 106);
this.lblPortaCaminho.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblPortaCaminho.Name = "lblPortaCaminho";
this.lblPortaCaminho.Size = new System.Drawing.Size(154, 25);
this.lblPortaCaminho.TabIndex = 32;
this.lblPortaCaminho.Text = "Porta Caminho";
//
// txtCanal
// lblBaseIP
//
this.txtCanal.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtCanal.Location = new System.Drawing.Point(797, 138);
this.txtCanal.Margin = new System.Windows.Forms.Padding(2);
this.txtCanal.Name = "txtCanal";
this.txtCanal.Size = new System.Drawing.Size(189, 38);
this.txtCanal.TabIndex = 31;
this.lblBaseIP.AutoSize = true;
this.lblBaseIP.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblBaseIP.Location = new System.Drawing.Point(14, 51);
this.lblBaseIP.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblBaseIP.Name = "lblBaseIP";
this.lblBaseIP.Size = new System.Drawing.Size(31, 25);
this.lblBaseIP.TabIndex = 30;
this.lblBaseIP.Text = "IP";
//
// lblEndereco
// txtBaseIP
//
this.lblEndereco.AutoSize = true;
this.lblEndereco.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.25F);
this.lblEndereco.Location = new System.Drawing.Point(357, 102);
this.lblEndereco.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblEndereco.Name = "lblEndereco";
this.lblEndereco.Size = new System.Drawing.Size(85, 17);
this.lblEndereco.TabIndex = 30;
this.lblEndereco.Text = "ENDEREÇO";
//
// txtEndereco
//
this.txtEndereco.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtEndereco.Location = new System.Drawing.Point(459, 87);
this.txtEndereco.Margin = new System.Windows.Forms.Padding(2);
this.txtEndereco.Name = "txtEndereco";
this.txtEndereco.Size = new System.Drawing.Size(189, 38);
this.txtEndereco.TabIndex = 29;
//
// cmbPower
//
this.cmbPower.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbPower.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cmbPower.FormattingEnabled = true;
this.cmbPower.Location = new System.Drawing.Point(459, 189);
this.cmbPower.Margin = new System.Windows.Forms.Padding(2);
this.cmbPower.Name = "cmbPower";
this.cmbPower.Size = new System.Drawing.Size(189, 39);
this.cmbPower.TabIndex = 28;
//
// lblPotencia
//
this.lblPotencia.AutoSize = true;
this.lblPotencia.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.25F);
this.lblPotencia.Location = new System.Drawing.Point(357, 204);
this.lblPotencia.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblPotencia.Name = "lblPotencia";
this.lblPotencia.Size = new System.Drawing.Size(60, 17);
this.lblPotencia.TabIndex = 27;
this.lblPotencia.Text = "POWER";
//
// cmbWorCycle
//
this.cmbWorCycle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbWorCycle.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cmbWorCycle.FormattingEnabled = true;
this.cmbWorCycle.Location = new System.Drawing.Point(137, 189);
this.cmbWorCycle.Margin = new System.Windows.Forms.Padding(2);
this.cmbWorCycle.Name = "cmbWorCycle";
this.cmbWorCycle.Size = new System.Drawing.Size(189, 39);
this.cmbWorCycle.TabIndex = 26;
//
// lblWorCycle
//
this.lblWorCycle.AutoSize = true;
this.lblWorCycle.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.25F);
this.lblWorCycle.Location = new System.Drawing.Point(7, 204);
this.lblWorCycle.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblWorCycle.Name = "lblWorCycle";
this.lblWorCycle.Size = new System.Drawing.Size(90, 17);
this.lblWorCycle.TabIndex = 25;
this.lblWorCycle.Text = "WOR CYCLE";
//
// cmbTransmissao
//
this.cmbTransmissao.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbTransmissao.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cmbTransmissao.FormattingEnabled = true;
this.cmbTransmissao.Location = new System.Drawing.Point(137, 138);
this.cmbTransmissao.Margin = new System.Windows.Forms.Padding(2);
this.cmbTransmissao.Name = "cmbTransmissao";
this.cmbTransmissao.Size = new System.Drawing.Size(189, 39);
this.cmbTransmissao.TabIndex = 24;
//
// lblTransmissao
//
this.lblTransmissao.AutoSize = true;
this.lblTransmissao.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.25F);
this.lblTransmissao.Location = new System.Drawing.Point(7, 153);
this.lblTransmissao.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblTransmissao.Name = "lblTransmissao";
this.lblTransmissao.Size = new System.Drawing.Size(107, 17);
this.lblTransmissao.TabIndex = 23;
this.lblTransmissao.Text = "TRANSMISSÃO";
//
// cmbPacketSize
//
this.cmbPacketSize.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbPacketSize.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cmbPacketSize.FormattingEnabled = true;
this.cmbPacketSize.Location = new System.Drawing.Point(797, 189);
this.cmbPacketSize.Margin = new System.Windows.Forms.Padding(2);
this.cmbPacketSize.Name = "cmbPacketSize";
this.cmbPacketSize.Size = new System.Drawing.Size(189, 39);
this.cmbPacketSize.TabIndex = 22;
//
// lblTamanhoPacote
//
this.lblTamanhoPacote.AutoSize = true;
this.lblTamanhoPacote.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.25F);
this.lblTamanhoPacote.Location = new System.Drawing.Point(690, 204);
this.lblTamanhoPacote.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblTamanhoPacote.Name = "lblTamanhoPacote";
this.lblTamanhoPacote.Size = new System.Drawing.Size(96, 17);
this.lblTamanhoPacote.TabIndex = 21;
this.lblTamanhoPacote.Text = "PACKET SIZE";
//
// cmbAirRate
//
this.cmbAirRate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbAirRate.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cmbAirRate.FormattingEnabled = true;
this.cmbAirRate.Location = new System.Drawing.Point(459, 138);
this.cmbAirRate.Margin = new System.Windows.Forms.Padding(2);
this.cmbAirRate.Name = "cmbAirRate";
this.cmbAirRate.Size = new System.Drawing.Size(189, 39);
this.cmbAirRate.TabIndex = 20;
//
// lblAirRate
//
this.lblAirRate.AutoSize = true;
this.lblAirRate.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.25F);
this.lblAirRate.Location = new System.Drawing.Point(357, 153);
this.lblAirRate.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblAirRate.Name = "lblAirRate";
this.lblAirRate.Size = new System.Drawing.Size(71, 17);
this.lblAirRate.TabIndex = 19;
this.lblAirRate.Text = "AIR RATE";
//
// cmbBaudRate
//
this.cmbBaudRate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbBaudRate.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cmbBaudRate.FormattingEnabled = true;
this.cmbBaudRate.Location = new System.Drawing.Point(137, 87);
this.cmbBaudRate.Margin = new System.Windows.Forms.Padding(2);
this.cmbBaudRate.Name = "cmbBaudRate";
this.cmbBaudRate.Size = new System.Drawing.Size(189, 39);
this.cmbBaudRate.TabIndex = 18;
//
// lblBaudRate
//
this.lblBaudRate.AutoSize = true;
this.lblBaudRate.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.25F);
this.lblBaudRate.Location = new System.Drawing.Point(7, 102);
this.lblBaudRate.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblBaudRate.Name = "lblBaudRate";
this.lblBaudRate.Size = new System.Drawing.Size(87, 17);
this.lblBaudRate.TabIndex = 17;
this.lblBaudRate.Text = "BAUD RATE";
this.txtBaseIP.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtBaseIP.Location = new System.Drawing.Point(123, 42);
this.txtBaseIP.Margin = new System.Windows.Forms.Padding(2);
this.txtBaseIP.Name = "txtBaseIP";
this.txtBaseIP.Size = new System.Drawing.Size(237, 38);
this.txtBaseIP.TabIndex = 29;
this.txtBaseIP.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// picLer
//
@ -311,18 +164,6 @@
this.picAtualizar.TabIndex = 35;
this.picAtualizar.TabStop = false;
//
// cmbComunicacao
//
this.cmbComunicacao.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbComunicacao.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cmbComunicacao.FormattingEnabled = true;
this.cmbComunicacao.Location = new System.Drawing.Point(137, 18);
this.cmbComunicacao.Margin = new System.Windows.Forms.Padding(2);
this.cmbComunicacao.Name = "cmbComunicacao";
this.cmbComunicacao.Size = new System.Drawing.Size(189, 39);
this.cmbComunicacao.TabIndex = 36;
this.cmbComunicacao.SelectedIndexChanged += new System.EventHandler(this.cmbComunicacao_SelectedIndexChanged);
//
// btnCalibrarSonar
//
this.btnCalibrarSonar.Enabled = false;
@ -335,42 +176,12 @@
this.btnCalibrarSonar.UseVisualStyleBackColor = true;
this.btnCalibrarSonar.Click += new System.EventHandler(this.btnCalibrarSonar_Click);
//
// chbSonarAtivado
//
this.chbSonarAtivado.AutoSize = true;
this.chbSonarAtivado.Checked = true;
this.chbSonarAtivado.CheckState = System.Windows.Forms.CheckState.Checked;
this.chbSonarAtivado.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
this.chbSonarAtivado.Location = new System.Drawing.Point(210, 23);
this.chbSonarAtivado.Name = "chbSonarAtivado";
this.chbSonarAtivado.Size = new System.Drawing.Size(165, 24);
this.chbSonarAtivado.TabIndex = 38;
this.chbSonarAtivado.Text = "SONAR ATIVADO";
this.chbSonarAtivado.UseVisualStyleBackColor = true;
this.chbSonarAtivado.CheckedChanged += new System.EventHandler(this.chbSonarAtivado_CheckedChanged);
//
// gpbComunicacao
//
this.gpbComunicacao.Controls.Add(this.lblComunicacao);
this.gpbComunicacao.Controls.Add(this.lblBaudRate);
this.gpbComunicacao.Controls.Add(this.cmbBaudRate);
this.gpbComunicacao.Controls.Add(this.lblAirRate);
this.gpbComunicacao.Controls.Add(this.cmbComunicacao);
this.gpbComunicacao.Controls.Add(this.cmbAirRate);
this.gpbComunicacao.Controls.Add(this.gpbEquipamento);
this.gpbComunicacao.Controls.Add(this.gpbBase);
this.gpbComunicacao.Controls.Add(this.picGravar);
this.gpbComunicacao.Controls.Add(this.lblTamanhoPacote);
this.gpbComunicacao.Controls.Add(this.cmbPacketSize);
this.gpbComunicacao.Controls.Add(this.picLer);
this.gpbComunicacao.Controls.Add(this.lblTransmissao);
this.gpbComunicacao.Controls.Add(this.cmbTransmissao);
this.gpbComunicacao.Controls.Add(this.lblCanal);
this.gpbComunicacao.Controls.Add(this.lblWorCycle);
this.gpbComunicacao.Controls.Add(this.txtCanal);
this.gpbComunicacao.Controls.Add(this.cmbWorCycle);
this.gpbComunicacao.Controls.Add(this.lblEndereco);
this.gpbComunicacao.Controls.Add(this.lblPotencia);
this.gpbComunicacao.Controls.Add(this.txtEndereco);
this.gpbComunicacao.Controls.Add(this.cmbPower);
this.gpbComunicacao.Location = new System.Drawing.Point(12, 340);
this.gpbComunicacao.Name = "gpbComunicacao";
this.gpbComunicacao.Size = new System.Drawing.Size(1000, 248);
@ -384,7 +195,6 @@
this.gpbCameras.Controls.Add(this.flwCamerasSolo);
this.gpbCameras.Controls.Add(this.picVoltar);
this.gpbCameras.Controls.Add(this.picSalvar);
this.gpbCameras.Controls.Add(this.chbSonarAtivado);
this.gpbCameras.Controls.Add(this.picAtualizar);
this.gpbCameras.Controls.Add(this.btnCalibrarSonar);
this.gpbCameras.Controls.Add(this.cmbCameraCaminho);
@ -397,9 +207,10 @@
//
// picCaminho
//
this.picCaminho.Location = new System.Drawing.Point(137, 53);
this.picCaminho.BackColor = System.Drawing.Color.Black;
this.picCaminho.Location = new System.Drawing.Point(137, 19);
this.picCaminho.Name = "picCaminho";
this.picCaminho.Size = new System.Drawing.Size(320, 200);
this.picCaminho.Size = new System.Drawing.Size(320, 234);
this.picCaminho.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picCaminho.TabIndex = 37;
this.picCaminho.TabStop = false;
@ -411,6 +222,202 @@
this.flwCamerasSolo.Size = new System.Drawing.Size(531, 297);
this.flwCamerasSolo.TabIndex = 39;
//
// gpbBase
//
this.gpbBase.Controls.Add(this.nudPortaErvas);
this.gpbBase.Controls.Add(this.nudPortaCaminho);
this.gpbBase.Controls.Add(this.lblPortaErvas);
this.gpbBase.Controls.Add(this.txtBaseIP);
this.gpbBase.Controls.Add(this.lblBaseIP);
this.gpbBase.Controls.Add(this.lblPortaCaminho);
this.gpbBase.Location = new System.Drawing.Point(6, 19);
this.gpbBase.Name = "gpbBase";
this.gpbBase.Size = new System.Drawing.Size(374, 223);
this.gpbBase.TabIndex = 35;
this.gpbBase.TabStop = false;
this.gpbBase.Text = "BASE";
//
// lblPortaErvas
//
this.lblPortaErvas.AutoSize = true;
this.lblPortaErvas.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblPortaErvas.LiveSetting = System.Windows.Forms.Automation.AutomationLiveSetting.Polite;
this.lblPortaErvas.Location = new System.Drawing.Point(14, 158);
this.lblPortaErvas.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblPortaErvas.Name = "lblPortaErvas";
this.lblPortaErvas.Size = new System.Drawing.Size(124, 25);
this.lblPortaErvas.TabIndex = 34;
this.lblPortaErvas.Text = "Porta Ervas";
//
// gpbEquipamento
//
this.gpbEquipamento.Controls.Add(this.label3);
this.gpbEquipamento.Controls.Add(this.label1);
this.gpbEquipamento.Controls.Add(this.txtEquipamentoGateway);
this.gpbEquipamento.Controls.Add(this.txtEquipamentoSubmask);
this.gpbEquipamento.Controls.Add(this.lblInterface);
this.gpbEquipamento.Controls.Add(this.cmbInterface);
this.gpbEquipamento.Controls.Add(this.txtEquipamentoIP);
this.gpbEquipamento.Controls.Add(this.label2);
this.gpbEquipamento.Controls.Add(this.txtEquipamentoSerial);
this.gpbEquipamento.Controls.Add(this.lblEquipamentoSerial);
this.gpbEquipamento.Location = new System.Drawing.Point(386, 19);
this.gpbEquipamento.Name = "gpbEquipamento";
this.gpbEquipamento.Size = new System.Drawing.Size(374, 223);
this.gpbEquipamento.TabIndex = 36;
this.gpbEquipamento.TabStop = false;
this.gpbEquipamento.Text = "EQUIPAMENTO";
//
// txtEquipamentoIP
//
this.txtEquipamentoIP.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtEquipamentoIP.Location = new System.Drawing.Point(123, 149);
this.txtEquipamentoIP.Margin = new System.Windows.Forms.Padding(2);
this.txtEquipamentoIP.Name = "txtEquipamentoIP";
this.txtEquipamentoIP.Size = new System.Drawing.Size(237, 38);
this.txtEquipamentoIP.TabIndex = 29;
this.txtEquipamentoIP.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.txtEquipamentoIP.TextChanged += new System.EventHandler(this.txtEquipamentoIP_TextChanged);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(14, 158);
this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(31, 25);
this.label2.TabIndex = 30;
this.label2.Text = "IP";
//
// txtEquipamentoSerial
//
this.txtEquipamentoSerial.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtEquipamentoSerial.Location = new System.Drawing.Point(123, 42);
this.txtEquipamentoSerial.Margin = new System.Windows.Forms.Padding(2);
this.txtEquipamentoSerial.Name = "txtEquipamentoSerial";
this.txtEquipamentoSerial.ReadOnly = true;
this.txtEquipamentoSerial.Size = new System.Drawing.Size(237, 38);
this.txtEquipamentoSerial.TabIndex = 31;
this.txtEquipamentoSerial.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblEquipamentoSerial
//
this.lblEquipamentoSerial.AutoSize = true;
this.lblEquipamentoSerial.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblEquipamentoSerial.Location = new System.Drawing.Point(14, 51);
this.lblEquipamentoSerial.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblEquipamentoSerial.Name = "lblEquipamentoSerial";
this.lblEquipamentoSerial.Size = new System.Drawing.Size(67, 25);
this.lblEquipamentoSerial.TabIndex = 32;
this.lblEquipamentoSerial.Text = "Serial";
//
// nudPortaCaminho
//
this.nudPortaCaminho.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.nudPortaCaminho.Location = new System.Drawing.Point(240, 98);
this.nudPortaCaminho.Maximum = new decimal(new int[] {
9999,
0,
0,
0});
this.nudPortaCaminho.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.nudPortaCaminho.Name = "nudPortaCaminho";
this.nudPortaCaminho.Size = new System.Drawing.Size(120, 38);
this.nudPortaCaminho.TabIndex = 33;
this.nudPortaCaminho.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.nudPortaCaminho.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// nudPortaErvas
//
this.nudPortaErvas.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.nudPortaErvas.Location = new System.Drawing.Point(240, 150);
this.nudPortaErvas.Maximum = new decimal(new int[] {
9999,
0,
0,
0});
this.nudPortaErvas.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.nudPortaErvas.Name = "nudPortaErvas";
this.nudPortaErvas.Size = new System.Drawing.Size(120, 38);
this.nudPortaErvas.TabIndex = 35;
this.nudPortaErvas.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.nudPortaErvas.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// cmbInterface
//
this.cmbInterface.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbInterface.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cmbInterface.FormattingEnabled = true;
this.cmbInterface.Location = new System.Drawing.Point(123, 97);
this.cmbInterface.Name = "cmbInterface";
this.cmbInterface.Size = new System.Drawing.Size(237, 39);
this.cmbInterface.TabIndex = 33;
this.cmbInterface.SelectedIndexChanged += new System.EventHandler(this.cmbInterface_SelectedIndexChanged);
//
// lblInterface
//
this.lblInterface.AutoSize = true;
this.lblInterface.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblInterface.Location = new System.Drawing.Point(14, 106);
this.lblInterface.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblInterface.Name = "lblInterface";
this.lblInterface.Size = new System.Drawing.Size(95, 25);
this.lblInterface.TabIndex = 34;
this.lblInterface.Text = "Interface";
//
// txtEquipamentoSubmask
//
this.txtEquipamentoSubmask.Location = new System.Drawing.Point(274, 197);
this.txtEquipamentoSubmask.Name = "txtEquipamentoSubmask";
this.txtEquipamentoSubmask.Size = new System.Drawing.Size(86, 20);
this.txtEquipamentoSubmask.TabIndex = 35;
this.txtEquipamentoSubmask.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.txtEquipamentoSubmask.TextChanged += new System.EventHandler(this.txtEquipamentoSubmask_TextChanged);
//
// txtEquipamentoGateway
//
this.txtEquipamentoGateway.Location = new System.Drawing.Point(123, 197);
this.txtEquipamentoGateway.Name = "txtEquipamentoGateway";
this.txtEquipamentoGateway.Size = new System.Drawing.Size(86, 20);
this.txtEquipamentoGateway.TabIndex = 36;
this.txtEquipamentoGateway.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.txtEquipamentoGateway.TextChanged += new System.EventHandler(this.txtEquipamentoGateway_TextChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(68, 200);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(49, 13);
this.label1.TabIndex = 37;
this.label1.Text = "Gateway";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(217, 200);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(51, 13);
this.label3.TabIndex = 38;
this.label3.Text = "Submask";
//
// frmAjustes
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -433,44 +440,47 @@
((System.ComponentModel.ISupportInitialize)(this.picGravar)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picAtualizar)).EndInit();
this.gpbComunicacao.ResumeLayout(false);
this.gpbComunicacao.PerformLayout();
this.gpbCameras.ResumeLayout(false);
this.gpbCameras.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picCaminho)).EndInit();
this.gpbBase.ResumeLayout(false);
this.gpbBase.PerformLayout();
this.gpbEquipamento.ResumeLayout(false);
this.gpbEquipamento.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudPortaCaminho)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudPortaErvas)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ComboBox cmbCameraCaminho;
private System.Windows.Forms.Label lblComunicacao;
private System.Windows.Forms.PictureBox picVoltar;
private System.Windows.Forms.PictureBox picSalvar;
private System.Windows.Forms.Label lblCanal;
private System.Windows.Forms.TextBox txtCanal;
private System.Windows.Forms.Label lblEndereco;
private System.Windows.Forms.TextBox txtEndereco;
private System.Windows.Forms.ComboBox cmbPower;
private System.Windows.Forms.Label lblPotencia;
private System.Windows.Forms.ComboBox cmbWorCycle;
private System.Windows.Forms.Label lblWorCycle;
private System.Windows.Forms.ComboBox cmbTransmissao;
private System.Windows.Forms.Label lblTransmissao;
private System.Windows.Forms.ComboBox cmbPacketSize;
private System.Windows.Forms.Label lblTamanhoPacote;
private System.Windows.Forms.ComboBox cmbAirRate;
private System.Windows.Forms.Label lblAirRate;
private System.Windows.Forms.ComboBox cmbBaudRate;
private System.Windows.Forms.Label lblBaudRate;
private System.Windows.Forms.Label lblPortaCaminho;
private System.Windows.Forms.Label lblBaseIP;
private System.Windows.Forms.TextBox txtBaseIP;
private System.Windows.Forms.PictureBox picLer;
private System.Windows.Forms.PictureBox picGravar;
private System.Windows.Forms.PictureBox picAtualizar;
private System.Windows.Forms.ComboBox cmbComunicacao;
private System.Windows.Forms.Button btnCalibrarSonar;
private System.Windows.Forms.CheckBox chbSonarAtivado;
private System.Windows.Forms.GroupBox gpbComunicacao;
private System.Windows.Forms.GroupBox gpbCameras;
private System.Windows.Forms.FlowLayoutPanel flwCamerasSolo;
private System.Windows.Forms.PictureBox picCaminho;
private System.Windows.Forms.GroupBox gpbBase;
private System.Windows.Forms.Label lblPortaErvas;
private System.Windows.Forms.GroupBox gpbEquipamento;
private System.Windows.Forms.TextBox txtEquipamentoIP;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox txtEquipamentoSerial;
private System.Windows.Forms.Label lblEquipamentoSerial;
private System.Windows.Forms.NumericUpDown nudPortaErvas;
private System.Windows.Forms.NumericUpDown nudPortaCaminho;
private System.Windows.Forms.Label lblInterface;
private System.Windows.Forms.ComboBox cmbInterface;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtEquipamentoGateway;
private System.Windows.Forms.TextBox txtEquipamentoSubmask;
}
}

View File

@ -27,9 +27,9 @@ namespace AgroBase.Forms.IHM
private async void frmAjustes_Load(object sender, EventArgs e)
{
cmbComunicacao.Items.Clear();
cmbComunicacao.Items.AddRange(new string[] { "Equipamento", "Base" });
cmbComunicacao.SelectedIndex = 0;
//cmbComunicacao.Items.Clear();
//cmbComunicacao.Items.AddRange(new string[] { "Equipamento", "Base" });
//cmbComunicacao.SelectedIndex = 0;
FuncoesGlobais.DefinirEventosPicBtn(picVoltar, "", async () =>
{
@ -56,75 +56,72 @@ namespace AgroBase.Forms.IHM
});
FuncoesGlobais.DefinirEventosPicBtn(picLer, "Erro ao ler parâmetros de comunicação!", async () =>
{
if (Variaveis.LoraService.Iniciado)
{
await AtualizarParametros();
}
else
{
CustomDialog.ShowDialog(
"Alerta",
"Módulo LoRa de comunicação não está conectado ou não está no modo de parametrização!",
MessageBoxIcon.Warning,
new Dictionary<(string, dynamic), Action>()
{
{ ("OK", null), () => { } }
}
);
}
AtualizarParametrosComunicacao();
//if (Variaveis.LoraService.Iniciado)
//{
// await AtualizarParametros();
//}
//else
//{
// CustomDialog.ShowDialog(
// "Alerta",
// "Módulo LoRa de comunicação não está conectado ou não está no modo de parametrização!",
// MessageBoxIcon.Warning,
// new Dictionary<(string, dynamic), Action>()
// {
// { ("OK", null), () => { } }
// }
// );
//}
});
FuncoesGlobais.DefinirEventosPicBtn(picGravar, "Erro ao salvar parâmetros de comunicação!", async () =>
{
if (Variaveis.LoraService.Iniciado)
{
LoRaParametrosModel Parametros = new LoRaParametrosModel();
Parametros.baudRate = LoRaBaseService.CodigosBaudRates.FirstOrDefault(x => x.Key.ToString() == cmbBaudRate.Text).Value;
Parametros.tranMode = LoRaBaseService.CodigosTipoTransmissao.FirstOrDefault(x => x.Key.ToString() == cmbTransmissao.Text).Value;
Parametros.address = Convert.ToByte(txtEndereco.Text);
Parametros.channel = Convert.ToByte(txtCanal.Text);
Parametros.airRate = LoRaBaseService.CodigosAirRates.FirstOrDefault(x => x.Key.ToString() == cmbAirRate.Text).Value;
Parametros.packetSize = LoRaBaseService.CodigosPacketSizes.FirstOrDefault(x => x.Key.ToString() == cmbPacketSize.Text).Value;
Parametros.worCycle = LoRaBaseService.CodigosWorCycles.FirstOrDefault(x => x.Key.ToString() == cmbWorCycle.Text).Value;
Parametros.power = LoRaBaseService.CodigosPowers.FirstOrDefault(x => x.Key.ToString() == cmbPower.Text).Value;
await ConfigurarModulo(Parametros);
CustomDialog.ShowDialog(
"Sucesso",
"Configuração de comunicação salva com sucesso!",
MessageBoxIcon.Information,
new Dictionary<(string, dynamic), Action>()
{
{ ("OK", null), () => { } }
}
);
}
else
{
CustomDialog.ShowDialog(
"Alerta",
"Módulo LoRa de comunicação não está conectado ou não está no modo de parametrização!",
MessageBoxIcon.Warning,
new Dictionary<(string, dynamic), Action>()
{
{ ("OK", null), () => { } }
}
);
}
SalvarParametrosConfiguracao();
//if (Variaveis.LoraService.Iniciado)
//{
// LoRaParametrosModel Parametros = new LoRaParametrosModel();
//
// Parametros.baudRate = LoRaBaseService.CodigosBaudRates.FirstOrDefault(x => x.Key.ToString() == cmbBaudRate.Text).Value;
// Parametros.tranMode = LoRaBaseService.CodigosTipoTransmissao.FirstOrDefault(x => x.Key.ToString() == cmbTransmissao.Text).Value;
// Parametros.address = Convert.ToByte(txtEndereco.Text);
// Parametros.channel = Convert.ToByte(txtCanal.Text);
// Parametros.airRate = LoRaBaseService.CodigosAirRates.FirstOrDefault(x => x.Key.ToString() == cmbAirRate.Text).Value;
// Parametros.packetSize = LoRaBaseService.CodigosPacketSizes.FirstOrDefault(x => x.Key.ToString() == cmbPacketSize.Text).Value;
// Parametros.worCycle = LoRaBaseService.CodigosWorCycles.FirstOrDefault(x => x.Key.ToString() == cmbWorCycle.Text).Value;
// Parametros.power = LoRaBaseService.CodigosPowers.FirstOrDefault(x => x.Key.ToString() == cmbPower.Text).Value;
//
// await ConfigurarModulo(Parametros);
//
// CustomDialog.ShowDialog(
// "Sucesso",
// "Configuração de comunicação salva com sucesso!",
// MessageBoxIcon.Information,
// new Dictionary<(string, dynamic), Action>()
// {
// { ("OK", null), () => { } }
// }
// );
//}
//else
//{
// CustomDialog.ShowDialog(
// "Alerta",
// "Módulo LoRa de comunicação não está conectado ou não está no modo de parametrização!",
// MessageBoxIcon.Warning,
// new Dictionary<(string, dynamic), Action>()
// {
// { ("OK", null), () => { } }
// }
// );
//}
});
await AtualizarCameras();
if (Variaveis.LoraService.Iniciado)
{
await AtualizarParametros();
}
chbSonarAtivado.Enabled = KinectService.Iniciado;
if (KinectService.Iniciado)
{
chbSonarAtivado.Checked = Variaveis.OperacaoEmAndamento.Parametros.Controle.SonarAtivado;
}
//if (Variaveis.LoraService.Iniciado)
//{
// await AtualizarParametros();
//}
AtualizarParametrosComunicacao();
}
private void frmAjustes_FormClosing(object sender, FormClosingEventArgs e)
@ -132,119 +129,127 @@ namespace AgroBase.Forms.IHM
}
#region COMUNICACAO
#region LORA
private async Task AtualizarParametros()
private async Task AtualizarParametrosLoRa()
{
LoRaParametrosModel Parametros = new LoRaParametrosModel();
//LoRaParametrosModel Parametros = new LoRaParametrosModel();
if (cmbComunicacao.SelectedIndex == 0)
{
var (sucesso, par) = await Variaveis.LoraService.RequisitarParametrosModulo();
//if (cmbComunicacao.SelectedIndex == 0)
//{
// var (sucesso, par) = await Variaveis.LoraService.RequisitarParametrosModulo();
//
// if (!sucesso)
// {
// CustomDialog.ShowDialog(
// "Erro",
// "Erro ao requisitar parâmetros! Verifique o modo do módulo LoRa!",
// MessageBoxIcon.Error,
// new Dictionary<(string, dynamic), Action>()
// {
// { ("OK", null), () => { } }
// }
// );
// }
//
// Parametros = par;
//}
//else
//{
// Parametros = Variaveis.LoraBaseParametros;
//}
if (!sucesso)
{
CustomDialog.ShowDialog(
"Erro",
"Erro ao requisitar parâmetros! Verifique o modo do módulo LoRa!",
MessageBoxIcon.Error,
new Dictionary<(string, dynamic), Action>()
{
{ ("OK", null), () => { } }
}
);
}
//txtEndereco.Text = ((int)Parametros.address).ToString();
//txtCanal.Text = ((int)Parametros.channel).ToString();
Parametros = par;
}
else
{
Parametros = Variaveis.LoraBaseParametros;
}
txtEndereco.Text = ((int)Parametros.address).ToString();
txtCanal.Text = ((int)Parametros.channel).ToString();
cmbBaudRate.Items.Clear();
cmbBaudRate.Items.AddRange(LoRaBaseService.CodigosBaudRates.Keys.Select(x => x.ToString()).ToArray());
cmbBaudRate.SelectedItem = LoRaBaseService.CodigosBaudRates.FirstOrDefault(x => x.Value == Parametros.baudRate).Key.ToString();
cmbTransmissao.Items.Clear();
cmbTransmissao.Items.AddRange(LoRaBaseService.CodigosTipoTransmissao.Keys.Select(x => x.ToString()).ToArray());
cmbTransmissao.SelectedItem = LoRaBaseService.CodigosTipoTransmissao.FirstOrDefault(x => x.Value == Parametros.tranMode).Key.ToString();
cmbAirRate.Items.Clear();
cmbAirRate.Items.AddRange(LoRaBaseService.CodigosAirRates.Keys.Select(x => x.ToString()).ToArray());
cmbAirRate.SelectedItem = LoRaBaseService.CodigosAirRates.FirstOrDefault(x => x.Value == Parametros.airRate).Key.ToString();
cmbPacketSize.Items.Clear();
cmbPacketSize.Items.AddRange(LoRaBaseService.CodigosPacketSizes.Keys.Select(x => x.ToString()).ToArray());
cmbPacketSize.SelectedItem = LoRaBaseService.CodigosPacketSizes.FirstOrDefault(x => x.Value == Parametros.packetSize).Key.ToString();
cmbWorCycle.Items.Clear();
cmbWorCycle.Items.AddRange(LoRaBaseService.CodigosWorCycles.Keys.Select(x => x.ToString()).ToArray());
cmbWorCycle.SelectedItem = LoRaBaseService.CodigosWorCycles.FirstOrDefault(x => x.Value == Parametros.worCycle).Key.ToString();
cmbPower.Items.Clear();
cmbPower.Items.AddRange(LoRaBaseService.CodigosPowers.Keys.Select(x => x.ToString()).ToArray());
cmbPower.SelectedItem = LoRaBaseService.CodigosPowers.FirstOrDefault(x => x.Value == Parametros.power).Key.ToString();
//cmbBaudRate.Items.Clear();
//cmbBaudRate.Items.AddRange(LoRaBaseService.CodigosBaudRates.Keys.Select(x => x.ToString()).ToArray());
//cmbBaudRate.SelectedItem = LoRaBaseService.CodigosBaudRates.FirstOrDefault(x => x.Value == Parametros.baudRate).Key.ToString();
//cmbTransmissao.Items.Clear();
//cmbTransmissao.Items.AddRange(LoRaBaseService.CodigosTipoTransmissao.Keys.Select(x => x.ToString()).ToArray());
//cmbTransmissao.SelectedItem = LoRaBaseService.CodigosTipoTransmissao.FirstOrDefault(x => x.Value == Parametros.tranMode).Key.ToString();
//cmbAirRate.Items.Clear();
//cmbAirRate.Items.AddRange(LoRaBaseService.CodigosAirRates.Keys.Select(x => x.ToString()).ToArray());
//cmbAirRate.SelectedItem = LoRaBaseService.CodigosAirRates.FirstOrDefault(x => x.Value == Parametros.airRate).Key.ToString();
//cmbPacketSize.Items.Clear();
//cmbPacketSize.Items.AddRange(LoRaBaseService.CodigosPacketSizes.Keys.Select(x => x.ToString()).ToArray());
//cmbPacketSize.SelectedItem = LoRaBaseService.CodigosPacketSizes.FirstOrDefault(x => x.Value == Parametros.packetSize).Key.ToString();
//cmbWorCycle.Items.Clear();
//cmbWorCycle.Items.AddRange(LoRaBaseService.CodigosWorCycles.Keys.Select(x => x.ToString()).ToArray());
//cmbWorCycle.SelectedItem = LoRaBaseService.CodigosWorCycles.FirstOrDefault(x => x.Value == Parametros.worCycle).Key.ToString();
//cmbPower.Items.Clear();
//cmbPower.Items.AddRange(LoRaBaseService.CodigosPowers.Keys.Select(x => x.ToString()).ToArray());
//cmbPower.SelectedItem = LoRaBaseService.CodigosPowers.FirstOrDefault(x => x.Value == Parametros.power).Key.ToString();
}
private async Task ConfigurarModulo(LoRaParametrosModel Parametros)
{
if (cmbComunicacao.SelectedIndex == 0)
{
if (Parametros.address == Variaveis.LoraBaseParametros.address)
{
CustomDialog.ShowDialog(
"Erro",
"O endereço informado já está sendo usado pelo módulo de comunicação LoRa da base!",
MessageBoxIcon.Error,
new Dictionary<(string, dynamic), Action>()
{
{ ("OK", null), () => { } }
}
);
return;
}
//if (cmbComunicacao.SelectedIndex == 0)
//{
// if (Parametros.address == Variaveis.LoraBaseParametros.address)
// {
// CustomDialog.ShowDialog(
// "Erro",
// "O endereço informado já está sendo usado pelo módulo de comunicação LoRa da base!",
// MessageBoxIcon.Error,
// new Dictionary<(string, dynamic), Action>()
// {
// { ("OK", null), () => { } }
// }
// );
// return;
// }
//
// Variaveis.LoraService.ParametrosSet = Parametros.Clone();
// Variaveis.LoraService.Configurado = false;
// Variaveis.OperacaoEmAndamento.DispSen.SalvarParametros(Variaveis.OperacaoEmAndamento.DispSen.Dados);
// CustomDialog.ShowDialog(
// "Sucesso",
// "Módulo de comunicação LoRa configurado com sucesso!",
// MessageBoxIcon.Information,
// new Dictionary<(string, dynamic), Action>()
// {
// { ("OK", null), () => { } }
// }
// );
//}
//else
//{
// if (Parametros.address == Variaveis.LoraService.ParametrosSet.address)
// {
// CustomDialog.ShowDialog(
// "Erro",
// "O endereço informado já está sendo usado pelo módulo de comunicação LoRa do equipamento!",
// MessageBoxIcon.Error,
// new Dictionary<(string, dynamic), Action>()
// {
// { ("OK", null), () => { } }
// }
// );
// return;
// }
//
// Variaveis.OperacaoEmAndamento.DispSen.Dados.LoRaParametrosBase = Parametros.Clone();
// Variaveis.OperacaoEmAndamento.DispSen.SalvarParametros(Variaveis.OperacaoEmAndamento.DispSen.Dados);
// CustomDialog.ShowDialog(
// "Sucesso",
// "Configuração do módulo de comunicação LoRa da base realizado com sucesso!",
// MessageBoxIcon.Information,
// new Dictionary<(string, dynamic), Action>()
// {
// { ("OK", null), () => { } }
// }
// );
//}
//await AtualizarParametrosLoRa();
}
Variaveis.LoraService.ParametrosSet = Parametros.Clone();
Variaveis.LoraService.Configurado = false;
Variaveis.OperacaoEmAndamento.DispSen.SalvarParametros(Variaveis.OperacaoEmAndamento.DispSen.Dados);
CustomDialog.ShowDialog(
"Sucesso",
"Módulo de comunicação LoRa configurado com sucesso!",
MessageBoxIcon.Information,
new Dictionary<(string, dynamic), Action>()
{
{ ("OK", null), () => { } }
}
);
}
else
private async void cmbComunicacao_SelectedIndexChanged(object sender, EventArgs e)
{
if (Variaveis.LoraService.Iniciado)
{
if (Parametros.address == Variaveis.LoraService.ParametrosSet.address)
{
CustomDialog.ShowDialog(
"Erro",
"O endereço informado já está sendo usado pelo módulo de comunicação LoRa do equipamento!",
MessageBoxIcon.Error,
new Dictionary<(string, dynamic), Action>()
{
{ ("OK", null), () => { } }
}
);
return;
}
Variaveis.OperacaoEmAndamento.DispSen.Dados.LoRaParametrosBase = Parametros.Clone();
Variaveis.OperacaoEmAndamento.DispSen.SalvarParametros(Variaveis.OperacaoEmAndamento.DispSen.Dados);
CustomDialog.ShowDialog(
"Sucesso",
"Configuração do módulo de comunicação LoRa da base realizado com sucesso!",
MessageBoxIcon.Information,
new Dictionary<(string, dynamic), Action>()
{
{ ("OK", null), () => { } }
}
);
await AtualizarParametrosLoRa();
}
await AtualizarParametros();
}
#endregion
@ -360,6 +365,11 @@ namespace AgroBase.Forms.IHM
}
}
private void btnCalibrarSonar_Click(object sender, EventArgs e)
{
VisualWorkerService.RecalibrarGridProfundidade();
}
private async void cmbCameraSolo_SelectedIndexChanged(object sender, EventArgs e)
{
ComboBox cmb = sender as ComboBox;
@ -417,24 +427,106 @@ namespace AgroBase.Forms.IHM
#endregion
private async void cmbComunicacao_SelectedIndexChanged(object sender, EventArgs e)
#region COMUNICACAO
private void AtualizarParametrosComunicacao()
{
if (Variaveis.LoraService.Iniciado)
VariaveisEquipamento.Parametros.AtualizarParametros();
var p = VariaveisEquipamento.Parametros;
txtBaseIP.Text = p.base_ip;
nudPortaCaminho.Value = p.base_porta_caminho;
nudPortaErvas.Value = p.base_porta_ervas;
cmbInterface.Text = p.rover_interface;
txtEquipamentoSerial.Text = p.serial_number;
txtEquipamentoIP.Text = p.rover_ip;
txtEquipamentoGateway.Text = p.rover_gateway;
txtEquipamentoSubmask.Text = p.rover_submask;
var interfaces = EthernetService.ObterNomesInterfaces().Where(x => x.Contains("Ativa")).ToList();
cmbInterface.Items.Clear();
cmbInterface.Items.AddRange(interfaces.ToArray());
cmbInterface.SelectedIndex = interfaces.IndexOf(interfaces.FirstOrDefault(x => x.Contains(p.rover_interface)));
}
private async void SalvarParametrosConfiguracao()
{
string _interface = cmbInterface.Text.Split('(')[0].Trim();
var p = VariaveisEquipamento.Parametros;
bool ip_mudou = p.rover_ip != txtEquipamentoIP.Text || p.rover_gateway != txtEquipamentoGateway.Text || p.rover_submask != txtEquipamentoSubmask.Text;
bool ip_sucesso = !ip_mudou;
p.base_ip = txtBaseIP.Text;
p.base_porta_caminho = (int)nudPortaCaminho.Value;
p.base_porta_ervas = (int)nudPortaErvas.Value;
p.rover_interface = _interface;
p.rover_ip = txtEquipamentoIP.Text;
p.rover_gateway = txtEquipamentoGateway.Text;
p.rover_submask = txtEquipamentoSubmask.Text;
p.camera_caminhho_id = CameraCaminho.Id;
p.camera_ervas_id = CamerasSolo.Select(x => x.Id).ToList();
if (ip_mudou)
{
await AtualizarParametros();
ip_sucesso = await EthernetService.DefinirIpFixo(_interface, p.rover_ip, p.rover_submask, p.rover_gateway, false);
}
bool sucesso = ip_sucesso && VariaveisEquipamento.Parametros.SalvarParametros();
if (sucesso)
{
CustomDialog.ShowDialog(
"Sucesso",
"Parâmetros salvos com sucesso!",
MessageBoxIcon.Information,
new Dictionary<(string, dynamic), Action>()
{
{ ("OK", null), () => { } }
}
);
}
else
{
CustomDialog.ShowDialog(
"Erro",
"Erro ao salvar parâmetros!",
MessageBoxIcon.Error,
new Dictionary<(string, dynamic), Action>()
{
{ ("OK", null), () => { } }
}
);
}
}
private void btnCalibrarSonar_Click(object sender, EventArgs e)
#endregion
private void cmbInterface_SelectedIndexChanged(object sender, EventArgs e)
{
//KinectService.RecalibrarSubdivisoes();
string _interface = cmbInterface.Text.Split('(')[0].Trim();
txtEquipamentoIP.Text = EthernetService.ObterIpAtual(_interface);
txtEquipamentoGateway.Text = EthernetService.ObterIpGateway(_interface);
txtEquipamentoSubmask.Text = EthernetService.ObterSubnetMaskAtual(_interface);
}
private void chbSonarAtivado_CheckedChanged(object sender, EventArgs e)
private void txtEquipamentoIP_TextChanged(object sender, EventArgs e)
{
btnCalibrarSonar.Enabled = ((CheckBox)sender).Checked;
((TextBox)sender).ForeColor = (VariaveisEquipamento.Parametros.rover_ip != ((TextBox)sender).Text) ? Color.Red : Color.Black;
}
private void txtEquipamentoGateway_TextChanged(object sender, EventArgs e)
{
((TextBox)sender).ForeColor = (VariaveisEquipamento.Parametros.rover_gateway != ((TextBox)sender).Text) ? Color.Red : Color.Black;
}
private void txtEquipamentoSubmask_TextChanged(object sender, EventArgs e)
{
((TextBox)sender).ForeColor = (VariaveisEquipamento.Parametros.rover_submask != ((TextBox)sender).Text) ? Color.Red : Color.Black;
}
}
}

View File

@ -549,6 +549,12 @@ namespace AgroBase.Models
public string base_ip { get; set; }
public int base_porta_caminho { get; set; }
public int base_porta_ervas { get; set; }
public string rover_interface { get; set; }
public string rover_ip { get; set; }
public string rover_gateway { get; set; }
public string rover_submask { get; set; }
public string camera_caminhho_id { get; set; }
public List<string> camera_ervas_id { get; set; }
public void AtualizarParametros()
{
@ -566,6 +572,14 @@ namespace AgroBase.Models
base_porta_caminho = par.base_porta_caminho;
base_porta_ervas = par.base_porta_ervas;
rover_interface = par.rover_interface;
rover_ip = par.rover_ip;
rover_gateway = par.rover_gateway;
rover_submask = par.rover_submask;
camera_caminhho_id = par.camera_caminhho_id;
camera_ervas_id = par.camera_ervas_id;
Carregado = true;
}
catch (Exception ex)
@ -574,6 +588,21 @@ namespace AgroBase.Models
Carregado = false;
}
}
public bool SalvarParametros()
{
try
{
string config_path = Path.Combine(Variaveis.CaminhoSistema, Variaveis.CaminhoParametros, "config.json");
File.WriteAllText(config_path, JsonConvert.SerializeObject(this));
return true;
}
catch (Exception ex)
{
Console.WriteLine($"Erro ao salvar arquivo de configuracoes: {ex.Message}");
return false;
}
}
}
}

View File

@ -82,7 +82,7 @@ class CameraManager:
self._timestamp_analise = None
self.grid_ref_shape = (15, 10)
self.grid_ref = self._gerar_grid_referencia_geometrico()
self.gerar_grid_ref()
self.data_fuser = CostmapFuser(grid_shape=self.grid_ref_shape, K=3, M=2, fuse_method="max", block_thr=0.7, central_cols=None, y_range_m=(0.5,5.0), near_is_bottom=True, fov_h_rad=np.radians(self.camera.parametros["fov_h"]), robot_width=self.largura_robo_m)
self.seg_runner = SegformerNavRunner(seg_config)
@ -119,6 +119,9 @@ class CameraManager:
self.iniciando = False
self.atualizar_saude_camera()
def gerar_grid_ref(self, n_frames=50):
self.grid_ref = self._gerar_grid_referencia_geometrico()
def _gerar_grid_referencia_geometrico(self, angulo_inclinacao_graus=28.91, altura_camera_m=0.74):
grid_w, grid_h = self.grid_ref_shape
def dist_grid_calibrado(grid_h, i, fov, incl, altura):

View File

@ -46,7 +46,7 @@ def main():
iniciar_camera_manager(mx_id)
elif acao == VisualWorkerCommandType.CalibrarProfundidade:
n_frames = dados.get("params", 50)
get_camera_manager().calibrar(n_frames)
get_camera_manager().gerar_grid_ref(n_frames)
elif acao == VisualWorkerCommandType.AtualizarSaudeCamera:
get_camera_manager().atualizar_saude_camera()
elif acao == VisualWorkerCommandType.GetCameraFrame: