Ajustes e inclusao do comando de reset
This commit is contained in:
parent
d79eb55179
commit
b5ba765526
|
|
@ -1423,7 +1423,7 @@ namespace AgroBase.Forms.IHM
|
||||||
private async Task EnviarComandoRele(DispositivosService<SensoriamentoModel> Dispositivo, SensorReleModel Rele, bool Ligar, int Delay)
|
private async Task EnviarComandoRele(DispositivosService<SensoriamentoModel> Dispositivo, SensorReleModel Rele, bool Ligar, int Delay)
|
||||||
{
|
{
|
||||||
var novoEstado = Ligar ? Estado.Ligado : Estado.Desligado;
|
var novoEstado = Ligar ? Estado.Ligado : Estado.Desligado;
|
||||||
GeneralJoystick.EnviarComandoSensoriamento(S_Code.sRLE, Rele.ID, novoEstado);
|
GeneralJoystick.EnviarComandoSensoriamento(Rele.Componente, Rele.ID, novoEstado);
|
||||||
await Task.Delay(Delay);
|
await Task.Delay(Delay);
|
||||||
Dispositivo.Dados.RequisitarDadosModulo(Rele.ID_Num, CanMessagePosicaoDados.Dados1, CanMessagePosicaoDados.Dados1, true);
|
Dispositivo.Dados.RequisitarDadosModulo(Rele.ID_Num, CanMessagePosicaoDados.Dados1, CanMessagePosicaoDados.Dados1, true);
|
||||||
await Task.Delay(Delay);
|
await Task.Delay(Delay);
|
||||||
|
|
@ -1663,7 +1663,7 @@ namespace AgroBase.Forms.IHM
|
||||||
await EnviarComandoSinaleiro(Dispositivo, Sinaleiro, true, 1000);
|
await EnviarComandoSinaleiro(Dispositivo, Sinaleiro, true, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusLED Status = Sinaleiro.ValoresLeituras.FirstOrDefault(x => x.funcao == FuncoesPinout.StatusLEDLeitura).atual.valor;
|
StatusLED Status = Sinaleiro.ValoresLeituras.FirstOrDefault(x => x.funcao == FuncoesPinout.StatusLedLeitura).atual.valor;
|
||||||
idx = PreencheDadosLinha(grid, Testes, idx, Iniciado && Status == StatusLED.Aceso ? 1 : -1);
|
idx = PreencheDadosLinha(grid, Testes, idx, Iniciado && Status == StatusLED.Aceso ? 1 : -1);
|
||||||
|
|
||||||
if (Iniciado)
|
if (Iniciado)
|
||||||
|
|
@ -1671,7 +1671,7 @@ namespace AgroBase.Forms.IHM
|
||||||
await EnviarComandoSinaleiro(Dispositivo, Sinaleiro, false, 1000);
|
await EnviarComandoSinaleiro(Dispositivo, Sinaleiro, false, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = Sinaleiro.ValoresLeituras.FirstOrDefault(x => x.funcao == FuncoesPinout.StatusLEDLeitura).atual.valor;
|
Status = Sinaleiro.ValoresLeituras.FirstOrDefault(x => x.funcao == FuncoesPinout.StatusLedLeitura).atual.valor;
|
||||||
idx = PreencheDadosLinha(grid, Testes, idx, Iniciado && Status == StatusLED.Apagado ? 0 : -1);
|
idx = PreencheDadosLinha(grid, Testes, idx, Iniciado && Status == StatusLED.Apagado ? 0 : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1682,9 +1682,8 @@ namespace AgroBase.Forms.IHM
|
||||||
|
|
||||||
private async Task EnviarComandoSinaleiro(DispositivosService<SensoriamentoModel> Dispositivo, SensorSinaleiroModel Sinaleiro, bool Ligar, int Delay)
|
private async Task EnviarComandoSinaleiro(DispositivosService<SensoriamentoModel> Dispositivo, SensorSinaleiroModel Sinaleiro, bool Ligar, int Delay)
|
||||||
{
|
{
|
||||||
var Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(StatusOperacao.NaoIniciado);
|
var Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(Ligar ? StatusLED.Aceso : StatusLED.Apagado);
|
||||||
Comportamento.statusLED = Ligar ? StatusLED.Aceso : StatusLED.Apagado;
|
GeneralJoystick.EnviarComandoSensoriamento(Sinaleiro.Componente, Sinaleiro.ID, Comportamento);
|
||||||
GeneralJoystick.EnviarComandoSensoriamento(S_Code.sLED, Sinaleiro.ID, Comportamento);
|
|
||||||
await Task.Delay(Delay);
|
await Task.Delay(Delay);
|
||||||
Dispositivo.Dados.RequisitarDadosModulo(Sinaleiro.ID_Num, CanMessagePosicaoDados.Dados1, CanMessagePosicaoDados.Dados1, true);
|
Dispositivo.Dados.RequisitarDadosModulo(Sinaleiro.ID_Num, CanMessagePosicaoDados.Dados1, CanMessagePosicaoDados.Dados1, true);
|
||||||
await Task.Delay(Delay);
|
await Task.Delay(Delay);
|
||||||
|
|
|
||||||
|
|
@ -1450,9 +1450,9 @@ namespace AgroBase.Forms.Operacoes
|
||||||
}
|
}
|
||||||
|
|
||||||
var LogSen = LogsSensoriamento.FirstOrDefault(x => x.Momento == MomentoAtual);
|
var LogSen = LogsSensoriamento.FirstOrDefault(x => x.Momento == MomentoAtual);
|
||||||
pnlManual.BackColor = LogSen.Sinaleiros?.FirstOrDefault(x => x.ID.Contains("MN"))?.ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.StatusLEDLeitura)?.atual?.valor == (int)Enums.StatusLED.Aceso ? Color.Yellow : Color.Gold;
|
pnlManual.BackColor = LogSen.Sinaleiros?.FirstOrDefault(x => x.ID.Contains("MN"))?.ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.StatusLedLeitura)?.atual?.valor == (int)Enums.StatusLED.Aceso ? Color.Yellow : Color.Gold;
|
||||||
pnlAutomatico.BackColor = LogSen.Sinaleiros?.FirstOrDefault(x => x.ID.Contains("AT"))?.ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.StatusLEDLeitura)?.atual?.valor == (int)Enums.StatusLED.Aceso ? Color.Yellow : Color.Gold;
|
pnlAutomatico.BackColor = LogSen.Sinaleiros?.FirstOrDefault(x => x.ID.Contains("AT"))?.ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.StatusLedLeitura)?.atual?.valor == (int)Enums.StatusLED.Aceso ? Color.Yellow : Color.Gold;
|
||||||
pnlOperacao.BackColor = LogSen.Sinaleiros?.FirstOrDefault(x => x.ID.Contains("OP"))?.ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.StatusLEDLeitura)?.atual?.valor == (int)Enums.StatusLED.Aceso ? Color.Green : Color.DarkGreen;
|
pnlOperacao.BackColor = LogSen.Sinaleiros?.FirstOrDefault(x => x.ID.Contains("OP"))?.ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.StatusLedLeitura)?.atual?.valor == (int)Enums.StatusLED.Aceso ? Color.Green : Color.DarkGreen;
|
||||||
lblSEN_QualidadeWifi.Text = $"Qualidade Wi-Fi: {LogSen.QualidadeWifi} dBm";
|
lblSEN_QualidadeWifi.Text = $"Qualidade Wi-Fi: {LogSen.QualidadeWifi} dBm";
|
||||||
lblSEN_LatenciaLoop.Text = $"Latencia de Loop: {LogSen.LatenciaLoop} ms";
|
lblSEN_LatenciaLoop.Text = $"Latencia de Loop: {LogSen.LatenciaLoop} ms";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
this.lblTensao = new System.Windows.Forms.Label();
|
this.lblTensao = new System.Windows.Forms.Label();
|
||||||
this.lblCorrente = new System.Windows.Forms.Label();
|
this.lblCorrente = new System.Windows.Forms.Label();
|
||||||
this.lblTemperatura = new System.Windows.Forms.Label();
|
this.lblTemperatura = new System.Windows.Forms.Label();
|
||||||
this.gridsTMP = new System.Windows.Forms.DataGridView();
|
this.gridsNTC = new System.Windows.Forms.DataGridView();
|
||||||
this.lblPressao = new System.Windows.Forms.Label();
|
this.lblPressao = new System.Windows.Forms.Label();
|
||||||
this.gridsULT = new System.Windows.Forms.DataGridView();
|
this.gridsULT = new System.Windows.Forms.DataGridView();
|
||||||
this.lblFluxo = new System.Windows.Forms.Label();
|
this.lblFluxo = new System.Windows.Forms.Label();
|
||||||
|
|
@ -62,13 +62,14 @@
|
||||||
this.chbRequisitarDados = new System.Windows.Forms.CheckBox();
|
this.chbRequisitarDados = new System.Windows.Forms.CheckBox();
|
||||||
this.lblAddrTx = new System.Windows.Forms.Label();
|
this.lblAddrTx = new System.Windows.Forms.Label();
|
||||||
this.txtEnderecoCAN_Tx = new System.Windows.Forms.TextBox();
|
this.txtEnderecoCAN_Tx = new System.Windows.Forms.TextBox();
|
||||||
this.lblPotenciometro = new System.Windows.Forms.Label();
|
this.lblMagnetico = new System.Windows.Forms.Label();
|
||||||
this.gridsPOT = new System.Windows.Forms.DataGridView();
|
this.gridsMAG = new System.Windows.Forms.DataGridView();
|
||||||
this.lblAddrRx = new System.Windows.Forms.Label();
|
this.lblAddrRx = new System.Windows.Forms.Label();
|
||||||
this.txtEnderecoCAN_Rx = new System.Windows.Forms.TextBox();
|
this.txtEnderecoCAN_Rx = new System.Windows.Forms.TextBox();
|
||||||
|
this.btnReiniciar = new System.Windows.Forms.Button();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.gridsTEN)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.gridsTEN)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.gridsCOR)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.gridsCOR)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.gridsTMP)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.gridsNTC)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.gridsULT)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.gridsULT)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.gridsFLX)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.gridsFLX)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.gridsMAS)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.gridsMAS)).BeginInit();
|
||||||
|
|
@ -76,7 +77,7 @@
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudBateriaValor)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.nudBateriaValor)).BeginInit();
|
||||||
this.gpbBateria.SuspendLayout();
|
this.gpbBateria.SuspendLayout();
|
||||||
this.gpbCameras.SuspendLayout();
|
this.gpbCameras.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.gridsPOT)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.gridsMAG)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// gridsTEN
|
// gridsTEN
|
||||||
|
|
@ -100,7 +101,7 @@
|
||||||
// btnSalvar
|
// btnSalvar
|
||||||
//
|
//
|
||||||
this.btnSalvar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.btnSalvar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.btnSalvar.Location = new System.Drawing.Point(1128, 690);
|
this.btnSalvar.Location = new System.Drawing.Point(1110, 695);
|
||||||
this.btnSalvar.Name = "btnSalvar";
|
this.btnSalvar.Name = "btnSalvar";
|
||||||
this.btnSalvar.Size = new System.Drawing.Size(75, 23);
|
this.btnSalvar.Size = new System.Drawing.Size(75, 23);
|
||||||
this.btnSalvar.TabIndex = 3;
|
this.btnSalvar.TabIndex = 3;
|
||||||
|
|
@ -135,14 +136,14 @@
|
||||||
this.lblTemperatura.TabIndex = 7;
|
this.lblTemperatura.TabIndex = 7;
|
||||||
this.lblTemperatura.Text = "Temperatura";
|
this.lblTemperatura.Text = "Temperatura";
|
||||||
//
|
//
|
||||||
// gridsTMP
|
// gridsNTC
|
||||||
//
|
//
|
||||||
this.gridsTMP.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
this.gridsNTC.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
this.gridsTMP.Location = new System.Drawing.Point(15, 311);
|
this.gridsNTC.Location = new System.Drawing.Point(15, 311);
|
||||||
this.gridsTMP.Name = "gridsTMP";
|
this.gridsNTC.Name = "gridsNTC";
|
||||||
this.gridsTMP.RowHeadersWidth = 51;
|
this.gridsNTC.RowHeadersWidth = 51;
|
||||||
this.gridsTMP.Size = new System.Drawing.Size(578, 124);
|
this.gridsNTC.Size = new System.Drawing.Size(578, 124);
|
||||||
this.gridsTMP.TabIndex = 6;
|
this.gridsNTC.TabIndex = 6;
|
||||||
//
|
//
|
||||||
// lblPressao
|
// lblPressao
|
||||||
//
|
//
|
||||||
|
|
@ -411,23 +412,23 @@
|
||||||
this.txtEnderecoCAN_Tx.TabIndex = 144;
|
this.txtEnderecoCAN_Tx.TabIndex = 144;
|
||||||
this.txtEnderecoCAN_Tx.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
this.txtEnderecoCAN_Tx.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||||
//
|
//
|
||||||
// lblPotenciometro
|
// lblMagnetico
|
||||||
//
|
//
|
||||||
this.lblPotenciometro.AutoSize = true;
|
this.lblMagnetico.AutoSize = true;
|
||||||
this.lblPotenciometro.Location = new System.Drawing.Point(12, 581);
|
this.lblMagnetico.Location = new System.Drawing.Point(12, 581);
|
||||||
this.lblPotenciometro.Name = "lblPotenciometro";
|
this.lblMagnetico.Name = "lblMagnetico";
|
||||||
this.lblPotenciometro.Size = new System.Drawing.Size(167, 13);
|
this.lblMagnetico.Size = new System.Drawing.Size(102, 13);
|
||||||
this.lblPotenciometro.TabIndex = 147;
|
this.lblMagnetico.TabIndex = 147;
|
||||||
this.lblPotenciometro.Text = "Potenciometro (Angulo Direcional)";
|
this.lblMagnetico.Text = "Magnético (Angular)";
|
||||||
//
|
//
|
||||||
// gridsPOT
|
// gridsMAG
|
||||||
//
|
//
|
||||||
this.gridsPOT.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
this.gridsMAG.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
this.gridsPOT.Location = new System.Drawing.Point(15, 597);
|
this.gridsMAG.Location = new System.Drawing.Point(15, 597);
|
||||||
this.gridsPOT.Name = "gridsPOT";
|
this.gridsMAG.Name = "gridsMAG";
|
||||||
this.gridsPOT.RowHeadersWidth = 51;
|
this.gridsMAG.RowHeadersWidth = 51;
|
||||||
this.gridsPOT.Size = new System.Drawing.Size(578, 124);
|
this.gridsMAG.Size = new System.Drawing.Size(578, 124);
|
||||||
this.gridsPOT.TabIndex = 146;
|
this.gridsMAG.TabIndex = 146;
|
||||||
//
|
//
|
||||||
// lblAddrRx
|
// lblAddrRx
|
||||||
//
|
//
|
||||||
|
|
@ -450,15 +451,27 @@
|
||||||
this.txtEnderecoCAN_Rx.TabIndex = 148;
|
this.txtEnderecoCAN_Rx.TabIndex = 148;
|
||||||
this.txtEnderecoCAN_Rx.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
this.txtEnderecoCAN_Rx.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||||
//
|
//
|
||||||
|
// btnReiniciar
|
||||||
|
//
|
||||||
|
this.btnReiniciar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.btnReiniciar.Location = new System.Drawing.Point(1139, 454);
|
||||||
|
this.btnReiniciar.Name = "btnReiniciar";
|
||||||
|
this.btnReiniciar.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.btnReiniciar.TabIndex = 150;
|
||||||
|
this.btnReiniciar.Text = "Reinciar";
|
||||||
|
this.btnReiniciar.UseVisualStyleBackColor = true;
|
||||||
|
this.btnReiniciar.Click += new System.EventHandler(this.btnReiniciar_Click);
|
||||||
|
//
|
||||||
// frmSenConfig
|
// frmSenConfig
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(1226, 730);
|
this.ClientSize = new System.Drawing.Size(1226, 730);
|
||||||
|
this.Controls.Add(this.btnReiniciar);
|
||||||
this.Controls.Add(this.lblAddrRx);
|
this.Controls.Add(this.lblAddrRx);
|
||||||
this.Controls.Add(this.txtEnderecoCAN_Rx);
|
this.Controls.Add(this.txtEnderecoCAN_Rx);
|
||||||
this.Controls.Add(this.lblPotenciometro);
|
this.Controls.Add(this.lblMagnetico);
|
||||||
this.Controls.Add(this.gridsPOT);
|
this.Controls.Add(this.gridsMAG);
|
||||||
this.Controls.Add(this.lblAddrTx);
|
this.Controls.Add(this.lblAddrTx);
|
||||||
this.Controls.Add(this.txtEnderecoCAN_Tx);
|
this.Controls.Add(this.txtEnderecoCAN_Tx);
|
||||||
this.Controls.Add(this.chbRequisitarDados);
|
this.Controls.Add(this.chbRequisitarDados);
|
||||||
|
|
@ -473,7 +486,7 @@
|
||||||
this.Controls.Add(this.lblPressao);
|
this.Controls.Add(this.lblPressao);
|
||||||
this.Controls.Add(this.gridsULT);
|
this.Controls.Add(this.gridsULT);
|
||||||
this.Controls.Add(this.lblTemperatura);
|
this.Controls.Add(this.lblTemperatura);
|
||||||
this.Controls.Add(this.gridsTMP);
|
this.Controls.Add(this.gridsNTC);
|
||||||
this.Controls.Add(this.lblCorrente);
|
this.Controls.Add(this.lblCorrente);
|
||||||
this.Controls.Add(this.lblTensao);
|
this.Controls.Add(this.lblTensao);
|
||||||
this.Controls.Add(this.gridsCOR);
|
this.Controls.Add(this.gridsCOR);
|
||||||
|
|
@ -487,7 +500,7 @@
|
||||||
this.Load += new System.EventHandler(this.frmSenConfig_Load);
|
this.Load += new System.EventHandler(this.frmSenConfig_Load);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.gridsTEN)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.gridsTEN)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.gridsCOR)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.gridsCOR)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.gridsTMP)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.gridsNTC)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.gridsULT)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.gridsULT)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.gridsFLX)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.gridsFLX)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.gridsMAS)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.gridsMAS)).EndInit();
|
||||||
|
|
@ -497,7 +510,7 @@
|
||||||
this.gpbBateria.PerformLayout();
|
this.gpbBateria.PerformLayout();
|
||||||
this.gpbCameras.ResumeLayout(false);
|
this.gpbCameras.ResumeLayout(false);
|
||||||
this.gpbCameras.PerformLayout();
|
this.gpbCameras.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.gridsPOT)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.gridsMAG)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
|
|
@ -510,7 +523,7 @@
|
||||||
private System.Windows.Forms.Label lblTensao;
|
private System.Windows.Forms.Label lblTensao;
|
||||||
private System.Windows.Forms.Label lblCorrente;
|
private System.Windows.Forms.Label lblCorrente;
|
||||||
private System.Windows.Forms.Label lblTemperatura;
|
private System.Windows.Forms.Label lblTemperatura;
|
||||||
private System.Windows.Forms.DataGridView gridsTMP;
|
private System.Windows.Forms.DataGridView gridsNTC;
|
||||||
private System.Windows.Forms.Label lblPressao;
|
private System.Windows.Forms.Label lblPressao;
|
||||||
private System.Windows.Forms.DataGridView gridsULT;
|
private System.Windows.Forms.DataGridView gridsULT;
|
||||||
private System.Windows.Forms.Label lblFluxo;
|
private System.Windows.Forms.Label lblFluxo;
|
||||||
|
|
@ -537,9 +550,10 @@
|
||||||
private System.Windows.Forms.CheckBox chbRequisitarDados;
|
private System.Windows.Forms.CheckBox chbRequisitarDados;
|
||||||
private System.Windows.Forms.Label lblAddrTx;
|
private System.Windows.Forms.Label lblAddrTx;
|
||||||
private System.Windows.Forms.TextBox txtEnderecoCAN_Tx;
|
private System.Windows.Forms.TextBox txtEnderecoCAN_Tx;
|
||||||
private System.Windows.Forms.Label lblPotenciometro;
|
private System.Windows.Forms.Label lblMagnetico;
|
||||||
private System.Windows.Forms.DataGridView gridsPOT;
|
private System.Windows.Forms.DataGridView gridsMAG;
|
||||||
private System.Windows.Forms.Label lblAddrRx;
|
private System.Windows.Forms.Label lblAddrRx;
|
||||||
private System.Windows.Forms.TextBox txtEnderecoCAN_Rx;
|
private System.Windows.Forms.TextBox txtEnderecoCAN_Rx;
|
||||||
|
private System.Windows.Forms.Button btnReiniciar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5,7 +5,6 @@ using AgroBase.Services;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using static AgroBase.Models.Enums;
|
using static AgroBase.Models.Enums;
|
||||||
|
|
||||||
|
|
@ -116,7 +115,7 @@ namespace AgroBase.Forms.Sensoriamento
|
||||||
{
|
{
|
||||||
foreach (var Sensor in Sensores)
|
foreach (var Sensor in Sensores)
|
||||||
{
|
{
|
||||||
string gridName = "grid" + Enum.GetName(typeof(S_Code), Sensor.Componente);
|
string gridName = $"grid{Sensor.Componente}";
|
||||||
DataGridView grid = this.Controls.OfType<DataGridView>().ToList().FirstOrDefault(x => x.Name == gridName);
|
DataGridView grid = this.Controls.OfType<DataGridView>().ToList().FirstOrDefault(x => x.Name == gridName);
|
||||||
if (grid != null && grid.Columns.Count == 0)
|
if (grid != null && grid.Columns.Count == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -137,7 +136,7 @@ namespace AgroBase.Forms.Sensoriamento
|
||||||
{
|
{
|
||||||
foreach (var Sensor in Sensores)
|
foreach (var Sensor in Sensores)
|
||||||
{
|
{
|
||||||
string gridName = "grid" + Enum.GetName(typeof(S_Code), Sensor.Componente);
|
string gridName = $"grid{Sensor.Componente}";
|
||||||
DataGridView grid = this.Controls.OfType<DataGridView>().ToList().FirstOrDefault(x => x.Name == gridName);
|
DataGridView grid = this.Controls.OfType<DataGridView>().ToList().FirstOrDefault(x => x.Name == gridName);
|
||||||
if (grid != null && grid.Columns.Count > 0)
|
if (grid != null && grid.Columns.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -168,7 +167,7 @@ namespace AgroBase.Forms.Sensoriamento
|
||||||
|
|
||||||
foreach (var Sensor in Sensores)
|
foreach (var Sensor in Sensores)
|
||||||
{
|
{
|
||||||
string gridName = "grid" + Enum.GetName(typeof(S_Code), Sensor.Componente);
|
string gridName = $"grid{Sensor.Componente}";
|
||||||
DataGridView grid = this.Controls.OfType<DataGridView>().ToList().FirstOrDefault(x => x.Name == gridName);
|
DataGridView grid = this.Controls.OfType<DataGridView>().ToList().FirstOrDefault(x => x.Name == gridName);
|
||||||
if (grid != null && grid.Rows.Count > 1)
|
if (grid != null && grid.Rows.Count > 1)
|
||||||
{
|
{
|
||||||
|
|
@ -274,5 +273,16 @@ namespace AgroBase.Forms.Sensoriamento
|
||||||
ModbusService.AdicionarComandoNaFila(Comando);*/
|
ModbusService.AdicionarComandoNaFila(Comando);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btnReiniciar_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show($"Tem certeza que deseja reiniciar o módulo {Dispositivo}?", "Confirmação", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
if (Dispositivo == T_Code.Atu)
|
||||||
|
GeneralJoystick.EnviarComandoAtuador(S_Code.sMOD, "", true);
|
||||||
|
if (Dispositivo == T_Code.Sen)
|
||||||
|
GeneralJoystick.EnviarComandoSensoriamento(S_Code.sMOD, "", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ namespace AgroBase.Forms
|
||||||
|
|
||||||
LivoxManagerProcess.Dispose();
|
LivoxManagerProcess.Dispose();
|
||||||
|
|
||||||
AsyncTaskTimerModel.PararTimers();
|
PythonService.EncerrarProcessos();
|
||||||
|
|
||||||
foreach (var Disp in Variaveis.DispositivosConectados)
|
foreach (var Disp in Variaveis.DispositivosConectados)
|
||||||
{
|
{
|
||||||
|
|
@ -112,12 +112,13 @@ namespace AgroBase.Forms
|
||||||
Disp.SalvarParametros(Disp.Dados);
|
Disp.SalvarParametros(Disp.Dados);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!FilaService.Liberado)
|
var timeout = DateTime.Now.AddSeconds(10);
|
||||||
|
while (!CanManager.CanService.FilaLiberada && DateTime.Now < timeout)
|
||||||
{
|
{
|
||||||
await Task.Delay(500);
|
await Task.Delay(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
PythonService.EncerrarProcessos();
|
AsyncTaskTimerModel.PararTimers();
|
||||||
|
|
||||||
try { Environment.Exit(0); } catch { }
|
try { Environment.Exit(0); } catch { }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -754,6 +754,12 @@ namespace AgroBase
|
||||||
|
|
||||||
switch (Componente)
|
switch (Componente)
|
||||||
{
|
{
|
||||||
|
case S_Code.sMOD:
|
||||||
|
if (DispAtu?.Dados != null && Status == true)
|
||||||
|
{
|
||||||
|
(id_num, posicao, data) = DispAtu.Dados.ProtocoloComandoReset();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case S_Code.sBMB:
|
case S_Code.sBMB:
|
||||||
var Bomba = DispAtu?.Dados?.BombasPressurizadoras?.FirstOrDefault(x => x.ID == ID);
|
var Bomba = DispAtu?.Dados?.BombasPressurizadoras?.FirstOrDefault(x => x.ID == ID);
|
||||||
if (Bomba != null)
|
if (Bomba != null)
|
||||||
|
|
@ -807,6 +813,12 @@ namespace AgroBase
|
||||||
|
|
||||||
switch (Componente)
|
switch (Componente)
|
||||||
{
|
{
|
||||||
|
case S_Code.sMOD:
|
||||||
|
if (DispSen?.Dados != null && Status == true)
|
||||||
|
{
|
||||||
|
(id_num, posicao, data) = DispSen.Dados.ProtocoloComandoReset();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case S_Code.sLED:
|
case S_Code.sLED:
|
||||||
var Sinaleiro = DispSen?.Dados?.Sinaleiros?.FirstOrDefault(x => x.ID == ID && x.Inicializado);
|
var Sinaleiro = DispSen?.Dados?.Sinaleiros?.FirstOrDefault(x => x.ID == ID && x.Inicializado);
|
||||||
if (Sinaleiro != null)
|
if (Sinaleiro != null)
|
||||||
|
|
|
||||||
|
|
@ -869,6 +869,18 @@ namespace AgroBase.Models.Modules
|
||||||
Variaveis.OperacaoEmAndamento.DispAtu?.AdicionarMensagemFila(ID_Num, posicaoTx, posicaoRx, null, aguardaResposta);
|
Variaveis.OperacaoEmAndamento.DispAtu?.AdicionarMensagemFila(ID_Num, posicaoTx, posicaoRx, null, aguardaResposta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public (int, CanMessagePosicaoDados, byte[]) ProtocoloComandoReset()
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
Variaveis.ID_Num_sMOD,
|
||||||
|
CanMessagePosicaoDados.Command1,
|
||||||
|
new byte[]
|
||||||
|
{
|
||||||
|
(byte)Estado.Reset
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public List<(int, CanMessagePosicaoDados, byte[])> ProtocoloConfiguracao(bool Conectar)
|
public List<(int, CanMessagePosicaoDados, byte[])> ProtocoloConfiguracao(bool Conectar)
|
||||||
{
|
{
|
||||||
// Inicializar o dicionário
|
// Inicializar o dicionário
|
||||||
|
|
@ -1020,10 +1032,7 @@ namespace AgroBase.Models.Modules
|
||||||
|
|
||||||
public async Task tmrRegistrador_Tick()
|
public async Task tmrRegistrador_Tick()
|
||||||
{
|
{
|
||||||
if (Variaveis.Fechando)
|
if (Variaveis.Fechando) return;
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
tmrRegistrador.SetInterval(_TaxaAmostragem);
|
tmrRegistrador.SetInterval(_TaxaAmostragem);
|
||||||
|
|
||||||
|
|
@ -1053,6 +1062,8 @@ namespace AgroBase.Models.Modules
|
||||||
|
|
||||||
private void VerificaControleLeitura()
|
private void VerificaControleLeitura()
|
||||||
{
|
{
|
||||||
|
if (Variaveis.Fechando) return;
|
||||||
|
|
||||||
foreach (var bico in BicosPulverizadores.Where(x => x.Comandar && x.Inicializado))
|
foreach (var bico in BicosPulverizadores.Where(x => x.Comandar && x.Inicializado))
|
||||||
{
|
{
|
||||||
Estado comandoEstado = bico.ComandoAtuar ? Estado.Ligado : Estado.Desligado;
|
Estado comandoEstado = bico.ComandoAtuar ? Estado.Ligado : Estado.Desligado;
|
||||||
|
|
|
||||||
|
|
@ -237,10 +237,7 @@ namespace AgroBase.Models.Modules
|
||||||
|
|
||||||
private async Task tmrRegistradorMOV_Tick()
|
private async Task tmrRegistradorMOV_Tick()
|
||||||
{
|
{
|
||||||
if (Variaveis.Fechando)
|
if (Variaveis.Fechando) return;
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!OIDCanService.Iniciado && SerialService.DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Mov))
|
if (!OIDCanService.Iniciado && SerialService.DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Mov))
|
||||||
{
|
{
|
||||||
|
|
@ -287,10 +284,7 @@ namespace AgroBase.Models.Modules
|
||||||
|
|
||||||
private async Task tmrRegistradorDIR_Tick()
|
private async Task tmrRegistradorDIR_Tick()
|
||||||
{
|
{
|
||||||
if (Variaveis.Fechando)
|
if (Variaveis.Fechando) return;
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!MKS057DCanService.Iniciado && SerialService.DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Dir))
|
if (!MKS057DCanService.Iniciado && SerialService.DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Dir))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -422,8 +422,8 @@ namespace AgroBase.Models.Modules
|
||||||
AQI,
|
AQI,
|
||||||
Iniciado,
|
Iniciado,
|
||||||
Energia,
|
Energia,
|
||||||
StatusLEDLeitura,
|
StatusLedLeitura,
|
||||||
StatusLEDComando,
|
StatusLedID,
|
||||||
ServoAnguloLeitura,
|
ServoAnguloLeitura,
|
||||||
ServoAnguloComando,
|
ServoAnguloComando,
|
||||||
EstadoLeitura,
|
EstadoLeitura,
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ using static AgroBase.Services.LoRaEspService;
|
||||||
using AgroBase.Services.Operadores;
|
using AgroBase.Services.Operadores;
|
||||||
using AgroBase.Models.Operadores;
|
using AgroBase.Models.Operadores;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using StackExchange.Redis;
|
||||||
|
|
||||||
namespace AgroBase.Models.Modules
|
namespace AgroBase.Models.Modules
|
||||||
{
|
{
|
||||||
|
|
@ -97,11 +98,13 @@ namespace AgroBase.Models.Modules
|
||||||
ID_Num = 21,
|
ID_Num = 21,
|
||||||
Descricao = "Sinaleiro indicação de modo Manual ativo",
|
Descricao = "Sinaleiro indicação de modo Manual ativo",
|
||||||
Componente = S_Code.sLED,
|
Componente = S_Code.sLED,
|
||||||
|
Controlar = true,
|
||||||
|
Mandatorio = true,
|
||||||
Funcoes = new List<FuncoesPinout>()
|
Funcoes = new List<FuncoesPinout>()
|
||||||
{
|
{
|
||||||
FuncoesPinout.Sinaleiro,
|
FuncoesPinout.Sinaleiro,
|
||||||
},
|
},
|
||||||
Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(StatusOperacao.NaoIniciado),
|
Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(StatusLED.Apagado),
|
||||||
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
||||||
{
|
{
|
||||||
new SensorValoresLeituraModel()
|
new SensorValoresLeituraModel()
|
||||||
|
|
@ -112,14 +115,14 @@ namespace AgroBase.Models.Modules
|
||||||
},
|
},
|
||||||
new SensorValoresLeituraModel()
|
new SensorValoresLeituraModel()
|
||||||
{
|
{
|
||||||
funcao = FuncoesPinout.StatusLEDLeitura,
|
funcao = FuncoesPinout.StatusLedID,
|
||||||
posicao = CanMessagePosicaoDados.Dados1,
|
posicao = CanMessagePosicaoDados.Dados1,
|
||||||
indice = 0,
|
indice = 0,
|
||||||
},
|
},
|
||||||
new SensorValoresLeituraModel()
|
new SensorValoresLeituraModel()
|
||||||
{
|
{
|
||||||
funcao = FuncoesPinout.StatusLEDComando,
|
funcao = FuncoesPinout.StatusLedLeitura,
|
||||||
posicao = CanMessagePosicaoDados.Dados1,
|
posicao = CanMessagePosicaoDados.Dados1,
|
||||||
indice = 1,
|
indice = 1,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -130,11 +133,13 @@ namespace AgroBase.Models.Modules
|
||||||
ID_Num = 22,
|
ID_Num = 22,
|
||||||
Descricao = "Sinaleiro indicação de modo Automático ativo",
|
Descricao = "Sinaleiro indicação de modo Automático ativo",
|
||||||
Componente = S_Code.sLED,
|
Componente = S_Code.sLED,
|
||||||
|
Controlar = true,
|
||||||
|
Mandatorio = true,
|
||||||
Funcoes = new List<FuncoesPinout>()
|
Funcoes = new List<FuncoesPinout>()
|
||||||
{
|
{
|
||||||
FuncoesPinout.Sinaleiro,
|
FuncoesPinout.Sinaleiro,
|
||||||
},
|
},
|
||||||
Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(StatusOperacao.NaoIniciado),
|
Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(StatusLED.Apagado),
|
||||||
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
||||||
{
|
{
|
||||||
new SensorValoresLeituraModel()
|
new SensorValoresLeituraModel()
|
||||||
|
|
@ -145,13 +150,13 @@ namespace AgroBase.Models.Modules
|
||||||
},
|
},
|
||||||
new SensorValoresLeituraModel()
|
new SensorValoresLeituraModel()
|
||||||
{
|
{
|
||||||
funcao = FuncoesPinout.StatusLEDLeitura,
|
funcao = FuncoesPinout.StatusLedID,
|
||||||
posicao = CanMessagePosicaoDados.Dados1,
|
posicao = CanMessagePosicaoDados.Dados1,
|
||||||
indice = 0,
|
indice = 0,
|
||||||
},
|
},
|
||||||
new SensorValoresLeituraModel()
|
new SensorValoresLeituraModel()
|
||||||
{
|
{
|
||||||
funcao = FuncoesPinout.StatusLEDComando,
|
funcao = FuncoesPinout.StatusLedLeitura,
|
||||||
posicao = CanMessagePosicaoDados.Dados1,
|
posicao = CanMessagePosicaoDados.Dados1,
|
||||||
indice = 1,
|
indice = 1,
|
||||||
},
|
},
|
||||||
|
|
@ -163,11 +168,13 @@ namespace AgroBase.Models.Modules
|
||||||
ID_Num = 23,
|
ID_Num = 23,
|
||||||
Descricao = "Sinaleiro indicação do status da operação ativa",
|
Descricao = "Sinaleiro indicação do status da operação ativa",
|
||||||
Componente = S_Code.sLED,
|
Componente = S_Code.sLED,
|
||||||
|
Controlar = true,
|
||||||
|
Mandatorio = true,
|
||||||
Funcoes = new List<FuncoesPinout>()
|
Funcoes = new List<FuncoesPinout>()
|
||||||
{
|
{
|
||||||
FuncoesPinout.Sinaleiro,
|
FuncoesPinout.Sinaleiro,
|
||||||
},
|
},
|
||||||
Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(StatusOperacao.NaoIniciado),
|
Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(StatusLED.Apagado),
|
||||||
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
||||||
{
|
{
|
||||||
new SensorValoresLeituraModel()
|
new SensorValoresLeituraModel()
|
||||||
|
|
@ -178,13 +185,13 @@ namespace AgroBase.Models.Modules
|
||||||
},
|
},
|
||||||
new SensorValoresLeituraModel()
|
new SensorValoresLeituraModel()
|
||||||
{
|
{
|
||||||
funcao = FuncoesPinout.StatusLEDLeitura,
|
funcao = FuncoesPinout.StatusLedID,
|
||||||
posicao = CanMessagePosicaoDados.Dados1,
|
posicao = CanMessagePosicaoDados.Dados1,
|
||||||
indice = 0,
|
indice = 0,
|
||||||
},
|
},
|
||||||
new SensorValoresLeituraModel()
|
new SensorValoresLeituraModel()
|
||||||
{
|
{
|
||||||
funcao = FuncoesPinout.StatusLEDComando,
|
funcao = FuncoesPinout.StatusLedLeitura,
|
||||||
posicao = CanMessagePosicaoDados.Dados1,
|
posicao = CanMessagePosicaoDados.Dados1,
|
||||||
indice = 1,
|
indice = 1,
|
||||||
},
|
},
|
||||||
|
|
@ -2131,6 +2138,18 @@ namespace AgroBase.Models.Modules
|
||||||
Variaveis.OperacaoEmAndamento.DispSen?.AdicionarMensagemFila(ID_Num, posicaoTx, posicaoRx, null, aguardaResposta);
|
Variaveis.OperacaoEmAndamento.DispSen?.AdicionarMensagemFila(ID_Num, posicaoTx, posicaoRx, null, aguardaResposta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public (int, CanMessagePosicaoDados, byte[]) ProtocoloComandoReset()
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
Variaveis.ID_Num_sMOD,
|
||||||
|
CanMessagePosicaoDados.Command1,
|
||||||
|
new byte[]
|
||||||
|
{
|
||||||
|
(byte)Estado.Reset
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public List<(int, CanMessagePosicaoDados, byte[])> ProtocoloConfiguracao(bool Conectar)
|
public List<(int, CanMessagePosicaoDados, byte[])> ProtocoloConfiguracao(bool Conectar)
|
||||||
{
|
{
|
||||||
// Inicializar o dicionário
|
// Inicializar o dicionário
|
||||||
|
|
@ -2214,8 +2233,12 @@ namespace AgroBase.Models.Modules
|
||||||
{
|
{
|
||||||
var config = new List<(int, CanMessagePosicaoDados, byte[])>();
|
var config = new List<(int, CanMessagePosicaoDados, byte[])>();
|
||||||
|
|
||||||
foreach (var sinaleiro in Sinaleiros.Where(x => (ConfigurarTodos ? true : x.Inicializado != Conectar)))
|
foreach (var sinaleiro in Sinaleiros.Where(x => (x.Controlar && (ConfigurarTodos ? true : x.Inicializado != Conectar)) || (!x.Controlar && x.Inicializado)))
|
||||||
{
|
{
|
||||||
|
if (!sinaleiro.Controlar && sinaleiro.Inicializado)
|
||||||
|
{
|
||||||
|
Conectar = false;
|
||||||
|
}
|
||||||
(CanMessagePosicaoDados posicao, var payload) = sinaleiro.ProtocoloConfiguracao(Pinout, Conectar);
|
(CanMessagePosicaoDados posicao, var payload) = sinaleiro.ProtocoloConfiguracao(Pinout, Conectar);
|
||||||
if (payload != null)
|
if (payload != null)
|
||||||
{
|
{
|
||||||
|
|
@ -2286,10 +2309,7 @@ namespace AgroBase.Models.Modules
|
||||||
|
|
||||||
public async Task tmrRegistrador_Tick()
|
public async Task tmrRegistrador_Tick()
|
||||||
{
|
{
|
||||||
if (Variaveis.Fechando)
|
if (Variaveis.Fechando) return;
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
tmrRegistrador.SetInterval(_TaxaAmostragem);
|
tmrRegistrador.SetInterval(_TaxaAmostragem);
|
||||||
|
|
||||||
|
|
@ -2319,49 +2339,29 @@ namespace AgroBase.Models.Modules
|
||||||
|
|
||||||
private void VerificaControleLeitura()
|
private void VerificaControleLeitura()
|
||||||
{
|
{
|
||||||
if (true) // !frmDiagnosticos.Diagnosticando
|
if (Variaveis.Fechando) return;
|
||||||
|
|
||||||
|
foreach (var sinaleiro in Sinaleiros.Where(x => x.Controlar && x.Inicializado))
|
||||||
{
|
{
|
||||||
var ledOP = Sinaleiros.FirstOrDefault(x => x.ID == "LEDOP" && x.Inicializado);
|
if (sinaleiro.Comportamento.statusLED != sinaleiro._StatusLed || sinaleiro.Comportamento.id != sinaleiro._StatusLedId)
|
||||||
var ledAT = Sinaleiros.FirstOrDefault(x => x.ID == "LEDAT" && x.Inicializado);
|
|
||||||
var ledMN = Sinaleiros.FirstOrDefault(x => x.ID == "LEDMN" && x.Inicializado);
|
|
||||||
|
|
||||||
var comportamento = VariaveisEquipamento.ComportamentoLedPorStatus();
|
|
||||||
var valOp = (int?)(ledOP?.ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.StatusLEDComando)?.atual?.valor) ?? 0;
|
|
||||||
if (ledOP != null && (!ledOP.Comportamento.Equals(comportamento) || valOp != (int)comportamento.statusLED))
|
|
||||||
{
|
{
|
||||||
GeneralJoystick.EnviarComandoSensoriamento(ledOP.Componente, ledOP.ID, comportamento);
|
GeneralJoystick.EnviarComandoSensoriamento(sinaleiro.Componente, sinaleiro.ID, sinaleiro.Comportamento);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var statusLedAt = Variaveis.OperacaoEmAndamento.Parametros.Controle.MovimentoAutomatico ? StatusLED.Aceso : StatusLED.Apagado;
|
foreach (var rele in Reles.Where(x => x.Controlar && x.Inicializado))
|
||||||
var valAt = (int?)(ledAT?.ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.StatusLEDComando)?.atual?.valor) ?? 0;
|
{
|
||||||
if (ledAT != null && (!ledAT.Comportamento.statusLED.Equals(statusLedAt) || (valAt != (int)statusLedAt)))
|
if (rele.StatusControle != rele._EstadoLeitura)
|
||||||
{
|
{
|
||||||
ledAT.Comportamento.statusLED = statusLedAt;
|
GeneralJoystick.EnviarComandoSensoriamento(rele.Componente, rele.ID, rele.StatusControle);
|
||||||
GeneralJoystick.EnviarComandoSensoriamento(ledAT.Componente, ledAT.ID, ledAT.Comportamento);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var statusLedMn = Variaveis.OperacaoEmAndamento.Modo == ModoOperacao.Manual ? StatusLED.Aceso : StatusLED.Apagado;
|
foreach (var servo in Servos.Where(x => x.Controlar && x.Inicializado))
|
||||||
var valMn = (int?)(ledMN?.ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.StatusLEDComando)?.atual?.valor) ?? 0;
|
{
|
||||||
if (ledMN != null && (!ledMN.Comportamento.statusLED.Equals(statusLedMn) || (valMn != (int)statusLedMn)))
|
if (servo._AnguloControle != servo._AnguloLeiutra)
|
||||||
{
|
{
|
||||||
ledMN.Comportamento.statusLED = statusLedMn;
|
GeneralJoystick.EnviarComandoSensoriamento(servo.Componente, servo.ID, servo._AnguloControle);
|
||||||
GeneralJoystick.EnviarComandoSensoriamento(ledMN.Componente, ledMN.ID, ledMN.Comportamento);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var rele in Reles.Where(x => x.Controlar && x.Inicializado))
|
|
||||||
{
|
|
||||||
if (rele.StatusControle != rele._EstadoLeitura)
|
|
||||||
{
|
|
||||||
GeneralJoystick.EnviarComandoSensoriamento(rele.Componente, rele.ID, rele.StatusControle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var servo in Servos.Where(x => x.Controlar && x.Inicializado))
|
|
||||||
{
|
|
||||||
if (servo._AnguloControle != servo._AnguloLeiutra)
|
|
||||||
{
|
|
||||||
GeneralJoystick.EnviarComandoSensoriamento(servo.Componente, servo.ID, servo._AnguloControle);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2392,6 +2392,13 @@ namespace AgroBase.Models.Modules
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AtualizarStatusSinaleiros(ModoOperacao Modo, StatusOperacao _statusOperacao)
|
||||||
|
{
|
||||||
|
Sinaleiros.First(x => x.ID == "LEDMN").Comportamento.statusLED = Modo == ModoOperacao.Manual ? StatusLED.Aceso : StatusLED.Apagado;
|
||||||
|
Sinaleiros.First(x => x.ID == "LEDAT").Comportamento.statusLED = Modo == ModoOperacao.Manual ? StatusLED.Apagado : StatusLED.Aceso;
|
||||||
|
Sinaleiros.First(x => x.ID == "LEDOP").Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(status_operacao: _statusOperacao);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SensorModel
|
public class SensorModel
|
||||||
|
|
@ -2400,7 +2407,7 @@ namespace AgroBase.Models.Modules
|
||||||
public int ID_Num { get; set; }
|
public int ID_Num { get; set; }
|
||||||
public string Descricao { get; set; }
|
public string Descricao { get; set; }
|
||||||
public S_Code Componente { get; set; }
|
public S_Code Componente { get; set; }
|
||||||
public bool Aferir { get; set; } = false;
|
public bool Aferir { get; set; }
|
||||||
public bool Mandatorio { get; set; }
|
public bool Mandatorio { get; set; }
|
||||||
public bool Liberado
|
public bool Liberado
|
||||||
{
|
{
|
||||||
|
|
@ -2459,6 +2466,8 @@ namespace AgroBase.Models.Modules
|
||||||
public int ID_Num { get; set; }
|
public int ID_Num { get; set; }
|
||||||
public string Descricao { get; set; }
|
public string Descricao { get; set; }
|
||||||
public S_Code Componente { get; set; }
|
public S_Code Componente { get; set; }
|
||||||
|
public bool Controlar { get; set; }
|
||||||
|
public bool Mandatorio { get; set; }
|
||||||
public List<FuncoesPinout> Funcoes { get; set; }
|
public List<FuncoesPinout> Funcoes { get; set; }
|
||||||
public SensorSinaleiroComportamentoModel Comportamento { get; set; }
|
public SensorSinaleiroComportamentoModel Comportamento { get; set; }
|
||||||
public bool Inicializado { get; set; }
|
public bool Inicializado { get; set; }
|
||||||
|
|
@ -2470,6 +2479,8 @@ namespace AgroBase.Models.Modules
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public List<SensorValoresLeituraModel> ValoresLeituras { get; set; }
|
public List<SensorValoresLeituraModel> ValoresLeituras { get; set; }
|
||||||
|
public int _StatusLedId => ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.StatusLedID)?.atual?.valor ?? 99;
|
||||||
|
public StatusLED _StatusLed => ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.StatusLedLeitura)?.atual?.valor ?? StatusLED.Apagado;
|
||||||
|
|
||||||
public (CanMessagePosicaoDados, byte[]) ProtocoloConfiguracao(PinoutDataModel pinout, bool conectar)
|
public (CanMessagePosicaoDados, byte[]) ProtocoloConfiguracao(PinoutDataModel pinout, bool conectar)
|
||||||
{
|
{
|
||||||
|
|
@ -2489,6 +2500,7 @@ namespace AgroBase.Models.Modules
|
||||||
{
|
{
|
||||||
List<byte> frame = new List<byte>
|
List<byte> frame = new List<byte>
|
||||||
{
|
{
|
||||||
|
(byte)Comportamento.id,
|
||||||
(byte)Comportamento.statusLED,
|
(byte)Comportamento.statusLED,
|
||||||
(byte)Comportamento.QtdPiscadas,
|
(byte)Comportamento.QtdPiscadas,
|
||||||
(byte)(Comportamento.TempoMs / 10),
|
(byte)(Comportamento.TempoMs / 10),
|
||||||
|
|
@ -2578,7 +2590,7 @@ namespace AgroBase.Models.Modules
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int _AnguloControle { get; set; }
|
public int _AnguloControle { get; set; }
|
||||||
public int _AnguloLeiutra => ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.ServoAnguloLeitura)?.atual?.valor ?? -1;
|
public int _AnguloLeiutra => (int)(ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.ServoAnguloLeitura)?.atual?.valor ?? -1);
|
||||||
public bool Inicializado { get; set; }
|
public bool Inicializado { get; set; }
|
||||||
public DateTime UltimaLeitura
|
public DateTime UltimaLeitura
|
||||||
{
|
{
|
||||||
|
|
@ -2622,6 +2634,8 @@ namespace AgroBase.Models.Modules
|
||||||
|
|
||||||
public class SensorSinaleiroComportamentoModel
|
public class SensorSinaleiroComportamentoModel
|
||||||
{
|
{
|
||||||
|
public int id { get; set; }
|
||||||
|
public StatusOperacao? statusOperacao { get; set; }
|
||||||
public StatusLED statusLED { get; set; }
|
public StatusLED statusLED { get; set; }
|
||||||
public int QtdPiscadas { get; set; } = 0;
|
public int QtdPiscadas { get; set; } = 0;
|
||||||
public int TempoMs { get; set; } = 0;
|
public int TempoMs { get; set; } = 0;
|
||||||
|
|
@ -2638,7 +2652,9 @@ namespace AgroBase.Models.Modules
|
||||||
return statusLED == other.statusLED &&
|
return statusLED == other.statusLED &&
|
||||||
QtdPiscadas == other.QtdPiscadas &&
|
QtdPiscadas == other.QtdPiscadas &&
|
||||||
TempoMs == other.TempoMs &&
|
TempoMs == other.TempoMs &&
|
||||||
PausaMs == other.PausaMs;
|
PausaMs == other.PausaMs &&
|
||||||
|
statusOperacao == other.statusOperacao &&
|
||||||
|
id == other.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
|
|
@ -3087,9 +3103,9 @@ namespace AgroBase.Models.Modules
|
||||||
}
|
}
|
||||||
case CanMessagePosicaoDados.Dados1:
|
case CanMessagePosicaoDados.Dados1:
|
||||||
{
|
{
|
||||||
StatusLED statusLeitura = (StatusLED)data[2];
|
int statusId = data[2];
|
||||||
StatusLED statusComando = (StatusLED)data[3];
|
StatusLED statusLeitura = (StatusLED)data[3];
|
||||||
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { statusLeitura, statusComando });
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { statusId, statusLeitura });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ namespace AgroBase.Models
|
||||||
{
|
{
|
||||||
foreach (var ind in mod.saude_individual)
|
foreach (var ind in mod.saude_individual)
|
||||||
{
|
{
|
||||||
var ind_ant = saudeAnterior.FirstOrDefault(x => x.saude_individual.Any(y => y.id == ind.id))?.saude_individual?.FirstOrDefault(x => x.id == ind.id);
|
var ind_ant = saudeAnterior.FirstOrDefault(x => x.modulo == mod.modulo && x.saude_individual.Any(y => y.id == ind.id))?.saude_individual?.FirstOrDefault(x => x.id == ind.id);
|
||||||
if (ind.status != ind_ant?.status)
|
if (ind.status != ind_ant?.status)
|
||||||
{
|
{
|
||||||
string msg = ind.motivos.Any() ? string.Join("; ", ind.motivos) : $"{ind.status} ({ind.saude:0}%)";
|
string msg = ind.motivos.Any() ? string.Join("; ", ind.motivos) : $"{ind.status} ({ind.saude:0}%)";
|
||||||
|
|
@ -839,28 +839,6 @@ namespace AgroBase.Models
|
||||||
Variaveis.OperacaoEmAndamento.Parametros.DadosLeitura = new OperacaoParametrosDadosModel();
|
Variaveis.OperacaoEmAndamento.Parametros.DadosLeitura = new OperacaoParametrosDadosModel();
|
||||||
Variaveis.OperacaoEmAndamento.Sensoriamento = new OperacaoSensoriamentoLogModel();
|
Variaveis.OperacaoEmAndamento.Sensoriamento = new OperacaoSensoriamentoLogModel();
|
||||||
|
|
||||||
if (Variaveis.OperacaoEmAndamento.DispSen != null)
|
|
||||||
{
|
|
||||||
if (Variaveis.OperacaoEmAndamento.DispSen.Dados.ConfiguracaoSensorUltrassom == null)
|
|
||||||
{
|
|
||||||
Variaveis.OperacaoEmAndamento.DispSen.Dados.ConfiguracaoSensorUltrassom = UltrasonicA05Helper.CarregarConfiguracaoPadrao(ConfiguracaoSensorUltrassonico.NaoUtilizado);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Variaveis.OperacaoEmAndamento.DispSen.Dados.Conectado)
|
|
||||||
{
|
|
||||||
Variaveis.OperacaoEmAndamento.DispSen.Dados.Sinaleiros.ForEach(x => x.Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(StatusOperacao.NaoIniciado));
|
|
||||||
|
|
||||||
Variaveis.OperacaoEmAndamento.DispSen.Dados.Sinaleiros.First(x => x.ID == (Modo == ModoOperacao.Manual ? "LEDMN" : "LEDAT")).Comportamento.statusLED = StatusLED.Aceso;
|
|
||||||
Variaveis.OperacaoEmAndamento.DispSen.Dados.Sinaleiros.First(x => x.ID == "LEDOP").Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus();
|
|
||||||
|
|
||||||
//OperacaoCarregar.DispSen.Dados.Sinaleiros.ForEach(x => OperacaoCarregar.DispSen.AdicionarMensagemFila(OperacaoCarregar.DispSen.Dados.Modulo_ID, x.ProtocoloComando(), true, false));
|
|
||||||
foreach (var Sinaleiro in Variaveis.OperacaoEmAndamento.DispSen.Dados.Sinaleiros)
|
|
||||||
{
|
|
||||||
GeneralJoystick.EnviarComandoSensoriamento(Sinaleiro.Componente, Sinaleiro.ID, Sinaleiro.Comportamento);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RedisService.AtualizarCampos(CtxKey.DadosOperacao, ("configurado", false));
|
RedisService.AtualizarCampos(CtxKey.DadosOperacao, ("configurado", false));
|
||||||
|
|
||||||
Variaveis.OperacaoEmAndamento.Sensoriamento.AtualizarDados();
|
Variaveis.OperacaoEmAndamento.Sensoriamento.AtualizarDados();
|
||||||
|
|
@ -886,19 +864,21 @@ namespace AgroBase.Models
|
||||||
case T_Code.Atu:
|
case T_Code.Atu:
|
||||||
if (Variaveis.OperacaoEmAndamento.DispAtu != null)
|
if (Variaveis.OperacaoEmAndamento.DispAtu != null)
|
||||||
{
|
{
|
||||||
Variaveis.OperacaoEmAndamento.DispAtu.Dados.Sensores.ForEach(s => d.Add(s.ID, (s.Mandatorio, s.Aferir)));
|
var da = Variaveis.OperacaoEmAndamento.DispAtu.Dados;
|
||||||
Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombasPressurizadoras.ForEach(b => d.Add(b.ID, (b.Mandatorio, b.Comandar)));
|
da.Sensores.ForEach(s => d.Add(s.ID, (s.Mandatorio, s.Aferir)));
|
||||||
Variaveis.OperacaoEmAndamento.DispAtu.Dados.BicosPulverizadores.ForEach(b => d.Add(b.ID, (b.Mandatorio, b.Comandar)));
|
da.BombasPressurizadoras.ForEach(b => d.Add(b.ID, (b.Mandatorio, b.Comandar)));
|
||||||
Variaveis.OperacaoEmAndamento.DispAtu.Dados.Servos.ForEach(s => d.Add(s.ID, (s.Mandatorio, s.Controlar)));
|
da.BicosPulverizadores.ForEach(b => d.Add(b.ID, (b.Mandatorio, b.Comandar)));
|
||||||
|
da.Servos.ForEach(s => d.Add(s.ID, (s.Mandatorio, s.Controlar)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case T_Code.Sen:
|
case T_Code.Sen:
|
||||||
if (Variaveis.OperacaoEmAndamento.DispSen != null)
|
if (Variaveis.OperacaoEmAndamento.DispSen != null)
|
||||||
{
|
{
|
||||||
Variaveis.OperacaoEmAndamento.DispSen.Dados.Sensores.ForEach(s => d.Add(s.ID, (s.Mandatorio, s.Aferir)));
|
var ds = Variaveis.OperacaoEmAndamento.DispSen.Dados;
|
||||||
Variaveis.OperacaoEmAndamento.DispSen.Dados.Sinaleiros.ForEach(s => d.Add(s.ID, (true, true)));
|
ds.Sensores.ForEach(s => d.Add(s.ID, (s.Mandatorio, s.Aferir)));
|
||||||
Variaveis.OperacaoEmAndamento.DispSen.Dados.Servos.ForEach(s => d.Add(s.ID, (s.Mandatorio, s.Controlar)));
|
ds.Sinaleiros.ForEach(s => d.Add(s.ID, (s.Mandatorio, s.Controlar)));
|
||||||
Variaveis.OperacaoEmAndamento.DispSen.Dados.Reles.ForEach(r => d.Add(r.ID, (r.Mandatorio, r.Controlar)));
|
ds.Servos.ForEach(s => d.Add(s.ID, (s.Mandatorio, s.Controlar)));
|
||||||
|
ds.Reles.ForEach(r => d.Add(r.ID, (r.Mandatorio, r.Controlar)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -926,23 +906,24 @@ namespace AgroBase.Models
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case T_Code.Atu:
|
case T_Code.Atu:
|
||||||
|
var da = Variaveis.OperacaoEmAndamento.DispAtu.Dados;
|
||||||
foreach (var c in m.ComponentesEmUso)
|
foreach (var c in m.ComponentesEmUso)
|
||||||
{
|
{
|
||||||
var s = Variaveis.OperacaoEmAndamento.DispAtu.Dados.Sensores.FirstOrDefault(x => x.ID == c.Key);
|
var s = da.Sensores.FirstOrDefault(x => x.ID == c.Key);
|
||||||
if (s != null)
|
if (s != null)
|
||||||
{
|
{
|
||||||
s.Mandatorio = c.Value.Item1;
|
s.Mandatorio = c.Value.Item1;
|
||||||
s.Aferir = c.Value.Item2;
|
s.Aferir = c.Value.Item2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var bc = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BicosPulverizadores.FirstOrDefault(x => x.ID == c.Key);
|
var bc = da.BicosPulverizadores.FirstOrDefault(x => x.ID == c.Key);
|
||||||
if (bc != null)
|
if (bc != null)
|
||||||
{
|
{
|
||||||
bc.Mandatorio = c.Value.Item1;
|
bc.Mandatorio = c.Value.Item1;
|
||||||
bc.Comandar = c.Value.Item2;
|
bc.Comandar = c.Value.Item2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var bo = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombasPressurizadoras.FirstOrDefault(x => x.ID == c.Key);
|
var bo = da.BombasPressurizadoras.FirstOrDefault(x => x.ID == c.Key);
|
||||||
if (bo != null)
|
if (bo != null)
|
||||||
{
|
{
|
||||||
bo.Mandatorio = c.Value.Item1;
|
bo.Mandatorio = c.Value.Item1;
|
||||||
|
|
@ -952,29 +933,37 @@ namespace AgroBase.Models
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case T_Code.Sen:
|
case T_Code.Sen:
|
||||||
|
var ds = Variaveis.OperacaoEmAndamento.DispSen.Dados;
|
||||||
foreach (var c in m.ComponentesEmUso)
|
foreach (var c in m.ComponentesEmUso)
|
||||||
{
|
{
|
||||||
var s = Variaveis.OperacaoEmAndamento.DispSen.Dados.Sensores.FirstOrDefault(x => x.ID == c.Key);
|
var s = ds.Sensores.FirstOrDefault(x => x.ID == c.Key);
|
||||||
if (s != null)
|
if (s != null)
|
||||||
{
|
{
|
||||||
s.Mandatorio = c.Value.Item1;
|
s.Mandatorio = c.Value.Item1;
|
||||||
s.Aferir = c.Value.Item2;
|
s.Aferir = c.Value.Item2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var sv = Variaveis.OperacaoEmAndamento.DispSen.Dados.Servos.FirstOrDefault(x => x.ID == c.Key);
|
var sv = ds.Servos.FirstOrDefault(x => x.ID == c.Key);
|
||||||
if (sv != null)
|
if (sv != null)
|
||||||
{
|
{
|
||||||
sv.Mandatorio = c.Value.Item1;
|
sv.Mandatorio = c.Value.Item1;
|
||||||
sv.Controlar = c.Value.Item2;
|
sv.Controlar = c.Value.Item2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var rl = Variaveis.OperacaoEmAndamento.DispSen.Dados.Reles.FirstOrDefault(x => x.ID == c.Key);
|
var rl = ds.Reles.FirstOrDefault(x => x.ID == c.Key);
|
||||||
if (rl != null)
|
if (rl != null)
|
||||||
{
|
{
|
||||||
rl.Mandatorio = c.Value.Item1;
|
rl.Mandatorio = c.Value.Item1;
|
||||||
rl.Controlar = c.Value.Item2;
|
rl.Controlar = c.Value.Item2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
var ld = ds.Sinaleiros.FirstOrDefault(x => x.ID == c.Key);
|
||||||
|
if (ld != null)
|
||||||
|
{
|
||||||
|
ld.Mandatorio = c.Value.Item1;
|
||||||
|
ld.Controlar = c.Value.Item2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1577,7 +1566,7 @@ namespace AgroBase.Models
|
||||||
|
|
||||||
S_Code get_comp(string id)
|
S_Code get_comp(string id)
|
||||||
{
|
{
|
||||||
if (id == "") return S_Code.sMOD;
|
if (string.IsNullOrEmpty(id)) return S_Code.sMOD;
|
||||||
var d_atu = Variaveis.OperacaoEmAndamento.DispAtu.Dados;
|
var d_atu = Variaveis.OperacaoEmAndamento.DispAtu.Dados;
|
||||||
if (d_atu.BicosPulverizadores.Any(x => x.ID == id)) return S_Code.sBIC;
|
if (d_atu.BicosPulverizadores.Any(x => x.ID == id)) return S_Code.sBIC;
|
||||||
if (d_atu.BombasPressurizadoras.Any(x => x.ID == id)) return S_Code.sBMB;
|
if (d_atu.BombasPressurizadoras.Any(x => x.ID == id)) return S_Code.sBMB;
|
||||||
|
|
@ -1613,6 +1602,7 @@ namespace AgroBase.Models
|
||||||
{
|
{
|
||||||
S_Code get_comp(string id)
|
S_Code get_comp(string id)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrEmpty(id)) return S_Code.sMOD;
|
||||||
var d_sen = Variaveis.OperacaoEmAndamento.DispSen.Dados;
|
var d_sen = Variaveis.OperacaoEmAndamento.DispSen.Dados;
|
||||||
if (d_sen.Reles.Any(x => x.ID == id)) return S_Code.sRLE;
|
if (d_sen.Reles.Any(x => x.ID == id)) return S_Code.sRLE;
|
||||||
if (d_sen.Servos.Any(x => x.ID == id)) return S_Code.sSRV;
|
if (d_sen.Servos.Any(x => x.ID == id)) return S_Code.sSRV;
|
||||||
|
|
@ -2329,6 +2319,7 @@ namespace AgroBase.Models
|
||||||
|
|
||||||
double tmp_max = Math.Max(Variaveis.OperacaoEmAndamento.DadosPerformance?.GPU_temp ?? 0, Variaveis.OperacaoEmAndamento.DadosPerformance?.CPU_temp ?? 0);
|
double tmp_max = Math.Max(Variaveis.OperacaoEmAndamento.DadosPerformance?.GPU_temp ?? 0, Variaveis.OperacaoEmAndamento.DadosPerformance?.CPU_temp ?? 0);
|
||||||
_DispMvd?.Dados?.AtualizarDadosFreio();
|
_DispMvd?.Dados?.AtualizarDadosFreio();
|
||||||
|
_DispSen?.Dados?.AtualizarStatusSinaleiros(Variaveis.OperacaoEmAndamento.Modo, Variaveis.OperacaoEmAndamento.StatusAtual);
|
||||||
_Cooler?.Atualizar(tmp_max, DateTime.Now);
|
_Cooler?.Atualizar(tmp_max, DateTime.Now);
|
||||||
_Bateria?.AtualizarConsumo(_DispMvd?.Dados?.DistanciaPercorridaTotal ?? 0);
|
_Bateria?.AtualizarConsumo(_DispMvd?.Dados?.DistanciaPercorridaTotal ?? 0);
|
||||||
_Reservatorio?.AtualizarConsumo(_DispMvd?.Dados?.DistanciaPercorridaTotal ?? 0, Variaveis.OperacaoEmAndamento.TempoDecorridoSegs);
|
_Reservatorio?.AtualizarConsumo(_DispMvd?.Dados?.DistanciaPercorridaTotal ?? 0, Variaveis.OperacaoEmAndamento.TempoDecorridoSegs);
|
||||||
|
|
|
||||||
|
|
@ -232,6 +232,8 @@ namespace AgroBase.Models.Operacoes
|
||||||
ID_Num = x.ID_Num,
|
ID_Num = x.ID_Num,
|
||||||
Inicializado = x.Inicializado,
|
Inicializado = x.Inicializado,
|
||||||
Comportamento = x.Comportamento,
|
Comportamento = x.Comportamento,
|
||||||
|
StatusLedId = x._StatusLedId,
|
||||||
|
StatusLed = x._StatusLed,
|
||||||
UltimoComandoRespondido = x.UltimaLeitura
|
UltimoComandoRespondido = x.UltimaLeitura
|
||||||
}).ToList(),
|
}).ToList(),
|
||||||
UltimoComandoRespondido = dSen.DadosLeitura.UltimoComandoRespondido
|
UltimoComandoRespondido = dSen.DadosLeitura.UltimoComandoRespondido
|
||||||
|
|
@ -469,6 +471,8 @@ namespace AgroBase.Models.Operacoes
|
||||||
public int ID_Num { get; set; }
|
public int ID_Num { get; set; }
|
||||||
public bool Inicializado { get; set; }
|
public bool Inicializado { get; set; }
|
||||||
public SensorSinaleiroComportamentoModel Comportamento { get; set; }
|
public SensorSinaleiroComportamentoModel Comportamento { get; set; }
|
||||||
|
public int StatusLedId { get; set; }
|
||||||
|
public StatusLED StatusLed { get; set; }
|
||||||
public DateTime UltimoComandoRespondido { get; set; }
|
public DateTime UltimoComandoRespondido { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -310,88 +310,65 @@ namespace AgroBase.Models
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static SensorSinaleiroComportamentoModel ComportamentoLedPorStatus(StatusOperacao? _status = null)
|
public static SensorSinaleiroComportamentoModel ComportamentoLedPorStatus(StatusLED status_led = StatusLED.Apagado, StatusOperacao? status_operacao = null)
|
||||||
{
|
{
|
||||||
if (_status == null)
|
|
||||||
{
|
|
||||||
_status = Variaveis.OperacaoEmAndamento.StatusAtual;
|
|
||||||
}
|
|
||||||
|
|
||||||
SensorSinaleiroComportamentoModel comportamento = new SensorSinaleiroComportamentoModel()
|
SensorSinaleiroComportamentoModel comportamento = new SensorSinaleiroComportamentoModel()
|
||||||
{
|
{
|
||||||
statusLED = StatusLED.Apagado,
|
id = 99,
|
||||||
|
statusOperacao = status_operacao,
|
||||||
|
statusLED = status_led,
|
||||||
QtdPiscadas = 0,
|
QtdPiscadas = 0,
|
||||||
TempoMs = 0,
|
TempoMs = 0,
|
||||||
PausaMs = 0,
|
PausaMs = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (_status)
|
if (status_operacao == null) return comportamento;
|
||||||
|
|
||||||
|
comportamento.id = (int)((StatusOperacao)status_operacao);
|
||||||
|
|
||||||
|
switch ((StatusOperacao)status_operacao)
|
||||||
{
|
{
|
||||||
case StatusOperacao.Parametrizando:
|
case StatusOperacao.Parametrizando:
|
||||||
{
|
{
|
||||||
comportamento = new SensorSinaleiroComportamentoModel()
|
comportamento.QtdPiscadas = 2;
|
||||||
{
|
comportamento.TempoMs = 800;
|
||||||
statusLED = StatusLED.Piscando,
|
comportamento.PausaMs = 2000;
|
||||||
QtdPiscadas = 2,
|
|
||||||
TempoMs = 800,
|
|
||||||
PausaMs = 2000,
|
|
||||||
};
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case StatusOperacao.NaoIniciado:
|
case StatusOperacao.NaoIniciado:
|
||||||
case StatusOperacao.Concluido:
|
case StatusOperacao.Concluido:
|
||||||
{
|
{
|
||||||
comportamento = new SensorSinaleiroComportamentoModel()
|
comportamento.QtdPiscadas = 1;
|
||||||
{
|
comportamento.TempoMs = 1000;
|
||||||
statusLED = StatusLED.Piscando,
|
comportamento.PausaMs = 2000;
|
||||||
QtdPiscadas = 1,
|
|
||||||
TempoMs = 1000,
|
|
||||||
PausaMs = 2000,
|
|
||||||
};
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case StatusOperacao.Aguardando:
|
case StatusOperacao.Aguardando:
|
||||||
{
|
{
|
||||||
comportamento = new SensorSinaleiroComportamentoModel()
|
comportamento.QtdPiscadas = 3;
|
||||||
{
|
comportamento.TempoMs = 500;
|
||||||
statusLED = StatusLED.Piscando,
|
comportamento.PausaMs = 800;
|
||||||
QtdPiscadas = 3,
|
|
||||||
TempoMs = 500,
|
|
||||||
PausaMs = 800,
|
|
||||||
};
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case StatusOperacao.Parado:
|
case StatusOperacao.Parado:
|
||||||
{
|
{
|
||||||
comportamento = new SensorSinaleiroComportamentoModel()
|
comportamento.QtdPiscadas = 5;
|
||||||
{
|
comportamento.TempoMs = 500;
|
||||||
statusLED = StatusLED.Piscando,
|
comportamento.PausaMs = 2000;
|
||||||
QtdPiscadas = 5,
|
|
||||||
TempoMs = 500,
|
|
||||||
PausaMs = 2000,
|
|
||||||
};
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case StatusOperacao.EmAndamento:
|
case StatusOperacao.EmAndamento:
|
||||||
{
|
{
|
||||||
comportamento = new SensorSinaleiroComportamentoModel()
|
comportamento.QtdPiscadas = 1;
|
||||||
{
|
comportamento.TempoMs = 500;
|
||||||
statusLED = StatusLED.Piscando,
|
comportamento.PausaMs = 1000;
|
||||||
QtdPiscadas = 1,
|
|
||||||
TempoMs = 500,
|
|
||||||
PausaMs = 1000,
|
|
||||||
};
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case StatusOperacao.Calibrando:
|
case StatusOperacao.Calibrando:
|
||||||
{
|
{
|
||||||
comportamento = new SensorSinaleiroComportamentoModel()
|
comportamento.QtdPiscadas = 2;
|
||||||
{
|
comportamento.TempoMs = 500;
|
||||||
statusLED = StatusLED.Piscando,
|
comportamento.PausaMs = 800;
|
||||||
QtdPiscadas = 2,
|
|
||||||
TempoMs = 500,
|
|
||||||
PausaMs = 800,
|
|
||||||
};
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,7 @@ namespace AgroBase.Services
|
||||||
double FreqRx { get; set; }
|
double FreqRx { get; set; }
|
||||||
int ErrosCriticos { get; set; }
|
int ErrosCriticos { get; set; }
|
||||||
double UltimoErroCritico { get; set; }
|
double UltimoErroCritico { get; set; }
|
||||||
|
bool FilaLiberada { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -35,6 +35,21 @@ namespace AgroBase.Services
|
||||||
private List<CanMessage> Mensagens = new List<CanMessage>();
|
private List<CanMessage> Mensagens = new List<CanMessage>();
|
||||||
private readonly object _LockMensagens = new object();
|
private readonly object _LockMensagens = new object();
|
||||||
|
|
||||||
|
public bool FilaLiberada
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
lock (_LockMensagens)
|
||||||
|
{
|
||||||
|
bool liberado =
|
||||||
|
Mensagens == null ||
|
||||||
|
Mensagens.Count == 0 ||
|
||||||
|
!Mensagens.Any(x => !x.Enviado && x.Momento >= DateTime.Now.AddSeconds(-10));
|
||||||
|
return liberado;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public double UltimoTx { get; set; } = 0;
|
public double UltimoTx { get; set; } = 0;
|
||||||
private DateTime _ultimoTx = DateTime.MinValue;
|
private DateTime _ultimoTx = DateTime.MinValue;
|
||||||
public double FreqTx { get; set; } = 0;
|
public double FreqTx { get; set; } = 0;
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,21 @@ namespace AgroBase.Services
|
||||||
private List<CanMessage> MensagensPendentes = new List<CanMessage>();
|
private List<CanMessage> MensagensPendentes = new List<CanMessage>();
|
||||||
private readonly object _LockMensagens = new object();
|
private readonly object _LockMensagens = new object();
|
||||||
private bool DebugMode = false;
|
private bool DebugMode = false;
|
||||||
|
|
||||||
|
public bool FilaLiberada
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
lock (_LockMensagens)
|
||||||
|
{
|
||||||
|
bool liberado =
|
||||||
|
MensagensPendentes == null ||
|
||||||
|
MensagensPendentes.Count == 0 ||
|
||||||
|
!MensagensPendentes.Any(x => !x.Enviado && x.Momento >= DateTime.Now.AddSeconds(-10));
|
||||||
|
return liberado;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
public double UltimoTx { get; set; } = 0;
|
public double UltimoTx { get; set; } = 0;
|
||||||
private DateTime _ultimoTx = DateTime.MinValue;
|
private DateTime _ultimoTx = DateTime.MinValue;
|
||||||
public double FreqTx { get; set; } = 0;
|
public double FreqTx { get; set; } = 0;
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,12 @@ namespace AgroBase.Comum
|
||||||
if (Dados is SensoriamentoModel senModel && Dispositivo == T_Code.Sen)
|
if (Dados is SensoriamentoModel senModel && Dispositivo == T_Code.Sen)
|
||||||
{
|
{
|
||||||
clbDispositivos.Items.Clear();
|
clbDispositivos.Items.Clear();
|
||||||
|
var Sinaleiros = senModel.Sinaleiros;
|
||||||
|
foreach (var Sinaleiro in Sinaleiros)
|
||||||
|
{
|
||||||
|
clbDispositivos.Items.Add(Sinaleiro.ID);
|
||||||
|
clbDispositivos.SetItemChecked(clbDispositivos.Items.Count - 1, Sinaleiro.Controlar);
|
||||||
|
}
|
||||||
var Sensores = senModel.Sensores;
|
var Sensores = senModel.Sensores;
|
||||||
foreach (var Sensor in Sensores)
|
foreach (var Sensor in Sensores)
|
||||||
{
|
{
|
||||||
|
|
@ -327,6 +333,10 @@ namespace AgroBase.Comum
|
||||||
{
|
{
|
||||||
senModel.Servos.First(x => x.ID == Item.ToString()).Controlar = true;
|
senModel.Servos.First(x => x.ID == Item.ToString()).Controlar = true;
|
||||||
}
|
}
|
||||||
|
else if (senModel.Sinaleiros.Any(x => x.ID == Item.ToString()))
|
||||||
|
{
|
||||||
|
senModel.Sinaleiros.First(x => x.ID == Item.ToString()).Controlar = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -309,6 +309,8 @@ namespace AgroBase.Services.Operadores
|
||||||
//RedisService.SetObject(RedisService.ModKey(Enums.T_Code.Mov), string.Empty);
|
//RedisService.SetObject(RedisService.ModKey(Enums.T_Code.Mov), string.Empty);
|
||||||
//RedisService.SetObject(RedisService.ModKey(Enums.T_Code.Sen), string.Empty);
|
//RedisService.SetObject(RedisService.ModKey(Enums.T_Code.Sen), string.Empty);
|
||||||
|
|
||||||
|
var dirAtivos = new List<int>();
|
||||||
|
var movAtivos = new List<int>();
|
||||||
foreach (var mod in Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos)
|
foreach (var mod in Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos)
|
||||||
{
|
{
|
||||||
int endereco_dir = mod.DirMotor._EnderecoCAN_Tx;
|
int endereco_dir = mod.DirMotor._EnderecoCAN_Tx;
|
||||||
|
|
@ -327,8 +329,8 @@ namespace AgroBase.Services.Operadores
|
||||||
($"{endereco_dir}.sentido", mod.DirMotor.Sentido),
|
($"{endereco_dir}.sentido", mod.DirMotor.Sentido),
|
||||||
($"{endereco_dir}.sentido_sp", mod.DirMotor.Sentido_SP),
|
($"{endereco_dir}.sentido_sp", mod.DirMotor.Sentido_SP),
|
||||||
($"{endereco_dir}.sentido_real", mod.DirMotor.SentidoReal),
|
($"{endereco_dir}.sentido_real", mod.DirMotor.SentidoReal),
|
||||||
($"{endereco_dir}.freq.io", mod.DirMotor.Leitura?.NumeroPulsos?.frequencia ?? 0),
|
($"{endereco_dir}.freq.pulsos", mod.DirMotor.Leitura?.NumeroPulsos?.frequencia ?? 0),
|
||||||
($"{endereco_dir}.freq.pulsos", mod.DirMotor.Leitura?.EntradaIN1?.frequencia ?? 0)
|
($"{endereco_dir}.freq.io", mod.DirMotor.Leitura?.EntradaIN1?.frequencia ?? 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
int endereco_mov = mod.MovMotor._EnderecoCAN_Tx;
|
int endereco_mov = mod.MovMotor._EnderecoCAN_Tx;
|
||||||
|
|
@ -355,7 +357,12 @@ namespace AgroBase.Services.Operadores
|
||||||
($"{endereco_mov}.freq.corrente_barramento", mod.MovMotor.Leitura?.CorrenteBarramento?.frequencia ?? 0),
|
($"{endereco_mov}.freq.corrente_barramento", mod.MovMotor.Leitura?.CorrenteBarramento?.frequencia ?? 0),
|
||||||
($"{endereco_mov}.freq.temperatura", mod.MovMotor.Leitura?.Temperatura?.frequencia ?? 0)
|
($"{endereco_mov}.freq.temperatura", mod.MovMotor.Leitura?.Temperatura?.frequencia ?? 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
dirAtivos.Add(endereco_dir);
|
||||||
|
movAtivos.Add(endereco_mov);
|
||||||
}
|
}
|
||||||
|
RedisService.AtualizarCampos(RedisService.ModKey(Enums.T_Code.Dir), ($"ativos", dirAtivos.ToList()));
|
||||||
|
RedisService.AtualizarCampos(RedisService.ModKey(Enums.T_Code.Mov), ($"ativos", movAtivos.ToList()));
|
||||||
|
|
||||||
var DadosSen = Variaveis.OperacaoEmAndamento.DispSen.Dados;
|
var DadosSen = Variaveis.OperacaoEmAndamento.DispSen.Dados;
|
||||||
//Console.WriteLine("[HEALTH SEN] " + DadosSen.Conectado);
|
//Console.WriteLine("[HEALTH SEN] " + DadosSen.Conectado);
|
||||||
|
|
@ -365,6 +372,7 @@ namespace AgroBase.Services.Operadores
|
||||||
("freq_base", DadosSen.FrequenciaBase)
|
("freq_base", DadosSen.FrequenciaBase)
|
||||||
);
|
);
|
||||||
var senSensoresAtualizados = new List<(string caminho, object valor)>();
|
var senSensoresAtualizados = new List<(string caminho, object valor)>();
|
||||||
|
var senSensoresAtivos = new List<string>();
|
||||||
foreach (var sensor in DadosSen.Sensores)
|
foreach (var sensor in DadosSen.Sensores)
|
||||||
{
|
{
|
||||||
int tipo = (int)sensor.Componente;
|
int tipo = (int)sensor.Componente;
|
||||||
|
|
@ -399,15 +407,19 @@ namespace AgroBase.Services.Operadores
|
||||||
saude = saude ?? new { }
|
saude = saude ?? new { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
senSensoresAtivos.Add($"{tipo}.{id}");
|
||||||
senSensoresAtualizados.Add(($"{basePath}", sensorObj));
|
senSensoresAtualizados.Add(($"{basePath}", sensorObj));
|
||||||
}
|
}
|
||||||
|
senSensoresAtualizados.Add(("sensores.ativos", senSensoresAtivos));
|
||||||
RedisService.AtualizarCampos(RedisService.ModKey(Enums.T_Code.Sen), senSensoresAtualizados.ToArray());
|
RedisService.AtualizarCampos(RedisService.ModKey(Enums.T_Code.Sen), senSensoresAtualizados.ToArray());
|
||||||
|
|
||||||
var senServosAtualizados = new List<(string caminho, object valor)>();
|
var senServosAtualizados = new List<(string caminho, object valor)>();
|
||||||
|
var senServosAtivos = new List<string>();
|
||||||
foreach (var servo in DadosSen.Servos)
|
foreach (var servo in DadosSen.Servos)
|
||||||
{
|
{
|
||||||
|
int tipo = (int)servo.Componente;
|
||||||
int id = servo.ID_Num;
|
int id = servo.ID_Num;
|
||||||
string basePath = $"servos.{id}";
|
string basePath = $"servos.{tipo}.{id}";
|
||||||
|
|
||||||
var saude = RedisService.GetField<object>(RedisService.ModKey(Enums.T_Code.Sen), $"{basePath}.saude");
|
var saude = RedisService.GetField<object>(RedisService.ModKey(Enums.T_Code.Sen), $"{basePath}.saude");
|
||||||
|
|
||||||
|
|
@ -426,6 +438,7 @@ namespace AgroBase.Services.Operadores
|
||||||
conectado = servo.Inicializado,
|
conectado = servo.Inicializado,
|
||||||
id,
|
id,
|
||||||
label = servo.ID,
|
label = servo.ID,
|
||||||
|
tipo,
|
||||||
controlar = servo.Controlar,
|
controlar = servo.Controlar,
|
||||||
mandatorio = servo.Mandatorio,
|
mandatorio = servo.Mandatorio,
|
||||||
angulo_sp = servo._AnguloControle,
|
angulo_sp = servo._AnguloControle,
|
||||||
|
|
@ -434,15 +447,19 @@ namespace AgroBase.Services.Operadores
|
||||||
saude = saude ?? new { }
|
saude = saude ?? new { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
senServosAtivos.Add($"{tipo}.{id}");
|
||||||
senServosAtualizados.Add(($"{basePath}", servoObj));
|
senServosAtualizados.Add(($"{basePath}", servoObj));
|
||||||
}
|
}
|
||||||
|
senServosAtualizados.Add(("servos.ativos", senServosAtivos));
|
||||||
RedisService.AtualizarCampos(RedisService.ModKey(Enums.T_Code.Sen), senServosAtualizados.ToArray());
|
RedisService.AtualizarCampos(RedisService.ModKey(Enums.T_Code.Sen), senServosAtualizados.ToArray());
|
||||||
|
|
||||||
var senRelesAtualizados = new List<(string caminho, object valor)>();
|
var senRelesAtualizados = new List<(string caminho, object valor)>();
|
||||||
|
var senRelesAtivos = new List<string>();
|
||||||
foreach (var rele in DadosSen.Reles)
|
foreach (var rele in DadosSen.Reles)
|
||||||
{
|
{
|
||||||
|
int tipo = (int)rele.Componente;
|
||||||
int id = rele.ID_Num;
|
int id = rele.ID_Num;
|
||||||
string basePath = $"reles.{id}";
|
string basePath = $"reles.{tipo}.{id}";
|
||||||
|
|
||||||
var saude = RedisService.GetField<object>(RedisService.ModKey(Enums.T_Code.Sen), $"{basePath}.saude");
|
var saude = RedisService.GetField<object>(RedisService.ModKey(Enums.T_Code.Sen), $"{basePath}.saude");
|
||||||
|
|
||||||
|
|
@ -461,6 +478,7 @@ namespace AgroBase.Services.Operadores
|
||||||
conectado = rele.Inicializado,
|
conectado = rele.Inicializado,
|
||||||
id,
|
id,
|
||||||
label = rele.ID,
|
label = rele.ID,
|
||||||
|
tipo,
|
||||||
controlar = rele.Controlar,
|
controlar = rele.Controlar,
|
||||||
mandatorio = rele.Mandatorio,
|
mandatorio = rele.Mandatorio,
|
||||||
dados,
|
dados,
|
||||||
|
|
@ -468,15 +486,19 @@ namespace AgroBase.Services.Operadores
|
||||||
saude = saude ?? new { }
|
saude = saude ?? new { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
senRelesAtivos.Add($"{tipo}.{id}");
|
||||||
senRelesAtualizados.Add(($"{basePath}", releObj));
|
senRelesAtualizados.Add(($"{basePath}", releObj));
|
||||||
}
|
}
|
||||||
|
senRelesAtualizados.Add(("reles.ativos", senRelesAtivos));
|
||||||
RedisService.AtualizarCampos(RedisService.ModKey(Enums.T_Code.Sen), senRelesAtualizados.ToArray());
|
RedisService.AtualizarCampos(RedisService.ModKey(Enums.T_Code.Sen), senRelesAtualizados.ToArray());
|
||||||
|
|
||||||
var senLedsAtualizados = new List<(string caminho, object valor)>();
|
var senLedsAtualizados = new List<(string caminho, object valor)>();
|
||||||
|
var senLedsAtivos = new List<string>();
|
||||||
foreach (var led in DadosSen.Sinaleiros)
|
foreach (var led in DadosSen.Sinaleiros)
|
||||||
{
|
{
|
||||||
|
int tipo = (int)led.Componente;
|
||||||
int id = led.ID_Num;
|
int id = led.ID_Num;
|
||||||
string basePath = $"sinaleiros.{id}";
|
string basePath = $"sinaleiros.{tipo}.{id}";
|
||||||
|
|
||||||
var saude = RedisService.GetField<object>(RedisService.ModKey(Enums.T_Code.Sen), $"{basePath}.saude");
|
var saude = RedisService.GetField<object>(RedisService.ModKey(Enums.T_Code.Sen), $"{basePath}.saude");
|
||||||
|
|
||||||
|
|
@ -495,15 +517,18 @@ namespace AgroBase.Services.Operadores
|
||||||
conectado = led.Inicializado,
|
conectado = led.Inicializado,
|
||||||
id,
|
id,
|
||||||
label = led.ID,
|
label = led.ID,
|
||||||
controlar = true,
|
tipo,
|
||||||
mandatorio = true,
|
controlar = led.Controlar,
|
||||||
|
mandatorio = led.Mandatorio,
|
||||||
dados,
|
dados,
|
||||||
timestamp = agora,
|
timestamp = agora,
|
||||||
saude = saude ?? new { }
|
saude = saude ?? new { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
senLedsAtivos.Add($"{tipo}.{id}");
|
||||||
senLedsAtualizados.Add(($"{basePath}", ledObj));
|
senLedsAtualizados.Add(($"{basePath}", ledObj));
|
||||||
}
|
}
|
||||||
|
senLedsAtualizados.Add(("sinaleiros.ativos", senLedsAtivos));
|
||||||
RedisService.AtualizarCampos(RedisService.ModKey(Enums.T_Code.Sen), senLedsAtualizados.ToArray());
|
RedisService.AtualizarCampos(RedisService.ModKey(Enums.T_Code.Sen), senLedsAtualizados.ToArray());
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -514,6 +539,7 @@ namespace AgroBase.Services.Operadores
|
||||||
("freq_base", DadosAtu.FrequenciaBase)
|
("freq_base", DadosAtu.FrequenciaBase)
|
||||||
);
|
);
|
||||||
var atuSensoresAtualizados = new List<(string caminho, object valor)>();
|
var atuSensoresAtualizados = new List<(string caminho, object valor)>();
|
||||||
|
var atuSensoresAtivos = new List<string>();
|
||||||
foreach (var sensor in DadosAtu.Sensores)
|
foreach (var sensor in DadosAtu.Sensores)
|
||||||
{
|
{
|
||||||
int tipo = (int)sensor.Componente;
|
int tipo = (int)sensor.Componente;
|
||||||
|
|
@ -548,11 +574,14 @@ namespace AgroBase.Services.Operadores
|
||||||
saude = saude ?? new { }
|
saude = saude ?? new { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
atuSensoresAtivos.Add($"{tipo}.{id}");
|
||||||
atuSensoresAtualizados.Add(($"{basePath}", sensorObj));
|
atuSensoresAtualizados.Add(($"{basePath}", sensorObj));
|
||||||
}
|
}
|
||||||
|
atuSensoresAtualizados.Add(("sensores.ativos", atuSensoresAtivos));
|
||||||
RedisService.AtualizarCampos(RedisService.ModKey(Enums.T_Code.Atu), atuSensoresAtualizados.ToArray());
|
RedisService.AtualizarCampos(RedisService.ModKey(Enums.T_Code.Atu), atuSensoresAtualizados.ToArray());
|
||||||
|
|
||||||
var atuBicosAtualizados = new List<(string caminho, object valor)>();
|
var atuBicosAtualizados = new List<(string caminho, object valor)>();
|
||||||
|
var atuBicosAtivos = new List<string>();
|
||||||
foreach (var bico in DadosAtu.BicosPulverizadores)
|
foreach (var bico in DadosAtu.BicosPulverizadores)
|
||||||
{
|
{
|
||||||
int tipo = (int)bico.Componente;
|
int tipo = (int)bico.Componente;
|
||||||
|
|
@ -574,7 +603,7 @@ namespace AgroBase.Services.Operadores
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var sensorObj = new
|
var bicoObj = new
|
||||||
{
|
{
|
||||||
conectado = bico.Inicializado,
|
conectado = bico.Inicializado,
|
||||||
id,
|
id,
|
||||||
|
|
@ -587,11 +616,14 @@ namespace AgroBase.Services.Operadores
|
||||||
saude = saude ?? new { }
|
saude = saude ?? new { }
|
||||||
};
|
};
|
||||||
|
|
||||||
atuBicosAtualizados.Add(($"{basePath}", sensorObj));
|
atuBicosAtualizados.Add(($"{basePath}", bicoObj));
|
||||||
|
atuBicosAtivos.Add($"{tipo}.{id}");
|
||||||
}
|
}
|
||||||
|
atuBicosAtualizados.Add(("bicos.ativos", atuBicosAtivos));
|
||||||
RedisService.AtualizarCampos(RedisService.ModKey(Enums.T_Code.Atu), atuBicosAtualizados.ToArray());
|
RedisService.AtualizarCampos(RedisService.ModKey(Enums.T_Code.Atu), atuBicosAtualizados.ToArray());
|
||||||
|
|
||||||
var atuBombasAtualizados = new List<(string caminho, object valor)>();
|
var atuBombasAtualizados = new List<(string caminho, object valor)>();
|
||||||
|
var atuBombasAtivos = new List<string>();
|
||||||
foreach (var bomba in DadosAtu.BombasPressurizadoras)
|
foreach (var bomba in DadosAtu.BombasPressurizadoras)
|
||||||
{
|
{
|
||||||
int tipo = (int)bomba.Componente;
|
int tipo = (int)bomba.Componente;
|
||||||
|
|
@ -626,15 +658,19 @@ namespace AgroBase.Services.Operadores
|
||||||
saude = saude ?? new { }
|
saude = saude ?? new { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
atuBombasAtivos.Add($"{tipo}.{id}");
|
||||||
atuBombasAtualizados.Add(($"{basePath}", sensorObj));
|
atuBombasAtualizados.Add(($"{basePath}", sensorObj));
|
||||||
}
|
}
|
||||||
|
atuBombasAtualizados.Add(("bombas.ativos", atuBombasAtivos));
|
||||||
RedisService.AtualizarCampos(RedisService.ModKey(Enums.T_Code.Atu), atuBombasAtualizados.ToArray());
|
RedisService.AtualizarCampos(RedisService.ModKey(Enums.T_Code.Atu), atuBombasAtualizados.ToArray());
|
||||||
|
|
||||||
var atuServosAtualizados = new List<(string caminho, object valor)>();
|
var atuServosAtualizados = new List<(string caminho, object valor)>();
|
||||||
|
var atuServosAtivos = new List<string>();
|
||||||
foreach (var servo in DadosAtu.Servos)
|
foreach (var servo in DadosAtu.Servos)
|
||||||
{
|
{
|
||||||
|
int tipo = (int)servo.Componente;
|
||||||
int id = servo.ID_Num;
|
int id = servo.ID_Num;
|
||||||
string basePath = $"servos.{id}";
|
string basePath = $"servos.{tipo}.{id}";
|
||||||
|
|
||||||
var saude = RedisService.GetField<object>(RedisService.ModKey(Enums.T_Code.Atu), $"{basePath}.saude");
|
var saude = RedisService.GetField<object>(RedisService.ModKey(Enums.T_Code.Atu), $"{basePath}.saude");
|
||||||
|
|
||||||
|
|
@ -653,6 +689,7 @@ namespace AgroBase.Services.Operadores
|
||||||
conectado = servo.Inicializado,
|
conectado = servo.Inicializado,
|
||||||
id,
|
id,
|
||||||
label = servo.ID,
|
label = servo.ID,
|
||||||
|
tipo,
|
||||||
controlar = servo.Controlar,
|
controlar = servo.Controlar,
|
||||||
mandatorio = servo.Mandatorio,
|
mandatorio = servo.Mandatorio,
|
||||||
angulo_sp = servo._AnguloControle,
|
angulo_sp = servo._AnguloControle,
|
||||||
|
|
@ -661,8 +698,10 @@ namespace AgroBase.Services.Operadores
|
||||||
saude = saude ?? new { }
|
saude = saude ?? new { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
atuServosAtivos.Add($"{tipo}.{id}");
|
||||||
atuServosAtualizados.Add(($"{basePath}", servoObj));
|
atuServosAtualizados.Add(($"{basePath}", servoObj));
|
||||||
}
|
}
|
||||||
|
atuServosAtualizados.Add(("servos.ativos", atuServosAtivos));
|
||||||
RedisService.AtualizarCampos(RedisService.ModKey(Enums.T_Code.Atu), atuServosAtualizados.ToArray());
|
RedisService.AtualizarCampos(RedisService.ModKey(Enums.T_Code.Atu), atuServosAtualizados.ToArray());
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -216,9 +216,24 @@
|
||||||
<!-- Mensagem quando não há opções para o módulo selecionado -->
|
<!-- Mensagem quando não há opções para o módulo selecionado -->
|
||||||
<TextBlock x:Name="txtOpcoes_SemDados" Text="Nenhum teste disponível para este módulo." FontSize="10" VerticalAlignment="Center" HorizontalAlignment="Center" TextWrapping="Wrap" Visibility="Visible"/>
|
<TextBlock x:Name="txtOpcoes_SemDados" Text="Nenhum teste disponível para este módulo." FontSize="10" VerticalAlignment="Center" HorizontalAlignment="Center" TextWrapping="Wrap" Visibility="Visible"/>
|
||||||
|
|
||||||
|
<!-- Painel especifico de SEN -->
|
||||||
|
<StackPanel x:Name="panelOpcoes_Sensoriamento" Grid.Row="0" Visibility="Collapsed">
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||||
|
<Label Content="Reinicia o módulo"/>
|
||||||
|
<Button x:Name="btnSensoriamento_Reiniciar" Content="Reiniciar" Click="btnSensoriamento_Reiniciar_Click"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Painel especifico de ATU -->
|
<!-- Painel especifico de ATU -->
|
||||||
<StackPanel x:Name="panelOpcoes_Atuador" Grid.Row="0" Visibility="Collapsed">
|
<StackPanel x:Name="panelOpcoes_Atuador" Grid.Row="0" Visibility="Collapsed">
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||||
|
<Label Content="Reinicia o módulo"/>
|
||||||
|
<Button x:Name="btnAtuador_Reiniciar" Content="Reiniciar" Click="btnAtuador_Reiniciar_Click"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
|
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
|
||||||
|
|
||||||
<Label Content="Altura" Height="30"/>
|
<Label Content="Altura" Height="30"/>
|
||||||
|
|
|
||||||
|
|
@ -679,11 +679,17 @@ namespace OperationControl.Windows
|
||||||
lblSaude_Latencia.Content = $"Latência {dispositivo?.Latencia ?? 0} ms";
|
lblSaude_Latencia.Content = $"Latência {dispositivo?.Latencia ?? 0} ms";
|
||||||
lblSaude_Impedimento.Text = $"Impedimento: {motivos ?? "Nenhum"}";
|
lblSaude_Impedimento.Text = $"Impedimento: {motivos ?? "Nenhum"}";
|
||||||
|
|
||||||
bool mandatorio = rover?.ModulosMandatorios?.Any(x => x.Dispositivo == modulo && x.Mandatorio) ?? false;
|
//bool mandatorio = rover?.ModulosMandatorios?.Any(x => x.Dispositivo == modulo && x.Mandatorio) ?? false;
|
||||||
//var cu = rover?.ModulosMandatorios?.FirstOrDefault(x => x.Dispositivo == modulo)?.ComponentesEmUso.FirstOrDefault(x => x.Key == label);
|
//var cu = rover?.ModulosMandatorios?.FirstOrDefault(x => x.Dispositivo == modulo)?.ComponentesEmUso.FirstOrDefault(x => x.Key == label);
|
||||||
//bool em_uso = individual?.em_uso ?? (cu?.Key != null ? cu?.Value : null) ?? rover?.ModulosMandatorios?.Any(x => x.Dispositivo == modulo && x.Utilizar) ?? false;
|
//bool em_uso = individual?.em_uso ?? (cu?.Key != null ? cu?.Value : null) ?? rover?.ModulosMandatorios?.Any(x => x.Dispositivo == modulo && x.Utilizar) ?? false;
|
||||||
//bool em_uso = rover?.ModulosMandatorios?.FirstOrDefault(x => x.Dispositivo == modulo)?.ComponentesEmUso?.Any(x => x.Key == label) ?? false;
|
//bool em_uso = rover?.ModulosMandatorios?.FirstOrDefault(x => x.Dispositivo == modulo)?.ComponentesEmUso?.Any(x => x.Key == label) ?? false;
|
||||||
bool em_uso = label != "" ? rover?.ModulosMandatorios?.FirstOrDefault(x => x.Dispositivo == modulo)?.ComponentesEmUso?.Any(x => x.Key == label && x.Value.Item2) ?? false : rover?.ModulosMandatorios?.Any(x => x.Dispositivo == modulo && x.Utilizar) ?? false;
|
bool mandatorio =
|
||||||
|
!string.IsNullOrEmpty(label) ? rover?.ModulosMandatorios?.FirstOrDefault(x => x.Dispositivo == modulo)?.ComponentesEmUso?.Any(x => x.Key == label && x.Value.Item1) ?? false :
|
||||||
|
rover?.ModulosMandatorios?.Any(x => x.Dispositivo == modulo && x.Mandatorio) ?? false;
|
||||||
|
|
||||||
|
bool em_uso =
|
||||||
|
!string.IsNullOrEmpty(label) ? rover?.ModulosMandatorios?.FirstOrDefault(x => x.Dispositivo == modulo)?.ComponentesEmUso?.Any(x => x.Key == label && x.Value.Item2) ?? false :
|
||||||
|
rover?.ModulosMandatorios?.Any(x => x.Dispositivo == modulo && x.Utilizar) ?? false;
|
||||||
|
|
||||||
chbSaude_Mandatorio.IsChecked = mandatorio;
|
chbSaude_Mandatorio.IsChecked = mandatorio;
|
||||||
chbSaude_EmUso.IsChecked = em_uso;
|
chbSaude_EmUso.IsChecked = em_uso;
|
||||||
|
|
@ -1306,8 +1312,32 @@ namespace OperationControl.Windows
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Sensoriamento
|
||||||
|
|
||||||
|
private void btnSensoriamento_Reiniciar_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
(var modulo, var label, var s_code, var iniciado) = GetModuleData(_labelModuloSelecionado);
|
||||||
|
if (modulo != AgroBase.Models.Enums.T_Code.Sen && s_code != AgroBase.Models.Enums.S_Code.sMOD)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (MessageBox.Show($"Tem certeza que deseja reiniciar o módulo {modulo}?", "Confirmação", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
|
||||||
|
VariaveisControleOperacao.EnviarComandoSensoriamento(label, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Atuador
|
#region Atuador
|
||||||
|
|
||||||
|
private void btnAtuador_Reiniciar_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
(var modulo, var label, var s_code, var iniciado) = GetModuleData(_labelModuloSelecionado);
|
||||||
|
if (modulo != AgroBase.Models.Enums.T_Code.Atu && s_code != AgroBase.Models.Enums.S_Code.sMOD)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (MessageBox.Show($"Tem certeza que deseja reiniciar o módulo {modulo}?", "Confirmação", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
|
||||||
|
VariaveisControleOperacao.EnviarComandoAtuador(label, true);
|
||||||
|
}
|
||||||
|
|
||||||
private void sldBarra_Altura_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
private void sldBarra_Altura_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||||
{
|
{
|
||||||
if (lblBarra_Altura != null)
|
if (lblBarra_Altura != null)
|
||||||
|
|
@ -1585,9 +1615,9 @@ namespace OperationControl.Windows
|
||||||
};
|
};
|
||||||
rover.ModulosMandatorios.Add(mod);
|
rover.ModulosMandatorios.Add(mod);
|
||||||
}
|
}
|
||||||
mod.Mandatorio = chbSaude_Mandatorio.IsChecked ?? false;
|
|
||||||
if (string.IsNullOrEmpty(label))
|
if (string.IsNullOrEmpty(label))
|
||||||
{
|
{
|
||||||
|
mod.Mandatorio = chbSaude_Mandatorio.IsChecked ?? false;
|
||||||
mod.Utilizar = chbSaude_EmUso.IsChecked ?? false;
|
mod.Utilizar = chbSaude_EmUso.IsChecked ?? false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -2199,9 +2229,12 @@ namespace OperationControl.Windows
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -253,6 +253,20 @@ void ProcessarCmd(std::vector<uint8_t> data) {
|
||||||
uint8_t id = data[1];
|
uint8_t id = data[1];
|
||||||
S_Code componente = DetectarComponente(id);
|
S_Code componente = DetectarComponente(id);
|
||||||
switch (componente) {
|
switch (componente) {
|
||||||
|
case sMOD: {
|
||||||
|
if (data.size() < 3) return;
|
||||||
|
switch (posicao) {
|
||||||
|
case CanMessagePosicaoDados::Command1: {
|
||||||
|
Estado estado = (Estado)data[2];
|
||||||
|
if (estado == Estado::Reset) {
|
||||||
|
delay(100);
|
||||||
|
esp_restart();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case sBIC: {
|
case sBIC: {
|
||||||
Bico::ComandarBico(listaBicos, data);
|
Bico::ComandarBico(listaBicos, data);
|
||||||
ComponenteCAN::ProcessarComponentesCAN(listaBicos, {}, false, id, false, false, CanMessagePosicaoDados::Dados1, EnviarDadosCAN);
|
ComponenteCAN::ProcessarComponentesCAN(listaBicos, {}, false, id, false, false, CanMessagePosicaoDados::Dados1, EnviarDadosCAN);
|
||||||
|
|
@ -262,6 +276,10 @@ void ProcessarCmd(std::vector<uint8_t> data) {
|
||||||
BombaPressurizadora::ComandarBomba(listaBombas, data);
|
BombaPressurizadora::ComandarBomba(listaBombas, data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case sSRV: {
|
||||||
|
ServoAgro::ComandarServo(listaServos, data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ class Sinaleiro : public ComponenteCAN {
|
||||||
PinoModel _pino;
|
PinoModel _pino;
|
||||||
bool Iniciado = false;
|
bool Iniciado = false;
|
||||||
|
|
||||||
|
int _StatusID = 99;
|
||||||
StatusLED _Status = Apagado;
|
StatusLED _Status = Apagado;
|
||||||
StatusLED _StatusLeitura = Apagado;
|
StatusLED _StatusLeitura = Apagado;
|
||||||
int _Qtd = 0;
|
int _Qtd = 0;
|
||||||
|
|
@ -83,8 +84,8 @@ class Sinaleiro : public ComponenteCAN {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CanMessagePosicaoDados::Dados1: {
|
case CanMessagePosicaoDados::Dados1: {
|
||||||
|
data.push_back(static_cast<uint8_t>(_StatusID));
|
||||||
data.push_back(static_cast<uint8_t>(_StatusLeitura));
|
data.push_back(static_cast<uint8_t>(_StatusLeitura));
|
||||||
data.push_back(static_cast<uint8_t>(_Status));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -139,17 +140,19 @@ class Sinaleiro : public ComponenteCAN {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ComandarSinaleiro(std::vector<Sinaleiro*>& lista, std::vector<uint8_t>& data) {
|
static void ComandarSinaleiro(std::vector<Sinaleiro*>& lista, std::vector<uint8_t>& data) {
|
||||||
if (data.size() < 6) return;
|
if (data.size() < 7) return;
|
||||||
CanMessagePosicaoDados posicao = (CanMessagePosicaoDados)data[0];
|
CanMessagePosicaoDados posicao = (CanMessagePosicaoDados)data[0];
|
||||||
uint8_t idNum = data[1];
|
uint8_t idNum = data[1];
|
||||||
for (auto* _led : lista) {
|
for (auto* _led : lista) {
|
||||||
if (_led->ID_Num == idNum) {
|
if (_led->ID_Num == idNum) {
|
||||||
switch (posicao) {
|
switch (posicao) {
|
||||||
case CanMessagePosicaoDados::Command1: {
|
case CanMessagePosicaoDados::Command1: {
|
||||||
StatusLED novoStatus = (StatusLED)data[2];
|
int statusId = data[2];
|
||||||
int novaQtd = data[3];
|
StatusLED novoStatus = (StatusLED)data[3];
|
||||||
uint16_t novoTempo = (uint16_t)data[4] * 10;
|
int novaQtd = data[4];
|
||||||
uint16_t novaPausa = (uint16_t)data[5] * 10;
|
uint16_t novoTempo = (uint16_t)data[5] * 10;
|
||||||
|
uint16_t novaPausa = (uint16_t)data[6] * 10;
|
||||||
|
_led->_StatusID = statusId;
|
||||||
_led->_Status = novoStatus;
|
_led->_Status = novoStatus;
|
||||||
_led->_Qtd = novaQtd;
|
_led->_Qtd = novaQtd;
|
||||||
_led->_TempoMs = novoTempo;
|
_led->_TempoMs = novoTempo;
|
||||||
|
|
|
||||||
|
|
@ -46,11 +46,11 @@ int latenciaLoop = 0;
|
||||||
int qtdEnviosStatus = 0;
|
int qtdEnviosStatus = 0;
|
||||||
int maxEnviosStatus = 5;
|
int maxEnviosStatus = 5;
|
||||||
|
|
||||||
|
std::vector<Sinaleiro*> listaSinaleiros;
|
||||||
|
std::vector<ServoAgro*> listaServos;
|
||||||
|
std::vector<Rele*> listaReles;
|
||||||
std::vector<SensorTemperatura*> listaSensoresTemperaturaNTC;
|
std::vector<SensorTemperatura*> listaSensoresTemperaturaNTC;
|
||||||
std::vector<SensorCorrente*> listaSensoresCorrente;
|
std::vector<SensorCorrente*> listaSensoresCorrente;
|
||||||
std::vector<Sinaleiro*> listaSinaleiros;
|
|
||||||
std::vector<Rele*> listaReles;
|
|
||||||
std::vector<ServoAgro*> listaServos;
|
|
||||||
std::vector<SensorIMU*> listaSensoresIMU;
|
std::vector<SensorIMU*> listaSensoresIMU;
|
||||||
std::vector<SensorGas*> listaSensoresGas;
|
std::vector<SensorGas*> listaSensoresGas;
|
||||||
std::vector<SensorTemperaturaSHT*> listaSensoresTemperaturaSHT;
|
std::vector<SensorTemperaturaSHT*> listaSensoresTemperaturaSHT;
|
||||||
|
|
@ -302,6 +302,20 @@ void ProcessarCmd(std::vector<uint8_t> data) {
|
||||||
uint8_t id = data[1];
|
uint8_t id = data[1];
|
||||||
S_Code componente = DetectarComponente(id);
|
S_Code componente = DetectarComponente(id);
|
||||||
switch (componente) {
|
switch (componente) {
|
||||||
|
case sMOD: {
|
||||||
|
if (data.size() < 3) return;
|
||||||
|
switch (posicao) {
|
||||||
|
case CanMessagePosicaoDados::Command1: {
|
||||||
|
Estado estado = (Estado)data[2];
|
||||||
|
if (estado == Estado::Reset) {
|
||||||
|
delay(100);
|
||||||
|
esp_restart();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case sLED: {
|
case sLED: {
|
||||||
Sinaleiro::ComandarSinaleiro(listaSinaleiros, data);
|
Sinaleiro::ComandarSinaleiro(listaSinaleiros, data);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue