ajustado firmware e leitura de fluxo
This commit is contained in:
parent
c260596838
commit
9e8f198fcd
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -485,6 +485,7 @@
|
|||
<Compile Include="Services\UsrDR302Service.cs" />
|
||||
<Compile Include="Services\VersionamentoService.cs" />
|
||||
<Compile Include="Services\Visualizador3DService.cs" />
|
||||
<Compile Include="Services\WifiService.cs" />
|
||||
<Compile Include="Services\WT901CService.cs" />
|
||||
<None Include="Imagens\seta_voltar.png" />
|
||||
<None Include="Imagens\wifi_off.png" />
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ namespace AgroBase.Forms.Atuador
|
|||
grdSensoriamento.Rows[3].Cells[1].Value = DispAtu.Dados.BombaPressurizadora.LeituraPotencia;
|
||||
grdSensoriamento.Rows[4].Cells[1].Value = DispAtu.Dados.PressaoLinha.ToString("0.00000");
|
||||
grdSensoriamento.Rows[5].Cells[1].Value = DispAtu.Dados.PressaoLinhaCalc.ToString("0.00000");
|
||||
grdSensoriamento.Rows[6].Cells[1].Value = DispAtu.Dados.VazaoFluxoMLpS.ToString("0.00000");
|
||||
grdSensoriamento.Rows[6].Cells[1].Value = DispAtu.Dados.VazaoFluxoMLpSMedia.ToString("0.00000");
|
||||
grdSensoriamento.Rows[7].Cells[1].Value = DispAtu.Dados.MassaReservatorio.ToString("0.00000");
|
||||
grdSensoriamento.Rows[8].Cells[1].Value = DispAtu.Dados.VolumeReservatorio.ToString("0.00000");
|
||||
grdSensoriamento.Rows[9].Cells[1].Value = DispAtu.Dados.PercentualReservatorio.ToString("0.00");
|
||||
|
|
@ -156,18 +156,21 @@ namespace AgroBase.Forms.Atuador
|
|||
|
||||
private void nudPressaoSP_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
var Bomba = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombaPressurizadora;
|
||||
Variaveis.OperacaoEmAndamento.Controle.PressaoLinha = Convert.ToInt32(((NumericUpDown)sender).Value);
|
||||
GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombaPressurizadora.ComandoAtuar);
|
||||
GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, Bomba.ComandoAtuar, Bomba.ID);
|
||||
}
|
||||
|
||||
private void btnLigarBomba_Click(object sender, EventArgs e)
|
||||
{
|
||||
GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, true);
|
||||
var Bomba = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombaPressurizadora;
|
||||
GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, true, Bomba.ID);
|
||||
}
|
||||
|
||||
private void btnDesligarBomba_Click(object sender, EventArgs e)
|
||||
{
|
||||
GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, false);
|
||||
var Bomba = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombaPressurizadora;
|
||||
GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, false, Bomba.ID);
|
||||
}
|
||||
|
||||
private void pnlBico_Paint(object sender, PaintEventArgs e)
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ namespace AgroBase.Forms
|
|||
{
|
||||
cameraSolo.camera.selectedCamera = cmbCameras.SelectedIndex > 0 ? cmbCameras.SelectedIndex : 0;
|
||||
cmbCameras.Items.Clear();
|
||||
cmbCameras.Items.AddRange(CameraService.AtualizaListaCameras().Keys.ToArray());
|
||||
cmbCameras.Items.AddRange(CameraService.ObterListaCameras().Keys.ToArray());
|
||||
if (cmbCameras.Items.Count == 1)
|
||||
{
|
||||
cameraSolo.camera.selectedCamera = 0;
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ namespace AgroBase.Forms.IHM
|
|||
cmbS1.SelectedIndexChanged += cmbCameraSolo_SelectedIndexChanged;
|
||||
|
||||
|
||||
Cameras = CameraService.AtualizaListaCameras();
|
||||
Cameras = CameraService.ObterListaCameras();
|
||||
|
||||
cmbC.Items.Clear();
|
||||
if (KinectService.Iniciado)
|
||||
|
|
|
|||
|
|
@ -46,12 +46,12 @@
|
|||
this.dgSinaleiros = new System.Windows.Forms.DataGridView();
|
||||
this.tabResultados = new System.Windows.Forms.TabPage();
|
||||
this.dgResultados = new System.Windows.Forms.DataGridView();
|
||||
this.tabFalhas = new System.Windows.Forms.TabPage();
|
||||
this.tvwFalhas = new System.Windows.Forms.TreeView();
|
||||
this.picVoltar = new System.Windows.Forms.PictureBox();
|
||||
this.picDiagnosticarTudo = new System.Windows.Forms.PictureBox();
|
||||
this.picIniciarDiagnostico = new System.Windows.Forms.PictureBox();
|
||||
this.picLoading = new System.Windows.Forms.PictureBox();
|
||||
this.tabFalhas = new System.Windows.Forms.TabPage();
|
||||
this.tvwFalhas = new System.Windows.Forms.TreeView();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.tabPulverizador.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgPulverizador)).BeginInit();
|
||||
|
|
@ -70,11 +70,11 @@
|
|||
((System.ComponentModel.ISupportInitialize)(this.dgSinaleiros)).BeginInit();
|
||||
this.tabResultados.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgResultados)).BeginInit();
|
||||
this.tabFalhas.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picVoltar)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picDiagnosticarTudo)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picIniciarDiagnostico)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picLoading)).BeginInit();
|
||||
this.tabFalhas.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tabControl1
|
||||
|
|
@ -138,7 +138,7 @@
|
|||
this.dgMovimentacao.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
|
||||
this.dgMovimentacao.Location = new System.Drawing.Point(6, 6);
|
||||
this.dgMovimentacao.Name = "dgMovimentacao";
|
||||
this.dgMovimentacao.Size = new System.Drawing.Size(668, 406);
|
||||
this.dgMovimentacao.Size = new System.Drawing.Size(892, 522);
|
||||
this.dgMovimentacao.TabIndex = 1;
|
||||
//
|
||||
// tabDirecional
|
||||
|
|
@ -184,7 +184,7 @@
|
|||
this.dgSensoriamento.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
|
||||
this.dgSensoriamento.Location = new System.Drawing.Point(6, 6);
|
||||
this.dgSensoriamento.Name = "dgSensoriamento";
|
||||
this.dgSensoriamento.Size = new System.Drawing.Size(668, 406);
|
||||
this.dgSensoriamento.Size = new System.Drawing.Size(892, 522);
|
||||
this.dgSensoriamento.TabIndex = 3;
|
||||
//
|
||||
// tabComunicacao
|
||||
|
|
@ -207,12 +207,11 @@
|
|||
this.dgComunicacao.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
|
||||
this.dgComunicacao.Location = new System.Drawing.Point(6, 6);
|
||||
this.dgComunicacao.Name = "dgComunicacao";
|
||||
this.dgComunicacao.Size = new System.Drawing.Size(668, 406);
|
||||
this.dgComunicacao.Size = new System.Drawing.Size(892, 522);
|
||||
this.dgComunicacao.TabIndex = 4;
|
||||
//
|
||||
// tabCameras
|
||||
//
|
||||
this.tabCameras.Controls.Add(this.picCamera);
|
||||
this.tabCameras.Controls.Add(this.dgCameras);
|
||||
this.tabCameras.Location = new System.Drawing.Point(4, 38);
|
||||
this.tabCameras.Name = "tabCameras";
|
||||
|
|
@ -224,9 +223,9 @@
|
|||
//
|
||||
// picCamera
|
||||
//
|
||||
this.picCamera.Location = new System.Drawing.Point(574, 344);
|
||||
this.picCamera.Location = new System.Drawing.Point(12, 194);
|
||||
this.picCamera.Name = "picCamera";
|
||||
this.picCamera.Size = new System.Drawing.Size(100, 68);
|
||||
this.picCamera.Size = new System.Drawing.Size(65, 65);
|
||||
this.picCamera.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
this.picCamera.TabIndex = 6;
|
||||
this.picCamera.TabStop = false;
|
||||
|
|
@ -240,7 +239,7 @@
|
|||
this.dgCameras.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
|
||||
this.dgCameras.Location = new System.Drawing.Point(6, 6);
|
||||
this.dgCameras.Name = "dgCameras";
|
||||
this.dgCameras.Size = new System.Drawing.Size(668, 332);
|
||||
this.dgCameras.Size = new System.Drawing.Size(892, 522);
|
||||
this.dgCameras.TabIndex = 5;
|
||||
//
|
||||
// tabSinaleiros
|
||||
|
|
@ -263,7 +262,7 @@
|
|||
this.dgSinaleiros.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
|
||||
this.dgSinaleiros.Location = new System.Drawing.Point(6, 6);
|
||||
this.dgSinaleiros.Name = "dgSinaleiros";
|
||||
this.dgSinaleiros.Size = new System.Drawing.Size(668, 406);
|
||||
this.dgSinaleiros.Size = new System.Drawing.Size(892, 522);
|
||||
this.dgSinaleiros.TabIndex = 6;
|
||||
//
|
||||
// tabResultados
|
||||
|
|
@ -286,9 +285,30 @@
|
|||
this.dgResultados.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
|
||||
this.dgResultados.Location = new System.Drawing.Point(6, 6);
|
||||
this.dgResultados.Name = "dgResultados";
|
||||
this.dgResultados.Size = new System.Drawing.Size(668, 406);
|
||||
this.dgResultados.Size = new System.Drawing.Size(892, 522);
|
||||
this.dgResultados.TabIndex = 7;
|
||||
//
|
||||
// tabFalhas
|
||||
//
|
||||
this.tabFalhas.Controls.Add(this.tvwFalhas);
|
||||
this.tabFalhas.Location = new System.Drawing.Point(4, 38);
|
||||
this.tabFalhas.Name = "tabFalhas";
|
||||
this.tabFalhas.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabFalhas.Size = new System.Drawing.Size(904, 534);
|
||||
this.tabFalhas.TabIndex = 8;
|
||||
this.tabFalhas.Text = "Cód. Falhas";
|
||||
this.tabFalhas.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// tvwFalhas
|
||||
//
|
||||
this.tvwFalhas.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tvwFalhas.Location = new System.Drawing.Point(6, 6);
|
||||
this.tvwFalhas.Name = "tvwFalhas";
|
||||
this.tvwFalhas.Size = new System.Drawing.Size(892, 522);
|
||||
this.tvwFalhas.TabIndex = 0;
|
||||
//
|
||||
// picVoltar
|
||||
//
|
||||
this.picVoltar.Image = global::AgroBase.Properties.Resources.voltar;
|
||||
|
|
@ -331,32 +351,12 @@
|
|||
this.picLoading.TabIndex = 15;
|
||||
this.picLoading.TabStop = false;
|
||||
//
|
||||
// tabFalhas
|
||||
//
|
||||
this.tabFalhas.Controls.Add(this.tvwFalhas);
|
||||
this.tabFalhas.Location = new System.Drawing.Point(4, 38);
|
||||
this.tabFalhas.Name = "tabFalhas";
|
||||
this.tabFalhas.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabFalhas.Size = new System.Drawing.Size(904, 534);
|
||||
this.tabFalhas.TabIndex = 8;
|
||||
this.tabFalhas.Text = "Cód. Falhas";
|
||||
this.tabFalhas.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// tvwFalhas
|
||||
//
|
||||
this.tvwFalhas.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tvwFalhas.Location = new System.Drawing.Point(6, 6);
|
||||
this.tvwFalhas.Name = "tvwFalhas";
|
||||
this.tvwFalhas.Size = new System.Drawing.Size(892, 522);
|
||||
this.tvwFalhas.TabIndex = 0;
|
||||
//
|
||||
// frmDiagnosticos
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1024, 600);
|
||||
this.Controls.Add(this.picCamera);
|
||||
this.Controls.Add(this.picLoading);
|
||||
this.Controls.Add(this.picIniciarDiagnostico);
|
||||
this.Controls.Add(this.picDiagnosticarTudo);
|
||||
|
|
@ -386,11 +386,11 @@
|
|||
((System.ComponentModel.ISupportInitialize)(this.dgSinaleiros)).EndInit();
|
||||
this.tabResultados.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgResultados)).EndInit();
|
||||
this.tabFalhas.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.picVoltar)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picDiagnosticarTudo)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picIniciarDiagnostico)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picLoading)).EndInit();
|
||||
this.tabFalhas.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -416,7 +416,7 @@ namespace AgroBase.Forms.IHM
|
|||
|
||||
await EnviarComandoBico(B01, true, 1000);
|
||||
|
||||
double Fluxo = FluxoInicializado ? Dispositivo.Dados.VazaoFluxoMLpS : -1;
|
||||
double Fluxo = FluxoInicializado ? Dispositivo.Dados.VazaoFluxoMLpSInstantanea : -1;
|
||||
idx = PreencheDadosLinha(grid, Testes, idx, Fluxo);
|
||||
|
||||
bool statusB01_1 = B01 != null && B01.LeituraStatusBico;
|
||||
|
|
@ -466,8 +466,9 @@ namespace AgroBase.Forms.IHM
|
|||
|
||||
private async Task EnviarComandoBomba(bool Ligar, int Delay)
|
||||
{
|
||||
var Bomba = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombaPressurizadora;
|
||||
Variaveis.OperacaoEmAndamento.Controle.PressaoLinha = 85;
|
||||
GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, Ligar);
|
||||
GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, Ligar, Bomba.ID);
|
||||
await Task.Delay(Delay);
|
||||
}
|
||||
|
||||
|
|
@ -581,13 +582,13 @@ namespace AgroBase.Forms.IHM
|
|||
{
|
||||
Componente = x.Modulo_ID + " Servo Freio",
|
||||
Teste = "Ativar",
|
||||
ValorPadrao = VariaveisEquipamento.AnguloFreio[AcaoFreio.Ativar]
|
||||
ValorPadrao = x.MovMotor.ConfigFreio.Incremental ? 15 : 165
|
||||
},
|
||||
new ColunasDiagnosticoModel()
|
||||
{
|
||||
Componente = x.Modulo_ID + " Servo Freio",
|
||||
Teste = "Desativar",
|
||||
ValorPadrao = VariaveisEquipamento.AnguloFreio[AcaoFreio.Desativar]
|
||||
ValorPadrao = x.MovMotor.ConfigFreio.Incremental ? 0 : 180
|
||||
},
|
||||
}));
|
||||
|
||||
|
|
@ -691,11 +692,14 @@ namespace AgroBase.Forms.IHM
|
|||
{
|
||||
await Task.Delay(500);
|
||||
|
||||
bool sentidoCorreto = Sentido == Direcao.Parado ? true :
|
||||
Modulo.MovMotor.Sentido ==
|
||||
(Sentido == Enums.Direcao.Frente ? Modulo.MovMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Frente :
|
||||
Sentido sentidoMovimento =
|
||||
Sentido == Enums.Direcao.Frente ? Modulo.MovMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Frente :
|
||||
Sentido == Enums.Direcao.Tras ? Modulo.MovMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Tras :
|
||||
Enums.Sentido.Parado);
|
||||
Enums.Sentido.Parado;
|
||||
|
||||
bool sentidoCorreto =
|
||||
Sentido == Direcao.Parado ? true :
|
||||
Modulo.MovMotor.Sentido == sentidoMovimento;
|
||||
|
||||
bool rpmCorreto =
|
||||
Teste.ComplementoValorPadrao == "<" ? Modulo.MovMotor.RPM_Roda < Teste.ValorPadrao :
|
||||
|
|
@ -726,12 +730,12 @@ namespace AgroBase.Forms.IHM
|
|||
await Task.Delay(1000);
|
||||
|
||||
Sucesso =
|
||||
Teste.ComplementoValorPadrao == "<" ? (((FirmwareServoFreio)ServoFreio.Leitura)?.Angulo ?? 0) < Teste.ValorPadrao :
|
||||
Teste.ComplementoValorPadrao == ">" ? (((FirmwareServoFreio)ServoFreio.Leitura)?.Angulo ?? 0) > Teste.ValorPadrao :
|
||||
(((FirmwareServoFreio)ServoFreio.Leitura)?.Angulo ?? 0) == Teste.ValorPadrao;
|
||||
Teste.ComplementoValorPadrao == "<" ? ServoFreio.LeituraAngulo < Teste.ValorPadrao :
|
||||
Teste.ComplementoValorPadrao == ">" ? ServoFreio.LeituraAngulo > Teste.ValorPadrao :
|
||||
ServoFreio.LeituraAngulo == Teste.ValorPadrao;
|
||||
}
|
||||
|
||||
Teste.ValorAferido = (((FirmwareServoFreio)ServoFreio.Leitura)?.Angulo ?? 0);
|
||||
Teste.ValorAferido = ServoFreio.LeituraAngulo;
|
||||
|
||||
return Sucesso;
|
||||
}
|
||||
|
|
@ -801,9 +805,7 @@ namespace AgroBase.Forms.IHM
|
|||
|
||||
TipoMovimentoDirecional _oldTipoMovimento = Variaveis.OperacaoEmAndamento.Controle.TipoMovimento;
|
||||
double _oldAngulo = Variaveis.OperacaoEmAndamento.Controle.Angulo;
|
||||
|
||||
Variaveis.OperacaoEmAndamento.Controle.TipoMovimento = TipoMovimentoDirecional.Diagnostico;
|
||||
Variaveis.OperacaoEmAndamento.Controle.Angulo = 25;
|
||||
double _oldVelocidadeMP = Variaveis.OperacaoEmAndamento.Controle.VelocidadeMP;
|
||||
|
||||
DispositivosService<MovimentacaoUnificadaModel> Dispositivo = (DispositivosService<MovimentacaoUnificadaModel>)Variaveis.DispositivosConectados.FirstOrDefault(x => x.Dispositivo == Enums.T_Code.Mvd);
|
||||
|
||||
|
|
@ -812,6 +814,10 @@ namespace AgroBase.Forms.IHM
|
|||
return false;
|
||||
}
|
||||
|
||||
Variaveis.OperacaoEmAndamento.Controle.TipoMovimento = TipoMovimentoDirecional.Diagnostico;
|
||||
Variaveis.OperacaoEmAndamento.Controle.Angulo = 25;
|
||||
Variaveis.OperacaoEmAndamento.Controle.VelocidadeMP = 30;
|
||||
|
||||
foreach (var Modulo in Dispositivo.Dados.Modulos)
|
||||
{
|
||||
var Leitura = Modulo.DirMotor.Leitura;
|
||||
|
|
@ -851,18 +857,18 @@ namespace AgroBase.Forms.IHM
|
|||
|
||||
Variaveis.OperacaoEmAndamento.Controle.TipoMovimento = _oldTipoMovimento;
|
||||
Variaveis.OperacaoEmAndamento.Controle.Angulo = _oldAngulo;
|
||||
Variaveis.OperacaoEmAndamento.Controle.VelocidadeMP = _oldVelocidadeMP;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private async Task EnviarComandoDir(ModuloMvdModel Modulo, Enums.Direcao Sentido, ColunasDiagnosticoModel Teste, int Timeout)
|
||||
{
|
||||
Modulo.DirMotor.EnviarComandoControle(Sentido);
|
||||
|
||||
DateTime Inicio = DateTime.Now;
|
||||
bool Sucesso = false;
|
||||
while (!Sucesso && Inicio.AddMilliseconds(Timeout) > DateTime.Now)
|
||||
{
|
||||
Modulo.DirMotor.EnviarComandoControle(Sentido);
|
||||
await Task.Delay(200);
|
||||
|
||||
/*bool sentidoCorreto = Modulo.DirMotor.Sentido ==
|
||||
|
|
@ -916,7 +922,7 @@ namespace AgroBase.Forms.IHM
|
|||
{
|
||||
Componente = "PZEM",
|
||||
Teste = "Corrente Bateria",
|
||||
ValorPadrao = 1,
|
||||
ValorPadrao = 0.1,
|
||||
ComplementoValorPadrao = ">"
|
||||
},
|
||||
new ColunasDiagnosticoModel()
|
||||
|
|
@ -944,7 +950,7 @@ namespace AgroBase.Forms.IHM
|
|||
{
|
||||
Componente = "Módulo Sen",
|
||||
Teste = "Corrente Barramento 5V",
|
||||
ValorPadrao = 1,
|
||||
ValorPadrao = 500,
|
||||
ComplementoValorPadrao = ">"
|
||||
},
|
||||
new ColunasDiagnosticoModel()
|
||||
|
|
@ -958,7 +964,7 @@ namespace AgroBase.Forms.IHM
|
|||
{
|
||||
Componente = "Módulo Sen",
|
||||
Teste = "Corrente Barramento 12V",
|
||||
ValorPadrao = 1,
|
||||
ValorPadrao = 0,
|
||||
ComplementoValorPadrao = ">"
|
||||
},
|
||||
new ColunasDiagnosticoModel()
|
||||
|
|
@ -1036,15 +1042,15 @@ namespace AgroBase.Forms.IHM
|
|||
bool SenIniciado = Modulo_Sen.Conectado;
|
||||
idx = PreencheDadosLinha(grid, Testes, idx, SenIniciado ? 1 : 0);
|
||||
|
||||
var S5V = Modulo_Sen.DadosLeitura.SensoresCorrente.FirstOrDefault(x => x.ID == "AB5V");
|
||||
double Tensao5V = S5V != null ? (double)S5V.Current : -1;
|
||||
var S5V = ((FirmwareSensorCorrente)Modulo_Sen.Sensores.FirstOrDefault(x => x.ID == "AB5V").Leitura);
|
||||
double Tensao5V = S5V != null ? (double)S5V.BusVoltage : -1;
|
||||
idx = PreencheDadosLinha(grid, Testes, idx, Tensao5V);
|
||||
|
||||
double Corrente5V = S5V != null ? (double)S5V.Current : -1;
|
||||
idx = PreencheDadosLinha(grid, Testes, idx, Corrente5V);
|
||||
|
||||
var S12V = Modulo_Sen.DadosLeitura.SensoresCorrente.FirstOrDefault(x => x.ID == "AB12V");
|
||||
double Tensao12V = S12V != null ? (double)S12V.Current : -1;
|
||||
var S12V = ((FirmwareSensorCorrente)Modulo_Sen.Sensores.FirstOrDefault(x => x.ID == "AB12V").Leitura);
|
||||
double Tensao12V = S12V != null ? (double)S12V.BusVoltage : -1;
|
||||
idx = PreencheDadosLinha(grid, Testes, idx, Tensao12V);
|
||||
|
||||
double Corrente12V = S12V != null ? (double)S12V.Current : -1;
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@
|
|||
this.picWifi = new System.Windows.Forms.PictureBox();
|
||||
this.pgbAtualizacaoArquivos = new System.Windows.Forms.ProgressBar();
|
||||
this.lblProgressoAtualizacao = new System.Windows.Forms.Label();
|
||||
this.lblWifi = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picManual)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picDiagnosticos)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picOperacao)).BeginInit();
|
||||
|
|
@ -126,7 +127,7 @@
|
|||
this.lblMqtt.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.lblMqtt.AutoSize = true;
|
||||
this.lblMqtt.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblMqtt.Location = new System.Drawing.Point(473, 488);
|
||||
this.lblMqtt.Location = new System.Drawing.Point(473, 480);
|
||||
this.lblMqtt.Name = "lblMqtt";
|
||||
this.lblMqtt.Size = new System.Drawing.Size(114, 13);
|
||||
this.lblMqtt.TabIndex = 13;
|
||||
|
|
@ -357,7 +358,7 @@
|
|||
this.lblStatus.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.lblStatus.AutoSize = true;
|
||||
this.lblStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblStatus.Location = new System.Drawing.Point(473, 538);
|
||||
this.lblStatus.Location = new System.Drawing.Point(473, 541);
|
||||
this.lblStatus.Name = "lblStatus";
|
||||
this.lblStatus.Size = new System.Drawing.Size(84, 13);
|
||||
this.lblStatus.TabIndex = 40;
|
||||
|
|
@ -379,7 +380,7 @@
|
|||
this.lblOperacaoLiberada.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.lblOperacaoLiberada.AutoSize = true;
|
||||
this.lblOperacaoLiberada.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblOperacaoLiberada.Location = new System.Drawing.Point(473, 461);
|
||||
this.lblOperacaoLiberada.Location = new System.Drawing.Point(473, 460);
|
||||
this.lblOperacaoLiberada.Name = "lblOperacaoLiberada";
|
||||
this.lblOperacaoLiberada.Size = new System.Drawing.Size(124, 13);
|
||||
this.lblOperacaoLiberada.TabIndex = 42;
|
||||
|
|
@ -391,7 +392,7 @@
|
|||
this.lblCodigoFalha.AutoSize = true;
|
||||
this.lblCodigoFalha.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.lblCodigoFalha.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblCodigoFalha.Location = new System.Drawing.Point(473, 514);
|
||||
this.lblCodigoFalha.Location = new System.Drawing.Point(473, 521);
|
||||
this.lblCodigoFalha.Name = "lblCodigoFalha";
|
||||
this.lblCodigoFalha.Size = new System.Drawing.Size(96, 13);
|
||||
this.lblCodigoFalha.TabIndex = 43;
|
||||
|
|
@ -492,12 +493,24 @@
|
|||
this.lblProgressoAtualizacao.TabIndex = 46;
|
||||
this.lblProgressoAtualizacao.Text = "(0,00%) Atualizando arquivos...";
|
||||
//
|
||||
// lblWifi
|
||||
//
|
||||
this.lblWifi.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.lblWifi.AutoSize = true;
|
||||
this.lblWifi.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblWifi.Location = new System.Drawing.Point(473, 501);
|
||||
this.lblWifi.Name = "lblWifi";
|
||||
this.lblWifi.Size = new System.Drawing.Size(107, 13);
|
||||
this.lblWifi.TabIndex = 47;
|
||||
this.lblWifi.Text = "Wi-Fi: Desconectado";
|
||||
//
|
||||
// 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(1024, 600);
|
||||
this.Controls.Add(this.lblWifi);
|
||||
this.Controls.Add(this.lblProgressoAtualizacao);
|
||||
this.Controls.Add(this.pgbAtualizacaoArquivos);
|
||||
this.Controls.Add(this.picWifi);
|
||||
|
|
@ -593,5 +606,6 @@
|
|||
private System.Windows.Forms.PictureBox picWifi;
|
||||
public System.Windows.Forms.Label lblProgressoAtualizacao;
|
||||
public System.Windows.Forms.ProgressBar pgbAtualizacaoArquivos;
|
||||
private System.Windows.Forms.Label lblWifi;
|
||||
}
|
||||
}
|
||||
|
|
@ -103,6 +103,7 @@ namespace AgroBase.Forms.IHM
|
|||
lblCodigoFalha.Click += LblCodigoFalha_Click;
|
||||
}
|
||||
|
||||
/*
|
||||
private async Task tmrDispositivos_Tick()
|
||||
{
|
||||
CodFalha = Variaveis.OperacaoEmAndamento.RetornaCodigoFalha();
|
||||
|
|
@ -148,12 +149,97 @@ namespace AgroBase.Forms.IHM
|
|||
bool mqttConectado = Variaveis.MqttService.StatusConexao();
|
||||
lblMqtt.Text = "MQTT: " + (mqttConectado ? "Conectado" : "Desconectado");
|
||||
lblMqtt.ForeColor = mqttConectado ? Color.Green : Color.Red;
|
||||
bool wifiConectado = WifiService.WifiConectado;
|
||||
bool wifiDisponivel = WifiService.WifiDisponivel;
|
||||
lblWifi.Text = "Wi-Fi: " + (wifiConectado ? "Conectado" : wifiDisponivel ? "Disponível" : "Desconectado");
|
||||
lblWifi.ForeColor = wifiConectado ? Color.Green : wifiDisponivel ? Color.Yellow : Color.Red;
|
||||
bool opLiberada = Variaveis.OperacaoEmAndamento.OperacaoLiberada;
|
||||
lblOperacaoLiberada.Text = "Operação Liberada: " + (opLiberada ? "Sim" : "Não");
|
||||
lblOperacaoLiberada.ForeColor = opLiberada ? Color.Green : Color.Red;
|
||||
lblCodigoFalha.Text = $"Código de Falha: {CodFalha}";
|
||||
picWifi.Image = APIService.HasInternet ? Resources.wifi_on : Resources.wifi_off;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
private async Task tmrDispositivos_Tick()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Atualizar controles da UI de forma segura
|
||||
if (tmrDispositivos._uiControl.InvokeRequired)
|
||||
{
|
||||
tmrDispositivos._uiControl.Invoke(new Action(async () => await AtualizarControlesUI()));
|
||||
}
|
||||
else
|
||||
{
|
||||
await AtualizarControlesUI();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Erro no tmrDispositivos_Tick: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task AtualizarControlesUI()
|
||||
{
|
||||
CodFalha = Variaveis.OperacaoEmAndamento.RetornaCodigoFalha();
|
||||
|
||||
var Labels = this.Controls.OfType<Label>().Where(y => y.Name.Contains("lblD_")).ToList();
|
||||
var listaCameras = CameraService.ObterListaCameras();
|
||||
Labels.ForEach(lbl =>
|
||||
{
|
||||
T_Code Dispositivo = (T_Code)Enum.Parse(typeof(T_Code), lbl.Name.Split('_')[1]);
|
||||
string Mod_ID = lbl.Name.Split('_').Length == 3 ? lbl.Name.Split('_')[2] : lbl.Name.Split('_')[1];
|
||||
|
||||
if (Dispositivo == T_Code.Cam)
|
||||
{
|
||||
var CameraCaminho = Variaveis.OperacaoEmAndamento.CameraCaminhoKinect;
|
||||
|
||||
if (CameraCaminho != null && Mod_ID == CameraCaminho.ID)
|
||||
{
|
||||
lbl.ForeColor = !listaCameras.Any(x => x.Value == CameraCaminho.CameraSelecionada)
|
||||
? Color.DarkRed
|
||||
: CameraCaminho.camera.selectedCamera == 0
|
||||
? Color.Gold
|
||||
: Color.DarkGreen;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var Modulo = SerialService.DispositivosMapeados.FirstOrDefault(x => x.Dispositivo == Dispositivo && (x.Mod_ID == Mod_ID || x.Mod_ID == null));
|
||||
lbl.ForeColor = Modulo == null
|
||||
? Color.Black
|
||||
: Modulo.Erro
|
||||
? Color.Gold
|
||||
: Modulo.Conectado
|
||||
? Color.DarkGreen
|
||||
: Color.DarkRed;
|
||||
}
|
||||
});
|
||||
|
||||
bool mqttConectado = Variaveis.MqttService.StatusConexao();
|
||||
lblMqtt.Text = "MQTT: " + (mqttConectado ? "Conectado" : "Desconectado");
|
||||
lblMqtt.ForeColor = mqttConectado ? Color.Green : Color.Red;
|
||||
|
||||
bool wifiConectado = WifiService.WifiConectado;
|
||||
bool wifiDisponivel = WifiService.WifiDisponivel;
|
||||
bool wifiConectando = WifiService.Conectando;
|
||||
lblWifi.Text = "Wi-Fi: " + (wifiConectado ? "Conectado" : wifiConectando ? "Conectando..." : wifiDisponivel ? "Disponível" : "Desconectado");
|
||||
lblWifi.ForeColor = wifiConectado ? Color.Green : wifiConectando ? Color.Black : wifiDisponivel ? Color.Yellow : Color.Red;
|
||||
|
||||
bool opLiberada = Variaveis.OperacaoEmAndamento.OperacaoLiberada;
|
||||
lblOperacaoLiberada.Text = "Operação Liberada: " + (opLiberada ? "Sim" : "Não");
|
||||
lblOperacaoLiberada.ForeColor = opLiberada ? Color.Green : Color.Red;
|
||||
|
||||
lblCodigoFalha.Text = $"Código de Falha: {CodFalha}";
|
||||
picWifi.Image = APIService.HasInternet ? Resources.wifi_on : Resources.wifi_off;
|
||||
|
||||
await Task.CompletedTask; // Mantém a assinatura assíncrona
|
||||
}
|
||||
|
||||
|
||||
private void LblCodigoFalha_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ namespace AgroBase.Forms.Movimentacao
|
|||
{
|
||||
cameraService.selectedCamera = cmbCameras.SelectedIndex > 0 ? cmbCameras.SelectedIndex : 0;
|
||||
cmbCameras.Items.Clear();
|
||||
cmbCameras.Items.AddRange(CameraService.AtualizaListaCameras().Keys.ToArray());
|
||||
cmbCameras.Items.AddRange(CameraService.ObterListaCameras().Keys.ToArray());
|
||||
if (cmbCameras.Items.Count == 1)
|
||||
{
|
||||
cameraService.selectedCamera = 0;
|
||||
|
|
|
|||
|
|
@ -390,6 +390,9 @@ namespace AgroBase.Forms.Operacoes
|
|||
gridDados.Rows.Add("Volume do Reservatório", "", "L");
|
||||
gridDados.Rows.Add("Pressão da Linha", "", "psi");
|
||||
gridDados.Rows.Add("Potência na Bomba", "", "%");
|
||||
gridDados.Rows.Add("Vazão Instantanea", "", "mL/s");
|
||||
gridDados.Rows.Add("Vazão Media", "", "mL/s");
|
||||
gridDados.Rows.Add("Volume Vazado", "", "mL");
|
||||
|
||||
AtualizarInformacoesGerais();
|
||||
}
|
||||
|
|
@ -420,6 +423,9 @@ namespace AgroBase.Forms.Operacoes
|
|||
gridDados.Rows[16].Cells[1].Value = Variaveis.OperacaoEmAndamento.DispAtu.Dados.VolumeReservatorio.ToString("0.000");
|
||||
gridDados.Rows[17].Cells[1].Value = Variaveis.OperacaoEmAndamento.DispAtu.Dados.PressaoLinha.ToString("0.00");
|
||||
gridDados.Rows[18].Cells[1].Value = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombaPressurizadora.LeituraPotencia.ToString("0.00");
|
||||
gridDados.Rows[19].Cells[1].Value = Variaveis.OperacaoEmAndamento.DispAtu.Dados.VazaoFluxoMLpSInstantanea.ToString("0.00");
|
||||
gridDados.Rows[20].Cells[1].Value = Variaveis.OperacaoEmAndamento.DispAtu.Dados.VazaoFluxoMLpSMedia.ToString("0.00");
|
||||
gridDados.Rows[21].Cells[1].Value = Variaveis.OperacaoEmAndamento.DispAtu.Dados.VolumeVazaoML.ToString("0.00");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -496,18 +502,21 @@ namespace AgroBase.Forms.Operacoes
|
|||
|
||||
private void btnLigarBomba_Click(object sender, EventArgs e)
|
||||
{
|
||||
GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, true);
|
||||
var Bomba = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombaPressurizadora;
|
||||
GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, true, Bomba.ID);
|
||||
}
|
||||
|
||||
private void btnDesligarBomba_Click(object sender, EventArgs e)
|
||||
{
|
||||
GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, false);
|
||||
var Bomba = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombaPressurizadora;
|
||||
GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, false, Bomba.ID);
|
||||
}
|
||||
|
||||
private void nudPressaoSP_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
var Bomba = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombaPressurizadora;
|
||||
Variaveis.OperacaoEmAndamento.Controle.PressaoLinha = Convert.ToInt32(((NumericUpDown)sender).Value);
|
||||
GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombaPressurizadora.ComandoAtuar);
|
||||
GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, Bomba.ComandoAtuar, Bomba.ID);
|
||||
}
|
||||
|
||||
private void pnlAtuadores_Paint(object sender, PaintEventArgs e)
|
||||
|
|
|
|||
|
|
@ -384,7 +384,7 @@ namespace AgroBase.Forms.Operacoes
|
|||
new GraficoInterativoSerieModel()
|
||||
{
|
||||
Titulo = "Vazão",
|
||||
Valores = LogsAtuador.Select(x => x?.VazaoFluxoMLpS ?? 0).ToList(),
|
||||
Valores = LogsAtuador.Select(x => x?.VazaoFluxoMLpSMedia ?? 0).ToList(),
|
||||
Visivel = true,
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ namespace AgroBase.Forms.Sensoriamento
|
|||
{
|
||||
cameraService.selectedCamera = cmbCameras.SelectedIndex > 0 ? cmbCameras.SelectedIndex : 0;
|
||||
cmbCameras.Items.Clear();
|
||||
cmbCameras.Items.AddRange(CameraService.AtualizaListaCameras().Keys.ToArray());
|
||||
cmbCameras.Items.AddRange(CameraService.ObterListaCameras().Keys.ToArray());
|
||||
if (cmbCameras.Items.Count == 1)
|
||||
{
|
||||
cameraService.selectedCamera = 0;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ namespace AgroBase.Forms.Sensoriamento
|
|||
|
||||
private void AtualizarCameras()
|
||||
{
|
||||
Cameras = CameraService.AtualizaListaCameras();
|
||||
Cameras = CameraService.ObterListaCameras();
|
||||
cmbCaminho.Items.Clear();
|
||||
cmbCaminho.Items.AddRange(Cameras.Values.ToArray());
|
||||
string IDrua = ((SensoriamentoModel)Disp.Dados).CameraID_Caminho;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ using AgroBase.Models;
|
|||
using AgroBase.Services;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
|
@ -29,7 +28,8 @@ namespace AgroBase.Forms
|
|||
{
|
||||
InitializeComponent();
|
||||
|
||||
EthernetService.ConfigurarIP(true, false);
|
||||
WifiService.IniciarRotinas();
|
||||
APIService.IniciarRotinas();
|
||||
|
||||
//FilaService.IniciarRotinas();
|
||||
//BLD300RService.IniciarRotinas();
|
||||
|
|
|
|||
|
|
@ -1,13 +1,4 @@
|
|||
using AgroBase.Comum;
|
||||
using AgroBase.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using static AgroBase.Models.Enums;
|
||||
|
||||
|
|
@ -15,20 +6,14 @@ namespace AgroBase.Forms
|
|||
{
|
||||
public partial class frmJoystick : Form
|
||||
{
|
||||
|
||||
public frmJoystick()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void frmJoystick_KeyDown(object sender, KeyEventArgs e)
|
||||
private void frmJoystick_Shown(object sender, EventArgs e)
|
||||
{
|
||||
GeneralJoystick.EnviaComandoMotor(e.KeyCode);
|
||||
}
|
||||
|
||||
private void frmJoystick_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
GeneralJoystick.EnviaComandoMotor(Keys.Escape);
|
||||
GeneralJoystick.AtualizaDispositivo();
|
||||
}
|
||||
|
||||
private void frmJoystick_FormClosing(object sender, FormClosingEventArgs e)
|
||||
|
|
@ -37,9 +22,18 @@ namespace AgroBase.Forms
|
|||
this.Hide();
|
||||
}
|
||||
|
||||
private void frmJoystick_Shown(object sender, EventArgs e)
|
||||
|
||||
private void frmJoystick_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
GeneralJoystick.AtualizaDispositivo();
|
||||
T_Code disp = GeneralJoystick.GetDispositivoComando(e.KeyCode);
|
||||
GeneralJoystick.EnviaComandoMotor(e.KeyCode, disp);
|
||||
}
|
||||
|
||||
private void frmJoystick_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
T_Code disp = GeneralJoystick.GetDispositivoComando(e.KeyCode);
|
||||
GeneralJoystick.EnviaComandoMotor(Keys.Escape, disp);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ namespace AgroBase
|
|||
this.btnForcarAtualizacao = new System.Windows.Forms.Button();
|
||||
this.clbRotinas = new System.Windows.Forms.CheckedListBox();
|
||||
this.btnAtualizarRotinas = new System.Windows.Forms.Button();
|
||||
this.lblStripWifi = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.gpbAcoes.SuspendLayout();
|
||||
this.erroStrip.SuspendLayout();
|
||||
this.pnlLateral.SuspendLayout();
|
||||
|
|
@ -122,7 +123,7 @@ namespace AgroBase
|
|||
this.gpbAcoes.Controls.Add(this.erroStrip);
|
||||
this.gpbAcoes.Controls.Add(this.pnlLateral);
|
||||
this.gpbAcoes.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.gpbAcoes.Location = new System.Drawing.Point(479, 0);
|
||||
this.gpbAcoes.Location = new System.Drawing.Point(649, 0);
|
||||
this.gpbAcoes.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.gpbAcoes.Name = "gpbAcoes";
|
||||
this.gpbAcoes.Padding = new System.Windows.Forms.Padding(2);
|
||||
|
|
@ -327,11 +328,12 @@ namespace AgroBase
|
|||
this.lblStripJoystickComando,
|
||||
this.lblStripOperacaoLiberada,
|
||||
this.lblStripOperacaoStatus,
|
||||
this.lblStripMqtt});
|
||||
this.lblStripMqtt,
|
||||
this.lblStripWifi});
|
||||
this.generalStrip.Location = new System.Drawing.Point(0, 612);
|
||||
this.generalStrip.Name = "generalStrip";
|
||||
this.generalStrip.Padding = new System.Windows.Forms.Padding(1, 0, 10, 0);
|
||||
this.generalStrip.Size = new System.Drawing.Size(479, 22);
|
||||
this.generalStrip.Size = new System.Drawing.Size(649, 22);
|
||||
this.generalStrip.TabIndex = 1;
|
||||
this.generalStrip.Text = "statusStrip1";
|
||||
//
|
||||
|
|
@ -889,7 +891,7 @@ namespace AgroBase
|
|||
this.clbRotinas.FormattingEnabled = true;
|
||||
this.clbRotinas.Location = new System.Drawing.Point(9, 417);
|
||||
this.clbRotinas.Name = "clbRotinas";
|
||||
this.clbRotinas.Size = new System.Drawing.Size(457, 94);
|
||||
this.clbRotinas.Size = new System.Drawing.Size(627, 94);
|
||||
this.clbRotinas.TabIndex = 49;
|
||||
//
|
||||
// btnAtualizarRotinas
|
||||
|
|
@ -904,11 +906,17 @@ namespace AgroBase
|
|||
this.btnAtualizarRotinas.UseVisualStyleBackColor = true;
|
||||
this.btnAtualizarRotinas.Click += new System.EventHandler(this.btnAtualizarRotinas_Click);
|
||||
//
|
||||
// lblStripWifi
|
||||
//
|
||||
this.lblStripWifi.Name = "lblStripWifi";
|
||||
this.lblStripWifi.Size = new System.Drawing.Size(116, 17);
|
||||
this.lblStripWifi.Text = "Wi-Fi: Desconectado";
|
||||
//
|
||||
// frmPrincipal
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1098, 634);
|
||||
this.ClientSize = new System.Drawing.Size(1268, 634);
|
||||
this.Controls.Add(this.btnAtualizarRotinas);
|
||||
this.Controls.Add(this.clbRotinas);
|
||||
this.Controls.Add(this.btnForcarAtualizacao);
|
||||
|
|
@ -1028,6 +1036,7 @@ namespace AgroBase
|
|||
private System.Windows.Forms.CheckedListBox clbRotinas;
|
||||
private System.Windows.Forms.Button btnAtualizarRotinas;
|
||||
public System.Windows.Forms.ProgressBar pgbAtualizacaoArquivos;
|
||||
public System.Windows.Forms.ToolStripStatusLabel lblStripWifi;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ namespace AgroBase
|
|||
AtualizaDadosGerais();
|
||||
|
||||
lblStripMqtt.Text = "MQTT: " + (Variaveis.MqttService.StatusConexao() ? "Conectado" : "Desconectado");
|
||||
lblStripWifi.Text = "Wi-Fi: " + (WifiService.WifiConectado ? "Conectado" : WifiService.Conectando ? "Conectando..." : WifiService.WifiDisponivel ? "Disponivel" : "Desconectado");
|
||||
|
||||
bool opLiberada = Variaveis.OperacaoEmAndamento.OperacaoLiberada;
|
||||
lblStripOperacaoLiberada.Text = "Operação Liberada: " + (opLiberada ? "Sim" : "Não");
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace AgroBase.Models
|
|||
public string StackTrace { get { return _stackTrace; } }
|
||||
private string _id;
|
||||
public string Id { get { return _id; } }
|
||||
private Control _uiControl;
|
||||
public Control _uiControl;
|
||||
private int _timeout = 60000;
|
||||
|
||||
private DateTime beginTask = DateTime.MinValue;
|
||||
|
|
|
|||
|
|
@ -475,13 +475,18 @@ namespace AgroBase
|
|||
|
||||
public static void EnviaComandoMotor(Keys Tecla, T_Code Disp = T_Code.Vzo, bool ForcarComando = false)
|
||||
{
|
||||
if (
|
||||
// Verifica se deve interromper o fluxo
|
||||
bool deveInterromper =
|
||||
!frmDiagnosticos.Diagnosticando && !ForcarComando &&
|
||||
(!Variaveis.OperacaoEmAndamento.OperacaoLiberada ||
|
||||
(
|
||||
MKS057DService.Referenciando ||
|
||||
!Variaveis.OperacaoEmAndamento.OperacaoLiberada ||
|
||||
!Variaveis.OperacaoEmAndamento.Iniciado ||
|
||||
Variaveis.OperacaoEmAndamento.Modo != ModoOperacao.Manual ||
|
||||
!VerificaComandoValidoSonar(Tecla))
|
||||
)
|
||||
!VerificaComandoValidoSonar(Tecla)
|
||||
);
|
||||
|
||||
if (deveInterromper)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -640,9 +645,9 @@ namespace AgroBase
|
|||
}
|
||||
}
|
||||
|
||||
public static void EnviarComandoAtuador(S_Code Componente, bool Status, string ID = "")
|
||||
public static void EnviarComandoAtuador(S_Code Componente, bool Status, string ID)
|
||||
{
|
||||
if (!Variaveis.OperacaoEmAndamento.Iniciado)
|
||||
if (!Variaveis.OperacaoEmAndamento.Iniciado && !frmDiagnosticos.Diagnosticando)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -652,9 +657,13 @@ namespace AgroBase
|
|||
switch (Componente)
|
||||
{
|
||||
case S_Code.sBMB:
|
||||
DispAtu.Dados.BombaPressurizadora.ComandoAtuar = Status;
|
||||
string ProtocoloBomba = DispAtu.Dados.BombaPressurizadora.ProtocoloComando();
|
||||
var Bomba = DispAtu?.Dados?.BombasPressurizadoras?.FirstOrDefault(x => x.ID == ID);
|
||||
if (Bomba != null)
|
||||
{
|
||||
Bomba.ComandoAtuar = Status;
|
||||
string ProtocoloBomba = Bomba.ProtocoloComando();
|
||||
DispAtu.AdicionarMensagemFila(DispAtu.Dados.Modulo_ID, ProtocoloBomba, true, true);
|
||||
}
|
||||
break;
|
||||
case S_Code.sBIC:
|
||||
var Bico = DispAtu.Dados.BicosPulverizadores.FirstOrDefault(x => x.ID == ID);
|
||||
|
|
@ -676,7 +685,7 @@ namespace AgroBase
|
|||
switch (Componente)
|
||||
{
|
||||
case S_Code.sLED:
|
||||
var Sinaleiro = DispSen.Dados.Sinaleiros.FirstOrDefault(x => x.ID == ID);
|
||||
var Sinaleiro = DispSen?.Dados?.Sinaleiros?.FirstOrDefault(x => x.ID == ID && x.Inicializado);
|
||||
if (Sinaleiro != null)
|
||||
{
|
||||
Sinaleiro.Comportamento = (SensorSinaleiroComportamentoModel)Status;
|
||||
|
|
@ -685,7 +694,7 @@ namespace AgroBase
|
|||
}
|
||||
break;
|
||||
case S_Code.sRLE:
|
||||
var Rele = DispSen.Dados.Reles.FirstOrDefault(x => x.ID == ID);
|
||||
var Rele = DispSen?.Dados?.Reles?.FirstOrDefault(x => x.ID == ID && x.Inicializado);
|
||||
if (Rele != null)
|
||||
{
|
||||
Rele.StatusControle = (Estado)Status;
|
||||
|
|
@ -694,7 +703,7 @@ namespace AgroBase
|
|||
}
|
||||
break;
|
||||
case S_Code.sFRO:
|
||||
var ServoFreio = DispSen.Dados.Servos.FirstOrDefault(x => x.ID == ID);
|
||||
var ServoFreio = DispSen?.Dados?.Servos?.FirstOrDefault(x => x.ID == ID && x.Inicializado);
|
||||
if (ServoFreio != null)
|
||||
{
|
||||
ServoFreio._AnguloControle = (int)Status;
|
||||
|
|
@ -743,6 +752,12 @@ namespace AgroBase
|
|||
return !ComandosImpedidos.Any(x => x == Comando);
|
||||
}
|
||||
|
||||
public static T_Code GetDispositivoComando(Keys Tecla, BotoesJoystick botao = BotoesJoystick.Vazio)
|
||||
{
|
||||
T_Code disp = DeParaComandos.FirstOrDefault(x => x.key == Tecla || x.botaoJoy == botao)?.Dispositivo ?? T_Code.Vzo;
|
||||
return disp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class ComandosDispositivo
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace AgroBase.Models
|
|||
get
|
||||
{
|
||||
// Houve comandos recebidos do driver dentro dos ultimos 10 segundos
|
||||
int tempo = MKS057DService.UltimoReferenciamento.AddSeconds(10) > DateTime.Now ? 120 : 10;
|
||||
int tempo = MKS057DService.UltimoReferenciamento.AddSeconds(10) > DateTime.Now || MKS057DService.Referenciando ? 120 : 10;
|
||||
return UltimoComandoRecebido.AddSeconds(tempo) > DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
|
@ -57,6 +57,7 @@ namespace AgroBase.Models
|
|||
public int TimeoutResposta { get; set; } = 1000;
|
||||
public bool Enviado { get; set; } = false;
|
||||
public bool ErroEnvio { get; set; } = false;
|
||||
public bool Respondido { get; set; } = false;
|
||||
}
|
||||
|
||||
public enum ModosOperacao
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using AgroBase.Services;
|
||||
using AgroBase.Forms.IHM;
|
||||
using AgroBase.Services;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
@ -38,7 +39,7 @@ namespace AgroBase.Models.Modules
|
|||
public string ScriptDeteccaoErvas { get; set; } = PythonService.ScriptWeedDetector;
|
||||
|
||||
public AsyncTaskTimerModel tmrRegistrador;
|
||||
private int _TempoReconexaoComponentes = 15;
|
||||
private int _TempoReconexaoComponentes = 5;
|
||||
private int _VezesLeituraReconexao = 0;
|
||||
public AtuadorMensagemJsonModel DadosLeitura { get; set; } = new AtuadorMensagemJsonModel();
|
||||
|
||||
|
|
@ -73,19 +74,23 @@ namespace AgroBase.Models.Modules
|
|||
public double VolumeVazaoAferido { get; set; } = 0;
|
||||
public double _FluxoMlRef { get; set; } = 600;
|
||||
public double _FluxoPulsoRef { get; set; } = 538;
|
||||
public double VazaoFluxoMLpS
|
||||
public double VazaoFluxoMLpSInstantanea
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((FirmwareSensorFluxo)Sensores.FirstOrDefault(x => x.Componente == S_Code.sFLX)?.Leitura)?.Vazao ?? 0;
|
||||
}
|
||||
}
|
||||
private double _somaVazao; // Acumula a soma da vazão para calcular a média
|
||||
private int _contadorLeituras; // Conta o número de leituras feitas
|
||||
private DateTime _ultimoRegistroVazao; // Armazena o horário da última atualização
|
||||
public double VazaoFluxoMLpSMedia { get; set; }
|
||||
public double VolumeVazaoML { get; set; }
|
||||
public DateTime InicioAtuacao { get; set; } = DateTime.MinValue;
|
||||
public double TempoAtuado { get; set; } = 0;
|
||||
public void AtualizaTempoAtuadoGeral()
|
||||
{
|
||||
bool algumBicoAtivo = BicosPulverizadores.Any(x => x.ComandoAtuar);
|
||||
bool algumBicoAtivo = BicosPulverizadores.Any(x => x.Inicializado && x.ComandoAtuar);
|
||||
|
||||
if (algumBicoAtivo)
|
||||
{
|
||||
|
|
@ -106,6 +111,7 @@ namespace AgroBase.Models.Modules
|
|||
}
|
||||
|
||||
AtualizaPercentualErvas();
|
||||
AtualizaVazaoEVolume();
|
||||
}
|
||||
public void AtualizaPercentualErvas()
|
||||
{
|
||||
|
|
@ -121,6 +127,40 @@ namespace AgroBase.Models.Modules
|
|||
Variaveis.OperacaoEmAndamento.Sensoriamento.PercentualErvasTerreno = 0;
|
||||
}
|
||||
}
|
||||
public void AtualizaVazaoEVolume()
|
||||
{
|
||||
// Captura a vazão instantânea
|
||||
double vazaoInstantanea = VazaoFluxoMLpSInstantanea;
|
||||
|
||||
if (_ultimoRegistroVazao == DateTime.MinValue)
|
||||
{
|
||||
_ultimoRegistroVazao = DateTime.Now;
|
||||
return;
|
||||
}
|
||||
|
||||
// Calcula o tempo decorrido desde a última atualização (em segundos)
|
||||
double intervaloSegundos = (DateTime.Now - _ultimoRegistroVazao).TotalSeconds;
|
||||
_ultimoRegistroVazao = DateTime.Now;
|
||||
|
||||
if (intervaloSegundos > 0)
|
||||
{
|
||||
// Atualiza o volume total vazado
|
||||
VolumeVazaoML += vazaoInstantanea * intervaloSegundos;
|
||||
|
||||
// Acumula a vazão para o cálculo da média
|
||||
_somaVazao += vazaoInstantanea;
|
||||
_contadorLeituras++;
|
||||
}
|
||||
|
||||
VazaoFluxoMLpSMedia = _contadorLeituras > 0 ? _somaVazao / _contadorLeituras : 0;
|
||||
|
||||
var BicosAtuados = BicosPulverizadores.Where(x => x.Inicializado && x.ComandoAtuar).ToList();
|
||||
double vazaoInstantaneaBico = vazaoInstantanea / ((double)BicosAtuados.Count());
|
||||
foreach (var Bico in BicosAtuados)
|
||||
{
|
||||
Bico.MediaNivelFluxo = vazaoInstantaneaBico;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -286,7 +326,11 @@ namespace AgroBase.Models.Modules
|
|||
});
|
||||
|
||||
Dados.VolumeVazaoAferido = 0;
|
||||
Dados._somaVazao = 0;
|
||||
Dados._contadorLeituras = 0;
|
||||
Dados._ultimoRegistroVazao = DateTime.MinValue;
|
||||
Dados.VolumeVazaoML = 0;
|
||||
Dados.VazaoFluxoMLpSMedia = 0;
|
||||
Dados.TempoAtuado = 0;
|
||||
Dados.InicioAtuacao = DateTime.MinValue;
|
||||
}
|
||||
|
|
@ -308,7 +352,7 @@ namespace AgroBase.Models.Modules
|
|||
var bombasConfig = BombasConfig(Conectar);
|
||||
configDictionary[Modulo_ID].AddRange(bombasConfig);
|
||||
|
||||
if (!Conectado || configDictionary.Count() > 0)
|
||||
if (!Conectado || configDictionary.Any(x => x.Value.Count() > 0))
|
||||
{
|
||||
// Adicionar configuração do ProtocoloMOD
|
||||
var protocoloMOD = ModConfig(Conectar);
|
||||
|
|
@ -510,7 +554,7 @@ namespace AgroBase.Models.Modules
|
|||
DefineStatusConexao(Modulo_ID, _conectado);
|
||||
|
||||
|
||||
if (SerialService.DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Atu) && (_VezesLeituraReconexao >= _TempoReconexaoComponentes || !Conectado))
|
||||
if (SerialService.DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Atu) && (_VezesLeituraReconexao >= _TempoReconexaoComponentes))
|
||||
{
|
||||
Variaveis.OperacaoEmAndamento.DispAtu?.EnviarProtocolosConfiguracao();
|
||||
|
||||
|
|
@ -584,6 +628,8 @@ namespace AgroBase.Models.Modules
|
|||
}
|
||||
|
||||
private void VerificaControleLeitura()
|
||||
{
|
||||
if (!frmDiagnosticos.Diagnosticando)
|
||||
{
|
||||
// Caso a pressao de set point da bomba seja diferente da pressao de set point de controle, reenvia o comando para garantir a integridade do controle
|
||||
if (BombaPressurizadora.LeituraPressaoSP != Variaveis.OperacaoEmAndamento.Controle.PressaoLinha || !FuncoesMatematicas.ValorEstaEntre(BombaPressurizadora.LeituraPressao, Variaveis.OperacaoEmAndamento.Controle.PressaoLinha, 20))
|
||||
|
|
@ -600,6 +646,7 @@ namespace AgroBase.Models.Modules
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -937,6 +984,14 @@ namespace AgroBase.Models.Modules
|
|||
float textYPosition = yPosition + (circleDiameter - stringSize.Height) / 2;
|
||||
g.DrawString(bicoNumero, font, Brushes.Black, textXPosition, textYPosition);
|
||||
|
||||
// Média de vazão (dentro do círculo, abaixo do número do bico)
|
||||
string mediaFluxoTexto = $"{Bicos[i].MediaNivelFluxo:0.0} mL/s";
|
||||
Font fontMediaFluxo = new Font("Arial", 6, FontStyle.Regular);
|
||||
SizeF stringSizeMediaFluxo = g.MeasureString(mediaFluxoTexto, fontMediaFluxo);
|
||||
float textXPositionMediaFluxo = xPosition + circleDiameter + 3;
|
||||
float textYPositionMediaFluxo = textYPosition + 3; // Abaixo do número do bico
|
||||
g.DrawString(mediaFluxoTexto, fontMediaFluxo, Brushes.Gray, textXPositionMediaFluxo, textYPositionMediaFluxo);
|
||||
|
||||
// Quantidade de atuações (abaixo do círculo)
|
||||
string bicoAtuacao = Bicos[i].Atuacoes.ToString("000");
|
||||
Font fontA = new Font("Arial", 8, FontStyle.Bold);
|
||||
|
|
@ -1014,7 +1069,22 @@ namespace AgroBase.Models.Modules
|
|||
public class FirmwareBombaPressurizadora
|
||||
{
|
||||
public string ID { get; set; }
|
||||
public bool Iniciado { get; set; }
|
||||
private bool _iniciado = false;
|
||||
public bool Iniciado
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Variaveis.OperacaoEmAndamento.DispAtu.Dados.DadosLeitura.Momento.AddMilliseconds(5 * AtuadorModel._TaxaAmostragem) < DateTime.Now)
|
||||
{
|
||||
_iniciado = false;
|
||||
}
|
||||
return _iniciado;
|
||||
}
|
||||
set
|
||||
{
|
||||
_iniciado = value;
|
||||
}
|
||||
}
|
||||
public Estado Estado { get; set; }
|
||||
public double Potencia { get; set; }
|
||||
public double PressaoSP { get; set; }
|
||||
|
|
|
|||
|
|
@ -260,6 +260,8 @@ namespace AgroBase.Models.Modules
|
|||
{
|
||||
if (!BLD300RService.Iniciado && SerialService.DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Bld))
|
||||
{
|
||||
await BLD300RService.InicializarEthernetService();
|
||||
|
||||
foreach (var Leitura in BLD300RService.DadosLeitura.Where(x => x.UltimoComandoRecebido.AddSeconds(10) < DateTime.Now))
|
||||
{
|
||||
BLD300RService.AdicionarComandoNaFila(new BLD300RService.BLDComandoModel()
|
||||
|
|
@ -320,6 +322,8 @@ namespace AgroBase.Models.Modules
|
|||
{
|
||||
if (!MKS057DService.Iniciado && SerialService.DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Mks))
|
||||
{
|
||||
await MKS057DService.InicializarEthernetService();
|
||||
|
||||
foreach (var Leitura in MKS057DService.DadosLeitura.Where(x => x.UltimoComandoRecebido.AddSeconds(10) < DateTime.Now))
|
||||
{
|
||||
MKS057DService.AdicionarComandoNaFila(MKS057DService.MontarComandoRequisicaoPulsos(Leitura.Endereco));
|
||||
|
|
@ -850,6 +854,11 @@ namespace AgroBase.Models.Modules
|
|||
|
||||
ComandoLigado = RPM_SP > 0;
|
||||
|
||||
if (RPM_SP > 0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
switch (DirecaoAtual)
|
||||
{
|
||||
case Direcao.Frente:
|
||||
|
|
@ -1180,6 +1189,7 @@ namespace AgroBase.Models.Modules
|
|||
bool EstadoAnterior = EstadoInicial;
|
||||
|
||||
double _anguloAnterior = Angulo;
|
||||
double _velocidadeAnterior = 0;
|
||||
int _angulo = 45;
|
||||
int _offset = 0;
|
||||
Sentido _sentido = Sentido.Horario;
|
||||
|
|
@ -1188,13 +1198,17 @@ namespace AgroBase.Models.Modules
|
|||
double _anguloSaida = 9999;
|
||||
|
||||
const int MaxTentativas = 10;
|
||||
DateTime TimeoutGeral = DateTime.Now.AddMinutes(3); // Timeout geral para o processo.
|
||||
DateTime TimeoutGeral = DateTime.Now.AddMinutes(2); // Timeout geral para o processo.
|
||||
|
||||
double anguloMaxVisitado = 0;
|
||||
double anguloMinVisitado = 0;
|
||||
|
||||
if (!Sucesso)
|
||||
{
|
||||
while (!Sucesso && tentativas < MaxTentativas && DateTime.Now < TimeoutGeral)
|
||||
{
|
||||
int VelocidadeGiro = EstadoInicial ? 10 : 18;
|
||||
// Se o angulo ja foi visitado, entao pode se mover mais rapido, senao, se move mais devagar
|
||||
int VelocidadeGiro = DefineVelocidadeReferenciamento(EstadoInicial, anguloMaxVisitado, anguloMinVisitado);
|
||||
|
||||
await MKS057DService.EnviarComandoControle(MKS057DService.MontarComandoMovimento(Addr, _angulo, VelocidadeGiro, _sentido));
|
||||
|
||||
|
|
@ -1254,7 +1268,7 @@ namespace AgroBase.Models.Modules
|
|||
|
||||
EstadoAnterior = _ref;
|
||||
|
||||
Console.WriteLine($"Ref {Addr}: Angulo SP = {_angulo}, Angulo Atual = {Angulo}, Sentido SP = {_sentido.ToString()}, Passou = {inverterGiro}, Sucesso = {Sucesso}, Entrada: {_ref}");
|
||||
Console.WriteLine($"Ref {Addr}: Angulo SP = {_angulo}, Velocidade: {VelocidadeGiro}, Angulo Atual = {Angulo}, Sentido SP = {_sentido.ToString()}, Passou = {inverterGiro}, Sucesso = {Sucesso}, Entrada: {_ref}");
|
||||
|
||||
if (Sucesso)
|
||||
{
|
||||
|
|
@ -1272,12 +1286,26 @@ namespace AgroBase.Models.Modules
|
|||
|
||||
await Task.Delay(100); // Verificações rápidas.
|
||||
|
||||
if (_anguloAnterior == Angulo)
|
||||
VelocidadeGiro = DefineVelocidadeReferenciamento(EstadoInicial, anguloMaxVisitado, anguloMinVisitado);
|
||||
|
||||
if (
|
||||
(_anguloAnterior == Angulo && RPM == 0) || // Verifica se o angulo nao foi alterado desde a ultima leitura, e o motor nao esta em movimento
|
||||
(_velocidadeAnterior != VelocidadeGiro) // Verifica se mudou a velocidade de giro do motor de acordo com o angulo atual
|
||||
)
|
||||
{
|
||||
await MKS057DService.EnviarComandoControle(MKS057DService.MontarComandoMovimento(Addr, _angulo, VelocidadeGiro, _sentido));
|
||||
}
|
||||
|
||||
_anguloAnterior = Angulo;
|
||||
_velocidadeAnterior = VelocidadeGiro;
|
||||
if (Angulo > anguloMaxVisitado)
|
||||
{
|
||||
anguloMaxVisitado = Angulo;
|
||||
}
|
||||
else if (Angulo < anguloMinVisitado)
|
||||
{
|
||||
anguloMinVisitado = Angulo;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Sucesso && inverterGiro)
|
||||
|
|
@ -1296,6 +1324,16 @@ namespace AgroBase.Models.Modules
|
|||
}
|
||||
|
||||
MKS057DService.AddrRef = 0x00;
|
||||
MKS057DService.UltimoReferenciamento = DateTime.Now;
|
||||
}
|
||||
|
||||
private int DefineVelocidadeReferenciamento(bool EstadoInicial, double anguloMaxVisitado, double anguloMinVisitado)
|
||||
{
|
||||
int VelocidadeGiro =
|
||||
EstadoInicial || ReferenciaEstaEmZero() ? 10 : // Se o sensor estiver atuado ou o fluxo tiver iniciado com ele ja atuado, entao deve se mover lentamente para melhor precisao dos angulos de entrada e saida
|
||||
Angulo > anguloMaxVisitado || Angulo < anguloMinVisitado ? 18 : // Se o angulo atual ainda nao foi visitado, deve se mover em velocidade media
|
||||
36; // Se o angulo ja foi visitado, deve se mover em uma velocidade maior
|
||||
return VelocidadeGiro;
|
||||
}
|
||||
|
||||
private bool ReferenciaEstaEmZero()
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ namespace AgroBase.Models.Modules
|
|||
};
|
||||
|
||||
public AsyncTaskTimerModel tmrRegistrador;
|
||||
private int _TempoReconexaoComponentes = 15;
|
||||
private int _TempoReconexaoComponentes = 5;
|
||||
private int _VezesLeituraReconexao = 0;
|
||||
|
||||
public static SensoriamentoModel CarregarParametrosIniciais()
|
||||
|
|
@ -493,7 +493,7 @@ namespace AgroBase.Models.Modules
|
|||
var servosConfig = ServosConfig(Conectar);
|
||||
configDictionary[Modulo_ID].AddRange(servosConfig);
|
||||
|
||||
if (!Conectado || configDictionary.Count() > 0)
|
||||
if (!Conectado || configDictionary.Any(x => x.Value.Count() > 0))
|
||||
{
|
||||
// Adicionar configuração do ProtocoloMOD
|
||||
var protocoloMOD = ModConfig(Conectar);
|
||||
|
|
@ -717,7 +717,7 @@ namespace AgroBase.Models.Modules
|
|||
DefineStatusConexao(Modulo_ID, _conectado);
|
||||
|
||||
|
||||
if (SerialService.DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Sen) && (_VezesLeituraReconexao >= _TempoReconexaoComponentes || !Conectado))
|
||||
if (SerialService.DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Sen) && (_VezesLeituraReconexao >= _TempoReconexaoComponentes))
|
||||
{
|
||||
Variaveis.OperacaoEmAndamento.DispSen?.EnviarProtocolosConfiguracao();
|
||||
|
||||
|
|
@ -806,7 +806,6 @@ namespace AgroBase.Models.Modules
|
|||
ledMN.Comportamento.statusLED = statusLedMn;
|
||||
GeneralJoystick.EnviarComandoSensoriamento(S_Code.sLED, ledMN.ID, ledMN.Comportamento);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var rele in Reles.Where(x => x.Controlar && x.Inicializado))
|
||||
{
|
||||
|
|
@ -824,6 +823,7 @@ namespace AgroBase.Models.Modules
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1198,7 +1198,22 @@ namespace AgroBase.Models.Modules
|
|||
public class FirmwareSensorTemperatura
|
||||
{
|
||||
public string ID { get; set; }
|
||||
public bool Iniciado { get; set; }
|
||||
private bool _iniciado = false;
|
||||
public bool Iniciado
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Variaveis.OperacaoEmAndamento.DispSen.Dados.DadosLeitura.Momento.AddMilliseconds(5 * SensoriamentoModel._TaxaAmostragem) < DateTime.Now)
|
||||
{
|
||||
_iniciado = false;
|
||||
}
|
||||
return _iniciado;
|
||||
}
|
||||
set
|
||||
{
|
||||
_iniciado = value;
|
||||
}
|
||||
}
|
||||
private int _leitura;
|
||||
public int Leitura
|
||||
{
|
||||
|
|
@ -1275,7 +1290,22 @@ namespace AgroBase.Models.Modules
|
|||
public class FirmwareSensorCorrente
|
||||
{
|
||||
public string ID { get; set; }
|
||||
public bool Iniciado { get; set; }
|
||||
private bool _iniciado = false;
|
||||
public bool Iniciado
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Variaveis.OperacaoEmAndamento.DispSen.Dados.DadosLeitura.Momento.AddMilliseconds(5 * SensoriamentoModel._TaxaAmostragem) < DateTime.Now)
|
||||
{
|
||||
_iniciado = false;
|
||||
}
|
||||
return _iniciado;
|
||||
}
|
||||
set
|
||||
{
|
||||
_iniciado = value;
|
||||
}
|
||||
}
|
||||
public double BusVoltage { get; set; }
|
||||
public double ShuntVoltage { get; set; }
|
||||
public double? Current
|
||||
|
|
@ -1338,7 +1368,22 @@ namespace AgroBase.Models.Modules
|
|||
public class FirmwareSinaleiro
|
||||
{
|
||||
public string ID { get; set; }
|
||||
public bool Iniciado { get; set; }
|
||||
private bool _iniciado = false;
|
||||
public bool Iniciado
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Variaveis.OperacaoEmAndamento.DispSen.Dados.DadosLeitura.Momento.AddMilliseconds(5 * SensoriamentoModel._TaxaAmostragem) < DateTime.Now)
|
||||
{
|
||||
_iniciado = false;
|
||||
}
|
||||
return _iniciado;
|
||||
}
|
||||
set
|
||||
{
|
||||
_iniciado = value;
|
||||
}
|
||||
}
|
||||
public StatusLED Leitura { get; set; }
|
||||
public StatusLED Comando { get; set; }
|
||||
}
|
||||
|
|
@ -1346,32 +1391,80 @@ namespace AgroBase.Models.Modules
|
|||
public class FirmwareRele
|
||||
{
|
||||
public string ID { get; set; }
|
||||
public bool Iniciado { get; set; }
|
||||
private bool _iniciado = false;
|
||||
public bool Iniciado
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Variaveis.OperacaoEmAndamento.DispSen.Dados.DadosLeitura.Momento.AddMilliseconds(5 * SensoriamentoModel._TaxaAmostragem) < DateTime.Now)
|
||||
{
|
||||
_iniciado = false;
|
||||
}
|
||||
return _iniciado;
|
||||
}
|
||||
set
|
||||
{
|
||||
_iniciado = value;
|
||||
}
|
||||
}
|
||||
public Estado Leitura { get; set; }
|
||||
}
|
||||
|
||||
public class FirmwareServoFreio
|
||||
{
|
||||
public string ID { get; set; }
|
||||
public bool Iniciado { get; set; }
|
||||
private bool _iniciado = false;
|
||||
public bool Iniciado
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Variaveis.OperacaoEmAndamento.DispSen.Dados.DadosLeitura.Momento.AddMilliseconds(5 * SensoriamentoModel._TaxaAmostragem) < DateTime.Now)
|
||||
{
|
||||
_iniciado = false;
|
||||
}
|
||||
return _iniciado;
|
||||
}
|
||||
set
|
||||
{
|
||||
_iniciado = value;
|
||||
}
|
||||
}
|
||||
public int Angulo { get; set; }
|
||||
}
|
||||
|
||||
public class FirmwareSensorFluxo
|
||||
{
|
||||
public string ID { get; set; }
|
||||
public bool Iniciado { get; set; }
|
||||
private int _pulsos;
|
||||
public int Pulsos
|
||||
private bool _iniciado = false;
|
||||
public bool Iniciado
|
||||
{
|
||||
get { return _pulsos; }
|
||||
get
|
||||
{
|
||||
if (Variaveis.OperacaoEmAndamento.DispAtu.Dados.DadosLeitura.Momento.AddMilliseconds(5 * AtuadorModel._TaxaAmostragem) < DateTime.Now)
|
||||
{
|
||||
_iniciado = false;
|
||||
}
|
||||
return _iniciado;
|
||||
}
|
||||
set
|
||||
{
|
||||
_pulsos = value;
|
||||
_iniciado = value;
|
||||
}
|
||||
}
|
||||
public int Pulsos { get; set; }
|
||||
private int _periodo;
|
||||
public int Periodo
|
||||
{
|
||||
get
|
||||
{
|
||||
return _periodo;
|
||||
}
|
||||
set
|
||||
{
|
||||
_periodo = value;
|
||||
AtualizarVazao();
|
||||
}
|
||||
}
|
||||
public int Periodo { get; set; }
|
||||
private double _atual;
|
||||
public double Vazao { get { return _atual; } }
|
||||
public double ValorMaximo { get; set; }
|
||||
|
|
@ -1410,7 +1503,7 @@ namespace AgroBase.Models.Modules
|
|||
}
|
||||
else
|
||||
{
|
||||
double Frequencia = ((double)_pulsos / (double)Periodo * 1000);
|
||||
double Frequencia = ((double)Pulsos / (double)Periodo * 1000);
|
||||
//double vazao = (_LeituraPulsos * FatorLeitura) / ((double)_LeituraPeriodo / 1000);
|
||||
//double vazao = ((double)1 / FatorLeitura) * (60 * 1000 / _LeituraPeriodo);
|
||||
//double vazao = ((double)_LeituraPulsos / (((double)_LeituraPeriodo / 1000) * 8.1)) + 3;
|
||||
|
|
@ -1424,7 +1517,7 @@ namespace AgroBase.Models.Modules
|
|||
double Rt = 0.0037;
|
||||
double vazao = (Frequencia * 2 * Math.PI * Rh * Math.PI * (Rt * Rt)) * 1000000;
|
||||
|
||||
Console.WriteLine("Pulsos: " + _pulsos + " - Periodo: " + Periodo + " ms - Vazão: " + vazao.ToString("0.00000"));
|
||||
Console.WriteLine("Pulsos: " + Pulsos + " - Periodo: " + Periodo + " ms - Vazão: " + vazao.ToString("0.00000"));
|
||||
|
||||
_atual = vazao;
|
||||
}
|
||||
|
|
@ -1448,9 +1541,24 @@ namespace AgroBase.Models.Modules
|
|||
public class FirmwareSensorMassa
|
||||
{
|
||||
public string ID { get; set; }
|
||||
public bool Iniciado { get; set; }
|
||||
private int _leitura;
|
||||
public int Leitura
|
||||
private bool _iniciado = false;
|
||||
public bool Iniciado
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Variaveis.OperacaoEmAndamento.DispAtu.Dados.DadosLeitura.Momento.AddMilliseconds(5 * AtuadorModel._TaxaAmostragem) < DateTime.Now)
|
||||
{
|
||||
_iniciado = false;
|
||||
}
|
||||
return _iniciado;
|
||||
}
|
||||
set
|
||||
{
|
||||
_iniciado = value;
|
||||
}
|
||||
}
|
||||
private double _leitura;
|
||||
public double Leitura
|
||||
{
|
||||
get { return _leitura; }
|
||||
set
|
||||
|
|
@ -1519,7 +1627,22 @@ namespace AgroBase.Models.Modules
|
|||
public class FirmwareSensorPressao
|
||||
{
|
||||
public string ID { get; set; }
|
||||
public bool Iniciado { get; set; }
|
||||
private bool _iniciado = false;
|
||||
public bool Iniciado
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Variaveis.OperacaoEmAndamento.DispAtu.Dados.DadosLeitura.Momento.AddMilliseconds(5 * AtuadorModel._TaxaAmostragem) < DateTime.Now)
|
||||
{
|
||||
_iniciado = false;
|
||||
}
|
||||
return _iniciado;
|
||||
}
|
||||
set
|
||||
{
|
||||
_iniciado = value;
|
||||
}
|
||||
}
|
||||
public double Leitura { get; set; }
|
||||
public double Pressao { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ using System.Text;
|
|||
using System.Windows.Forms.DataVisualization.Charting;
|
||||
using OpenHardwareMonitor.Hardware;
|
||||
using CefSharp.WinForms;
|
||||
using MathNet.Numerics;
|
||||
|
||||
namespace AgroBase.Models
|
||||
{
|
||||
|
|
@ -854,9 +853,10 @@ namespace AgroBase.Models
|
|||
|
||||
PararCarroOperacaoInterrompida();
|
||||
|
||||
if (Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombaPressurizadora.Inicializado)
|
||||
var Bomba = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombaPressurizadora;
|
||||
if (Bomba.Inicializado)
|
||||
{
|
||||
GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, false);
|
||||
GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, false, Bomba.ID);
|
||||
}
|
||||
|
||||
Variaveis.OperacaoEmAndamento.Iniciado = false;
|
||||
|
|
@ -878,9 +878,10 @@ namespace AgroBase.Models
|
|||
if (DispAtu != null)
|
||||
{
|
||||
// Ligar bomba
|
||||
if (DispAtu.Dados.BombaPressurizadora.Inicializado)
|
||||
var Bomba = DispAtu.Dados.BombaPressurizadora;
|
||||
if (Bomba.Inicializado)
|
||||
{
|
||||
GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, true);
|
||||
GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, true, Bomba.ID);
|
||||
|
||||
await Task.Delay(5000);
|
||||
}
|
||||
|
|
@ -974,7 +975,7 @@ namespace AgroBase.Models
|
|||
return;
|
||||
}
|
||||
|
||||
var listaCameras = CameraService.AtualizaListaCameras().Values.ToArray();
|
||||
var listaCameras = CameraService.ObterListaCameras().Values.ToArray();
|
||||
|
||||
CamerasSolo.Clear();
|
||||
for (int i = 0; i < QuantidadeCamerasSolo; i++)
|
||||
|
|
@ -1976,7 +1977,8 @@ namespace AgroBase.Models
|
|||
PressaoLinha = Variaveis.OperacaoEmAndamento.DispAtu.Dados.PressaoLinha,
|
||||
PotenciaBomba = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombaPressurizadora.LeituraPotencia,
|
||||
BombaLigada = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombaPressurizadora.ComandoAtuar,
|
||||
VazaoFluxoMLpS = Variaveis.OperacaoEmAndamento.DispAtu.Dados.VazaoFluxoMLpS,
|
||||
VazaoFluxoMLpSInstantanea = Variaveis.OperacaoEmAndamento.DispAtu.Dados.VazaoFluxoMLpSInstantanea,
|
||||
VazaoFluxoMLpSMedia = Variaveis.OperacaoEmAndamento.DispAtu.Dados.VazaoFluxoMLpSMedia,
|
||||
VolumeVazaoML = Variaveis.OperacaoEmAndamento.DispAtu.Dados.VolumeVazaoML,
|
||||
QuantidadeBicos = Variaveis.OperacaoEmAndamento.DispAtu.Dados.QuantidadeBicos,
|
||||
TempoPulverizadorAtuado = Variaveis.OperacaoEmAndamento.DispAtu.Dados.TempoAtuado,
|
||||
|
|
@ -3130,7 +3132,8 @@ namespace AgroBase.Models
|
|||
public double PercentualReservatorio { get; set; }
|
||||
public double PotenciaBomba { get; set; }
|
||||
public bool BombaLigada { get; set; }
|
||||
public double VazaoFluxoMLpS { get; set; }
|
||||
public double VazaoFluxoMLpSInstantanea { get; set; }
|
||||
public double VazaoFluxoMLpSMedia { get; set; }
|
||||
public double VolumeVazaoML { get; set; }
|
||||
public int QuantidadeBicos { get; set; }
|
||||
public double TempoPulverizadorAtuado { get; set; }
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ namespace AgroBase.Models
|
|||
public static string FaixaIPwifi { get; set; } = "192.168.100";
|
||||
public static string FaixaIPethernet { get; set; } = "192.168.105";
|
||||
public static string IP_Host { get; set; } = FaixaIPwifi + ".105";
|
||||
public static string NomeRedeWifiEquipamento { get; set; } = "Agrobot";
|
||||
public static string SenhaRedeWifiEquipamento { get; set; } = "4321agro";
|
||||
public static bool IsAgroMonitor
|
||||
{
|
||||
get
|
||||
|
|
@ -119,7 +121,7 @@ namespace AgroBase.Models
|
|||
public static int TempoEntrePingsConexao { get; set; } = 10000;
|
||||
public static Dictionary<AcaoFreio, int> AnguloFreio { get; } = new Dictionary<AcaoFreio, int>()
|
||||
{
|
||||
{ AcaoFreio.Ativar, 90 },
|
||||
{ AcaoFreio.Ativar, 15 },
|
||||
{ AcaoFreio.Desativar, 0 }
|
||||
};
|
||||
public static Dictionary<TipoMovimentoDirecional, int> AnguloMovimento { get; } = new Dictionary<TipoMovimentoDirecional, int>()
|
||||
|
|
@ -154,10 +156,10 @@ namespace AgroBase.Models
|
|||
{
|
||||
comportamento = new SensorSinaleiroComportamentoModel()
|
||||
{
|
||||
statusLED = StatusLED.Aceso,
|
||||
QtdPiscadas = 0,
|
||||
TempoMs = 0,
|
||||
PausaMs = 0,
|
||||
statusLED = StatusLED.Piscando,
|
||||
QtdPiscadas = 2,
|
||||
TempoMs = 500,
|
||||
PausaMs = 2000,
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
|
@ -166,10 +168,10 @@ namespace AgroBase.Models
|
|||
{
|
||||
comportamento = new SensorSinaleiroComportamentoModel()
|
||||
{
|
||||
statusLED = StatusLED.Apagado,
|
||||
QtdPiscadas = 0,
|
||||
TempoMs = 0,
|
||||
PausaMs = 0,
|
||||
statusLED = StatusLED.Piscando,
|
||||
QtdPiscadas = 1,
|
||||
TempoMs = 1000,
|
||||
PausaMs = 1000,
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
|
@ -178,9 +180,9 @@ namespace AgroBase.Models
|
|||
comportamento = new SensorSinaleiroComportamentoModel()
|
||||
{
|
||||
statusLED = StatusLED.Piscando,
|
||||
QtdPiscadas = 1,
|
||||
QtdPiscadas = 2,
|
||||
TempoMs = 1000,
|
||||
PausaMs = 0,
|
||||
PausaMs = 2000,
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
|
@ -189,9 +191,9 @@ namespace AgroBase.Models
|
|||
comportamento = new SensorSinaleiroComportamentoModel()
|
||||
{
|
||||
statusLED = StatusLED.Piscando,
|
||||
QtdPiscadas = 1,
|
||||
TempoMs = 2000,
|
||||
PausaMs = 0,
|
||||
QtdPiscadas = 4,
|
||||
TempoMs = 200,
|
||||
PausaMs = 1000,
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
|
@ -202,7 +204,7 @@ namespace AgroBase.Models
|
|||
statusLED = StatusLED.Piscando,
|
||||
QtdPiscadas = 3,
|
||||
TempoMs = 200,
|
||||
PausaMs = 1000,
|
||||
PausaMs = 2000,
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
|
@ -497,37 +499,43 @@ namespace AgroBase.Models
|
|||
}
|
||||
|
||||
|
||||
public static void DefinirEventosPicBtn(Control ctrl, string MensagemErro, Func<Task> func, bool hover = false)
|
||||
public static void DefinirEventosPicBtn(Control ctrl, string mensagemErro, Func<Task> func, bool hover = false)
|
||||
{
|
||||
ctrl.Cursor = Cursors.Hand;
|
||||
|
||||
// Adiciona eventos de hover (evita múltiplos registros)
|
||||
if (hover)
|
||||
{
|
||||
ctrl.MouseEnter -= picBtn_MouseEnter;
|
||||
ctrl.MouseLeave -= picBtn_MouseLeave;
|
||||
ctrl.MouseEnter += picBtn_MouseEnter;
|
||||
ctrl.MouseLeave += picBtn_MouseLeave;
|
||||
}
|
||||
ctrl.Click += (s, args) =>
|
||||
{
|
||||
picBtn_Click(s, args).ContinueWith(t =>
|
||||
{
|
||||
if (t.IsCompleted)
|
||||
{
|
||||
func().ContinueWith(ft =>
|
||||
{
|
||||
if (ft.IsFaulted)
|
||||
{
|
||||
MessageBox.Show(MensagemErro, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}, TaskScheduler.FromCurrentSynchronizationContext());
|
||||
}
|
||||
}, TaskScheduler.FromCurrentSynchronizationContext());
|
||||
};
|
||||
|
||||
// Remove eventos anteriores e adiciona o novo
|
||||
ctrl.Click -= async (s, args) => await HandlePicBtnClick(ctrl, mensagemErro, func);
|
||||
ctrl.Click += async (s, args) => await HandlePicBtnClick(ctrl, mensagemErro, func);
|
||||
}
|
||||
|
||||
public static async Task picBtn_Click(object sender, EventArgs e)
|
||||
private static async Task HandlePicBtnClick(Control ctrl, string mensagemErro, Func<Task> func)
|
||||
{
|
||||
await PiscarBtn((Control)sender, 2);
|
||||
}
|
||||
try
|
||||
{
|
||||
// Executa o efeito de piscada antes da ação
|
||||
await PiscarBtn(ctrl, 2);
|
||||
|
||||
// Executa a ação associada ao botão
|
||||
if (func != null)
|
||||
{
|
||||
await func();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Exibe uma mensagem de erro genérica para qualquer exceção
|
||||
MessageBox.Show($"{mensagemErro}\nDetalhes: {ex.Message}", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
public static void picBtn_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
TransicaoTamanho((Control)sender, true, 5).ConfigureAwait(false);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using AgroBase.Forms;
|
||||
using AgroBase.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
|
@ -11,10 +12,10 @@ namespace AgroBase.Services
|
|||
{
|
||||
public class APIService
|
||||
{
|
||||
private static AsyncTaskTimerModel tmrMonitoramento;
|
||||
private static string Endpoint { get; set; } = frmInstancial.DebugMode ? "http://localhost:1337/agrobase/" : "https://zendioninc.com.br/api/agrobase/";
|
||||
private static string UrlDownloadArquivos { get; set; } = "https://zendioninc.com.br/agrobase/downloads";
|
||||
|
||||
public static bool HasInternet
|
||||
private static bool _hasInternet
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
@ -34,6 +35,19 @@ namespace AgroBase.Services
|
|||
}
|
||||
}
|
||||
}
|
||||
public static bool HasInternet { get; set; }
|
||||
|
||||
public static void IniciarRotinas()
|
||||
{
|
||||
tmrMonitoramento?.Dispose();
|
||||
tmrMonitoramento = new AsyncTaskTimerModel("tmrMonitoramento", tmrMonitoramento_Tick, 10000);
|
||||
tmrMonitoramento.Start();
|
||||
}
|
||||
|
||||
private static async Task tmrMonitoramento_Tick()
|
||||
{
|
||||
HasInternet = _hasInternet;
|
||||
}
|
||||
|
||||
// Método para GET
|
||||
public static async Task<(bool, string)> GetAsync(string url)
|
||||
|
|
|
|||
|
|
@ -201,8 +201,11 @@ namespace AgroBase.Services
|
|||
|
||||
|
||||
// Inicializa o serviço Ethernet com IP e porta específicos
|
||||
public static async Task<bool> InicializarEthernetService(string ipAddress, int port)
|
||||
public static async Task<bool> InicializarEthernetService()
|
||||
{
|
||||
string ipAddress = Variaveis.OperacaoEmAndamento.DispMvd.Dados.IP_Bld;
|
||||
int port = VariaveisPortas.Ethernet_TCP;
|
||||
|
||||
_ethernetService = new EthernetService(ipAddress, port);
|
||||
return await _ethernetService.ConnectAsync();
|
||||
}
|
||||
|
|
@ -211,9 +214,7 @@ namespace AgroBase.Services
|
|||
{
|
||||
EnvioLiberado = false;
|
||||
|
||||
if (_ethernetService == null)
|
||||
{
|
||||
bool connect = await InicializarEthernetService(Variaveis.OperacaoEmAndamento.DispMvd.Dados.IP_Bld, VariaveisPortas.Ethernet_TCP);
|
||||
bool connect = await InicializarEthernetService();
|
||||
if (!connect)
|
||||
{
|
||||
Console.WriteLine("Falha ao inicializar o serviço Ethernet.");
|
||||
|
|
@ -221,7 +222,6 @@ namespace AgroBase.Services
|
|||
EnvioLiberado = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (_ethernetService._isReconnecting)
|
||||
{
|
||||
|
|
@ -312,7 +312,7 @@ namespace AgroBase.Services
|
|||
{
|
||||
// Envia o comando via Ethernet
|
||||
Comando.ErroEnvio = !await EnviarComando(_ethernetService, comando);
|
||||
Comando.Enviado = !Comando.AguardaResposta;
|
||||
Comando.Enviado = true;
|
||||
|
||||
// Recebe a resposta via Ethernet, independentemente de precisar processá-la ou não
|
||||
byte[] resposta = await _ethernetService.ReceiveDataAsync(7, Comando.TimeoutResposta); // Timeout ajustável, aqui 1 segundo
|
||||
|
|
@ -323,11 +323,11 @@ namespace AgroBase.Services
|
|||
{
|
||||
// Processa a resposta, pois é esperada
|
||||
bool Respondido = DecifrarResposta(resposta, Comando.Parametro, Comando.Endereco);
|
||||
Comando.Enviado = Respondido;
|
||||
Comando.Respondido = Respondido;
|
||||
if (!Respondido)
|
||||
{
|
||||
RegisrarErrosComunicacao(Comando.Endereco, $"Timeout ou erro ao receber resposta. GET={Comando.Get}, Parametro={Comando.Parametro.Chave}, Valor={Comando.Valor}");
|
||||
Comando.Momento = DateTime.Now.AddMilliseconds(500); // Retenta após um pequeno intervalo
|
||||
//Comando.Momento = DateTime.Now.AddMilliseconds(500); // Retenta após um pequeno intervalo
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -635,6 +635,7 @@ namespace AgroBase.Services
|
|||
public DateTime Momento { get; set; } = DateTime.Now;
|
||||
public bool Enviado { get; set; } = false;
|
||||
public bool ErroEnvio { get; set; } = false;
|
||||
public bool Respondido { get; set; } = false;
|
||||
public byte Endereco { get; set; }
|
||||
public ModbusParametrosModel Parametro { get; set; }
|
||||
public float Valor { get; set; }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using AgroBase.Models;
|
||||
using AForge.Video.DirectShow;
|
||||
using AgroBase.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
|
@ -73,6 +74,31 @@ namespace AgroBase.Services
|
|||
return CamerasConectadas;
|
||||
}
|
||||
|
||||
public static Dictionary<string, string> ObterListaCameras()
|
||||
{
|
||||
var cameras = new Dictionary<string, string>();
|
||||
try
|
||||
{
|
||||
FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
|
||||
|
||||
cameras.Add("Sem vídeo", "Sem video");
|
||||
int index = 0;
|
||||
|
||||
foreach (FilterInfo device in videoDevices)
|
||||
{
|
||||
string cameraDesc = $"{index} - {device.Name}";
|
||||
cameras.Add(cameraDesc, device.MonikerString);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Erro ao listar câmeras: {ex.Message}");
|
||||
}
|
||||
|
||||
return cameras;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -217,6 +217,48 @@ public class EthernetService
|
|||
return null;
|
||||
}
|
||||
|
||||
public async Task<byte[]> ReceiveExactDataAsync(int expectedLength = 8, int timeoutMilliseconds = 1000)
|
||||
{
|
||||
if (_networkStream == null || !_networkStream.CanRead)
|
||||
{
|
||||
Console.WriteLine("O NetworkStream não está disponível para leitura.");
|
||||
return null;
|
||||
}
|
||||
|
||||
var buffer = new byte[expectedLength];
|
||||
var bytesRead = 0;
|
||||
var timeoutTask = Task.Delay(timeoutMilliseconds);
|
||||
|
||||
try
|
||||
{
|
||||
while (bytesRead < expectedLength)
|
||||
{
|
||||
var readTask = _networkStream.ReadAsync(buffer, bytesRead, expectedLength - bytesRead);
|
||||
if (await Task.WhenAny(readTask, timeoutTask) == timeoutTask)
|
||||
{
|
||||
Console.WriteLine("Timeout ao esperar os dados.");
|
||||
return null;
|
||||
}
|
||||
|
||||
var readBytes = await readTask;
|
||||
if (readBytes == 0)
|
||||
{
|
||||
Console.WriteLine("A conexão foi encerrada pelo dispositivo.");
|
||||
return null;
|
||||
}
|
||||
|
||||
bytesRead += readBytes;
|
||||
}
|
||||
|
||||
Console.WriteLine($"Dados recebidos ({bytesRead} bytes): {BitConverter.ToString(buffer)}");
|
||||
return buffer;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Erro ao receber dados: {ex.Message}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task FlushBufferAsync()
|
||||
|
|
@ -515,4 +557,5 @@ public class EthernetService
|
|||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,8 +53,11 @@ namespace AgroBase.Services
|
|||
}
|
||||
|
||||
// Inicializa o serviço Ethernet com IP e porta específicos
|
||||
public static async Task<bool> InicializarEthernetService(string ipAddress, int port)
|
||||
public static async Task<bool> InicializarEthernetService()
|
||||
{
|
||||
string ipAddress = Variaveis.OperacaoEmAndamento.DispMvd.Dados.IP_Mks;
|
||||
int port = VariaveisPortas.Ethernet_TCP;
|
||||
|
||||
_ethernetService = new EthernetService(ipAddress, port);
|
||||
return await _ethernetService.ConnectAsync();
|
||||
}
|
||||
|
|
@ -63,9 +66,7 @@ namespace AgroBase.Services
|
|||
{
|
||||
EnvioLiberado = false;
|
||||
|
||||
if (_ethernetService == null)
|
||||
{
|
||||
bool connect = await InicializarEthernetService(Variaveis.OperacaoEmAndamento.DispMvd.Dados.IP_Mks, VariaveisPortas.Ethernet_TCP);
|
||||
bool connect = await InicializarEthernetService();
|
||||
if (!connect)
|
||||
{
|
||||
Console.WriteLine("Falha ao inicializar o serviço Ethernet.");
|
||||
|
|
@ -73,7 +74,6 @@ namespace AgroBase.Services
|
|||
EnvioLiberado = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (_ethernetService._isReconnecting)
|
||||
{
|
||||
|
|
@ -104,7 +104,7 @@ namespace AgroBase.Services
|
|||
}
|
||||
|
||||
//var resposta = await _ethernetService.ReceiveDataAsync(8);
|
||||
var resposta = await _ethernetService.ReceiveDataAsync2(8);
|
||||
var resposta = await _ethernetService.ReceiveDataAsync(8);
|
||||
|
||||
SerialService.MostrarComandoResposta(T_Code.Mks, comando, resposta);
|
||||
|
||||
|
|
@ -518,7 +518,7 @@ namespace AgroBase.Services
|
|||
// Envia o comando via Ethernet
|
||||
(bool sucessoEnvio, byte[] comando) = await SendRelevantData(Addr, QueryCommand[DataSended]);
|
||||
Comando.ErroEnvio = !sucessoEnvio;
|
||||
Comando.Enviado = !Comando.AguardaResposta;
|
||||
Comando.Enviado = true;
|
||||
|
||||
// Recebe a resposta via Ethernet, independentemente de precisar processá-la ou não
|
||||
byte[] resposta = await _ethernetService.ReceiveDataAsync(8, Comando.TimeoutResposta); // Timeout ajustável, aqui 1 segundo
|
||||
|
|
@ -529,11 +529,11 @@ namespace AgroBase.Services
|
|||
{
|
||||
// Processa a resposta, pois é esperada
|
||||
bool Respondido = DecifrarResposta(resposta);
|
||||
Comando.Enviado = Respondido;
|
||||
Comando.Respondido = Respondido;
|
||||
if (!Respondido)
|
||||
{
|
||||
RegisrarErrosComunicacao(Addr, $"Timeout ao receber resposta. GET={Comando.Get}, Parametro={Comando.Comando}");
|
||||
Comando.Momento = DateTime.Now.AddMilliseconds(500);
|
||||
//Comando.Momento = DateTime.Now.AddMilliseconds(500);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ namespace AgroBase.Services
|
|||
|
||||
ContadorCarga.AtualizarConsumo();
|
||||
|
||||
Variaveis.OperacaoEmAndamento.Sensoriamento.BateriaConsumida = ContadorCarga.PercentualConsumido;
|
||||
Variaveis.OperacaoEmAndamento.Sensoriamento.BateriaConsumida = Math.Round(ContadorCarga.PercentualConsumido, 2);
|
||||
Variaveis.OperacaoEmAndamento.Sensoriamento.PorcentagemBateria = Math.Round(FuncoesMatematicas.Map(UltimaLeitura.Tensao, TensaoMinima, TensaoMaxima, 0.0, 100.0), 2);
|
||||
|
||||
return Sucesso;
|
||||
|
|
|
|||
|
|
@ -683,6 +683,8 @@ namespace AgroBase.Services
|
|||
{
|
||||
bool ethernetEncontrado = false;
|
||||
|
||||
if (WifiService.WifiConectado)
|
||||
{
|
||||
foreach (T_Code disp in DispositivosProprios)
|
||||
{
|
||||
bool proprio = await ProcuraDispositivoProprio(disp);
|
||||
|
|
@ -691,6 +693,7 @@ namespace AgroBase.Services
|
|||
ethernetEncontrado = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool DispBld = await ProcuraDispositivoBLD();
|
||||
if (DispBld)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,330 @@
|
|||
using AgroBase.Models;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AgroBase.Services
|
||||
{
|
||||
public class WifiService
|
||||
{
|
||||
private static AsyncTaskTimerModel tmrMonitoramento;
|
||||
private static bool PerfilExiste { get; set; } = false;
|
||||
public static bool WifiDisponivel { get; set; } = false;
|
||||
public static bool WifiConectado { get; set; } = false;
|
||||
public static bool Conectando { get; set; } = false;
|
||||
|
||||
public static void IniciarRotinas()
|
||||
{
|
||||
tmrMonitoramento?.Dispose();
|
||||
tmrMonitoramento = new AsyncTaskTimerModel("tmrMonitoramento", tmrMonitoramento_Tick, 10000);
|
||||
tmrMonitoramento.Start();
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
PerfilExiste = await PerfilWiFiExisteAsync(Variaveis.NomeRedeWifiEquipamento);
|
||||
});
|
||||
}
|
||||
|
||||
private static async Task tmrMonitoramento_Tick()
|
||||
{
|
||||
WifiDisponivel = await VerificarRedeDisponivelAsync(Variaveis.NomeRedeWifiEquipamento);
|
||||
|
||||
if (WifiDisponivel)
|
||||
{
|
||||
string _ssid = ObterNomeRedeWifiAtual();
|
||||
|
||||
WifiConectado = _ssid == Variaveis.NomeRedeWifiEquipamento;
|
||||
|
||||
if (!WifiConectado)
|
||||
{
|
||||
Conectando = true;
|
||||
await VerificarConectarComSenhaAsync(Variaveis.NomeRedeWifiEquipamento, Variaveis.SenhaRedeWifiEquipamento);
|
||||
Conectando = false;
|
||||
}
|
||||
if (WifiConectado)
|
||||
{
|
||||
string _interface = "";
|
||||
VerificaInterfaceConectada(out _interface);
|
||||
var ip = EthernetService.ObterIpAtual(_interface);
|
||||
if (ip != Variaveis.IP_Host)
|
||||
{
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
EthernetService.ConfigurarIP(true, false);
|
||||
Variaveis.MqttService = new MqttService("localhost", 1883);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WifiConectado = false;
|
||||
Conectando = false;
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task<bool> VerificarConectarComSenhaAsync(string nomeRede, string senha)
|
||||
{
|
||||
string xmlPerfil = $@"<?xml version=""1.0""?>
|
||||
<WLANProfile xmlns=""http://www.microsoft.com/networking/WLAN/profile/v1"">
|
||||
<name>{nomeRede}</name>
|
||||
<SSIDConfig>
|
||||
<SSID>
|
||||
<name>{nomeRede}</name>
|
||||
</SSID>
|
||||
<nonBroadcast>false</nonBroadcast>
|
||||
</SSIDConfig>
|
||||
<connectionType>ESS</connectionType>
|
||||
<connectionMode>auto</connectionMode>
|
||||
<MSM>
|
||||
<security>
|
||||
<authEncryption>
|
||||
<authentication>WPA2PSK</authentication>
|
||||
<encryption>AES</encryption>
|
||||
<useOneX>false</useOneX>
|
||||
</authEncryption>
|
||||
<sharedKey>
|
||||
<keyType>passPhrase</keyType>
|
||||
<protected>false</protected>
|
||||
<keyMaterial>{senha}</keyMaterial>
|
||||
</sharedKey>
|
||||
</security>
|
||||
</MSM>
|
||||
</WLANProfile>";
|
||||
|
||||
if (!PerfilExiste)
|
||||
{
|
||||
PerfilExiste = await AdicionarPerfilWiFiAsync(nomeRede, xmlPerfil);
|
||||
}
|
||||
|
||||
if (PerfilExiste)
|
||||
{
|
||||
return await ConectarRedeWifiAsync(nomeRede);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Não foi possível adicionar o perfil para a rede {nomeRede}.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task<bool> PerfilWiFiExisteAsync(string nomePerfil)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Configura o comando para listar os perfis existentes
|
||||
ProcessStartInfo psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = "netsh",
|
||||
Arguments = "wlan show profiles",
|
||||
RedirectStandardOutput = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
using (Process process = new Process { StartInfo = psi })
|
||||
{
|
||||
process.Start();
|
||||
|
||||
// Lê a saída do processo de forma assíncrona
|
||||
string output = await process.StandardOutput.ReadToEndAsync();
|
||||
process.WaitForExit();
|
||||
|
||||
bool existente = output.Contains($"All User Profile : {nomePerfil}");
|
||||
|
||||
// Verifica se o perfil está listado na saída
|
||||
return existente;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Erro ao verificar existência do perfil Wi-Fi: {ex.Message}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task<bool> AdicionarPerfilWiFiAsync(string nomePerfil, string xmlPerfil)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Salva o XML em um arquivo temporário
|
||||
string caminhoArquivo = Path.Combine(Path.GetTempPath(), $"{nomePerfil}.xml");
|
||||
File.WriteAllText(caminhoArquivo, xmlPerfil);
|
||||
|
||||
// Executa o comando para adicionar o perfil
|
||||
ProcessStartInfo psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = "netsh",
|
||||
Arguments = $"wlan add profile filename=\"{caminhoArquivo}\"",
|
||||
RedirectStandardOutput = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
using (Process process = new Process { StartInfo = psi })
|
||||
{
|
||||
process.Start();
|
||||
|
||||
// Lê a saída do processo de forma assíncrona
|
||||
string output = await process.StandardOutput.ReadToEndAsync();
|
||||
process.WaitForExit();
|
||||
|
||||
// Exibe o resultado e verifica se foi bem-sucedido
|
||||
if (output.Contains(" is added on interface "))
|
||||
{
|
||||
Console.WriteLine($"Perfil {nomePerfil} adicionado com sucesso.");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Falha ao adicionar perfil {nomePerfil}: {output}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Erro ao adicionar perfil Wi-Fi: {ex.Message}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task<bool> VerificarRedeDisponivelAsync(string nomeRede)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
ProcessStartInfo psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = "netsh",
|
||||
Arguments = "wlan show networks",
|
||||
RedirectStandardOutput = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
using (Process process = Process.Start(psi))
|
||||
{
|
||||
string output = process.StandardOutput.ReadToEnd();
|
||||
process.WaitForExit();
|
||||
|
||||
WifiDisponivel = output.Contains(nomeRede);
|
||||
|
||||
return WifiDisponivel;
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Erro ao listar redes Wi-Fi: {ex.Message}");
|
||||
WifiDisponivel = false;
|
||||
|
||||
return WifiDisponivel;
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task<bool> ConectarRedeWifiAsync(string nomeRede)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
ProcessStartInfo psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = "netsh",
|
||||
Arguments = $"wlan connect name=\"{nomeRede}\"",
|
||||
RedirectStandardOutput = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
using (Process process = Process.Start(psi))
|
||||
{
|
||||
string output = process.StandardOutput.ReadToEnd();
|
||||
process.WaitForExit();
|
||||
|
||||
WifiConectado = output.Contains("successfully");
|
||||
|
||||
return WifiConectado;
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Erro ao conectar-se à rede Wi-Fi: {ex.Message}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static string ObterNomeRedeWifiAtual()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Configura o comando para executar o netsh
|
||||
ProcessStartInfo psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = "netsh",
|
||||
Arguments = "wlan show interfaces",
|
||||
RedirectStandardOutput = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
// Executa o comando
|
||||
using (Process process = Process.Start(psi))
|
||||
{
|
||||
string output = process.StandardOutput.ReadToEnd();
|
||||
process.WaitForExit();
|
||||
|
||||
// Procura pelo SSID na saída
|
||||
foreach (var line in output.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
if (line.Trim().StartsWith("SSID"))
|
||||
{
|
||||
// O SSID está na linha e começa após "SSID"
|
||||
var parts = line.Split(new[] { ':' }, 2);
|
||||
if (parts.Length > 1)
|
||||
{
|
||||
return parts[1].Trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Erro ao obter o SSID atual: {ex.Message}");
|
||||
}
|
||||
|
||||
return null; // Retorna null se o SSID não for encontrado
|
||||
}
|
||||
|
||||
public static bool VerificaInterfaceConectada(out string _interface)
|
||||
{
|
||||
_interface = null;
|
||||
|
||||
// Obtém todas as interfaces de rede
|
||||
var interfaces = NetworkInterface.GetAllNetworkInterfaces();
|
||||
|
||||
foreach (var nic in interfaces)
|
||||
{
|
||||
// Filtra apenas interfaces sem fio (Wi-Fi)
|
||||
if (nic.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 && nic.OperationalStatus == OperationalStatus.Up)
|
||||
{
|
||||
var properties = nic.GetIPProperties();
|
||||
|
||||
// Nome da rede Wi-Fi conectada
|
||||
_interface = nic.Name;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false; // Não está conectado a nenhuma rede Wi-Fi
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
|
@ -18,3 +18,4 @@
|
|||
22/11/2024 08:24:14:797 - Porta COM88 - 0: Erro ao processar fila de comandos. Erro=The port is closed.
|
||||
22/11/2024 15:31:48:366 - Porta COM - 0: Erro ao processar fila de comandos. Erro=The port is closed.
|
||||
02/12/2024 15:45:31:555 - Porta COM95 - 0: Erro ao processar fila de comandos. Erro=The port is closed.
|
||||
04/12/2024 09:04:07:117 - Porta COM97 - 0: Erro ao processar fila de comandos. Erro=The port is closed.
|
||||
|
|
|
|||
|
|
@ -8987,3 +8987,232 @@ Parameter name: source
|
|||
03/12/2024 17:12:39:312 - Endereço 209 (192.168.105.11): Dados recebidos de um endereço inválido: [251 209 4 245 2 246 244 254]
|
||||
03/12/2024 17:13:45:089 - Endereço 245 (192.168.105.11): Dados recebidos de um endereço inválido: [3 245 2 245]
|
||||
03/12/2024 17:15:04:958 - Endereço 159 (192.168.105.11): Dados recebidos de um endereço inválido: [160 159 245]
|
||||
04/12/2024 09:02:47:766 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:02:47:768 - Endereço 1 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:02:47:820 - Endereço 1 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:02:47:834 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:02:47:834 - Endereço 3 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:02:47:848 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:02:47:849 - Endereço 3 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:02:47:913 - Endereço 3 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:02:47:926 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:02:47:926 - Endereço 2 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:02:47:939 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:02:47:940 - Endereço 2 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:02:47:993 - Endereço 2 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:02:48:003 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:02:48:003 - Endereço 4 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:02:48:016 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:02:48:016 - Endereço 4 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:02:48:071 - Endereço 4 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:02:48:084 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:04:07:607 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:04:07:607 - Endereço 1 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:04:07:669 - Endereço 1 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:04:07:691 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:04:07:692 - Endereço 3 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:04:07:716 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:04:07:716 - Endereço 3 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:04:07:780 - Endereço 3 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:04:07:793 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:04:07:793 - Endereço 2 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:04:07:808 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:04:07:809 - Endereço 2 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:04:07:874 - Endereço 2 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:04:07:885 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:04:07:886 - Endereço 4 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:04:07:899 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:04:07:899 - Endereço 4 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:04:07:952 - Endereço 4 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:04:07:963 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:17:790 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:08:17:790 - Endereço 1 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:08:17:846 - Endereço 1 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:08:17:875 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:17:875 - Endereço 3 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:08:17:889 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:08:17:890 - Endereço 3 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:08:17:940 - Endereço 3 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:08:17:950 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:17:950 - Endereço 2 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:08:17:962 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:08:17:962 - Endereço 2 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:08:18:015 - Endereço 2 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:08:18:026 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:18:027 - Endereço 4 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:08:18:039 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:08:18:039 - Endereço 4 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:08:18:093 - Endereço 4 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:08:18:103 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:26:462 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:27:468 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:08:28:548 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:29:736 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:30:746 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:08:31:811 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:32:826 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:08:33:905 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:34:908 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:08:35:910 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:08:36:973 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:38:147 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:39:154 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:08:40:227 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:41:236 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:08:42:301 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:43:310 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:08:44:325 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:08:45:387 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:46:568 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:47:579 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:08:48:649 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:49:662 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:08:50:737 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:51:742 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:08:52:746 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:08:53:811 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:54:982 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:55:997 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:08:57:064 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:08:58:079 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:08:59:158 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:09:00:166 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:09:01:175 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:09:02:242 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:09:03:421 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:09:04:414 - Endereço 0 (192.168.105.11): Dados recebidos de um endereço inválido: [0 0 0 50 251 4 64 19]
|
||||
04/12/2024 09:20:29:152 - Endereço 255 (192.168.105.11): Dados recebidos de um endereço inválido: [160 255]
|
||||
04/12/2024 09:48:18:105 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:48:18:106 - Endereço 1 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:48:18:218 - Endereço 1 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:48:18:256 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:48:18:256 - Endereço 3 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:48:18:272 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:48:18:273 - Endereço 3 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:48:18:334 - Endereço 3 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:48:18:348 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:48:18:348 - Endereço 2 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:48:18:364 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:48:18:365 - Endereço 2 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:48:18:429 - Endereço 2 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:48:18:442 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:48:18:442 - Endereço 4 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:48:18:458 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:48:18:459 - Endereço 4 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:48:18:522 - Endereço 4 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 09:48:18:555 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:48:26:888 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:48:27:905 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:48:28:968 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:48:30:081 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:48:31:150 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:48:32:168 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:48:33:245 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:48:34:261 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:48:35:327 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:48:36:334 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:48:37:428 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:48:38:541 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:48:39:618 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:48:40:620 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:48:41:692 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:48:42:708 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:48:43:776 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:48:44:791 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:48:45:866 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:48:46:992 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:48:48:063 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:48:49:077 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:48:50:150 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:48:51:156 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:48:52:228 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:48:53:231 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:48:54:298 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:48:55:423 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:48:56:492 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:48:57:506 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:48:58:573 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:48:59:577 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:49:00:662 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:49:01:672 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:49:02:738 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 09:49:03:856 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 09:49:04:535 - Endereço 0 (192.168.105.11): Dados recebidos de um endereço inválido: [0 0 0 50 251 1 64 19]
|
||||
04/12/2024 10:05:16:620 - Endereço 255 (192.168.105.11): Dados recebidos de um endereço inválido: [160 255]
|
||||
04/12/2024 10:05:28:779 - Endereço 1 (192.168.105.11): Erro ao enviar comando: Index was outside the bounds of the array.
|
||||
04/12/2024 10:05:53:986 - Endereço 246 (192.168.105.11): Dados recebidos de um endereço inválido: [2 246]
|
||||
04/12/2024 10:15:08:731 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 13:40:46:045 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 13:40:46:046 - Endereço 1 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 13:40:46:101 - Endereço 1 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 13:40:46:112 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 13:40:46:113 - Endereço 3 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 13:40:46:126 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 13:40:46:126 - Endereço 3 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 13:40:46:192 - Endereço 3 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 13:40:46:203 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 13:40:46:204 - Endereço 2 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 13:40:46:216 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 13:40:46:217 - Endereço 2 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 13:40:46:269 - Endereço 2 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 13:40:46:296 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 13:40:46:297 - Endereço 4 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 13:40:46:316 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 13:40:46:317 - Endereço 4 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 13:40:46:376 - Endereço 4 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 13:40:46:393 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 13:42:22:966 - Endereço 105 (192.168.105.11): Dados recebidos de um endereço inválido: [251 105 127 33 1 0 50]
|
||||
04/12/2024 13:42:25:761 - Endereço 255 (192.168.105.11): Dados recebidos de um endereço inválido: [251 255]
|
||||
04/12/2024 13:42:25:896 - Endereço 243 (192.168.105.11): Dados recebidos de um endereço inválido: [159 243]
|
||||
04/12/2024 13:42:35:880 - Endereço 255 (192.168.105.11): Dados recebidos de um endereço inválido: [255 255]
|
||||
04/12/2024 15:15:19:783 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 15:15:21:528 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 15:15:27:540 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 15:18:47:467 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 15:18:48:482 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 15:21:05:640 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 15:21:08:855 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 15:32:24:884 - Endereço 6 (192.168.105.10): Dados recebidos de um endereço inválido: [1 6 0 182 0 1 169 236]
|
||||
04/12/2024 15:32:24:904 - Endereço 6 (192.168.105.10): Dados recebidos de um endereço inválido: [1 6 0 118 0 0 104 16]
|
||||
04/12/2024 15:32:25:149 - Endereço 6 (192.168.105.10): Dados recebidos de um endereço inválido: [1 6 0 146 1 244 40 48]
|
||||
04/12/2024 15:32:25:400 - Endereço 6 (192.168.105.10): Dados recebidos de um endereço inválido: [1 6 0 102 0 0 105 213]
|
||||
04/12/2024 15:32:25:564 - Endereço 6 (192.168.105.10): Dados recebidos de um endereço inválido: [3 6 192 218 243 0 0 0]
|
||||
04/12/2024 15:32:25:807 - Endereço 6 (192.168.105.10): Dados recebidos de um endereço inválido: [2 6 0 134 0 10 232 23]
|
||||
04/12/2024 15:32:26:051 - Endereço 6 (192.168.105.10): Dados recebidos de um endereço inválido: [2 6 0 138 0 0 168 19]
|
||||
04/12/2024 15:32:26:282 - Endereço 6 (192.168.105.10): Dados recebidos de um endereço inválido: [4 6 0 182 0 1 169 185]
|
||||
04/12/2024 15:32:37:796 - Endereço 208 (192.168.105.10): Dados recebidos de um endereço inválido: [10 208 0 0 0 0 0 0]
|
||||
04/12/2024 15:32:43:913 - Endereço 252 (192.168.105.10): Dados recebidos de um endereço inválido: [6 252 68 0 0 0 0 0]
|
||||
04/12/2024 15:33:11:537 - Endereço 24 (192.168.105.10): Dados recebidos de um endereço inválido: [4 24 55 244 0 0 0 0]
|
||||
04/12/2024 15:33:11:553 - Endereço 0 (192.168.105.10): Dados recebidos de um endereço inválido: [4 0 0 0 0 0 0 0]
|
||||
04/12/2024 15:33:11:569 - Endereço 12 (192.168.105.10): Dados recebidos de um endereço inválido: [153 12 0 0 0 0 0 0]
|
||||
04/12/2024 15:45:57:426 - Endereço 6 (192.168.105.10): Dados recebidos de um endereço inválido: [1 6 0 182 0 1 169 236]
|
||||
04/12/2024 15:45:57:651 - Endereço 6 (192.168.105.10): Dados recebidos de um endereço inválido: [1 6 0 134 0 10 232 36]
|
||||
04/12/2024 15:45:57:963 - Endereço 6 (192.168.105.10): Dados recebidos de um endereço inválido: [1 6 0 138 0 0 168 32]
|
||||
04/12/2024 15:45:58:202 - Endereço 6 (192.168.105.10): Dados recebidos de um endereço inválido: [3 6 0 182 0 1 168 14]
|
||||
04/12/2024 15:46:28:530 - Endereço 12 (192.168.105.10): Dados recebidos de um endereço inválido: [1 12 71 255 0 0 0 0]
|
||||
04/12/2024 15:46:41:838 - Endereço 0 (192.168.105.10): Dados recebidos de um endereço inválido: [244 0 0 0 0 0 0 0]
|
||||
04/12/2024 15:46:41:854 - Endereço 0 (192.168.105.10): Dados recebidos de um endereço inválido: [230 0 0 0 0 0 0 0]
|
||||
04/12/2024 15:47:20:946 - Endereço 195 (192.168.105.10): Dados recebidos de um endereço inválido: [11 195 227 32 5 28 0 0]
|
||||
04/12/2024 16:14:01:586 - Endereço 1 (192.168.105.11): Erro ao enviar dados para o dispositivo via Ethernet
|
||||
04/12/2024 16:14:04:263 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 16:14:05:592 - Endereço 1 (192.168.105.11): Erro ao enviar dados para o dispositivo via Ethernet
|
||||
04/12/2024 16:14:05:655 - Endereço 1 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 16:14:06:140 - Endereço 1 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 16:14:06:141 - Endereço 3 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 16:14:06:512 - Endereço 3 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=1
|
||||
04/12/2024 16:14:06:513 - Endereço 3 (192.168.105.11): Conexão Ethernet não está definida ou não está conectada
|
||||
04/12/2024 16:40:33:952 - Endereço 162 (192.168.105.11): Dados recebidos de um endereço inválido: [251 162 255 145 251 72 255]
|
||||
04/12/2024 16:40:59:299 - Endereço 246 (192.168.105.11): Dados recebidos de um endereço inválido: [2 246]
|
||||
04/12/2024 16:41:03:316 - Endereço 245 (192.168.105.11): Dados recebidos de um endereço inválido: [3 245 2 245]
|
||||
04/12/2024 16:46:45:243 - Endereço 241 (192.168.105.11): Dados recebidos de um endereço inválido: [251 241]
|
||||
04/12/2024 16:52:46:485 - Endereço 2 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
04/12/2024 16:56:32:719 - Endereço 245 (192.168.105.11): Dados recebidos de um endereço inválido: [1 245 2 243]
|
||||
04/12/2024 17:16:16:065 - Endereço 160 (192.168.105.11): Dados recebidos de um endereço inválido: [191 160 159 245]
|
||||
05/12/2024 08:06:15:419 - Endereço 245 (192.168.105.11): Dados recebidos de um endereço inválido: [3 245 2 245]
|
||||
05/12/2024 08:10:31:268 - Endereço 245 (192.168.105.11): Dados recebidos de um endereço inválido: [2 245]
|
||||
05/12/2024 08:10:34:288 - Endereço 245 (192.168.105.11): Dados recebidos de um endereço inválido: [2 245]
|
||||
05/12/2024 08:10:43:388 - Endereço 161 (192.168.105.11): Dados recebidos de um endereço inválido: [251 161 191 160 159 245 189 254]
|
||||
05/12/2024 08:12:11:439 - Endereço 245 (192.168.105.11): Dados recebidos de um endereço inválido: [3 245 2 245]
|
||||
05/12/2024 08:12:15:602 - Endereço 1 (192.168.105.11): Erro ao enviar comando: Index was outside the bounds of the array.
|
||||
05/12/2024 09:12:11:308 - Endereço 4 (192.168.105.11): Erro ao enviar dados para o dispositivo via Ethernet
|
||||
05/12/2024 09:12:15:539 - Endereço 4 (192.168.105.11): Timeout ao receber resposta. GET=True, Parametro=46
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"tmrRegistrador":{"State":2,"IsRunning":false,"IsStopped":true,"IsCreated":false,"Interval":1000,"StackTrace":"AtuadorModel.IniciarRegistrador","Id":"tmrRegistrador_Atu","TimeTick":"00:00:00"},"Modulo_ID":"Atu","IP":"192.168.100.13","RequisitarDados":true,"Conectado":false,"QuantidadeBicos":4,"DensidadeHerbicida":1.05,"BicosPulverizadores":[{"ID":"B01","Posicao":1,"Componente":422,"AtuacaoNivelAlto":true,"ComandoAtuar":false,"Comandar":true,"Testando":false,"Funcoes":[21],"LeituraStatusBico":false,"MediaNivelFluxo":0.0,"Leitura":null,"Inicializado":false,"Atuacoes":0,"InicioAtuacao":"0001-01-01T00:00:00","TempoAtuado":0.0},{"ID":"B02","Posicao":2,"Componente":422,"AtuacaoNivelAlto":true,"ComandoAtuar":false,"Comandar":true,"Testando":false,"Funcoes":[21],"LeituraStatusBico":false,"MediaNivelFluxo":0.0,"Leitura":null,"Inicializado":false,"Atuacoes":0,"InicioAtuacao":"0001-01-01T00:00:00","TempoAtuado":0.0},{"ID":"B03","Posicao":3,"Componente":422,"AtuacaoNivelAlto":true,"ComandoAtuar":false,"Comandar":true,"Testando":false,"Funcoes":[21],"LeituraStatusBico":false,"MediaNivelFluxo":0.0,"Leitura":null,"Inicializado":false,"Atuacoes":0,"InicioAtuacao":"0001-01-01T00:00:00","TempoAtuado":0.0},{"ID":"B04","Posicao":4,"Componente":422,"AtuacaoNivelAlto":true,"ComandoAtuar":false,"Comandar":true,"Testando":false,"Funcoes":[21],"LeituraStatusBico":false,"MediaNivelFluxo":0.0,"Leitura":null,"Inicializado":false,"Atuacoes":0,"InicioAtuacao":"0001-01-01T00:00:00","TempoAtuado":0.0}],"BombasPressurizadoras":[{"ID":"BOMBA","ComandoAtuar":false,"Componente":325,"LeituraEstado":false,"Comandar":true,"Testando":false,"Funcoes":[14,35,36,37,5],"LeituraPotencia":0.0,"LeituraPressaoSP":0.0,"LeituraPressao":0.0,"Leitura":null,"Inicializado":false}],"Sensores":[{"LogGrafico":[],"ID":"FLXLN","Prioridade":23,"Descricao":"Fluxo na linha principal","Componente":198,"Aferir":true,"DelayAmostragem":300,"Leitura":null,"Inicializado":false,"Testando":false,"Funcoes":[25],"Parametros":[],"UnidadeMedida":"mL/s","LimiteMaximo":0.0,"LimiteMinimo":0.0},{"LogGrafico":[],"ID":"MASRS","Prioridade":3,"Descricao":"Massa do reservatório de herbicida","Componente":532,"Aferir":true,"DelayAmostragem":1000,"Leitura":null,"Inicializado":false,"Testando":false,"Funcoes":[22,23],"Parametros":[],"UnidadeMedida":"Kg","LimiteMaximo":50.0,"LimiteMinimo":5.0},{"LogGrafico":[],"ID":"PRSLN","Prioridade":3,"Descricao":"Pressão na linha principal","Componente":333,"Aferir":true,"DelayAmostragem":1000,"Leitura":null,"Inicializado":false,"Testando":false,"Funcoes":[24],"Parametros":[["Vmin","000.00"],["Vmax","004.50"],["Pmax","174.04"]],"UnidadeMedida":"psi","LimiteMaximo":120.0,"LimiteMinimo":60.0}],"BombaPressurizadora":{"ID":"BOMBA","ComandoAtuar":false,"Componente":325,"LeituraEstado":false,"Comandar":true,"Testando":false,"Funcoes":[14,35,36,37,5],"LeituraPotencia":0.0,"LeituraPressaoSP":0.0,"LeituraPressao":0.0,"Leitura":null,"Inicializado":false},"ScriptDeteccaoErvas":"weed_detector-1_0.py","DadosLeitura":{"Conectado":false,"Mod_ID":null,"Momento":"0001-01-01T00:00:00","BicosPulverizadores":[],"BombasPressurizadoras":[],"SensoresFluxo":[],"SensoresMassa":[],"SensoresPressao":[]},"_MassaRef":0.8,"_MassaLeituraRef":40876.37,"_MassaLeituraExtra":1895800.0,"MassaReservatorio":0.0,"VolumeReservatorio":0.0,"PercentualReservatorio":0.0,"VolumeVazaoAferido":0.0,"_FluxoMlRef":102.0,"_FluxoPulsoRef":80.0,"VazaoFluxoMLpS":0.0,"VolumeVazaoML":0.0,"InicioAtuacao":"0001-01-01T00:00:00","TempoAtuado":0.0,"_PressaoVmin":0.0,"_PressaoVmax":4.5,"_PressaoMax":174.045,"PressaoLinha":0.0,"PressaoLinhaCalc":0.0}
|
||||
{"tmrRegistrador":{"_uiControl":null,"State":2,"IsRunning":false,"IsStopped":true,"IsCreated":false,"Interval":1000,"StackTrace":"AtuadorModel.IniciarRegistrador","Id":"tmrRegistrador_Atu","TimeTick":"00:00:00"},"Modulo_ID":"Atu","IP":"192.168.100.13","RequisitarDados":true,"Conectado":false,"QuantidadeBicos":4,"DensidadeHerbicida":1.05,"BicosPulverizadores":[{"ID":"B01","Posicao":1,"Componente":422,"AtuacaoNivelAlto":true,"ComandoAtuar":false,"Comandar":true,"Testando":false,"Funcoes":[21],"LeituraStatusBico":false,"MediaNivelFluxo":0.0,"Leitura":null,"Inicializado":false,"Atuacoes":0,"InicioAtuacao":"0001-01-01T00:00:00","TempoAtuado":0.0},{"ID":"B02","Posicao":2,"Componente":422,"AtuacaoNivelAlto":true,"ComandoAtuar":false,"Comandar":true,"Testando":false,"Funcoes":[21],"LeituraStatusBico":false,"MediaNivelFluxo":0.0,"Leitura":null,"Inicializado":false,"Atuacoes":0,"InicioAtuacao":"0001-01-01T00:00:00","TempoAtuado":0.0},{"ID":"B03","Posicao":3,"Componente":422,"AtuacaoNivelAlto":true,"ComandoAtuar":false,"Comandar":true,"Testando":false,"Funcoes":[21],"LeituraStatusBico":false,"MediaNivelFluxo":0.0,"Leitura":null,"Inicializado":false,"Atuacoes":0,"InicioAtuacao":"0001-01-01T00:00:00","TempoAtuado":0.0},{"ID":"B04","Posicao":4,"Componente":422,"AtuacaoNivelAlto":true,"ComandoAtuar":false,"Comandar":true,"Testando":false,"Funcoes":[21],"LeituraStatusBico":false,"MediaNivelFluxo":0.0,"Leitura":null,"Inicializado":false,"Atuacoes":0,"InicioAtuacao":"0001-01-01T00:00:00","TempoAtuado":0.0}],"BombasPressurizadoras":[{"ID":"BOMBA","ComandoAtuar":false,"Componente":325,"LeituraEstado":false,"Comandar":true,"Testando":false,"Funcoes":[14,35,36,37,5],"LeituraPotencia":0.0,"LeituraPressaoSP":0.0,"LeituraPressao":0.0,"Leitura":null,"Inicializado":false}],"Sensores":[{"LogGrafico":[],"ID":"FLXLN","Prioridade":23,"Descricao":"Fluxo na linha principal","Componente":198,"Aferir":true,"DelayAmostragem":300,"Leitura":null,"Inicializado":false,"Testando":false,"Funcoes":[25],"Parametros":[],"UnidadeMedida":"mL/s","LimiteMaximo":0.0,"LimiteMinimo":0.0},{"LogGrafico":[],"ID":"MASRS","Prioridade":3,"Descricao":"Massa do reservatório de herbicida","Componente":532,"Aferir":true,"DelayAmostragem":1000,"Leitura":null,"Inicializado":false,"Testando":false,"Funcoes":[22,23],"Parametros":[],"UnidadeMedida":"Kg","LimiteMaximo":50.0,"LimiteMinimo":5.0},{"LogGrafico":[],"ID":"PRSLN","Prioridade":3,"Descricao":"Pressão na linha principal","Componente":333,"Aferir":true,"DelayAmostragem":1000,"Leitura":null,"Inicializado":false,"Testando":false,"Funcoes":[24],"Parametros":[["Vmin","000.00"],["Vmax","004.50"],["Pmax","174.04"]],"UnidadeMedida":"psi","LimiteMaximo":120.0,"LimiteMinimo":60.0}],"BombaPressurizadora":{"ID":"BOMBA","ComandoAtuar":false,"Componente":325,"LeituraEstado":false,"Comandar":true,"Testando":false,"Funcoes":[14,35,36,37,5],"LeituraPotencia":0.0,"LeituraPressaoSP":0.0,"LeituraPressao":0.0,"Leitura":null,"Inicializado":false},"ScriptDeteccaoErvas":"weed_detector-1_0.py","DadosLeitura":{"Conectado":false,"Mod_ID":null,"Momento":"0001-01-01T00:00:00","BicosPulverizadores":[],"BombasPressurizadoras":[],"SensoresFluxo":[],"SensoresMassa":[],"SensoresPressao":[]},"_MassaRef":0.8,"_MassaLeituraRef":40876.37,"_MassaLeituraExtra":1895800.0,"MassaReservatorio":0.0,"VolumeReservatorio":0.0,"PercentualReservatorio":0.0,"VolumeVazaoAferido":0.0,"_FluxoMlRef":102.0,"_FluxoPulsoRef":80.0,"VazaoFluxoMLpSInstantanea":0.0,"VazaoFluxoMLpSMedia":0.0,"VolumeVazaoML":0.0,"InicioAtuacao":"0001-01-01T00:00:00","TempoAtuado":0.0,"_PressaoVmin":0.0,"_PressaoVmax":4.5,"_PressaoMax":174.045,"PressaoLinha":0.0,"PressaoLinhaCalc":0.0}
|
||||
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
|
|
@ -25,7 +25,7 @@
|
|||
<meta name="viewport" content="width=device-width,
|
||||
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<style>
|
||||
#map_25eea00ac1923151642c61c60e0aa577 {
|
||||
#map_c7af28f8a3c40c5dd24a2726b3eb0552 {
|
||||
position: relative;
|
||||
width: 100.0%;
|
||||
height: 100.0%;
|
||||
|
|
@ -39,14 +39,14 @@
|
|||
<body>
|
||||
|
||||
|
||||
<div class="folium-map" id="map_25eea00ac1923151642c61c60e0aa577" ></div>
|
||||
<div class="folium-map" id="map_c7af28f8a3c40c5dd24a2726b3eb0552" ></div>
|
||||
|
||||
</body>
|
||||
<script>
|
||||
|
||||
|
||||
var map_25eea00ac1923151642c61c60e0aa577 = L.map(
|
||||
"map_25eea00ac1923151642c61c60e0aa577",
|
||||
var map_c7af28f8a3c40c5dd24a2726b3eb0552 = L.map(
|
||||
"map_c7af28f8a3c40c5dd24a2726b3eb0552",
|
||||
{
|
||||
center: [0.0, 0.0],
|
||||
crs: L.CRS.EPSG3857,
|
||||
|
|
@ -59,6 +59,15 @@
|
|||
|
||||
|
||||
|
||||
|
||||
var tile_layer_ccfaf9e6793048006f49405eb96e5c6f = 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_ccfaf9e6793048006f49405eb96e5c6f.addTo(map_c7af28f8a3c40c5dd24a2726b3eb0552);
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
|
@ -78,7 +87,7 @@
|
|||
}
|
||||
trajeto_json_add({"features": []});
|
||||
|
||||
trajeto_json.addTo(map_25eea00ac1923151642c61c60e0aa577);
|
||||
trajeto_json.addTo(map_c7af28f8a3c40c5dd24a2726b3eb0552);
|
||||
|
||||
function adicionarGeometria(novaGeometria) {
|
||||
trajeto_json.addData(novaGeometria);
|
||||
|
|
@ -136,7 +145,7 @@
|
|||
|
||||
var marcadorDinamico = L.marker([0, 0], {
|
||||
icon: customIcon
|
||||
}).addTo(map_25eea00ac1923151642c61c60e0aa577);
|
||||
}).addTo(map_c7af28f8a3c40c5dd24a2726b3eb0552);
|
||||
|
||||
// Conectar ao broker MQTT
|
||||
const client = mqtt.connect('ws://localhost:9001'); // Use wss para conexão segura
|
||||
|
|
@ -174,7 +183,7 @@
|
|||
marcadorDinamico.setRotationAngle(angulo);
|
||||
|
||||
adicionarCoordenada("Tj", [novaLongitude, novaLatitude]);
|
||||
map_25eea00ac1923151642c61c60e0aa577.setView(novaPosicao, map_25eea00ac1923151642c61c60e0aa577.getZoom());
|
||||
map_c7af28f8a3c40c5dd24a2726b3eb0552.setView(novaPosicao, map_c7af28f8a3c40c5dd24a2726b3eb0552.getZoom());
|
||||
});
|
||||
|
||||
function calcularOrientacao(P1latitude, P1longitude, P2latitude, P2longitude) {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
c0dc644741f90cfbc6e195d6355a1e380c1e960cefff1b211bf55e3dbd91e24f
|
||||
67868050e67547dc83356f09c576b86f9f0a70485da0997bf220ca7410042de4
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -37,7 +37,7 @@ long _baudRate = 115200;
|
|||
bool Conectado = false;
|
||||
bool Verificando = false;
|
||||
|
||||
int _TaxaAmostragem = 500;
|
||||
int _TaxaAmostragem = 1000;
|
||||
volatile bool RequisitarDados = false;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,12 +10,15 @@
|
|||
const String TopicoRecepcao = "disp/tx/";
|
||||
const String TopicoTransmissao = "disp/rx/";
|
||||
|
||||
unsigned long ultimaTentativaConexao = 0; // Tempo da última tentativa de conexão
|
||||
const unsigned long intervaloTentativa = 5000; // 5 segundos
|
||||
|
||||
class MqttService {
|
||||
private:
|
||||
const char* server = "192.168." WIFI_FAIXA ".105";
|
||||
int port = 1883;
|
||||
const char* user = "zendion";
|
||||
const char* password = "Z210203!";
|
||||
const char* user = "";
|
||||
const char* password = "";
|
||||
String mqtt_mod_id; // Alterado para String
|
||||
WiFiClient wifiClient;
|
||||
PubSubClient mqttClient;
|
||||
|
|
@ -28,7 +31,7 @@ class MqttService {
|
|||
|
||||
MqttService() : mqttClient(wifiClient) {
|
||||
mqttClient.setServer(server, port);
|
||||
mqttClient.setBufferSize(1024);
|
||||
mqttClient.setBufferSize(2048);
|
||||
mqttClient.setCallback([this](char* topic, byte* payload, unsigned int length) {
|
||||
this->processMessage(topic, payload, length);
|
||||
});
|
||||
|
|
@ -43,11 +46,22 @@ class MqttService {
|
|||
}
|
||||
|
||||
bool InicializarComunicacaoMqtt() {
|
||||
// Verifica se já passou o intervalo necessário para uma nova tentativa
|
||||
if (millis() - ultimaTentativaConexao < intervaloTentativa) {
|
||||
PrintTela("Aguardando para próxima tentativa de conexão MQTT...");
|
||||
return MqttIsConnected; // Retorna o estado atual sem tentar reconectar
|
||||
}
|
||||
|
||||
ultimaTentativaConexao = millis(); // Atualiza o tempo da última tentativa
|
||||
|
||||
connect();
|
||||
|
||||
if (MqttIsConnected) {
|
||||
PrintTela("Tamanho máximo de mensagens: " + String(mqttClient.getBufferSize()));
|
||||
LimparMensagensRetidas(TopicoRecepcao + mqtt_mod_id); // Limpa mensagens retidas
|
||||
subscribe(TopicoRecepcao);
|
||||
}
|
||||
|
||||
return MqttIsConnected;
|
||||
}
|
||||
|
||||
|
|
@ -67,6 +81,19 @@ class MqttService {
|
|||
}
|
||||
}
|
||||
|
||||
void LimparMensagensRetidas(const String& topico) {
|
||||
if (mqttClient.connected()) {
|
||||
// Publica uma mensagem vazia com o flag Retain para limpar mensagens retidas
|
||||
if (mqttClient.publish(topico.c_str(), "", true)) {
|
||||
Serial.println("Mensagem retida limpa no tópico: " + topico);
|
||||
} else {
|
||||
Serial.println("Falha ao limpar mensagem retida no tópico: " + topico);
|
||||
}
|
||||
} else {
|
||||
Serial.println("Broker MQTT desconectado, não foi possível limpar mensagens retidas.");
|
||||
}
|
||||
}
|
||||
|
||||
void subscribe(String topico) {
|
||||
String fullTopic = topico + mqtt_mod_id; // Concatena o ID ao tópico base
|
||||
mqttClient.subscribe(fullTopic.c_str());
|
||||
|
|
@ -105,9 +132,12 @@ class MqttService {
|
|||
}
|
||||
|
||||
void loop() {
|
||||
if (MqttIsConnected) {
|
||||
if (mqttClient.connected()) {
|
||||
mqttClient.loop();
|
||||
}
|
||||
else {
|
||||
InicializarComunicacaoMqtt();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#include "SerialService.h"
|
||||
#include "Pinout.h"
|
||||
#include <Bounce2.h>
|
||||
|
||||
#ifndef SensorFluxoModel
|
||||
#define SensorFluxoModel
|
||||
|
|
@ -18,14 +17,12 @@ class SensorFluxo {
|
|||
// Definições
|
||||
String Mod_ID = "";
|
||||
String _ID;
|
||||
S_Code _componente = sFLX;
|
||||
PinoModel _pino;
|
||||
|
||||
Bounce bouncer; // Gerenciador de debounce
|
||||
unsigned long tempoAnterior = 0;
|
||||
unsigned int _Pulsos = 0;
|
||||
unsigned long _PeriodoTotal = 0;
|
||||
unsigned long primeiroMillis = millis();
|
||||
bool ultimaLeitura = false;
|
||||
|
||||
bool Iniciado = false;
|
||||
|
||||
|
|
@ -36,27 +33,21 @@ class SensorFluxo {
|
|||
void Inicializar() {
|
||||
if (Iniciado) {
|
||||
PrintTela(_ID + " ja inicializado");
|
||||
//EnviarDadosSerial(Mod_ID, MontarProtocoloSensor(sCFG, _ID, Iniciado ? "1" : "0"));
|
||||
return;
|
||||
}
|
||||
|
||||
_pino.Conectar();
|
||||
bouncer.attach(_pino.num);
|
||||
bouncer.interval(10);
|
||||
|
||||
ResetarEstado();
|
||||
|
||||
PrintTela(_ID + " Iniciado");
|
||||
|
||||
Iniciado = true;
|
||||
|
||||
//EnviarDadosSerial(Mod_ID, MontarProtocoloSensor(sCFG, _ID, Iniciado ? "1" : "0"));
|
||||
}
|
||||
|
||||
void Desligar() {
|
||||
if (!Iniciado) {
|
||||
PrintTela(_ID + " nao esta inicializado");
|
||||
//EnviarDadosSerial(Mod_ID, MontarProtocoloSensor(sCFG, _ID, Iniciado ? "1" : "0"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -68,8 +59,6 @@ class SensorFluxo {
|
|||
PrintTela(_ID + " Desligado");
|
||||
|
||||
Iniciado = false;
|
||||
|
||||
//EnviarDadosSerial(Mod_ID, MontarProtocoloSensor(sCFG, _ID, Iniciado ? "1" : "0"));
|
||||
}
|
||||
|
||||
void AtualizarLeitura() {
|
||||
|
|
@ -87,18 +76,19 @@ class SensorFluxo {
|
|||
return;
|
||||
}
|
||||
|
||||
// Atualiza debounce
|
||||
bouncer.update();
|
||||
|
||||
// Detecta transição
|
||||
if (bouncer.fell()) { // Transição de HIGH para LOW
|
||||
bool Leitura = _pino.get() == 1;
|
||||
if (Leitura != ultimaLeitura) {
|
||||
if (Leitura && !ultimaLeitura) {
|
||||
unsigned long tempoAtual = millis();
|
||||
unsigned long intervalo = tempoAtual - tempoAnterior;
|
||||
unsigned long intervalo = (unsigned long)(tempoAtual - tempoAnterior); // Garante cálculo correto
|
||||
tempoAnterior = tempoAtual;
|
||||
|
||||
_Pulsos++;
|
||||
_PeriodoTotal += intervalo;
|
||||
}
|
||||
|
||||
ultimaLeitura = Leitura;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -106,13 +96,12 @@ class SensorFluxo {
|
|||
void ResetarEstado() {
|
||||
_Pulsos = 0;
|
||||
_PeriodoTotal = 0;
|
||||
tempoAnterior = 0;
|
||||
tempoAnterior = millis();
|
||||
ultimaLeitura = _pino.get() == 1;
|
||||
}
|
||||
|
||||
// Reinicia amostragem
|
||||
void ReiniciarAmostragem() {
|
||||
//Serial.println("Pulsos: " + String(_Pulsos) + ", Período Total: " + String(_PeriodoTotal) + " ms");
|
||||
|
||||
// Reseta os valores para a próxima amostragem
|
||||
_Pulsos = 0;
|
||||
_PeriodoTotal = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue