diff --git a/AgroBase/.vs/AgroBase/FileContentIndex/18f32c39-023f-4973-894a-73e7370aad4a.vsidx b/AgroBase/.vs/AgroBase/FileContentIndex/18f32c39-023f-4973-894a-73e7370aad4a.vsidx
deleted file mode 100644
index 7ce891c21..000000000
Binary files a/AgroBase/.vs/AgroBase/FileContentIndex/18f32c39-023f-4973-894a-73e7370aad4a.vsidx and /dev/null differ
diff --git a/AgroBase/.vs/AgroBase/FileContentIndex/365693cd-9bf5-4956-826f-7c46d8a6471a.vsidx b/AgroBase/.vs/AgroBase/FileContentIndex/365693cd-9bf5-4956-826f-7c46d8a6471a.vsidx
new file mode 100644
index 000000000..2d1cee25d
Binary files /dev/null and b/AgroBase/.vs/AgroBase/FileContentIndex/365693cd-9bf5-4956-826f-7c46d8a6471a.vsidx differ
diff --git a/AgroBase/.vs/AgroBase/FileContentIndex/a2d68010-7716-4826-af4f-324b8f55c7de.vsidx b/AgroBase/.vs/AgroBase/FileContentIndex/a2d68010-7716-4826-af4f-324b8f55c7de.vsidx
deleted file mode 100644
index 0e6986ad0..000000000
Binary files a/AgroBase/.vs/AgroBase/FileContentIndex/a2d68010-7716-4826-af4f-324b8f55c7de.vsidx and /dev/null differ
diff --git a/AgroBase/.vs/AgroBase/FileContentIndex/abd5b484-1a2f-4d8a-8489-f7bb3c3c318d.vsidx b/AgroBase/.vs/AgroBase/FileContentIndex/abd5b484-1a2f-4d8a-8489-f7bb3c3c318d.vsidx
new file mode 100644
index 000000000..3203b4969
Binary files /dev/null and b/AgroBase/.vs/AgroBase/FileContentIndex/abd5b484-1a2f-4d8a-8489-f7bb3c3c318d.vsidx differ
diff --git a/AgroBase/.vs/AgroBase/FileContentIndex/e222b3cf-d824-401f-9de4-c937c46f01ab.vsidx b/AgroBase/.vs/AgroBase/FileContentIndex/e222b3cf-d824-401f-9de4-c937c46f01ab.vsidx
new file mode 100644
index 000000000..e5b357a24
Binary files /dev/null and b/AgroBase/.vs/AgroBase/FileContentIndex/e222b3cf-d824-401f-9de4-c937c46f01ab.vsidx differ
diff --git a/AgroBase/.vs/AgroBase/v17/.suo b/AgroBase/.vs/AgroBase/v17/.suo
index 5dcc6da7b..b12956aea 100644
Binary files a/AgroBase/.vs/AgroBase/v17/.suo and b/AgroBase/.vs/AgroBase/v17/.suo differ
diff --git a/AgroBase/AgroBase/AgroBase.csproj b/AgroBase/AgroBase/AgroBase.csproj
index f3dfc2a9f..0389438fa 100644
--- a/AgroBase/AgroBase/AgroBase.csproj
+++ b/AgroBase/AgroBase/AgroBase.csproj
@@ -512,6 +512,7 @@
+
diff --git a/AgroBase/AgroBase/Forms/Direcional/frmDirConfig.cs b/AgroBase/AgroBase/Forms/Direcional/frmDirConfig.cs
index 840a1b020..c743fca5d 100644
--- a/AgroBase/AgroBase/Forms/Direcional/frmDirConfig.cs
+++ b/AgroBase/AgroBase/Forms/Direcional/frmDirConfig.cs
@@ -71,7 +71,7 @@ namespace AgroBase.Forms.Direcional
cmb.SelectedItem = Enum.GetName(typeof(Sentido), sentido);
TextBox txtEndereco = FuncoesGlobais.FindControlRecursive(gpbSentido, "txt" + Modulo.Modulo_ID + "Endereco");
- txtEndereco.Text = Modulo.DirMotor.Endereco;
+ txtEndereco.Text = FuncoesGlobais.HexByteToString(Modulo.DirMotor._EnderecoCAN_Tx);
NumericUpDown nudOffset = FuncoesGlobais.FindControlRecursive(gpbSentido, "nud" + Modulo.Modulo_ID + "Offset");
nudOffset.Value = Convert.ToInt32(Modulo.DirMotor.FolgaMecanica);
@@ -114,7 +114,7 @@ namespace AgroBase.Forms.Direcional
}
TextBox txtEndereco = FuncoesGlobais.FindControlRecursive(gpbSentido, "txt" + Modulo.Modulo_ID + "Endereco");
- Modulo.DirMotor.Endereco = txtEndereco.Text;
+ Modulo.DirMotor._EnderecoCAN_Tx = FuncoesGlobais.StringToHexByte(txtEndereco.Text);
NumericUpDown nudOffset = FuncoesGlobais.FindControlRecursive(gpbSentido, "nud" + Modulo.Modulo_ID + "Offset");
Modulo.DirMotor.FolgaMecanica = Convert.ToDouble(nudOffset.Value);
diff --git a/AgroBase/AgroBase/Forms/IHM/frmDiagnosticos.cs b/AgroBase/AgroBase/Forms/IHM/frmDiagnosticos.cs
index 583c28af8..f42bef623 100644
--- a/AgroBase/AgroBase/Forms/IHM/frmDiagnosticos.cs
+++ b/AgroBase/AgroBase/Forms/IHM/frmDiagnosticos.cs
@@ -12,6 +12,7 @@ using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using static AgroBase.Models.Enums;
+using static AgroBase.Services.OIDCanService.OidHandler;
namespace AgroBase.Forms.IHM
{
@@ -746,7 +747,7 @@ namespace AgroBase.Forms.IHM
double TemperaturaDriver = Inicializado ? Modulo.MovMotor.TemperaturaDriver : -1;
idx = PreencheDadosLinha(grid, Testes, idx, TemperaturaDriver);
- double CodigoErro = Inicializado ? Modulo.MovMotor.CodigoAlarme : -1;
+ int CodigoErro = Inicializado ? (int)Modulo.MovMotor.CodigoAlarme : (int)OidCodigoErro.NenhumErro;
idx = PreencheDadosLinha(grid, Testes, idx, CodigoErro);
bool ParaFrente = Inicializado ? await EnviarComandoMov(Modulo, Enums.Direcao.Frente, Testes[idx], 5000) : false;
@@ -837,7 +838,7 @@ namespace AgroBase.Forms.IHM
bool Sucesso = false;
while (!Sucesso && Inicio.AddMilliseconds(Timeout) > DateTime.Now)
{
- Dispositivo.Dados.RequisitarDadosModulo(F_Code.ReqTx, ServoFreio.ID_Num, CanMessagePosicaoDados.Dados1);
+ Dispositivo.Dados.RequisitarDadosModulo(ServoFreio.ID_Num, CanMessagePosicaoDados.Dados1, CanMessagePosicaoDados.Dados1, true);
await Task.Delay(1000);
Sucesso =
@@ -1453,7 +1454,7 @@ namespace AgroBase.Forms.IHM
var novoEstado = Ligar ? Estado.Ligado : Estado.Desligado;
GeneralJoystick.EnviarComandoSensoriamento(S_Code.sRLE, Rele.ID, novoEstado);
await Task.Delay(Delay);
- Dispositivo.Dados.RequisitarDadosModulo(F_Code.ReqTx, Rele.ID_Num, CanMessagePosicaoDados.Dados1);
+ Dispositivo.Dados.RequisitarDadosModulo(Rele.ID_Num, CanMessagePosicaoDados.Dados1, CanMessagePosicaoDados.Dados1, true);
await Task.Delay(Delay);
}
@@ -1714,7 +1715,7 @@ namespace AgroBase.Forms.IHM
Comportamento.statusLED = Ligar ? StatusLED.Aceso : StatusLED.Apagado;
GeneralJoystick.EnviarComandoSensoriamento(S_Code.sLED, Sinaleiro.ID, Comportamento);
await Task.Delay(Delay);
- Dispositivo.Dados.RequisitarDadosModulo(F_Code.ReqTx, Sinaleiro.ID_Num, CanMessagePosicaoDados.Dados1);
+ Dispositivo.Dados.RequisitarDadosModulo(Sinaleiro.ID_Num, CanMessagePosicaoDados.Dados1, CanMessagePosicaoDados.Dados1, true);
await Task.Delay(Delay);
}
diff --git a/AgroBase/AgroBase/Forms/Movimentacao/frmMovConfig.cs b/AgroBase/AgroBase/Forms/Movimentacao/frmMovConfig.cs
index 5819a06c2..9b14dc5e4 100644
--- a/AgroBase/AgroBase/Forms/Movimentacao/frmMovConfig.cs
+++ b/AgroBase/AgroBase/Forms/Movimentacao/frmMovConfig.cs
@@ -70,7 +70,7 @@ namespace AgroBase.Forms.Movimentacao
txtTorqueMaximo.Text = Modulo.MovMotor.CorrenteTorqueMaximo.ToString();
TextBox txtEndereco = FuncoesGlobais.FindControlRecursive(gpbSentido, "txt" + Modulo.Modulo_ID + "Endereco");
- txtEndereco.Text = Modulo.MovMotor.Endereco;
+ txtEndereco.Text = FuncoesGlobais.HexByteToString(Modulo.MovMotor._EnderecoCAN_Tx);
GroupBox gpbFreio = FuncoesGlobais.FindControlRecursive(gpbSentido, "gpb" + Mod_ID + "_Freio");
if (gpbFreio != null)
@@ -129,7 +129,7 @@ namespace AgroBase.Forms.Movimentacao
Modulo.MovMotor.CorrenteTorqueMaximo = Convert.ToInt32(txtTorqueMaximo.Text);
TextBox txtEndereco = FuncoesGlobais.FindControlRecursive(gpbSentido, "txt" + Modulo.Modulo_ID + "Endereco");
- Modulo.MovMotor.Endereco = txtEndereco.Text;
+ Modulo.MovMotor._EnderecoCAN_Tx = FuncoesGlobais.StringToHexByte(txtEndereco.Text);
GroupBox gpbFreio = FuncoesGlobais.FindControlRecursive(gpbSentido, "gpb" + Modulo.Modulo_ID + "_Freio");
if (gpbFreio != null)
diff --git a/AgroBase/AgroBase/Forms/Sensoriamento/frmSenConfig.Designer.cs b/AgroBase/AgroBase/Forms/Sensoriamento/frmSenConfig.Designer.cs
index 3a7a24726..4a1a7d94e 100644
--- a/AgroBase/AgroBase/Forms/Sensoriamento/frmSenConfig.Designer.cs
+++ b/AgroBase/AgroBase/Forms/Sensoriamento/frmSenConfig.Designer.cs
@@ -60,10 +60,12 @@
this.lblCaminho = new System.Windows.Forms.Label();
this.cmbCaminho = new System.Windows.Forms.ComboBox();
this.chbRequisitarDados = new System.Windows.Forms.CheckBox();
- this.lblIP = new System.Windows.Forms.Label();
- this.txtEnderecoCAN = new System.Windows.Forms.TextBox();
+ this.lblAddrTx = new System.Windows.Forms.Label();
+ this.txtEnderecoCAN_Tx = new System.Windows.Forms.TextBox();
this.lblPotenciometro = new System.Windows.Forms.Label();
this.gridsPOT = new System.Windows.Forms.DataGridView();
+ this.lblAddrRx = new System.Windows.Forms.Label();
+ this.txtEnderecoCAN_Rx = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.gridsTEN)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridsCOR)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridsTMP)).BeginInit();
@@ -381,33 +383,33 @@
//
this.chbRequisitarDados.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.chbRequisitarDados.AutoSize = true;
- this.chbRequisitarDados.Location = new System.Drawing.Point(1100, 628);
+ this.chbRequisitarDados.Location = new System.Drawing.Point(1100, 664);
this.chbRequisitarDados.Name = "chbRequisitarDados";
this.chbRequisitarDados.Size = new System.Drawing.Size(107, 17);
this.chbRequisitarDados.TabIndex = 28;
this.chbRequisitarDados.Text = "Requisitar Dados";
this.chbRequisitarDados.UseVisualStyleBackColor = true;
//
- // lblIP
+ // lblAddrTx
//
- this.lblIP.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.lblIP.AutoSize = true;
- this.lblIP.Location = new System.Drawing.Point(1097, 579);
- this.lblIP.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.lblIP.Name = "lblIP";
- this.lblIP.Size = new System.Drawing.Size(78, 13);
- this.lblIP.TabIndex = 145;
- this.lblIP.Text = "Endereço CAN";
+ this.lblAddrTx.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.lblAddrTx.AutoSize = true;
+ this.lblAddrTx.Location = new System.Drawing.Point(1097, 579);
+ this.lblAddrTx.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+ this.lblAddrTx.Name = "lblAddrTx";
+ this.lblAddrTx.Size = new System.Drawing.Size(69, 13);
+ this.lblAddrTx.TabIndex = 145;
+ this.lblAddrTx.Text = "CAN Addr Tx";
//
- // txtEnderecoCAN
+ // txtEnderecoCAN_Tx
//
- this.txtEnderecoCAN.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.txtEnderecoCAN.Location = new System.Drawing.Point(1100, 596);
- this.txtEnderecoCAN.Margin = new System.Windows.Forms.Padding(2);
- this.txtEnderecoCAN.Name = "txtEnderecoCAN";
- this.txtEnderecoCAN.Size = new System.Drawing.Size(85, 20);
- this.txtEnderecoCAN.TabIndex = 144;
- this.txtEnderecoCAN.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.txtEnderecoCAN_Tx.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtEnderecoCAN_Tx.Location = new System.Drawing.Point(1100, 596);
+ this.txtEnderecoCAN_Tx.Margin = new System.Windows.Forms.Padding(2);
+ this.txtEnderecoCAN_Tx.Name = "txtEnderecoCAN_Tx";
+ this.txtEnderecoCAN_Tx.Size = new System.Drawing.Size(85, 20);
+ this.txtEnderecoCAN_Tx.TabIndex = 144;
+ this.txtEnderecoCAN_Tx.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblPotenciometro
//
@@ -427,15 +429,38 @@
this.gridsPOT.Size = new System.Drawing.Size(578, 124);
this.gridsPOT.TabIndex = 146;
//
+ // lblAddrRx
+ //
+ this.lblAddrRx.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.lblAddrRx.AutoSize = true;
+ this.lblAddrRx.Location = new System.Drawing.Point(1097, 618);
+ this.lblAddrRx.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+ this.lblAddrRx.Name = "lblAddrRx";
+ this.lblAddrRx.Size = new System.Drawing.Size(70, 13);
+ this.lblAddrRx.TabIndex = 149;
+ this.lblAddrRx.Text = "CAN Addr Rx";
+ //
+ // txtEnderecoCAN_Rx
+ //
+ this.txtEnderecoCAN_Rx.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtEnderecoCAN_Rx.Location = new System.Drawing.Point(1100, 635);
+ this.txtEnderecoCAN_Rx.Margin = new System.Windows.Forms.Padding(2);
+ this.txtEnderecoCAN_Rx.Name = "txtEnderecoCAN_Rx";
+ this.txtEnderecoCAN_Rx.Size = new System.Drawing.Size(85, 20);
+ this.txtEnderecoCAN_Rx.TabIndex = 148;
+ this.txtEnderecoCAN_Rx.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ //
// frmSenConfig
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1226, 730);
+ this.Controls.Add(this.lblAddrRx);
+ this.Controls.Add(this.txtEnderecoCAN_Rx);
this.Controls.Add(this.lblPotenciometro);
this.Controls.Add(this.gridsPOT);
- this.Controls.Add(this.lblIP);
- this.Controls.Add(this.txtEnderecoCAN);
+ this.Controls.Add(this.lblAddrTx);
+ this.Controls.Add(this.txtEnderecoCAN_Tx);
this.Controls.Add(this.chbRequisitarDados);
this.Controls.Add(this.gpbCameras);
this.Controls.Add(this.gpbBateria);
@@ -510,9 +535,11 @@
private System.Windows.Forms.Button btnBateriaCalibrar;
private System.Windows.Forms.Button btnAtualizarCameras;
private System.Windows.Forms.CheckBox chbRequisitarDados;
- private System.Windows.Forms.Label lblIP;
- private System.Windows.Forms.TextBox txtEnderecoCAN;
+ private System.Windows.Forms.Label lblAddrTx;
+ private System.Windows.Forms.TextBox txtEnderecoCAN_Tx;
private System.Windows.Forms.Label lblPotenciometro;
private System.Windows.Forms.DataGridView gridsPOT;
+ private System.Windows.Forms.Label lblAddrRx;
+ private System.Windows.Forms.TextBox txtEnderecoCAN_Rx;
}
}
\ No newline at end of file
diff --git a/AgroBase/AgroBase/Forms/Sensoriamento/frmSenConfig.cs b/AgroBase/AgroBase/Forms/Sensoriamento/frmSenConfig.cs
index c41a65961..164284906 100644
--- a/AgroBase/AgroBase/Forms/Sensoriamento/frmSenConfig.cs
+++ b/AgroBase/AgroBase/Forms/Sensoriamento/frmSenConfig.cs
@@ -52,7 +52,8 @@ namespace AgroBase.Forms.Sensoriamento
}
}
- txtEnderecoCAN.Text = Disp.Dados._EnderecoCAN.ToString("X");
+ txtEnderecoCAN_Tx.Text = FuncoesGlobais.HexByteToString(Disp.Dados._EnderecoCAN_Tx);
+ txtEnderecoCAN_Rx.Text = FuncoesGlobais.HexByteToString(Disp.Dados._EnderecoCAN_Rx);
PopulaParametrosSensor();
@@ -196,7 +197,8 @@ namespace AgroBase.Forms.Sensoriamento
case T_Code.Sen:
{
var _Disp = (DispositivosService)Variaveis.DispositivosConectados.FirstOrDefault(x => x.Dispositivo == Dispositivo);
- _Disp.Dados._EnderecoCAN = Convert.ToByte(txtEnderecoCAN.Text, 16);
+ _Disp.Dados._EnderecoCAN_Tx = FuncoesGlobais.StringToHexByte(txtEnderecoCAN_Tx.Text);
+ _Disp.Dados._EnderecoCAN_Rx = FuncoesGlobais.StringToHexByte(txtEnderecoCAN_Rx.Text);
_Disp.Dados.RequisitarDados = chbRequisitarDados.Checked;
_Disp.Dados.Sensores = Sensores.ToList();
_Disp.Dados.CameraID_Caminho = cmbCaminho.Text;
@@ -208,7 +210,8 @@ namespace AgroBase.Forms.Sensoriamento
case T_Code.Atu:
{
var _Disp = (DispositivosService)Variaveis.DispositivosConectados.FirstOrDefault(x => x.Dispositivo == Dispositivo);
- _Disp.Dados._EnderecoCAN = Convert.ToByte(txtEnderecoCAN.Text, 16);
+ _Disp.Dados._EnderecoCAN_Tx = FuncoesGlobais.StringToHexByte(txtEnderecoCAN_Tx.Text);
+ _Disp.Dados._EnderecoCAN_Rx = FuncoesGlobais.StringToHexByte(txtEnderecoCAN_Rx.Text);
_Disp.Dados.RequisitarDados = chbRequisitarDados.Checked;
_Disp.Dados.Sensores = Sensores.ToList();
_Disp.SalvarParametros(_Disp.Dados);
diff --git a/AgroBase/AgroBase/Forms/frmAcompanhamento.cs b/AgroBase/AgroBase/Forms/frmAcompanhamento.cs
index 334cddf78..21e27d0fb 100644
--- a/AgroBase/AgroBase/Forms/frmAcompanhamento.cs
+++ b/AgroBase/AgroBase/Forms/frmAcompanhamento.cs
@@ -106,7 +106,7 @@ namespace AgroBase.Forms
Label lblTitulo = pnlFundo.Controls.OfType