ajustes no protocolo de comunicacao bld300r

This commit is contained in:
Diego Freitas 2024-07-31 17:10:58 -03:00
parent d9d4da8450
commit 10b170f706
50 changed files with 8221 additions and 442 deletions

Binary file not shown.

View File

@ -442,6 +442,7 @@
<None Include="Imagens\desligar.png" />
<None Include="Imagens\ajustes.png" />
<None Include="Imagens\excluir.png" />
<None Include="Imagens\joystick.png" />
<Content Include="Imagens\loading.gif" />
<None Include="Imagens\robo_superior.jpg" />
<None Include="Imagens\mcp.jpg" />

View File

@ -29,6 +29,11 @@
private void InitializeComponent()
{
this.pnlMapa = new System.Windows.Forms.Panel();
this.pnlCameraCaminho = new System.Windows.Forms.Panel();
this.pnlCameraSoloD = new System.Windows.Forms.Panel();
this.pnlCameraSoloE = new System.Windows.Forms.Panel();
this.pnlInclinacao = new System.Windows.Forms.Panel();
this.pnlOrientacao = new System.Windows.Forms.Panel();
this.lblMapaCarregado = new System.Windows.Forms.Label();
this.txtStatusAtual = new System.Windows.Forms.TextBox();
this.lblStatusAtual = new System.Windows.Forms.Label();
@ -54,22 +59,26 @@
this.pgbOperacao = new System.Windows.Forms.ProgressBar();
this.lblRuaAtual = new System.Windows.Forms.Label();
this.pgbRuaAtual = new System.Windows.Forms.ProgressBar();
this.lblUltimaLeituraSolo = new System.Windows.Forms.Label();
this.lblUltimaLeituraRua = new System.Windows.Forms.Label();
this.lblModoOperacao = new System.Windows.Forms.Label();
this.txtModoOperacao = new System.Windows.Forms.TextBox();
this.pnlCameraSoloE = new System.Windows.Forms.Panel();
this.pnlCameraSoloD = new System.Windows.Forms.Panel();
this.pnlCameraCaminho = new System.Windows.Forms.Panel();
this.picFechar = new System.Windows.Forms.PictureBox();
this.pnlInclinacao = new System.Windows.Forms.Panel();
this.pnlOrientacao = new System.Windows.Forms.Panel();
this.pnlJoystick = new System.Windows.Forms.Panel();
this.pnlAcompanhamento = new System.Windows.Forms.Panel();
this.cmbModoControle = new System.Windows.Forms.ComboBox();
this.lblModoControle = new System.Windows.Forms.Label();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.lblUltimaLeituraCaminho = new System.Windows.Forms.ToolStripStatusLabel();
this.lblUltimaLeituraSolo = new System.Windows.Forms.ToolStripStatusLabel();
this.lblPerformance = new System.Windows.Forms.ToolStripStatusLabel();
this.pnlMapa.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picFechar)).BeginInit();
this.pnlAcompanhamento.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
//
// pnlMapa
//
this.pnlMapa.Controls.Add(this.pnlJoystick);
this.pnlMapa.Controls.Add(this.pnlCameraCaminho);
this.pnlMapa.Controls.Add(this.pnlCameraSoloD);
this.pnlMapa.Controls.Add(this.pnlCameraSoloE);
@ -77,302 +86,29 @@
this.pnlMapa.Controls.Add(this.pnlOrientacao);
this.pnlMapa.Location = new System.Drawing.Point(0, 0);
this.pnlMapa.Name = "pnlMapa";
this.pnlMapa.Size = new System.Drawing.Size(480, 463);
this.pnlMapa.Size = new System.Drawing.Size(480, 455);
this.pnlMapa.TabIndex = 0;
//
// lblMapaCarregado
//
this.lblMapaCarregado.AutoSize = true;
this.lblMapaCarregado.Location = new System.Drawing.Point(486, 9);
this.lblMapaCarregado.Name = "lblMapaCarregado";
this.lblMapaCarregado.Size = new System.Drawing.Size(112, 13);
this.lblMapaCarregado.TabIndex = 2;
this.lblMapaCarregado.Text = "Mapa Carregado: N/A";
//
// txtStatusAtual
//
this.txtStatusAtual.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
this.txtStatusAtual.Location = new System.Drawing.Point(652, 90);
this.txtStatusAtual.Name = "txtStatusAtual";
this.txtStatusAtual.ReadOnly = true;
this.txtStatusAtual.Size = new System.Drawing.Size(136, 26);
this.txtStatusAtual.TabIndex = 6;
this.txtStatusAtual.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblStatusAtual
//
this.lblStatusAtual.AutoSize = true;
this.lblStatusAtual.Location = new System.Drawing.Point(486, 98);
this.lblStatusAtual.Name = "lblStatusAtual";
this.lblStatusAtual.Size = new System.Drawing.Size(64, 13);
this.lblStatusAtual.TabIndex = 5;
this.lblStatusAtual.Text = "Status Atual";
//
// txtIniciadoEm
//
this.txtIniciadoEm.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
this.txtIniciadoEm.Location = new System.Drawing.Point(652, 122);
this.txtIniciadoEm.Name = "txtIniciadoEm";
this.txtIniciadoEm.ReadOnly = true;
this.txtIniciadoEm.Size = new System.Drawing.Size(136, 26);
this.txtIniciadoEm.TabIndex = 8;
this.txtIniciadoEm.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblIniciadoEm
//
this.lblIniciadoEm.AutoSize = true;
this.lblIniciadoEm.Location = new System.Drawing.Point(486, 130);
this.lblIniciadoEm.Name = "lblIniciadoEm";
this.lblIniciadoEm.Size = new System.Drawing.Size(62, 13);
this.lblIniciadoEm.TabIndex = 7;
this.lblIniciadoEm.Text = "Iniciado Em";
//
// txtConcluidoEm
//
this.txtConcluidoEm.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
this.txtConcluidoEm.Location = new System.Drawing.Point(652, 154);
this.txtConcluidoEm.Name = "txtConcluidoEm";
this.txtConcluidoEm.ReadOnly = true;
this.txtConcluidoEm.Size = new System.Drawing.Size(136, 26);
this.txtConcluidoEm.TabIndex = 10;
this.txtConcluidoEm.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblConcluidoEm
//
this.lblConcluidoEm.AutoSize = true;
this.lblConcluidoEm.Location = new System.Drawing.Point(486, 162);
this.lblConcluidoEm.Name = "lblConcluidoEm";
this.lblConcluidoEm.Size = new System.Drawing.Size(74, 13);
this.lblConcluidoEm.TabIndex = 9;
this.lblConcluidoEm.Text = "Concluído Em";
//
// txtDistanciaPercorrida
//
this.txtDistanciaPercorrida.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
this.txtDistanciaPercorrida.Location = new System.Drawing.Point(652, 186);
this.txtDistanciaPercorrida.Name = "txtDistanciaPercorrida";
this.txtDistanciaPercorrida.ReadOnly = true;
this.txtDistanciaPercorrida.Size = new System.Drawing.Size(136, 26);
this.txtDistanciaPercorrida.TabIndex = 12;
this.txtDistanciaPercorrida.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblDistanciaPercorrida
//
this.lblDistanciaPercorrida.AutoSize = true;
this.lblDistanciaPercorrida.Location = new System.Drawing.Point(486, 194);
this.lblDistanciaPercorrida.Name = "lblDistanciaPercorrida";
this.lblDistanciaPercorrida.Size = new System.Drawing.Size(102, 13);
this.lblDistanciaPercorrida.TabIndex = 11;
this.lblDistanciaPercorrida.Text = "Distância Percorrida";
//
// txtTempoOperacao
//
this.txtTempoOperacao.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
this.txtTempoOperacao.Location = new System.Drawing.Point(652, 218);
this.txtTempoOperacao.Name = "txtTempoOperacao";
this.txtTempoOperacao.ReadOnly = true;
this.txtTempoOperacao.Size = new System.Drawing.Size(136, 26);
this.txtTempoOperacao.TabIndex = 14;
this.txtTempoOperacao.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblTempoOperacao
//
this.lblTempoOperacao.AutoSize = true;
this.lblTempoOperacao.Location = new System.Drawing.Point(486, 226);
this.lblTempoOperacao.Name = "lblTempoOperacao";
this.lblTempoOperacao.Size = new System.Drawing.Size(105, 13);
this.lblTempoOperacao.TabIndex = 13;
this.lblTempoOperacao.Text = "Tempo de Operação";
//
// txtErvasIdentificadas
//
this.txtErvasIdentificadas.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
this.txtErvasIdentificadas.Location = new System.Drawing.Point(652, 250);
this.txtErvasIdentificadas.Name = "txtErvasIdentificadas";
this.txtErvasIdentificadas.ReadOnly = true;
this.txtErvasIdentificadas.Size = new System.Drawing.Size(136, 26);
this.txtErvasIdentificadas.TabIndex = 16;
this.txtErvasIdentificadas.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblErvasIdentificadas
//
this.lblErvasIdentificadas.AutoSize = true;
this.lblErvasIdentificadas.Location = new System.Drawing.Point(486, 258);
this.lblErvasIdentificadas.Name = "lblErvasIdentificadas";
this.lblErvasIdentificadas.Size = new System.Drawing.Size(97, 13);
this.lblErvasIdentificadas.TabIndex = 15;
this.lblErvasIdentificadas.Text = "Ervas Identificadas";
//
// txtHerbicidaAplicado
//
this.txtHerbicidaAplicado.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
this.txtHerbicidaAplicado.Location = new System.Drawing.Point(652, 282);
this.txtHerbicidaAplicado.Name = "txtHerbicidaAplicado";
this.txtHerbicidaAplicado.ReadOnly = true;
this.txtHerbicidaAplicado.Size = new System.Drawing.Size(136, 26);
this.txtHerbicidaAplicado.TabIndex = 18;
this.txtHerbicidaAplicado.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblHerbicidaAplicado
//
this.lblHerbicidaAplicado.AutoSize = true;
this.lblHerbicidaAplicado.Location = new System.Drawing.Point(486, 290);
this.lblHerbicidaAplicado.Name = "lblHerbicidaAplicado";
this.lblHerbicidaAplicado.Size = new System.Drawing.Size(96, 13);
this.lblHerbicidaAplicado.TabIndex = 17;
this.lblHerbicidaAplicado.Text = "Herbicida Aplicado";
//
// txtBateriaConsumida
//
this.txtBateriaConsumida.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
this.txtBateriaConsumida.Location = new System.Drawing.Point(652, 314);
this.txtBateriaConsumida.Name = "txtBateriaConsumida";
this.txtBateriaConsumida.ReadOnly = true;
this.txtBateriaConsumida.Size = new System.Drawing.Size(136, 26);
this.txtBateriaConsumida.TabIndex = 20;
this.txtBateriaConsumida.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblBateriaConsumida
//
this.lblBateriaConsumida.AutoSize = true;
this.lblBateriaConsumida.Location = new System.Drawing.Point(486, 322);
this.lblBateriaConsumida.Name = "lblBateriaConsumida";
this.lblBateriaConsumida.Size = new System.Drawing.Size(95, 13);
this.lblBateriaConsumida.TabIndex = 19;
this.lblBateriaConsumida.Text = "Bateria Consumida";
//
// pgbReservatorio
//
this.pgbReservatorio.Location = new System.Drawing.Point(652, 346);
this.pgbReservatorio.Name = "pgbReservatorio";
this.pgbReservatorio.Size = new System.Drawing.Size(136, 26);
this.pgbReservatorio.TabIndex = 21;
//
// lblReservatorio
//
this.lblReservatorio.AutoSize = true;
this.lblReservatorio.Location = new System.Drawing.Point(486, 354);
this.lblReservatorio.Name = "lblReservatorio";
this.lblReservatorio.Size = new System.Drawing.Size(84, 13);
this.lblReservatorio.TabIndex = 23;
this.lblReservatorio.Text = "Reservatório (%)";
//
// lblBateria
//
this.lblBateria.AutoSize = true;
this.lblBateria.Location = new System.Drawing.Point(486, 386);
this.lblBateria.Name = "lblBateria";
this.lblBateria.Size = new System.Drawing.Size(57, 13);
this.lblBateria.TabIndex = 25;
this.lblBateria.Text = "Bateria (%)";
//
// pgbBateria
//
this.pgbBateria.Location = new System.Drawing.Point(652, 378);
this.pgbBateria.Name = "pgbBateria";
this.pgbBateria.Size = new System.Drawing.Size(136, 26);
this.pgbBateria.TabIndex = 24;
//
// lblOperacao
//
this.lblOperacao.AutoSize = true;
this.lblOperacao.Location = new System.Drawing.Point(486, 418);
this.lblOperacao.Name = "lblOperacao";
this.lblOperacao.Size = new System.Drawing.Size(71, 13);
this.lblOperacao.TabIndex = 27;
this.lblOperacao.Text = "Operação (%)";
//
// pgbOperacao
//
this.pgbOperacao.Location = new System.Drawing.Point(652, 410);
this.pgbOperacao.Name = "pgbOperacao";
this.pgbOperacao.Size = new System.Drawing.Size(136, 26);
this.pgbOperacao.TabIndex = 26;
//
// lblRuaAtual
//
this.lblRuaAtual.AutoSize = true;
this.lblRuaAtual.Location = new System.Drawing.Point(486, 450);
this.lblRuaAtual.Name = "lblRuaAtual";
this.lblRuaAtual.Size = new System.Drawing.Size(71, 13);
this.lblRuaAtual.TabIndex = 29;
this.lblRuaAtual.Text = "Rua Atual (%)";
//
// pgbRuaAtual
//
this.pgbRuaAtual.Location = new System.Drawing.Point(652, 442);
this.pgbRuaAtual.Name = "pgbRuaAtual";
this.pgbRuaAtual.Size = new System.Drawing.Size(136, 26);
this.pgbRuaAtual.TabIndex = 28;
//
// lblUltimaLeituraSolo
//
this.lblUltimaLeituraSolo.AutoSize = true;
this.lblUltimaLeituraSolo.Location = new System.Drawing.Point(12, 466);
this.lblUltimaLeituraSolo.Name = "lblUltimaLeituraSolo";
this.lblUltimaLeituraSolo.Size = new System.Drawing.Size(164, 13);
this.lblUltimaLeituraSolo.TabIndex = 30;
this.lblUltimaLeituraSolo.Text = "Ultima Leitura Solo: 00:00:00.000";
//
// lblUltimaLeituraRua
//
this.lblUltimaLeituraRua.AutoSize = true;
this.lblUltimaLeituraRua.Location = new System.Drawing.Point(207, 466);
this.lblUltimaLeituraRua.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblUltimaLeituraRua.Name = "lblUltimaLeituraRua";
this.lblUltimaLeituraRua.Size = new System.Drawing.Size(163, 13);
this.lblUltimaLeituraRua.TabIndex = 31;
this.lblUltimaLeituraRua.Text = "Ultima Leitura Rua: 00:00:00.000";
//
// lblModoOperacao
//
this.lblModoOperacao.AutoSize = true;
this.lblModoOperacao.Location = new System.Drawing.Point(486, 66);
this.lblModoOperacao.Name = "lblModoOperacao";
this.lblModoOperacao.Size = new System.Drawing.Size(99, 13);
this.lblModoOperacao.TabIndex = 3;
this.lblModoOperacao.Text = "Modo de Operação";
//
// txtModoOperacao
//
this.txtModoOperacao.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
this.txtModoOperacao.Location = new System.Drawing.Point(652, 58);
this.txtModoOperacao.Name = "txtModoOperacao";
this.txtModoOperacao.ReadOnly = true;
this.txtModoOperacao.Size = new System.Drawing.Size(136, 26);
this.txtModoOperacao.TabIndex = 4;
this.txtModoOperacao.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// pnlCameraSoloE
//
this.pnlCameraSoloE.Location = new System.Drawing.Point(0, 363);
this.pnlCameraSoloE.Name = "pnlCameraSoloE";
this.pnlCameraSoloE.Size = new System.Drawing.Size(130, 100);
this.pnlCameraSoloE.TabIndex = 17;
//
// pnlCameraSoloD
//
this.pnlCameraSoloD.Location = new System.Drawing.Point(350, 363);
this.pnlCameraSoloD.Name = "pnlCameraSoloD";
this.pnlCameraSoloD.Size = new System.Drawing.Size(130, 100);
this.pnlCameraSoloD.TabIndex = 18;
//
// pnlCameraCaminho
//
this.pnlCameraCaminho.Location = new System.Drawing.Point(174, 363);
this.pnlCameraCaminho.Location = new System.Drawing.Point(176, 355);
this.pnlCameraCaminho.Name = "pnlCameraCaminho";
this.pnlCameraCaminho.Size = new System.Drawing.Size(130, 100);
this.pnlCameraCaminho.TabIndex = 18;
//
// picFechar
// pnlCameraSoloD
//
this.picFechar.Image = global::AgroBase.Properties.Resources.fechar;
this.picFechar.Location = new System.Drawing.Point(753, 9);
this.picFechar.Name = "picFechar";
this.picFechar.Size = new System.Drawing.Size(35, 35);
this.picFechar.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picFechar.TabIndex = 1;
this.picFechar.TabStop = false;
this.pnlCameraSoloD.Location = new System.Drawing.Point(350, 355);
this.pnlCameraSoloD.Name = "pnlCameraSoloD";
this.pnlCameraSoloD.Size = new System.Drawing.Size(130, 100);
this.pnlCameraSoloD.TabIndex = 18;
//
// pnlCameraSoloE
//
this.pnlCameraSoloE.Location = new System.Drawing.Point(0, 355);
this.pnlCameraSoloE.Name = "pnlCameraSoloE";
this.pnlCameraSoloE.Size = new System.Drawing.Size(130, 100);
this.pnlCameraSoloE.TabIndex = 17;
//
// pnlInclinacao
//
@ -398,40 +134,362 @@
this.pnlOrientacao.TabIndex = 12;
this.pnlOrientacao.Paint += new System.Windows.Forms.PaintEventHandler(this.pnlOrientacao_Paint);
//
// lblMapaCarregado
//
this.lblMapaCarregado.AutoSize = true;
this.lblMapaCarregado.Location = new System.Drawing.Point(486, 9);
this.lblMapaCarregado.Name = "lblMapaCarregado";
this.lblMapaCarregado.Size = new System.Drawing.Size(112, 13);
this.lblMapaCarregado.TabIndex = 2;
this.lblMapaCarregado.Text = "Mapa Carregado: N/A";
//
// txtStatusAtual
//
this.txtStatusAtual.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
this.txtStatusAtual.Location = new System.Drawing.Point(169, 71);
this.txtStatusAtual.Name = "txtStatusAtual";
this.txtStatusAtual.ReadOnly = true;
this.txtStatusAtual.Size = new System.Drawing.Size(120, 26);
this.txtStatusAtual.TabIndex = 6;
this.txtStatusAtual.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblStatusAtual
//
this.lblStatusAtual.AutoSize = true;
this.lblStatusAtual.Location = new System.Drawing.Point(3, 79);
this.lblStatusAtual.Name = "lblStatusAtual";
this.lblStatusAtual.Size = new System.Drawing.Size(64, 13);
this.lblStatusAtual.TabIndex = 5;
this.lblStatusAtual.Text = "Status Atual";
//
// txtIniciadoEm
//
this.txtIniciadoEm.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
this.txtIniciadoEm.Location = new System.Drawing.Point(169, 103);
this.txtIniciadoEm.Name = "txtIniciadoEm";
this.txtIniciadoEm.ReadOnly = true;
this.txtIniciadoEm.Size = new System.Drawing.Size(120, 26);
this.txtIniciadoEm.TabIndex = 8;
this.txtIniciadoEm.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblIniciadoEm
//
this.lblIniciadoEm.AutoSize = true;
this.lblIniciadoEm.Location = new System.Drawing.Point(3, 111);
this.lblIniciadoEm.Name = "lblIniciadoEm";
this.lblIniciadoEm.Size = new System.Drawing.Size(62, 13);
this.lblIniciadoEm.TabIndex = 7;
this.lblIniciadoEm.Text = "Iniciado Em";
//
// txtConcluidoEm
//
this.txtConcluidoEm.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
this.txtConcluidoEm.Location = new System.Drawing.Point(169, 135);
this.txtConcluidoEm.Name = "txtConcluidoEm";
this.txtConcluidoEm.ReadOnly = true;
this.txtConcluidoEm.Size = new System.Drawing.Size(120, 26);
this.txtConcluidoEm.TabIndex = 10;
this.txtConcluidoEm.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblConcluidoEm
//
this.lblConcluidoEm.AutoSize = true;
this.lblConcluidoEm.Location = new System.Drawing.Point(3, 143);
this.lblConcluidoEm.Name = "lblConcluidoEm";
this.lblConcluidoEm.Size = new System.Drawing.Size(74, 13);
this.lblConcluidoEm.TabIndex = 9;
this.lblConcluidoEm.Text = "Concluído Em";
//
// txtDistanciaPercorrida
//
this.txtDistanciaPercorrida.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
this.txtDistanciaPercorrida.Location = new System.Drawing.Point(169, 167);
this.txtDistanciaPercorrida.Name = "txtDistanciaPercorrida";
this.txtDistanciaPercorrida.ReadOnly = true;
this.txtDistanciaPercorrida.Size = new System.Drawing.Size(120, 26);
this.txtDistanciaPercorrida.TabIndex = 12;
this.txtDistanciaPercorrida.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblDistanciaPercorrida
//
this.lblDistanciaPercorrida.AutoSize = true;
this.lblDistanciaPercorrida.Location = new System.Drawing.Point(3, 175);
this.lblDistanciaPercorrida.Name = "lblDistanciaPercorrida";
this.lblDistanciaPercorrida.Size = new System.Drawing.Size(102, 13);
this.lblDistanciaPercorrida.TabIndex = 11;
this.lblDistanciaPercorrida.Text = "Distância Percorrida";
//
// txtTempoOperacao
//
this.txtTempoOperacao.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
this.txtTempoOperacao.Location = new System.Drawing.Point(169, 199);
this.txtTempoOperacao.Name = "txtTempoOperacao";
this.txtTempoOperacao.ReadOnly = true;
this.txtTempoOperacao.Size = new System.Drawing.Size(120, 26);
this.txtTempoOperacao.TabIndex = 14;
this.txtTempoOperacao.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblTempoOperacao
//
this.lblTempoOperacao.AutoSize = true;
this.lblTempoOperacao.Location = new System.Drawing.Point(3, 207);
this.lblTempoOperacao.Name = "lblTempoOperacao";
this.lblTempoOperacao.Size = new System.Drawing.Size(105, 13);
this.lblTempoOperacao.TabIndex = 13;
this.lblTempoOperacao.Text = "Tempo de Operação";
//
// txtErvasIdentificadas
//
this.txtErvasIdentificadas.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
this.txtErvasIdentificadas.Location = new System.Drawing.Point(169, 231);
this.txtErvasIdentificadas.Name = "txtErvasIdentificadas";
this.txtErvasIdentificadas.ReadOnly = true;
this.txtErvasIdentificadas.Size = new System.Drawing.Size(120, 26);
this.txtErvasIdentificadas.TabIndex = 16;
this.txtErvasIdentificadas.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblErvasIdentificadas
//
this.lblErvasIdentificadas.AutoSize = true;
this.lblErvasIdentificadas.Location = new System.Drawing.Point(3, 239);
this.lblErvasIdentificadas.Name = "lblErvasIdentificadas";
this.lblErvasIdentificadas.Size = new System.Drawing.Size(97, 13);
this.lblErvasIdentificadas.TabIndex = 15;
this.lblErvasIdentificadas.Text = "Ervas Identificadas";
//
// txtHerbicidaAplicado
//
this.txtHerbicidaAplicado.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
this.txtHerbicidaAplicado.Location = new System.Drawing.Point(169, 263);
this.txtHerbicidaAplicado.Name = "txtHerbicidaAplicado";
this.txtHerbicidaAplicado.ReadOnly = true;
this.txtHerbicidaAplicado.Size = new System.Drawing.Size(120, 26);
this.txtHerbicidaAplicado.TabIndex = 18;
this.txtHerbicidaAplicado.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblHerbicidaAplicado
//
this.lblHerbicidaAplicado.AutoSize = true;
this.lblHerbicidaAplicado.Location = new System.Drawing.Point(3, 271);
this.lblHerbicidaAplicado.Name = "lblHerbicidaAplicado";
this.lblHerbicidaAplicado.Size = new System.Drawing.Size(96, 13);
this.lblHerbicidaAplicado.TabIndex = 17;
this.lblHerbicidaAplicado.Text = "Herbicida Aplicado";
//
// txtBateriaConsumida
//
this.txtBateriaConsumida.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
this.txtBateriaConsumida.Location = new System.Drawing.Point(169, 295);
this.txtBateriaConsumida.Name = "txtBateriaConsumida";
this.txtBateriaConsumida.ReadOnly = true;
this.txtBateriaConsumida.Size = new System.Drawing.Size(120, 26);
this.txtBateriaConsumida.TabIndex = 20;
this.txtBateriaConsumida.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblBateriaConsumida
//
this.lblBateriaConsumida.AutoSize = true;
this.lblBateriaConsumida.Location = new System.Drawing.Point(3, 303);
this.lblBateriaConsumida.Name = "lblBateriaConsumida";
this.lblBateriaConsumida.Size = new System.Drawing.Size(95, 13);
this.lblBateriaConsumida.TabIndex = 19;
this.lblBateriaConsumida.Text = "Bateria Consumida";
//
// pgbReservatorio
//
this.pgbReservatorio.Location = new System.Drawing.Point(169, 327);
this.pgbReservatorio.Name = "pgbReservatorio";
this.pgbReservatorio.Size = new System.Drawing.Size(120, 26);
this.pgbReservatorio.TabIndex = 21;
//
// lblReservatorio
//
this.lblReservatorio.AutoSize = true;
this.lblReservatorio.Location = new System.Drawing.Point(3, 335);
this.lblReservatorio.Name = "lblReservatorio";
this.lblReservatorio.Size = new System.Drawing.Size(84, 13);
this.lblReservatorio.TabIndex = 23;
this.lblReservatorio.Text = "Reservatório (%)";
//
// lblBateria
//
this.lblBateria.AutoSize = true;
this.lblBateria.Location = new System.Drawing.Point(3, 367);
this.lblBateria.Name = "lblBateria";
this.lblBateria.Size = new System.Drawing.Size(57, 13);
this.lblBateria.TabIndex = 25;
this.lblBateria.Text = "Bateria (%)";
//
// pgbBateria
//
this.pgbBateria.Location = new System.Drawing.Point(169, 359);
this.pgbBateria.Name = "pgbBateria";
this.pgbBateria.Size = new System.Drawing.Size(120, 26);
this.pgbBateria.TabIndex = 24;
//
// lblOperacao
//
this.lblOperacao.AutoSize = true;
this.lblOperacao.Location = new System.Drawing.Point(3, 399);
this.lblOperacao.Name = "lblOperacao";
this.lblOperacao.Size = new System.Drawing.Size(71, 13);
this.lblOperacao.TabIndex = 27;
this.lblOperacao.Text = "Operação (%)";
//
// pgbOperacao
//
this.pgbOperacao.Location = new System.Drawing.Point(169, 391);
this.pgbOperacao.Name = "pgbOperacao";
this.pgbOperacao.Size = new System.Drawing.Size(120, 26);
this.pgbOperacao.TabIndex = 26;
//
// lblRuaAtual
//
this.lblRuaAtual.AutoSize = true;
this.lblRuaAtual.Location = new System.Drawing.Point(3, 431);
this.lblRuaAtual.Name = "lblRuaAtual";
this.lblRuaAtual.Size = new System.Drawing.Size(71, 13);
this.lblRuaAtual.TabIndex = 29;
this.lblRuaAtual.Text = "Rua Atual (%)";
//
// pgbRuaAtual
//
this.pgbRuaAtual.Location = new System.Drawing.Point(169, 423);
this.pgbRuaAtual.Name = "pgbRuaAtual";
this.pgbRuaAtual.Size = new System.Drawing.Size(120, 26);
this.pgbRuaAtual.TabIndex = 28;
//
// lblModoOperacao
//
this.lblModoOperacao.AutoSize = true;
this.lblModoOperacao.Location = new System.Drawing.Point(3, 13);
this.lblModoOperacao.Name = "lblModoOperacao";
this.lblModoOperacao.Size = new System.Drawing.Size(99, 13);
this.lblModoOperacao.TabIndex = 3;
this.lblModoOperacao.Text = "Modo de Operação";
//
// txtModoOperacao
//
this.txtModoOperacao.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
this.txtModoOperacao.Location = new System.Drawing.Point(169, 5);
this.txtModoOperacao.Name = "txtModoOperacao";
this.txtModoOperacao.ReadOnly = true;
this.txtModoOperacao.Size = new System.Drawing.Size(120, 26);
this.txtModoOperacao.TabIndex = 4;
this.txtModoOperacao.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// picFechar
//
this.picFechar.Image = global::AgroBase.Properties.Resources.fechar;
this.picFechar.Location = new System.Drawing.Point(753, 9);
this.picFechar.Name = "picFechar";
this.picFechar.Size = new System.Drawing.Size(35, 35);
this.picFechar.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picFechar.TabIndex = 1;
this.picFechar.TabStop = false;
//
// pnlJoystick
//
this.pnlJoystick.Location = new System.Drawing.Point(16, 242);
this.pnlJoystick.Name = "pnlJoystick";
this.pnlJoystick.Size = new System.Drawing.Size(100, 100);
this.pnlJoystick.TabIndex = 18;
this.pnlJoystick.Visible = false;
//
// pnlAcompanhamento
//
this.pnlAcompanhamento.AutoScroll = true;
this.pnlAcompanhamento.Controls.Add(this.lblModoControle);
this.pnlAcompanhamento.Controls.Add(this.cmbModoControle);
this.pnlAcompanhamento.Controls.Add(this.lblModoOperacao);
this.pnlAcompanhamento.Controls.Add(this.txtModoOperacao);
this.pnlAcompanhamento.Controls.Add(this.lblStatusAtual);
this.pnlAcompanhamento.Controls.Add(this.lblRuaAtual);
this.pnlAcompanhamento.Controls.Add(this.txtStatusAtual);
this.pnlAcompanhamento.Controls.Add(this.pgbRuaAtual);
this.pnlAcompanhamento.Controls.Add(this.lblIniciadoEm);
this.pnlAcompanhamento.Controls.Add(this.lblOperacao);
this.pnlAcompanhamento.Controls.Add(this.txtIniciadoEm);
this.pnlAcompanhamento.Controls.Add(this.pgbOperacao);
this.pnlAcompanhamento.Controls.Add(this.lblConcluidoEm);
this.pnlAcompanhamento.Controls.Add(this.lblBateria);
this.pnlAcompanhamento.Controls.Add(this.txtConcluidoEm);
this.pnlAcompanhamento.Controls.Add(this.pgbBateria);
this.pnlAcompanhamento.Controls.Add(this.lblDistanciaPercorrida);
this.pnlAcompanhamento.Controls.Add(this.lblReservatorio);
this.pnlAcompanhamento.Controls.Add(this.txtDistanciaPercorrida);
this.pnlAcompanhamento.Controls.Add(this.pgbReservatorio);
this.pnlAcompanhamento.Controls.Add(this.lblTempoOperacao);
this.pnlAcompanhamento.Controls.Add(this.txtBateriaConsumida);
this.pnlAcompanhamento.Controls.Add(this.txtTempoOperacao);
this.pnlAcompanhamento.Controls.Add(this.lblBateriaConsumida);
this.pnlAcompanhamento.Controls.Add(this.lblErvasIdentificadas);
this.pnlAcompanhamento.Controls.Add(this.txtHerbicidaAplicado);
this.pnlAcompanhamento.Controls.Add(this.txtErvasIdentificadas);
this.pnlAcompanhamento.Controls.Add(this.lblHerbicidaAplicado);
this.pnlAcompanhamento.Location = new System.Drawing.Point(486, 58);
this.pnlAcompanhamento.Name = "pnlAcompanhamento";
this.pnlAcompanhamento.Size = new System.Drawing.Size(312, 397);
this.pnlAcompanhamento.TabIndex = 32;
//
// cmbModoControle
//
this.cmbModoControle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbModoControle.Enabled = false;
this.cmbModoControle.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
this.cmbModoControle.FormattingEnabled = true;
this.cmbModoControle.Location = new System.Drawing.Point(169, 37);
this.cmbModoControle.Name = "cmbModoControle";
this.cmbModoControle.Size = new System.Drawing.Size(120, 28);
this.cmbModoControle.TabIndex = 30;
//
// lblModoControle
//
this.lblModoControle.AutoSize = true;
this.lblModoControle.Location = new System.Drawing.Point(3, 45);
this.lblModoControle.Name = "lblModoControle";
this.lblModoControle.Size = new System.Drawing.Size(91, 13);
this.lblModoControle.TabIndex = 31;
this.lblModoControle.Text = "Modo de Controle";
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.lblUltimaLeituraSolo,
this.lblUltimaLeituraCaminho,
this.lblPerformance});
this.statusStrip1.Location = new System.Drawing.Point(0, 458);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(800, 22);
this.statusStrip1.TabIndex = 33;
this.statusStrip1.Text = "statusStrip1";
//
// lblUltimaLeituraCaminho
//
this.lblUltimaLeituraCaminho.Name = "lblUltimaLeituraCaminho";
this.lblUltimaLeituraCaminho.Size = new System.Drawing.Size(181, 17);
this.lblUltimaLeituraCaminho.Text = "Última Leitura Caminho: 00:00:00";
//
// lblUltimaLeituraSolo
//
this.lblUltimaLeituraSolo.Name = "lblUltimaLeituraSolo";
this.lblUltimaLeituraSolo.Size = new System.Drawing.Size(155, 17);
this.lblUltimaLeituraSolo.Text = "Última Leitura Solo: 00:00:00";
//
// lblPerformance
//
this.lblPerformance.Name = "lblPerformance";
this.lblPerformance.Size = new System.Drawing.Size(190, 17);
this.lblPerformance.Text = "CPU: 0,0% GPU: 0,0% RAM: 0,0%";
//
// frmDialogoMapa
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Ivory;
this.ClientSize = new System.Drawing.Size(800, 480);
this.Controls.Add(this.lblUltimaLeituraRua);
this.Controls.Add(this.lblUltimaLeituraSolo);
this.Controls.Add(this.lblRuaAtual);
this.Controls.Add(this.pgbRuaAtual);
this.Controls.Add(this.lblOperacao);
this.Controls.Add(this.pgbOperacao);
this.Controls.Add(this.lblBateria);
this.Controls.Add(this.pgbBateria);
this.Controls.Add(this.lblReservatorio);
this.Controls.Add(this.pgbReservatorio);
this.Controls.Add(this.txtBateriaConsumida);
this.Controls.Add(this.lblBateriaConsumida);
this.Controls.Add(this.txtHerbicidaAplicado);
this.Controls.Add(this.lblHerbicidaAplicado);
this.Controls.Add(this.txtErvasIdentificadas);
this.Controls.Add(this.lblErvasIdentificadas);
this.Controls.Add(this.txtTempoOperacao);
this.Controls.Add(this.lblTempoOperacao);
this.Controls.Add(this.txtDistanciaPercorrida);
this.Controls.Add(this.lblDistanciaPercorrida);
this.Controls.Add(this.txtConcluidoEm);
this.Controls.Add(this.lblConcluidoEm);
this.Controls.Add(this.txtIniciadoEm);
this.Controls.Add(this.lblIniciadoEm);
this.Controls.Add(this.txtStatusAtual);
this.Controls.Add(this.lblStatusAtual);
this.Controls.Add(this.txtModoOperacao);
this.Controls.Add(this.lblModoOperacao);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.pnlAcompanhamento);
this.Controls.Add(this.lblMapaCarregado);
this.Controls.Add(this.picFechar);
this.Controls.Add(this.pnlMapa);
@ -441,6 +499,10 @@
this.Text = "frmDialogoMapa";
this.pnlMapa.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picFechar)).EndInit();
this.pnlAcompanhamento.ResumeLayout(false);
this.pnlAcompanhamento.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@ -477,12 +539,18 @@
private System.Windows.Forms.ProgressBar pgbRuaAtual;
private System.Windows.Forms.Panel pnlOrientacao;
private System.Windows.Forms.Panel pnlInclinacao;
public System.Windows.Forms.Label lblUltimaLeituraSolo;
private System.Windows.Forms.Label lblUltimaLeituraRua;
private System.Windows.Forms.Panel pnlCameraCaminho;
private System.Windows.Forms.Panel pnlCameraSoloD;
private System.Windows.Forms.Panel pnlCameraSoloE;
private System.Windows.Forms.Label lblModoOperacao;
private System.Windows.Forms.TextBox txtModoOperacao;
private System.Windows.Forms.Panel pnlJoystick;
private System.Windows.Forms.Panel pnlAcompanhamento;
private System.Windows.Forms.Label lblModoControle;
private System.Windows.Forms.ComboBox cmbModoControle;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel lblUltimaLeituraSolo;
private System.Windows.Forms.ToolStripStatusLabel lblUltimaLeituraCaminho;
private System.Windows.Forms.ToolStripStatusLabel lblPerformance;
}
}

View File

@ -11,7 +11,6 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
namespace AgroBase.Forms.IHM
{
@ -22,9 +21,22 @@ namespace AgroBase.Forms.IHM
public frmDialogoMapa()
{
InitializeComponent();
// Ativa o double buffering
this.DoubleBuffered = true;
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
pnlJoystick.GetType().GetMethod("SetStyle", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).Invoke(pnlJoystick, new object[] { ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true });
tmrLeitura.Tick += tmrLeitura_Tick;
tmrLeitura.Start();
cmbModoControle.Items.Clear();
cmbModoControle.Items.AddRange(Enum.GetNames(typeof(Enums.TipoMovimentoDirecional)));
cmbModoControle.SelectedIndexChanged += CmbModoControle_SelectedIndexChanged;
FuncoesGlobais.DefinirEventosPicBtn(picFechar, async () =>
{
if (Variaveis.OperacaoEmAndamento.Iniciado)
@ -32,6 +44,10 @@ namespace AgroBase.Forms.IHM
if (MessageBox.Show("Tem certeza que deseja interromper a operação em andamento?", "Interromper Operação", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
Variaveis.OperacaoEmAndamento.FinalizarOperacao();
if (Variaveis.OperacaoEmAndamento.Modo == Enums.ModoOperacao.Manual)
{
this.Close();
}
}
}
else
@ -39,6 +55,8 @@ namespace AgroBase.Forms.IHM
this.Hide();
}
});
InicializarModoManual();
}
public async Task AtualizarRuasSelecionadas(List<string> ruasSelecionadas)
@ -62,14 +80,16 @@ namespace AgroBase.Forms.IHM
var ultimaLeitura = Variaveis.OperacaoEmAndamento.CamerasSolo.OrderByDescending(x => x.Leitura.timestamp).FirstOrDefault();
if (ultimaLeitura != null)
{
lblUltimaLeituraSolo.Text = "Ultima Leitura Solo: " + FuncoesGlobais.TimestampToDate(ultimaLeitura.Leitura.timestamp);
lblUltimaLeituraSolo.Text = "Última Leitura Solo: " + FuncoesGlobais.TimestampToDate(ultimaLeitura.Leitura.timestamp);
}
if (Variaveis.OperacaoEmAndamento.CameraCaminho != null)
{
lblUltimaLeituraRua.Text = "Ultima Leitura Rua: " + FuncoesGlobais.TimestampToDate(Variaveis.OperacaoEmAndamento.CameraCaminho.Leitura.timestamp);
lblUltimaLeituraCaminho.Text = "Última Leitura Caminho: " + FuncoesGlobais.TimestampToDate(Variaveis.OperacaoEmAndamento.CameraCaminho.Leitura.timestamp);
}
lblPerformance.Text = Variaveis.OperacaoEmAndamento.PerformanceStr;
txtModoOperacao.Text = Variaveis.OperacaoEmAndamento.Modo.ToString();
cmbModoControle.SelectedIndex = (int)Variaveis.OperacaoEmAndamento.Controle.TipoMovimento;
txtStatusAtual.Text = Variaveis.OperacaoEmAndamento.StatusAtual.ToString();
txtIniciadoEm.Text = new DateTime(Variaveis.OperacaoEmAndamento.TimestampInicio).ToString("dd/MM HH:mm:ss");
txtConcluidoEm.Text = new DateTime(Variaveis.OperacaoEmAndamento.TimestampFim).ToString("dd/MM HH:mm:ss");
@ -109,6 +129,147 @@ namespace AgroBase.Forms.IHM
}
catch { }
}
#region MODO MANUAL
private Point joystickCenter;
private bool isDragging = false;
private Keys prevMovKey = Keys.None;
private Keys prevDirKey = Keys.None;
private int joystickRadius;
private Point joystickPosition;
private void InicializarModoManual()
{
if (Variaveis.OperacaoEmAndamento.Modo == Enums.ModoOperacao.Manual)
{
Variaveis.OperacaoEmAndamento.Mapa = new MapasModel()
{
pnlMapa = pnlMapa,
lblMapa = lblMapaCarregado
};
Variaveis.OperacaoEmAndamento.Mapa.CarregarMapaGPS();
cmbModoControle.Enabled = true;
pnlJoystick.Visible = true;
// Configurar o painel do joystick
pnlJoystick.BackColor = Color.FromArgb(128, 0, 0, 0); // Fundo semitransparente
// Definir região circular para o painel
System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
path.AddEllipse(0, 0, pnlJoystick.Width, pnlJoystick.Height);
pnlJoystick.Region = new Region(path);
// Calcular o centro do joystick
joystickCenter = new Point(pnlJoystick.Width / 2, pnlJoystick.Height / 2);
// Definir o raio do joystick
joystickRadius = 25; // Metade do tamanho do círculo
joystickPosition = joystickCenter;
// Evento de pintura do painel
pnlJoystick.Paint += PanelJoystickBack_Paint;
// Eventos de toque/mouse
pnlJoystick.MouseDown += PanelJoystickBack_MouseDown;
pnlJoystick.MouseMove += PanelJoystickBack_MouseMove;
pnlJoystick.MouseUp += PanelJoystickBack_MouseUp;
IniciarOperacao();
}
}
private void PanelJoystickBack_Paint(object sender, PaintEventArgs e)
{
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
e.Graphics.FillEllipse(Brushes.Red, joystickPosition.X - joystickRadius, joystickPosition.Y - joystickRadius, joystickRadius * 2, joystickRadius * 2);
}
private void PanelJoystickBack_MouseDown(object sender, MouseEventArgs e)
{
isDragging = true;
}
private void PanelJoystickBack_MouseMove(object sender, MouseEventArgs e)
{
if (isDragging)
{
// Calcula a nova posição do joystick
var mouseX = e.X;
var mouseY = e.Y;
var deltaX = mouseX - joystickCenter.X;
var deltaY = mouseY - joystickCenter.Y;
// Limitar o movimento do joystick ao círculo do painel
var distance = Math.Sqrt(deltaX * deltaX + deltaY * deltaY);
var maxDistance = pnlJoystick.Width / 2;
if (distance > maxDistance)
{
deltaX = (int)(deltaX / distance * maxDistance);
deltaY = (int)(deltaY / distance * maxDistance);
}
joystickPosition = new Point(joystickCenter.X + deltaX, joystickCenter.Y + deltaY);
pnlJoystick.Invalidate(); // Redesenha o painel
// Enviar comandos de movimento ao robô
SendMovementCommand(deltaX, deltaY);
}
}
private void PanelJoystickBack_MouseUp(object sender, MouseEventArgs e)
{
isDragging = false;
// Retorna o joystick ao centro
joystickPosition = joystickCenter;
pnlJoystick.Invalidate(); // Redesenha o painel
// Enviar comando de parada ao robô
SendMovementCommand(0, 0);
}
private void SendMovementCommand(int deltaX, int deltaY)
{
Keys MovKey = Keys.Escape;
if (deltaY < -10) MovKey = Keys.Up;
else if (deltaY > 10) MovKey = Keys.Down;
Keys DirKey = Keys.Escape;
if (deltaX < -10) DirKey = Keys.Left;
else if (deltaX > 10) DirKey = Keys.Right;
// Verifica se o estado da tecla de movimento mudou
if (MovKey != prevMovKey)
{
// Lógica para enviar comando ao robô baseado em MovKey
Console.WriteLine($"Movimento: MovKey={MovKey}");
GeneralJoystick.EnviaComandoMotor(MovKey, Enums.T_Code.Mov);
prevMovKey = MovKey; // Atualiza o estado anterior
}
// Verifica se o estado da tecla de direção mudou
if (DirKey != prevDirKey)
{
// Lógica para enviar comando ao robô baseado em DirKey
Console.WriteLine($"Direção: DirKey={DirKey}");
GeneralJoystick.EnviaComandoMotor(DirKey, Enums.T_Code.Dir);
prevDirKey = DirKey; // Atualiza o estado anterior
}
}
private void CmbModoControle_SelectedIndexChanged(object sender, EventArgs e)
{
Variaveis.OperacaoEmAndamento.Controle.TipoMovimento = (Enums.TipoMovimentoDirecional)cmbModoControle.SelectedIndex;
}
#endregion
}
}

View File

@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -46,15 +46,18 @@
this.lblD_Cam_S0 = new System.Windows.Forms.Label();
this.lblD_Cam_S1 = new System.Windows.Forms.Label();
this.lblD_Cam_C = new System.Windows.Forms.Label();
this.lblDiagnosticos = new System.Windows.Forms.Label();
this.lblOperacao = new System.Windows.Forms.Label();
this.lblAjustes = new System.Windows.Forms.Label();
this.lblDesligar = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.picManual = new System.Windows.Forms.PictureBox();
this.picDiagnosticos = new System.Windows.Forms.PictureBox();
this.picOperacao = new System.Windows.Forms.PictureBox();
this.picAjustes = new System.Windows.Forms.PictureBox();
this.picDesligar = new System.Windows.Forms.PictureBox();
this.picRobo = new System.Windows.Forms.PictureBox();
this.lblDiagnosticos = new System.Windows.Forms.Label();
this.lblOperacao = new System.Windows.Forms.Label();
this.lblAjustes = new System.Windows.Forms.Label();
this.lblDesligar = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.picManual)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picDiagnosticos)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picOperacao)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picAjustes)).BeginInit();
@ -273,6 +276,72 @@
this.lblD_Cam_C.Text = "CAM";
this.lblD_Cam_C.Click += new System.EventHandler(this.lblModulo_Click);
//
// lblDiagnosticos
//
this.lblDiagnosticos.AutoSize = true;
this.lblDiagnosticos.BackColor = System.Drawing.Color.Transparent;
this.lblDiagnosticos.Cursor = System.Windows.Forms.Cursors.Hand;
this.lblDiagnosticos.Location = new System.Drawing.Point(369, 162);
this.lblDiagnosticos.Name = "lblDiagnosticos";
this.lblDiagnosticos.Size = new System.Drawing.Size(117, 24);
this.lblDiagnosticos.TabIndex = 32;
this.lblDiagnosticos.Text = "Diagnósticos";
//
// lblOperacao
//
this.lblOperacao.AutoSize = true;
this.lblOperacao.BackColor = System.Drawing.Color.Transparent;
this.lblOperacao.Cursor = System.Windows.Forms.Cursors.Hand;
this.lblOperacao.Location = new System.Drawing.Point(527, 162);
this.lblOperacao.Name = "lblOperacao";
this.lblOperacao.Size = new System.Drawing.Size(94, 24);
this.lblOperacao.TabIndex = 33;
this.lblOperacao.Text = "Operação";
//
// lblAjustes
//
this.lblAjustes.AutoSize = true;
this.lblAjustes.BackColor = System.Drawing.Color.Transparent;
this.lblAjustes.Cursor = System.Windows.Forms.Cursors.Hand;
this.lblAjustes.Location = new System.Drawing.Point(689, 162);
this.lblAjustes.Name = "lblAjustes";
this.lblAjustes.Size = new System.Drawing.Size(71, 24);
this.lblAjustes.TabIndex = 35;
this.lblAjustes.Text = "Ajustes";
//
// lblDesligar
//
this.lblDesligar.AutoSize = true;
this.lblDesligar.BackColor = System.Drawing.Color.Transparent;
this.lblDesligar.Cursor = System.Windows.Forms.Cursors.Hand;
this.lblDesligar.Location = new System.Drawing.Point(685, 450);
this.lblDesligar.Name = "lblDesligar";
this.lblDesligar.Size = new System.Drawing.Size(78, 24);
this.lblDesligar.TabIndex = 36;
this.lblDesligar.Text = "Desligar";
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Cursor = System.Windows.Forms.Cursors.Hand;
this.label1.Location = new System.Drawing.Point(364, 450);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(126, 24);
this.label1.TabIndex = 38;
this.label1.Text = "Modo Manual";
//
// picManual
//
this.picManual.Cursor = System.Windows.Forms.Cursors.Default;
this.picManual.Image = global::AgroBase.Properties.Resources.joystick;
this.picManual.Location = new System.Drawing.Point(362, 302);
this.picManual.Name = "picManual";
this.picManual.Size = new System.Drawing.Size(130, 130);
this.picManual.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picManual.TabIndex = 37;
this.picManual.TabStop = false;
//
// picDiagnosticos
//
this.picDiagnosticos.Cursor = System.Windows.Forms.Cursors.Default;
@ -327,56 +396,14 @@
this.picRobo.TabIndex = 1;
this.picRobo.TabStop = false;
//
// lblDiagnosticos
//
this.lblDiagnosticos.AutoSize = true;
this.lblDiagnosticos.BackColor = System.Drawing.Color.Transparent;
this.lblDiagnosticos.Cursor = System.Windows.Forms.Cursors.Hand;
this.lblDiagnosticos.Location = new System.Drawing.Point(369, 162);
this.lblDiagnosticos.Name = "lblDiagnosticos";
this.lblDiagnosticos.Size = new System.Drawing.Size(117, 24);
this.lblDiagnosticos.TabIndex = 32;
this.lblDiagnosticos.Text = "Diagnósticos";
//
// lblOperacao
//
this.lblOperacao.AutoSize = true;
this.lblOperacao.BackColor = System.Drawing.Color.Transparent;
this.lblOperacao.Cursor = System.Windows.Forms.Cursors.Hand;
this.lblOperacao.Location = new System.Drawing.Point(527, 162);
this.lblOperacao.Name = "lblOperacao";
this.lblOperacao.Size = new System.Drawing.Size(94, 24);
this.lblOperacao.TabIndex = 33;
this.lblOperacao.Text = "Operação";
//
// lblAjustes
//
this.lblAjustes.AutoSize = true;
this.lblAjustes.BackColor = System.Drawing.Color.Transparent;
this.lblAjustes.Cursor = System.Windows.Forms.Cursors.Hand;
this.lblAjustes.Location = new System.Drawing.Point(689, 162);
this.lblAjustes.Name = "lblAjustes";
this.lblAjustes.Size = new System.Drawing.Size(71, 24);
this.lblAjustes.TabIndex = 35;
this.lblAjustes.Text = "Ajustes";
//
// lblDesligar
//
this.lblDesligar.AutoSize = true;
this.lblDesligar.BackColor = System.Drawing.Color.Transparent;
this.lblDesligar.Cursor = System.Windows.Forms.Cursors.Hand;
this.lblDesligar.Location = new System.Drawing.Point(685, 450);
this.lblDesligar.Name = "lblDesligar";
this.lblDesligar.Size = new System.Drawing.Size(78, 24);
this.lblDesligar.TabIndex = 36;
this.lblDesligar.Text = "Desligar";
//
// frmIHM
//
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(800, 480);
this.Controls.Add(this.label1);
this.Controls.Add(this.picManual);
this.Controls.Add(this.lblDesligar);
this.Controls.Add(this.lblAjustes);
this.Controls.Add(this.lblOperacao);
@ -411,6 +438,7 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Agrobotics Persistence";
this.Load += new System.EventHandler(this.frmIHM_Load);
((System.ComponentModel.ISupportInitialize)(this.picManual)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picDiagnosticos)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picOperacao)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picAjustes)).EndInit();
@ -450,5 +478,7 @@
private System.Windows.Forms.Label lblOperacao;
private System.Windows.Forms.Label lblAjustes;
private System.Windows.Forms.Label lblDesligar;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.PictureBox picManual;
}
}

View File

@ -40,6 +40,19 @@ namespace AgroBase.Forms.IHM
frmAjustes frm = new frmAjustes();
frm.ShowDialog();
});
FuncoesGlobais.DefinirEventosPicBtn(picManual, async () =>
{
Variaveis.OperacaoEmAndamento = OperacaoModel.CarregarParametrosOperacaoPadrao(ModoOperacao.Manual);
if (Variaveis.OperacaoEmAndamento.OperacaoLiberada)
{
frmDialogoMapa frm = new frmDialogoMapa();
frm.ShowDialog();
}
else
{
MessageBox.Show(Variaveis.OperacaoEmAndamento.ErroOperacaoLiberada, "Iniciar Operação Manual", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
});
FuncoesGlobais.DefinirEventosPicBtn(picDesligar, async () =>
{
if (MessageBox.Show("Deseja desligar o equipamento?", "Desligar", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)

View File

@ -223,8 +223,14 @@ namespace AgroBase.Forms.Sensoriamento
}
else
{
PZEMService.ModoLeitura = true;
var Comando = PZEMService.ComandoGetParametro(PZEMService.Parametros[cmbBateriaParametro.Text]);
PZEMService.EnviarComando(ModbusService._PortaModbus, Comando);
Task.Run(async () =>
{
await Task.Delay(1000);
PZEMService.ModoLeitura = false;
});
}
}

View File

@ -78,7 +78,7 @@ namespace AgroBase.Forms
foreach (var Modulo in DispMvd.Dados.Modulos)
{
Label lblTitulo = pnlFundo.Controls.OfType<Label>().FirstOrDefault(ctrl => ctrl.Name == "lblM_" + Modulo.Modulo_ID);
lblTitulo.ForeColor = Modulo.MovMotor.Comandar ? Modulo.MovMotor.Inicializado ? Color.Green : Color.Red : Color.Black;
lblTitulo.ForeColor = Modulo.MovMotor.Comandar ? Modulo.MovMotor.BLD_Inicializado ? Color.Green : Color.Red : Color.Black;
lblTitulo.Text = lblTitulo.Text.Split(' ')[0] + " (" + Modulo.Modulo_ID + ") - Alm: " + Modulo.MovMotor.CodigoAlarme;
Label lblM_RPMSP = pnlFundo.Controls.OfType<Label>().FirstOrDefault(ctrl => ctrl.Name == "lbl" + Modulo.Modulo_ID + "M_RPMSP");
lblM_RPMSP.Text = "RPM SP: " + Variaveis.OperacaoEmAndamento.Controle.RPM_SP.ToString("0.00");

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -615,6 +615,13 @@ namespace AgroBase
break;
}
}
var Ctrl = Variaveis.OperacaoEmAndamento.Controle.TiposControle.FirstOrDefault(x => x.Tipo == Comando.Dispositivo);
if (Ctrl != null)
{
Ctrl.UltimaDirecao = DirecaoAtual;
}
foreach (var ProtocoloMotor in Protocolos)
{
Dispositivo.AdicionarMensagemFila(ProtocoloMotor.Key, ProtocoloMotor.Value, true, false);

View File

@ -798,39 +798,36 @@ namespace AgroBase.Models.Modules
{
BLD300RService.AdicionarComandoNaFila(new BLDComandoModel()
{
Momento = Agora,
Endereco = Addr,
Parametro = BLD300RService.Parametros.First(x => x.Chave == "Direction"),
Valor = Sentido_SP == Sentido.Horario ? 1 : 0,
Get = false,
AguardaResposta = true,
TimeoutResposta = 200,
TimeoutResposta = 500,
});
}
if (Ligado && (Leitura == null || Leitura.RPM_SP != RPM_SP_C))
{
BLD300RService.AdicionarComandoNaFila(new BLDComandoModel()
{
Momento = Agora.AddSeconds(1),
Endereco = Addr,
Parametro = BLD300RService.Parametros.First(x => x.Chave == "RPM_SP"),
Valor = RPM_SP,
Get = false,
AguardaResposta = true,
TimeoutResposta = 200,
TimeoutResposta = 500,
});
}
if (Leitura == null || Leitura.Freado != Freio)
{
BLD300RService.AdicionarComandoNaFila(new BLDComandoModel()
{
Momento = Agora.AddSeconds(2),
Endereco = Addr,
Parametro = BLD300RService.Parametros.First(x => x.Chave == "Breaked"),
Valor = Freio ? 1 : 0,
Get = false,
AguardaResposta = true,
TimeoutResposta = 200,
TimeoutResposta = 500,
});
AcaoDoFreio = Freio ? AcaoFreio.Ativar : AcaoFreio.Desativar;
@ -839,13 +836,12 @@ namespace AgroBase.Models.Modules
{
BLD300RService.AdicionarComandoNaFila(new BLDComandoModel()
{
Momento = Agora.AddSeconds(3),
Endereco = Addr,
Parametro = BLD300RService.Parametros.First(x => x.Chave == "Enabled"),
Valor = RPM_SP > 0 ? 1 : 0,
Get = false,
AguardaResposta = true,
TimeoutResposta = 200,
TimeoutResposta = 500,
});
}
}

View File

@ -1081,6 +1081,8 @@ namespace AgroBase.Models
private void TmrLeituras_Tick(object sender, EventArgs e)
{
AtualizarDadosPerformance();
if (Variaveis.IsAgroMonitor || !Variaveis.OperacaoEmAndamento.OperacaoLiberada)
{
return;
@ -1123,7 +1125,7 @@ namespace AgroBase.Models
{
}
AtualizarDadosPerformance();
AtualizaInformacoesControleOperacao();
}
@ -1561,16 +1563,16 @@ namespace AgroBase.Models
SenSensoriamentoLogModel logSen = new SenSensoriamentoLogModel()
{
Momento = Agora,
Inicializado = DispSen.Dados.Conectado,
Barramento3v3Corrente = DispSen.Dados.Sensores.FirstOrDefault(x => x.ID == "AB3V" && x.Inicializado)?.Leituras?[0] ?? -1,
Barramento3v3Tensao = DispSen.Dados.Sensores.FirstOrDefault(x => x.ID == "AB3V" && x.Inicializado)?.Leituras?[1] ?? -1,
Barramento5vCorrente = DispSen.Dados.Sensores.FirstOrDefault(x => x.ID == "AB5V" && x.Inicializado)?.Leituras?[0] ?? -1,
Barramento5vTensao = DispSen.Dados.Sensores.FirstOrDefault(x => x.ID == "AB5V" && x.Inicializado)?.Leituras?[1] ?? -1,
Barramento7v2Corrente = DispSen.Dados.Sensores.FirstOrDefault(x => x.ID == "AB7V2" && x.Inicializado)?.Leituras?[0] ?? -1,
Barramento7v2Tensao = DispSen.Dados.Sensores.FirstOrDefault(x => x.ID == "AB7V2" && x.Inicializado)?.Leituras?[1] ?? -1,
Barramento12vCorrente = DispSen.Dados.Sensores.FirstOrDefault(x => x.ID == "AB12V" && x.Inicializado)?.Leituras?[0] ?? -1,
Barramento12vTensao = DispSen.Dados.Sensores.FirstOrDefault(x => x.ID == "AB12V" && x.Inicializado)?.Leituras?[1] ?? -1,
OrientacaoMagnetica = DispSen.Dados.Sensores.FirstOrDefault(x => x.ID == "SMAG" && x.Inicializado)?.Leituras?[0] ?? -1,
Inicializado = DispSen.Dados.Conectado,
Barramento3v3Corrente = DispSen.Dados.Sensores.FirstOrDefault(x => x.ID == "AB3V" && x.Inicializado && x.Leituras != null && x.Leituras.Count() > 0)?.Leituras?[0] ?? -1,
Barramento3v3Tensao = DispSen.Dados.Sensores.FirstOrDefault(x => x.ID == "AB3V" && x.Inicializado && x.Leituras != null && x.Leituras.Count() > 1)?.Leituras?[1] ?? -1,
Barramento5vCorrente = DispSen.Dados.Sensores.FirstOrDefault(x => x.ID == "AB5V" && x.Inicializado && x.Leituras != null && x.Leituras.Count() > 0)?.Leituras?[0] ?? -1,
Barramento5vTensao = DispSen.Dados.Sensores.FirstOrDefault(x => x.ID == "AB5V" && x.Inicializado && x.Leituras != null && x.Leituras.Count() > 1)?.Leituras?[1] ?? -1,
Barramento7v2Corrente = DispSen.Dados.Sensores.FirstOrDefault(x => x.ID == "AB7V2" && x.Inicializado && x.Leituras != null && x.Leituras.Count() > 0)?.Leituras?[0] ?? -1,
Barramento7v2Tensao = DispSen.Dados.Sensores.FirstOrDefault(x => x.ID == "AB7V2" && x.Inicializado && x.Leituras != null && x.Leituras.Count() > 1)?.Leituras?[1] ?? -1,
Barramento12vCorrente = DispSen.Dados.Sensores.FirstOrDefault(x => x.ID == "AB12V" && x.Inicializado && x.Leituras != null && x.Leituras.Count() > 0)?.Leituras?[0] ?? -1,
Barramento12vTensao = DispSen.Dados.Sensores.FirstOrDefault(x => x.ID == "AB12V" && x.Inicializado && x.Leituras != null && x.Leituras.Count() > 1)?.Leituras?[1] ?? -1,
OrientacaoMagnetica = DispSen.Dados.Sensores.FirstOrDefault(x => x.ID == "SMAG" && x.Inicializado && x.Leituras != null && x.Leituras.Count() > 0)?.Leituras?[0] ?? -1,
StatusSinaleiroMN = DispSen.Dados.Sinaleiros.FirstOrDefault(x => x.ID == "LEDMN" && x.Inicializado)?.StatusLED ?? StatusLED.Apagado,
StatusSinaleiroAT = DispSen.Dados.Sinaleiros.FirstOrDefault(x => x.ID == "LEDAT" && x.Inicializado)?.StatusLED ?? StatusLED.Apagado,
StatusSinaleiroOP = DispSen.Dados.Sinaleiros.FirstOrDefault(x => x.ID == "LEDOP" && x.Inicializado)?.StatusLED ?? StatusLED.Apagado,
@ -1932,6 +1934,7 @@ namespace AgroBase.Models
public int DelayEnvioComando { get; set; }
public DateTime UltimoComando { get; set; }
public List<string> Comandos { get; set; }
public Direcao UltimaDirecao { get; set; }
}
public class OperacaoModulosMandatoriosModel

View File

@ -170,6 +170,16 @@ namespace AgroBase.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap joystick {
get {
object obj = ResourceManager.GetObject("joystick", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View File

@ -184,4 +184,7 @@
<data name="excluir" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\excluir.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="joystick" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\joystick.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -12,6 +12,8 @@ using Emgu.CV.Structure;
using System.Drawing.Printing;
using System.Threading;
using System.IO;
using Newtonsoft.Json;
using System.Collections;
namespace AgroBase.Services
{
@ -31,9 +33,10 @@ namespace AgroBase.Services
{
_PortaBLD.Open();
}
catch
catch (Exception ex)
{
_PortaBLD = null;
RegisrarErrosComunicacao(0, $"Erro ao abrir porta {_PortaBLD.PortName}. Erro={ex.Message}");
//_PortaBLD = null;
}
}
return _PortaBLD != null && _PortaBLD.IsOpen && DadosLeitura.Any(x => x.Iniciado);
@ -248,6 +251,11 @@ namespace AgroBase.Services
AtualizarPortaCOM(porta);
}
if (Iniciado)
{
return true;
}
EnvioLiberado = false;
var Parametro = Parametros.First(x => x.Chave == "Versao");
@ -263,7 +271,7 @@ namespace AgroBase.Services
}
catch
{
Console.WriteLine("Erro ao definir endereco");
RegisrarErrosComunicacao(Addr, $"Erro ao definir endereço");
}
if (DadosLeitura.Any(x => x.Endereco == Addr && x.Iniciado))
@ -307,6 +315,28 @@ namespace AgroBase.Services
_PortaBLD.Open();
}
private static void ReconectarPortaCOM()
{
RegisrarErrosComunicacao(0, $"Reiniciando conexão com a porta {_PortaBLD.PortName}...");
try
{
_PortaBLD.Close();
}
catch (Exception ex)
{
RegisrarErrosComunicacao(0, $"Erro ao reiniciar conexão. Erro={ex.Message}");
}
if (Iniciado)
{
RegisrarErrosComunicacao(0, $"Reconexão com a porta {_PortaBLD.PortName} reestabelecida");
}
else
{
RegisrarErrosComunicacao(0, $"Erro ao reestabelecer conexão com a porta {_PortaBLD.PortName}");
}
}
private static void DefinirDispositivo(List<string> Mod_IDs)
{
if (Iniciado)
@ -420,12 +450,29 @@ namespace AgroBase.Services
Modulo.MovMotor.CodigoAlarme = Leitura.CodigoAlarme;
Variaveis.OperacaoEmAndamento.DispMvd.Dados.RegistrarLogMov(Modulo);
if (Modulo.MovMotor.CodigoAlarme > 0 && Modulo.MovMotor.CodigoAlarme <= 99)
{
RegisrarErrosComunicacao(Leitura.Endereco, $"Módulo com código de alarme {Modulo.MovMotor.CodigoAlarme}, reiniciando o módulo...");
AdicionarComandoNaFila(new BLDComandoModel()
{
Endereco = Leitura.Endereco,
AguardaResposta = true,
TimeoutResposta = 200,
Get = false,
Parametro = Parametros.First(x => x.Chave == "AlarmeCode"),
Valor = 0
});
}
var Controle = Variaveis.OperacaoEmAndamento.Controle.TiposControle.FirstOrDefault(x => x.Tipo == T_Code.Mov);
Modulo.MovMotor.ProtocoloComando(Controle.UltimaDirecao);
}
}
}
}
private static void DecifrarResposta(byte[] resposta, ModbusParametrosModel Parametro, byte Addr)
private static bool DecifrarResposta(byte[] resposta, ModbusParametrosModel Parametro, byte Addr)
{
try
{
@ -477,16 +524,21 @@ namespace AgroBase.Services
}
else
{
Console.WriteLine("Resposta inválida ou código de função incorreto.");
RegisrarErrosComunicacao(Addr, $"Resposta inválida ou código de função incorreto. {BitConverter.ToString(resposta)}");
}
ParametroLeitura.Valor = Parametro.Valor;
Leitura.UltimoComandoRecebido = DateTime.Now;
return true;
}
RegisrarErrosComunicacao(Addr, $"Resposta inválida. {BitConverter.ToString(resposta)}");
return false;
}
catch (Exception ex)
{
RegisrarErrosComunicacao(Addr, $"Erro ao decifrar resposta. {BitConverter.ToString(resposta)}");
return false;
}
}
@ -569,6 +621,7 @@ namespace AgroBase.Services
if (comando != null && comando.Length > 0)
{
//Console.WriteLine("Enviando comando para o endereço: " + Comando.Endereco);
EnviarComando(_PortaBLD, comando);
Comando.Enviado = true;
@ -576,19 +629,23 @@ namespace AgroBase.Services
if (Comando.AguardaResposta)
{
byte[] resposta = await SerialService.LerDadosDaPortaSerialAsync(_PortaBLD, 7, Comando.TimeoutResposta);
DecifrarResposta(resposta, Comando.Parametro, Comando.Endereco);
bool Respondido = DecifrarResposta(resposta, Comando.Parametro, Comando.Endereco);
if (!Respondido)
{
RegisrarErrosComunicacao(Comando.Endereco, $"Timeout ao receber resposta. GET={Comando.Get}, Parametro={Comando.Parametro.Chave}, Valor={Comando.Valor}");
Comando.Enviado = false;
Comando.Momento = DateTime.Now.AddMilliseconds(500);
//ReconectarPortaCOM();
}
}
}
}
catch (IOException ex)
{
Console.WriteLine("Erro ao enviar comando BLD300R: " + ex.Message);
RegisrarErrosComunicacao(Comando.Endereco, $"Erro ao enviar comando. GET={Comando.Get}, Parametro={Comando.Parametro.Chave}, Valor={Comando.Valor}, Erro={ex.Message}");
Comando.Enviado = false;
Comando.Momento = DateTime.Now.AddSeconds(1);
}
finally
{
EnvioLiberado = true;
Comando.Momento = DateTime.Now.AddMilliseconds(500);
ReconectarPortaCOM();
}
}
@ -626,7 +683,7 @@ namespace AgroBase.Services
}
catch (Exception ex)
{
Console.WriteLine("Erro ao processar fila de comandos BLD300R: " + ex.Message);
RegisrarErrosComunicacao(0, $"Erro ao processar fila de comandos. Erro={ex.Message}");
}
finally
{
@ -656,6 +713,28 @@ namespace AgroBase.Services
}
}
private static void RegisrarErrosComunicacao(byte addr, string mensagem)
{
var Caminho = Variaveis.CaminhoLogsDispositivos;
if (!Directory.Exists(Caminho))
{
Directory.CreateDirectory(Caminho);
}
var Arquivo = T_Code.Bld.ToString() + "_err.txt";
Caminho += "/" + Arquivo;
mensagem = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss:fff") + " - Porta " + _PortaBLD.PortName + " - " + addr + ": " + mensagem + Environment.NewLine;
if (!File.Exists(Caminho))
{
File.WriteAllText(Caminho, mensagem);
}
else
{
File.AppendAllText(Caminho, mensagem);
}
}
public class BLDParametrosRequisitar
{

View File

@ -26,6 +26,7 @@ namespace AgroBase.Services
public static PZEMModel PenultimaLeitura = new PZEMModel();
public static double TensaoMinima { get; set; } = 30;
public static double TensaoMaxima { get; set; } = 42;
public static bool ModoLeitura = false;
public static Dictionary<string, byte> CodigosFuncoes = new Dictionary<string, byte>()
@ -365,7 +366,7 @@ namespace AgroBase.Services
{
var parametro_raw = "0x" + resposta[3].ToString("X") + resposta[4].ToString("X");
double Valor = Convert.ToInt16(parametro_raw, 16) * 0.01;
if (Iniciado)
if (ModoLeitura)
{
MessageBox.Show("Valor do parâmetro: " + Valor);
}

View File

@ -23,7 +23,7 @@ namespace AgroBase.Services
public static string BeginSensor = "#";
public static string SplitMessage = ";";
public static string SplitParams = ",";
public static List<T_Code> DispositivosMotores = new List<T_Code>() { T_Code.Mov, T_Code.Dir, T_Code.Mvd };
public static List<T_Code> DispositivosMotores = new List<T_Code>() { T_Code.Mov, T_Code.Dir };
public static List<T_Code> DispositivosConexaoInicial = new List<T_Code>() { T_Code.Mvd, T_Code.Atu, T_Code.Sen };
public static List<T_Code> DispositivosModbus = new List<T_Code>() { T_Code.Pzm, T_Code.Wit };
public static List<T_Code> DispositivosMultiplos = new List<T_Code>() { T_Code.Bld, T_Code.Mks, T_Code.Mvd };
@ -611,6 +611,10 @@ namespace AgroBase.Services
List<byte> buffer = new List<byte>();
while (buffer.Count < tamanhoEsperado && inicio.AddMilliseconds(Timeout) > DateTime.Now)
{
if (porta == null)
{
break;
}
int bytesDisponiveis = porta.BytesToRead;
if (bytesDisponiveis > 0)
{
@ -629,6 +633,10 @@ namespace AgroBase.Services
while (buffer.Count < tamanhoEsperado && inicio.AddMilliseconds(Timeout) > DateTime.Now)
{
await Task.Delay(50);
if (porta == null)
{
break;
}
int bytesDisponiveis = porta.BytesToRead;
if (bytesDisponiveis > 0)
{

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"Id":"1517","Name":"29_07_2024_14_15_39","Length":0.0,"Dist1":0.0,"Dist2":0.0},"geometry":{"id":null,"type":"LineString","coordinates":[[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0]]}}]}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"Id":"1517","Name":"23_07_2024_14_12_05","Length":0.0,"Dist1":0.0,"Dist2":0.0},"geometry":{"id":null,"type":"LineString","coordinates":[[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0]]}}]}
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"Id":"1517","Name":"29_07_2024_14_15_39","Length":0.0,"Dist1":0.0,"Dist2":0.0},"geometry":{"id":null,"type":"LineString","coordinates":[[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0]]}}]}

View File

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

View File

@ -25,7 +25,7 @@
<meta name="viewport" content="width=device-width,
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
#map_4c1511543a3318b4054bda73f8e7b34f {
#map_8b746edb65baddbb62b29b725055b009 {
position: relative;
width: 100.0%;
height: 100.0%;
@ -39,14 +39,14 @@
<body>
<div class="folium-map" id="map_4c1511543a3318b4054bda73f8e7b34f" ></div>
<div class="folium-map" id="map_8b746edb65baddbb62b29b725055b009" ></div>
</body>
<script>
var map_4c1511543a3318b4054bda73f8e7b34f = L.map(
"map_4c1511543a3318b4054bda73f8e7b34f",
var map_8b746edb65baddbb62b29b725055b009 = L.map(
"map_8b746edb65baddbb62b29b725055b009",
{
center: [0.0, 0.0],
crs: L.CRS.EPSG3857,
@ -60,13 +60,13 @@
var tile_layer_836ff05d2c90a5e9bf146d172b708c92 = L.tileLayer(
var tile_layer_2835da91a371d88cc6112d2c5e4f3945 = L.tileLayer(
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
{"attribution": "\u0026copy; \u003ca href=\"https://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e contributors", "detectRetina": false, "maxNativeZoom": 19, "maxZoom": 19, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}
);
tile_layer_836ff05d2c90a5e9bf146d172b708c92.addTo(map_4c1511543a3318b4054bda73f8e7b34f);
tile_layer_2835da91a371d88cc6112d2c5e4f3945.addTo(map_8b746edb65baddbb62b29b725055b009);
@ -82,7 +82,7 @@
}*/
});
}
function geo_json_4fa859316e87a9b5513403965f584cc6_onEachFeature(feature, layer) {
function geo_json_1771128b1c419f0965a9d8d43538c8da_onEachFeature(feature, layer) {
layer.on({
click: function(e) {
@ -118,20 +118,20 @@
}*/
});
};
var geo_json_4fa859316e87a9b5513403965f584cc6 = L.geoJson(null, {
onEachFeature: geo_json_4fa859316e87a9b5513403965f584cc6_onEachFeature,
var geo_json_1771128b1c419f0965a9d8d43538c8da = L.geoJson(null, {
onEachFeature: geo_json_1771128b1c419f0965a9d8d43538c8da_onEachFeature,
});
function geo_json_4fa859316e87a9b5513403965f584cc6_add (data) {
geo_json_4fa859316e87a9b5513403965f584cc6
function geo_json_1771128b1c419f0965a9d8d43538c8da_add (data) {
geo_json_1771128b1c419f0965a9d8d43538c8da
.addData(data);
}
geo_json_4fa859316e87a9b5513403965f584cc6_add({"features": [{"geometry": {"coordinates": [[0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]], "id": null, "type": "LineString"}, "id": 0, "properties": {"Dist1": 0.0, "Dist2": 0.0, "Id": "1517", "Length": 0.0, "Name": "23_07_2024_14_12_05"}, "type": "Feature"}], "type": "FeatureCollection"});
geo_json_1771128b1c419f0965a9d8d43538c8da_add({"features": [{"geometry": {"coordinates": [[0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]], "id": null, "type": "LineString"}, "id": 0, "properties": {"Dist1": 0.0, "Dist2": 0.0, "Id": "1517", "Length": 0.0, "Name": "29_07_2024_14_15_39"}, "type": "Feature"}], "type": "FeatureCollection"});
geo_json_4fa859316e87a9b5513403965f584cc6.addTo(map_4c1511543a3318b4054bda73f8e7b34f);
geo_json_1771128b1c419f0965a9d8d43538c8da.addTo(map_8b746edb65baddbb62b29b725055b009);
</script>
@ -152,7 +152,7 @@
}
trajeto_json_add({"features": []});
trajeto_json.addTo(map_4c1511543a3318b4054bda73f8e7b34f);
trajeto_json.addTo(map_8b746edb65baddbb62b29b725055b009);
function adicionarGeometria(novaGeometria) {
trajeto_json.addData(novaGeometria);
@ -210,7 +210,7 @@
}
trajeto_dinamico_json_add({"features": []});
trajeto_dinamico_json.addTo(map_4c1511543a3318b4054bda73f8e7b34f);
trajeto_dinamico_json.addTo(map_8b746edb65baddbb62b29b725055b009);
function adicionarGeometriaDinamica(novaGeometria) {
trajeto_dinamico_json.addData(novaGeometria);
@ -258,7 +258,7 @@
var marcadorDinamico = L.marker([0, 0], {
icon: customIcon
}).addTo(map_4c1511543a3318b4054bda73f8e7b34f);
}).addTo(map_8b746edb65baddbb62b29b725055b009);
// Conectar ao broker MQTT
const client = mqtt.connect('ws://localhost:9001'); // Use wss para conexão segura
@ -315,7 +315,7 @@
marcadorDinamico.setRotationAngle(angulo);
adicionarCoordenada("Tj", [novaLongitude, novaLatitude]);
map_4c1511543a3318b4054bda73f8e7b34f.setView(novaPosicao, map_4c1511543a3318b4054bda73f8e7b34f.getZoom());
map_8b746edb65baddbb62b29b725055b009.setView(novaPosicao, map_8b746edb65baddbb62b29b725055b009.getZoom());
}
else if (topic === 'selecao_ruas_mapa') {
var selecionadas = dados;
@ -328,7 +328,7 @@
function atualizarSelecaoRuas(selecionadas) {
selecionadas = JSON.parse(selecionadas);
RuasSelecionadas = Array.isArray(selecionadas) ? [...selecionadas] : [];
geo_json_4fa859316e87a9b5513403965f584cc6.eachLayer(function (layer) {
geo_json_1771128b1c419f0965a9d8d43538c8da.eachLayer(function (layer) {
if (RuasSelecionadas.includes(parseInt(layer.feature.id))) {
layer.setStyle({ color: 'blue' });
} else {