ajustes no codigo serial e bld300r

This commit is contained in:
Diego Freitas 2024-07-26 16:54:25 -03:00
parent d7ec074071
commit d9d4da8450
105 changed files with 1573 additions and 1602 deletions

Binary file not shown.

View File

@ -387,7 +387,7 @@
<Compile Include="Models\Modules\AtuadorModel.cs" /> <Compile Include="Models\Modules\AtuadorModel.cs" />
<Compile Include="Models\Modules\DirecionalModel.cs" /> <Compile Include="Models\Modules\DirecionalModel.cs" />
<Compile Include="Models\Modules\DispositivoBaseModel.cs" /> <Compile Include="Models\Modules\DispositivoBaseModel.cs" />
<Compile Include="Models\Enuns.cs" /> <Compile Include="Models\Enums.cs" />
<Compile Include="Models\GeneralJoystick.cs" /> <Compile Include="Models\GeneralJoystick.cs" />
<Compile Include="Models\Modules\MovimentacaoModel.cs" /> <Compile Include="Models\Modules\MovimentacaoModel.cs" />
<Compile Include="Models\Modules\MovimentacaoUnificadoModel.cs" /> <Compile Include="Models\Modules\MovimentacaoUnificadoModel.cs" />

View File

@ -11,7 +11,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting; using System.Windows.Forms.DataVisualization.Charting;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Forms.Atuador namespace AgroBase.Forms.Atuador
{ {
@ -152,28 +152,20 @@ namespace AgroBase.Forms.Atuador
grdSensoriamento.Rows[9].Cells[1].Value = DispAtu.Dados.PercentualReservatorio.ToString("0.00"); grdSensoriamento.Rows[9].Cells[1].Value = DispAtu.Dados.PercentualReservatorio.ToString("0.00");
} }
private void EnviarProtocoloComandoBomba()
{
string Protocolo = DispAtu.Dados.BombaPressurizadora.ProtocoloComando();
DispAtu.AdicionarMensagemFila(DispAtu.Dados.Modulo_ID, Protocolo, true, true);
}
private void nudPressaoSP_ValueChanged(object sender, EventArgs e) private void nudPressaoSP_ValueChanged(object sender, EventArgs e)
{ {
Variaveis.OperacaoEmAndamento.Controle.PressaoLinha = Convert.ToInt32(((NumericUpDown)sender).Value); Variaveis.OperacaoEmAndamento.Controle.PressaoLinha = Convert.ToInt32(((NumericUpDown)sender).Value);
EnviarProtocoloComandoBomba(); GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombaPressurizadora.BombaAtuada);
} }
private void btnLigarBomba_Click(object sender, EventArgs e) private void btnLigarBomba_Click(object sender, EventArgs e)
{ {
DispAtu.Dados.BombaPressurizadora.BombaAtuada = true; GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, true);
EnviarProtocoloComandoBomba();
} }
private void btnDesligarBomba_Click(object sender, EventArgs e) private void btnDesligarBomba_Click(object sender, EventArgs e)
{ {
DispAtu.Dados.BombaPressurizadora.BombaAtuada = false; GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, false);
EnviarProtocoloComandoBomba();
} }
private void pnlBico_Paint(object sender, PaintEventArgs e) private void pnlBico_Paint(object sender, PaintEventArgs e)
@ -197,33 +189,19 @@ namespace AgroBase.Forms.Atuador
{ {
Button btn = (Button)sender; Button btn = (Button)sender;
string ID = btn.Name.Replace("btn0_", ""); string ID = btn.Name.Replace("btn0_", "");
var Bico = DispAtu.Dados.BicosPulverizadores.FirstOrDefault(x => x.ID == ID); GeneralJoystick.EnviarComandoAtuador(S_Code.sBIC, false, ID);
if (Bico != null)
{
Bico.Atuado = !DispAtu.Dados.AtuacaoNivelAlto;
string Protocolo = Bico.ProtocoloComando();
DispAtu.AdicionarMensagemFila(DispAtu.Dados.Modulo_ID, Protocolo, true, false);
pnlBicos.Controls.OfType<Panel>().First(x => x.Name == "pnlB_" + ID).Invalidate(); pnlBicos.Controls.OfType<Panel>().First(x => x.Name == "pnlB_" + ID).Invalidate();
pnlBicos.Controls.OfType<Panel>().First(x => x.Name == "pnlB_" + ID).Controls.OfType<Label>().First(x => x.Name == "lblCmd_" + ID).Text = "Comando: Desligado"; pnlBicos.Controls.OfType<Panel>().First(x => x.Name == "pnlB_" + ID).Controls.OfType<Label>().First(x => x.Name == "lblCmd_" + ID).Text = "Comando: Desligado";
} }
}
private void btn1_Click(object sender, EventArgs e) private void btn1_Click(object sender, EventArgs e)
{ {
Button btn = (Button)sender; Button btn = (Button)sender;
string ID = btn.Name.Replace("btn1_", ""); string ID = btn.Name.Replace("btn1_", "");
var Bico = DispAtu.Dados.BicosPulverizadores.FirstOrDefault(x => x.ID == ID); GeneralJoystick.EnviarComandoAtuador(S_Code.sBIC, true, ID);
if (Bico != null)
{
Bico.Atuado = DispAtu.Dados.AtuacaoNivelAlto;
string Protocolo = Bico.ProtocoloComando();
DispAtu.AdicionarMensagemFila(DispAtu.Dados.Modulo_ID, Protocolo, true, false);
pnlBicos.Controls.OfType<Panel>().First(x => x.Name == "pnlB_" + ID).Invalidate(); pnlBicos.Controls.OfType<Panel>().First(x => x.Name == "pnlB_" + ID).Invalidate();
pnlBicos.Controls.OfType<Panel>().First(x => x.Name == "pnlB_" + ID).Controls.OfType<Label>().First(x => x.Name == "lblCmd_" + ID).Text = "Comando: Ligado"; pnlBicos.Controls.OfType<Panel>().First(x => x.Name == "pnlB_" + ID).Controls.OfType<Label>().First(x => x.Name == "lblCmd_" + ID).Text = "Comando: Ligado";
} }
}
private void btnSalvar_Click(object sender, EventArgs e) private void btnSalvar_Click(object sender, EventArgs e)
{ {

View File

@ -12,7 +12,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Forms.Atuador namespace AgroBase.Forms.Atuador
{ {

View File

@ -32,7 +32,8 @@ namespace AgroBase.Forms.Direcional
this.gpbSentido = new System.Windows.Forms.GroupBox(); this.gpbSentido = new System.Windows.Forms.GroupBox();
this.btnSalvarSentido = new System.Windows.Forms.Button(); this.btnSalvarSentido = new System.Windows.Forms.Button();
this.gpbDF = new System.Windows.Forms.GroupBox(); this.gpbDF = new System.Windows.Forms.GroupBox();
this.chbDFControlar = new System.Windows.Forms.CheckBox(); this.label2 = new System.Windows.Forms.Label();
this.txtDFEndereco = new System.Windows.Forms.TextBox();
this.nudDFOffset = new System.Windows.Forms.NumericUpDown(); this.nudDFOffset = new System.Windows.Forms.NumericUpDown();
this.lblDFOffset = new System.Windows.Forms.Label(); this.lblDFOffset = new System.Windows.Forms.Label();
this.cmbDFDireita = new System.Windows.Forms.ComboBox(); this.cmbDFDireita = new System.Windows.Forms.ComboBox();
@ -40,7 +41,8 @@ namespace AgroBase.Forms.Direcional
this.lblDFEsquerda = new System.Windows.Forms.Label(); this.lblDFEsquerda = new System.Windows.Forms.Label();
this.lblDFDireita = new System.Windows.Forms.Label(); this.lblDFDireita = new System.Windows.Forms.Label();
this.gpbEF = new System.Windows.Forms.GroupBox(); this.gpbEF = new System.Windows.Forms.GroupBox();
this.chbEFControlar = new System.Windows.Forms.CheckBox(); this.label4 = new System.Windows.Forms.Label();
this.txtEFEndereco = new System.Windows.Forms.TextBox();
this.nudEFOffset = new System.Windows.Forms.NumericUpDown(); this.nudEFOffset = new System.Windows.Forms.NumericUpDown();
this.lblEFOffset = new System.Windows.Forms.Label(); this.lblEFOffset = new System.Windows.Forms.Label();
this.cmbEFDireita = new System.Windows.Forms.ComboBox(); this.cmbEFDireita = new System.Windows.Forms.ComboBox();
@ -48,7 +50,8 @@ namespace AgroBase.Forms.Direcional
this.lblEFEsquerda = new System.Windows.Forms.Label(); this.lblEFEsquerda = new System.Windows.Forms.Label();
this.lblEFDireita = new System.Windows.Forms.Label(); this.lblEFDireita = new System.Windows.Forms.Label();
this.gpbDT = new System.Windows.Forms.GroupBox(); this.gpbDT = new System.Windows.Forms.GroupBox();
this.chbDTControlar = new System.Windows.Forms.CheckBox(); this.label3 = new System.Windows.Forms.Label();
this.txtDTEndereco = new System.Windows.Forms.TextBox();
this.nudDTOffset = new System.Windows.Forms.NumericUpDown(); this.nudDTOffset = new System.Windows.Forms.NumericUpDown();
this.lblDTOffset = new System.Windows.Forms.Label(); this.lblDTOffset = new System.Windows.Forms.Label();
this.cmbDTDireita = new System.Windows.Forms.ComboBox(); this.cmbDTDireita = new System.Windows.Forms.ComboBox();
@ -56,21 +59,16 @@ namespace AgroBase.Forms.Direcional
this.lblDTEsquerda = new System.Windows.Forms.Label(); this.lblDTEsquerda = new System.Windows.Forms.Label();
this.lblDTDireita = new System.Windows.Forms.Label(); this.lblDTDireita = new System.Windows.Forms.Label();
this.gpbET = new System.Windows.Forms.GroupBox(); this.gpbET = new System.Windows.Forms.GroupBox();
this.chbETControlar = new System.Windows.Forms.CheckBox(); this.label1 = new System.Windows.Forms.Label();
this.txtETEndereco = new System.Windows.Forms.TextBox();
this.nudETOffset = new System.Windows.Forms.NumericUpDown(); this.nudETOffset = new System.Windows.Forms.NumericUpDown();
this.lblETOffset = new System.Windows.Forms.Label(); this.lblETOffset = new System.Windows.Forms.Label();
this.cmbETDireita = new System.Windows.Forms.ComboBox(); this.cmbETDireita = new System.Windows.Forms.ComboBox();
this.cmbETEsquerda = new System.Windows.Forms.ComboBox(); this.cmbETEsquerda = new System.Windows.Forms.ComboBox();
this.lblETEsquerda = new System.Windows.Forms.Label(); this.lblETEsquerda = new System.Windows.Forms.Label();
this.lblETDireita = new System.Windows.Forms.Label(); this.lblETDireita = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label(); this.cmbTipoMovimento = new System.Windows.Forms.ComboBox();
this.txtDTEndereco = new System.Windows.Forms.TextBox(); this.lblTipoMovimento = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.txtETEndereco = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.txtDFEndereco = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.txtEFEndereco = new System.Windows.Forms.TextBox();
this.gpbSentido.SuspendLayout(); this.gpbSentido.SuspendLayout();
this.gpbDF.SuspendLayout(); this.gpbDF.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudDFOffset)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudDFOffset)).BeginInit();
@ -84,6 +82,8 @@ namespace AgroBase.Forms.Direcional
// //
// gpbSentido // gpbSentido
// //
this.gpbSentido.Controls.Add(this.cmbTipoMovimento);
this.gpbSentido.Controls.Add(this.lblTipoMovimento);
this.gpbSentido.Controls.Add(this.btnSalvarSentido); this.gpbSentido.Controls.Add(this.btnSalvarSentido);
this.gpbSentido.Controls.Add(this.gpbDF); this.gpbSentido.Controls.Add(this.gpbDF);
this.gpbSentido.Controls.Add(this.gpbEF); this.gpbSentido.Controls.Add(this.gpbEF);
@ -93,7 +93,7 @@ namespace AgroBase.Forms.Direcional
this.gpbSentido.Margin = new System.Windows.Forms.Padding(2); this.gpbSentido.Margin = new System.Windows.Forms.Padding(2);
this.gpbSentido.Name = "gpbSentido"; this.gpbSentido.Name = "gpbSentido";
this.gpbSentido.Padding = new System.Windows.Forms.Padding(2); this.gpbSentido.Padding = new System.Windows.Forms.Padding(2);
this.gpbSentido.Size = new System.Drawing.Size(379, 375); this.gpbSentido.Size = new System.Drawing.Size(376, 373);
this.gpbSentido.TabIndex = 80; this.gpbSentido.TabIndex = 80;
this.gpbSentido.TabStop = false; this.gpbSentido.TabStop = false;
this.gpbSentido.Text = "Sentido de giro"; this.gpbSentido.Text = "Sentido de giro";
@ -113,32 +113,39 @@ namespace AgroBase.Forms.Direcional
// //
this.gpbDF.Controls.Add(this.label2); this.gpbDF.Controls.Add(this.label2);
this.gpbDF.Controls.Add(this.txtDFEndereco); this.gpbDF.Controls.Add(this.txtDFEndereco);
this.gpbDF.Controls.Add(this.chbDFControlar);
this.gpbDF.Controls.Add(this.nudDFOffset); this.gpbDF.Controls.Add(this.nudDFOffset);
this.gpbDF.Controls.Add(this.lblDFOffset); this.gpbDF.Controls.Add(this.lblDFOffset);
this.gpbDF.Controls.Add(this.cmbDFDireita); this.gpbDF.Controls.Add(this.cmbDFDireita);
this.gpbDF.Controls.Add(this.cmbDFEsquerda); this.gpbDF.Controls.Add(this.cmbDFEsquerda);
this.gpbDF.Controls.Add(this.lblDFEsquerda); this.gpbDF.Controls.Add(this.lblDFEsquerda);
this.gpbDF.Controls.Add(this.lblDFDireita); this.gpbDF.Controls.Add(this.lblDFDireita);
this.gpbDF.Location = new System.Drawing.Point(196, 21); this.gpbDF.Location = new System.Drawing.Point(195, 60);
this.gpbDF.Margin = new System.Windows.Forms.Padding(2); this.gpbDF.Margin = new System.Windows.Forms.Padding(2);
this.gpbDF.Name = "gpbDF"; this.gpbDF.Name = "gpbDF";
this.gpbDF.Padding = new System.Windows.Forms.Padding(2); this.gpbDF.Padding = new System.Windows.Forms.Padding(2);
this.gpbDF.Size = new System.Drawing.Size(168, 150); this.gpbDF.Size = new System.Drawing.Size(168, 129);
this.gpbDF.TabIndex = 9; this.gpbDF.TabIndex = 9;
this.gpbDF.TabStop = false; this.gpbDF.TabStop = false;
this.gpbDF.Text = "M4 - Direito Frente (DF)"; this.gpbDF.Text = "M4 - Direito Frente (DF)";
// //
// chbDFControlar // label2
// //
this.chbDFControlar.AutoSize = true; this.label2.AutoSize = true;
this.chbDFControlar.Location = new System.Drawing.Point(12, 127); this.label2.Location = new System.Drawing.Point(10, 101);
this.chbDFControlar.Margin = new System.Windows.Forms.Padding(2); this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.chbDFControlar.Name = "chbDFControlar"; this.label2.Name = "label2";
this.chbDFControlar.Size = new System.Drawing.Size(68, 17); this.label2.Size = new System.Drawing.Size(53, 13);
this.chbDFControlar.TabIndex = 14; this.label2.TabIndex = 16;
this.chbDFControlar.Text = "Controlar"; this.label2.Text = "Endereço";
this.chbDFControlar.UseVisualStyleBackColor = true; //
// txtDFEndereco
//
this.txtDFEndereco.Location = new System.Drawing.Point(66, 98);
this.txtDFEndereco.Margin = new System.Windows.Forms.Padding(2);
this.txtDFEndereco.Name = "txtDFEndereco";
this.txtDFEndereco.Size = new System.Drawing.Size(92, 20);
this.txtDFEndereco.TabIndex = 15;
this.txtDFEndereco.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
// //
// nudDFOffset // nudDFOffset
// //
@ -211,32 +218,39 @@ namespace AgroBase.Forms.Direcional
// //
this.gpbEF.Controls.Add(this.label4); this.gpbEF.Controls.Add(this.label4);
this.gpbEF.Controls.Add(this.txtEFEndereco); this.gpbEF.Controls.Add(this.txtEFEndereco);
this.gpbEF.Controls.Add(this.chbEFControlar);
this.gpbEF.Controls.Add(this.nudEFOffset); this.gpbEF.Controls.Add(this.nudEFOffset);
this.gpbEF.Controls.Add(this.lblEFOffset); this.gpbEF.Controls.Add(this.lblEFOffset);
this.gpbEF.Controls.Add(this.cmbEFDireita); this.gpbEF.Controls.Add(this.cmbEFDireita);
this.gpbEF.Controls.Add(this.cmbEFEsquerda); this.gpbEF.Controls.Add(this.cmbEFEsquerda);
this.gpbEF.Controls.Add(this.lblEFEsquerda); this.gpbEF.Controls.Add(this.lblEFEsquerda);
this.gpbEF.Controls.Add(this.lblEFDireita); this.gpbEF.Controls.Add(this.lblEFDireita);
this.gpbEF.Location = new System.Drawing.Point(14, 21); this.gpbEF.Location = new System.Drawing.Point(13, 60);
this.gpbEF.Margin = new System.Windows.Forms.Padding(2); this.gpbEF.Margin = new System.Windows.Forms.Padding(2);
this.gpbEF.Name = "gpbEF"; this.gpbEF.Name = "gpbEF";
this.gpbEF.Padding = new System.Windows.Forms.Padding(2); this.gpbEF.Padding = new System.Windows.Forms.Padding(2);
this.gpbEF.Size = new System.Drawing.Size(168, 150); this.gpbEF.Size = new System.Drawing.Size(168, 129);
this.gpbEF.TabIndex = 9; this.gpbEF.TabIndex = 9;
this.gpbEF.TabStop = false; this.gpbEF.TabStop = false;
this.gpbEF.Text = "M2 - Esquerdo Frente (EF)"; this.gpbEF.Text = "M2 - Esquerdo Frente (EF)";
// //
// chbEFControlar // label4
// //
this.chbEFControlar.AutoSize = true; this.label4.AutoSize = true;
this.chbEFControlar.Location = new System.Drawing.Point(12, 127); this.label4.Location = new System.Drawing.Point(10, 101);
this.chbEFControlar.Margin = new System.Windows.Forms.Padding(2); this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.chbEFControlar.Name = "chbEFControlar"; this.label4.Name = "label4";
this.chbEFControlar.Size = new System.Drawing.Size(68, 17); this.label4.Size = new System.Drawing.Size(53, 13);
this.chbEFControlar.TabIndex = 14; this.label4.TabIndex = 18;
this.chbEFControlar.Text = "Controlar"; this.label4.Text = "Endereço";
this.chbEFControlar.UseVisualStyleBackColor = true; //
// txtEFEndereco
//
this.txtEFEndereco.Location = new System.Drawing.Point(66, 98);
this.txtEFEndereco.Margin = new System.Windows.Forms.Padding(2);
this.txtEFEndereco.Name = "txtEFEndereco";
this.txtEFEndereco.Size = new System.Drawing.Size(92, 20);
this.txtEFEndereco.TabIndex = 17;
this.txtEFEndereco.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
// //
// nudEFOffset // nudEFOffset
// //
@ -309,32 +323,39 @@ namespace AgroBase.Forms.Direcional
// //
this.gpbDT.Controls.Add(this.label3); this.gpbDT.Controls.Add(this.label3);
this.gpbDT.Controls.Add(this.txtDTEndereco); this.gpbDT.Controls.Add(this.txtDTEndereco);
this.gpbDT.Controls.Add(this.chbDTControlar);
this.gpbDT.Controls.Add(this.nudDTOffset); this.gpbDT.Controls.Add(this.nudDTOffset);
this.gpbDT.Controls.Add(this.lblDTOffset); this.gpbDT.Controls.Add(this.lblDTOffset);
this.gpbDT.Controls.Add(this.cmbDTDireita); this.gpbDT.Controls.Add(this.cmbDTDireita);
this.gpbDT.Controls.Add(this.cmbDTEsquerda); this.gpbDT.Controls.Add(this.cmbDTEsquerda);
this.gpbDT.Controls.Add(this.lblDTEsquerda); this.gpbDT.Controls.Add(this.lblDTEsquerda);
this.gpbDT.Controls.Add(this.lblDTDireita); this.gpbDT.Controls.Add(this.lblDTDireita);
this.gpbDT.Location = new System.Drawing.Point(196, 184); this.gpbDT.Location = new System.Drawing.Point(195, 193);
this.gpbDT.Margin = new System.Windows.Forms.Padding(2); this.gpbDT.Margin = new System.Windows.Forms.Padding(2);
this.gpbDT.Name = "gpbDT"; this.gpbDT.Name = "gpbDT";
this.gpbDT.Padding = new System.Windows.Forms.Padding(2); this.gpbDT.Padding = new System.Windows.Forms.Padding(2);
this.gpbDT.Size = new System.Drawing.Size(168, 150); this.gpbDT.Size = new System.Drawing.Size(168, 129);
this.gpbDT.TabIndex = 9; this.gpbDT.TabIndex = 9;
this.gpbDT.TabStop = false; this.gpbDT.TabStop = false;
this.gpbDT.Text = "M3 - Direito Trás (DT)"; this.gpbDT.Text = "M3 - Direito Trás (DT)";
// //
// chbDTControlar // label3
// //
this.chbDTControlar.AutoSize = true; this.label3.AutoSize = true;
this.chbDTControlar.Location = new System.Drawing.Point(12, 127); this.label3.Location = new System.Drawing.Point(10, 101);
this.chbDTControlar.Margin = new System.Windows.Forms.Padding(2); this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.chbDTControlar.Name = "chbDTControlar"; this.label3.Name = "label3";
this.chbDTControlar.Size = new System.Drawing.Size(68, 17); this.label3.Size = new System.Drawing.Size(53, 13);
this.chbDTControlar.TabIndex = 12; this.label3.TabIndex = 14;
this.chbDTControlar.Text = "Controlar"; this.label3.Text = "Endereço";
this.chbDTControlar.UseVisualStyleBackColor = true; //
// txtDTEndereco
//
this.txtDTEndereco.Location = new System.Drawing.Point(66, 98);
this.txtDTEndereco.Margin = new System.Windows.Forms.Padding(2);
this.txtDTEndereco.Name = "txtDTEndereco";
this.txtDTEndereco.Size = new System.Drawing.Size(92, 20);
this.txtDTEndereco.TabIndex = 13;
this.txtDTEndereco.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
// //
// nudDTOffset // nudDTOffset
// //
@ -407,32 +428,39 @@ namespace AgroBase.Forms.Direcional
// //
this.gpbET.Controls.Add(this.label1); this.gpbET.Controls.Add(this.label1);
this.gpbET.Controls.Add(this.txtETEndereco); this.gpbET.Controls.Add(this.txtETEndereco);
this.gpbET.Controls.Add(this.chbETControlar);
this.gpbET.Controls.Add(this.nudETOffset); this.gpbET.Controls.Add(this.nudETOffset);
this.gpbET.Controls.Add(this.lblETOffset); this.gpbET.Controls.Add(this.lblETOffset);
this.gpbET.Controls.Add(this.cmbETDireita); this.gpbET.Controls.Add(this.cmbETDireita);
this.gpbET.Controls.Add(this.cmbETEsquerda); this.gpbET.Controls.Add(this.cmbETEsquerda);
this.gpbET.Controls.Add(this.lblETEsquerda); this.gpbET.Controls.Add(this.lblETEsquerda);
this.gpbET.Controls.Add(this.lblETDireita); this.gpbET.Controls.Add(this.lblETDireita);
this.gpbET.Location = new System.Drawing.Point(14, 184); this.gpbET.Location = new System.Drawing.Point(13, 193);
this.gpbET.Margin = new System.Windows.Forms.Padding(2); this.gpbET.Margin = new System.Windows.Forms.Padding(2);
this.gpbET.Name = "gpbET"; this.gpbET.Name = "gpbET";
this.gpbET.Padding = new System.Windows.Forms.Padding(2); this.gpbET.Padding = new System.Windows.Forms.Padding(2);
this.gpbET.Size = new System.Drawing.Size(168, 150); this.gpbET.Size = new System.Drawing.Size(168, 129);
this.gpbET.TabIndex = 0; this.gpbET.TabIndex = 0;
this.gpbET.TabStop = false; this.gpbET.TabStop = false;
this.gpbET.Text = "M1 - Esquerdo Trás (ET)"; this.gpbET.Text = "M1 - Esquerdo Trás (ET)";
// //
// chbETControlar // label1
// //
this.chbETControlar.AutoSize = true; this.label1.AutoSize = true;
this.chbETControlar.Location = new System.Drawing.Point(12, 127); this.label1.Location = new System.Drawing.Point(10, 101);
this.chbETControlar.Margin = new System.Windows.Forms.Padding(2); this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.chbETControlar.Name = "chbETControlar"; this.label1.Name = "label1";
this.chbETControlar.Size = new System.Drawing.Size(68, 17); this.label1.Size = new System.Drawing.Size(53, 13);
this.chbETControlar.TabIndex = 14; this.label1.TabIndex = 16;
this.chbETControlar.Text = "Controlar"; this.label1.Text = "Endereço";
this.chbETControlar.UseVisualStyleBackColor = true; //
// txtETEndereco
//
this.txtETEndereco.Location = new System.Drawing.Point(66, 98);
this.txtETEndereco.Margin = new System.Windows.Forms.Padding(2);
this.txtETEndereco.Name = "txtETEndereco";
this.txtETEndereco.Size = new System.Drawing.Size(92, 20);
this.txtETEndereco.TabIndex = 15;
this.txtETEndereco.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
// //
// nudETOffset // nudETOffset
// //
@ -501,81 +529,24 @@ namespace AgroBase.Forms.Direcional
this.lblETDireita.TabIndex = 2; this.lblETDireita.TabIndex = 2;
this.lblETDireita.Text = "Direita"; this.lblETDireita.Text = "Direita";
// //
// label3 // cmbTipoMovimento
// //
this.label3.AutoSize = true; this.cmbTipoMovimento.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.label3.Location = new System.Drawing.Point(10, 101); this.cmbTipoMovimento.FormattingEnabled = true;
this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.cmbTipoMovimento.Location = new System.Drawing.Point(195, 18);
this.label3.Name = "label3"; this.cmbTipoMovimento.Name = "cmbTipoMovimento";
this.label3.Size = new System.Drawing.Size(53, 13); this.cmbTipoMovimento.Size = new System.Drawing.Size(168, 21);
this.label3.TabIndex = 14; this.cmbTipoMovimento.TabIndex = 13;
this.label3.Text = "Endereço"; this.cmbTipoMovimento.SelectedIndexChanged += new System.EventHandler(this.cmbTipoMovimento_SelectedIndexChanged);
// //
// txtDTEndereco // lblTipoMovimento
// //
this.txtDTEndereco.Location = new System.Drawing.Point(66, 98); this.lblTipoMovimento.AutoSize = true;
this.txtDTEndereco.Margin = new System.Windows.Forms.Padding(2); this.lblTipoMovimento.Location = new System.Drawing.Point(15, 21);
this.txtDTEndereco.Name = "txtDTEndereco"; this.lblTipoMovimento.Name = "lblTipoMovimento";
this.txtDTEndereco.Size = new System.Drawing.Size(92, 20); this.lblTipoMovimento.Size = new System.Drawing.Size(98, 13);
this.txtDTEndereco.TabIndex = 13; this.lblTipoMovimento.TabIndex = 12;
this.txtDTEndereco.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.lblTipoMovimento.Text = "Tipo de Movimento";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(10, 101);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(53, 13);
this.label1.TabIndex = 16;
this.label1.Text = "Endereço";
//
// txtETEndereco
//
this.txtETEndereco.Location = new System.Drawing.Point(66, 98);
this.txtETEndereco.Margin = new System.Windows.Forms.Padding(2);
this.txtETEndereco.Name = "txtETEndereco";
this.txtETEndereco.Size = new System.Drawing.Size(92, 20);
this.txtETEndereco.TabIndex = 15;
this.txtETEndereco.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(10, 101);
this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 13);
this.label2.TabIndex = 16;
this.label2.Text = "Endereço";
//
// txtDFEndereco
//
this.txtDFEndereco.Location = new System.Drawing.Point(66, 98);
this.txtDFEndereco.Margin = new System.Windows.Forms.Padding(2);
this.txtDFEndereco.Name = "txtDFEndereco";
this.txtDFEndereco.Size = new System.Drawing.Size(92, 20);
this.txtDFEndereco.TabIndex = 15;
this.txtDFEndereco.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(10, 101);
this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(53, 13);
this.label4.TabIndex = 18;
this.label4.Text = "Endereço";
//
// txtEFEndereco
//
this.txtEFEndereco.Location = new System.Drawing.Point(66, 98);
this.txtEFEndereco.Margin = new System.Windows.Forms.Padding(2);
this.txtEFEndereco.Name = "txtEFEndereco";
this.txtEFEndereco.Size = new System.Drawing.Size(92, 20);
this.txtEFEndereco.TabIndex = 17;
this.txtEFEndereco.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
// //
// frmDirConfig // frmDirConfig
// //
@ -591,6 +562,7 @@ namespace AgroBase.Forms.Direcional
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmDirConfig_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmDirConfig_FormClosing);
this.Load += new System.EventHandler(this.frmDirConfig_Load); this.Load += new System.EventHandler(this.frmDirConfig_Load);
this.gpbSentido.ResumeLayout(false); this.gpbSentido.ResumeLayout(false);
this.gpbSentido.PerformLayout();
this.gpbDF.ResumeLayout(false); this.gpbDF.ResumeLayout(false);
this.gpbDF.PerformLayout(); this.gpbDF.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudDFOffset)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nudDFOffset)).EndInit();
@ -638,10 +610,6 @@ namespace AgroBase.Forms.Direcional
private System.Windows.Forms.Label lblDTOffset; private System.Windows.Forms.Label lblDTOffset;
private System.Windows.Forms.NumericUpDown nudETOffset; private System.Windows.Forms.NumericUpDown nudETOffset;
private System.Windows.Forms.Label lblETOffset; private System.Windows.Forms.Label lblETOffset;
private System.Windows.Forms.CheckBox chbDFControlar;
private System.Windows.Forms.CheckBox chbEFControlar;
private System.Windows.Forms.CheckBox chbDTControlar;
private System.Windows.Forms.CheckBox chbETControlar;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtDTEndereco; private System.Windows.Forms.TextBox txtDTEndereco;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
@ -650,5 +618,7 @@ namespace AgroBase.Forms.Direcional
private System.Windows.Forms.TextBox txtEFEndereco; private System.Windows.Forms.TextBox txtEFEndereco;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtETEndereco; private System.Windows.Forms.TextBox txtETEndereco;
private System.Windows.Forms.ComboBox cmbTipoMovimento;
private System.Windows.Forms.Label lblTipoMovimento;
} }
} }

View File

@ -11,7 +11,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Forms.Direcional namespace AgroBase.Forms.Direcional
{ {
@ -31,6 +31,15 @@ namespace AgroBase.Forms.Direcional
return; return;
} }
cmbTipoMovimento.Items.Clear();
cmbTipoMovimento.Items.AddRange(Enum.GetNames(typeof(TipoMovimentoDirecional)));
cmbTipoMovimento.SelectedIndex = (int)Variaveis.OperacaoEmAndamento.Controle.TipoMovimento;
AtualizarConfiguracaoSentido();
}
private void AtualizarConfiguracaoSentido()
{
var cmbsSentido = gpbET.Controls.OfType<ComboBox>().ToList().Union(gpbEF.Controls.OfType<ComboBox>().ToList()).Union(gpbDT.Controls.OfType<ComboBox>().ToList()).Union(gpbDF.Controls.OfType<ComboBox>().ToList()).ToList(); var cmbsSentido = gpbET.Controls.OfType<ComboBox>().ToList().Union(gpbEF.Controls.OfType<ComboBox>().ToList()).Union(gpbDT.Controls.OfType<ComboBox>().ToList()).Union(gpbDF.Controls.OfType<ComboBox>().ToList()).ToList();
foreach (var cmb in cmbsSentido) foreach (var cmb in cmbsSentido)
{ {
@ -44,19 +53,19 @@ namespace AgroBase.Forms.Direcional
Sentido sentido = Sentido.Parado; Sentido sentido = Sentido.Parado;
if (cmb.Name.Contains("Frente")) if (cmb.Name.Contains("Frente"))
{ {
sentido = Modulo.DirMotor.ConfigSentidos.Frente; sentido = Modulo.DirMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Frente;
} }
else if (cmb.Name.Contains("Tras")) else if (cmb.Name.Contains("Tras"))
{ {
sentido = Modulo.DirMotor.ConfigSentidos.Tras; sentido = Modulo.DirMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Tras;
} }
else if (cmb.Name.Contains("Esquerda")) else if (cmb.Name.Contains("Esquerda"))
{ {
sentido = Modulo.DirMotor.ConfigSentidos.Esquerda; sentido = Modulo.DirMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Esquerda;
} }
else if (cmb.Name.Contains("Direita")) else if (cmb.Name.Contains("Direita"))
{ {
sentido = Modulo.DirMotor.ConfigSentidos.Direita; sentido = Modulo.DirMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Direita;
} }
cmb.SelectedItem = Enum.GetName(typeof(Sentido), sentido); cmb.SelectedItem = Enum.GetName(typeof(Sentido), sentido);
@ -66,11 +75,7 @@ namespace AgroBase.Forms.Direcional
NumericUpDown nudOffset = FuncoesGlobais.FindControlRecursive<NumericUpDown>(gpbSentido, "nud" + Modulo.Modulo_ID + "Offset"); NumericUpDown nudOffset = FuncoesGlobais.FindControlRecursive<NumericUpDown>(gpbSentido, "nud" + Modulo.Modulo_ID + "Offset");
nudOffset.Value = Convert.ToInt32(Modulo.DirMotor.Angulo_Offset); nudOffset.Value = Convert.ToInt32(Modulo.DirMotor.Angulo_Offset);
CheckBox chbComandar = FuncoesGlobais.FindControlRecursive<CheckBox>(gpbSentido, "chb" + Modulo.Modulo_ID + "Controlar");
chbComandar.Checked = Modulo.DirMotor.Comandar;
} }
} }
} }
@ -91,19 +96,19 @@ namespace AgroBase.Forms.Direcional
Sentido sentido = (Sentido)cmb.SelectedIndex; Sentido sentido = (Sentido)cmb.SelectedIndex;
if (cmb.Name.Contains("Frente")) if (cmb.Name.Contains("Frente"))
{ {
Modulo.DirMotor.ConfigSentidos.Frente = sentido; Modulo.DirMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Frente = sentido;
} }
else if (cmb.Name.Contains("Tras")) else if (cmb.Name.Contains("Tras"))
{ {
Modulo.DirMotor.ConfigSentidos.Tras = sentido; Modulo.DirMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Tras = sentido;
} }
else if (cmb.Name.Contains("Esquerda")) else if (cmb.Name.Contains("Esquerda"))
{ {
Modulo.DirMotor.ConfigSentidos.Esquerda = sentido; Modulo.DirMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Esquerda = sentido;
} }
else if (cmb.Name.Contains("Direita")) else if (cmb.Name.Contains("Direita"))
{ {
Modulo.DirMotor.ConfigSentidos.Direita = sentido; Modulo.DirMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Direita = sentido;
} }
TextBox txtEndereco = FuncoesGlobais.FindControlRecursive<TextBox>(gpbSentido, "txt" + Modulo.Modulo_ID + "Endereco"); TextBox txtEndereco = FuncoesGlobais.FindControlRecursive<TextBox>(gpbSentido, "txt" + Modulo.Modulo_ID + "Endereco");
@ -111,15 +116,16 @@ namespace AgroBase.Forms.Direcional
NumericUpDown nudOffset = FuncoesGlobais.FindControlRecursive<NumericUpDown>(gpbSentido, "nud" + Modulo.Modulo_ID + "Offset"); NumericUpDown nudOffset = FuncoesGlobais.FindControlRecursive<NumericUpDown>(gpbSentido, "nud" + Modulo.Modulo_ID + "Offset");
Modulo.DirMotor.Angulo_Offset = Convert.ToDouble(nudOffset.Value); Modulo.DirMotor.Angulo_Offset = Convert.ToDouble(nudOffset.Value);
CheckBox chbComandar = FuncoesGlobais.FindControlRecursive<CheckBox>(gpbSentido, "chb" + Modulo.Modulo_ID + "Controlar");
Modulo.DirMotor.Comandar = chbComandar.Checked;
} }
} }
Disp.SalvarParametros(Disp.Dados); Disp.SalvarParametros(Disp.Dados);
} }
private void cmbTipoMovimento_SelectedIndexChanged(object sender, EventArgs e)
{
Variaveis.OperacaoEmAndamento.Controle.TipoMovimento = (TipoMovimentoDirecional)cmbTipoMovimento.SelectedIndex;
AtualizarConfiguracaoSentido();
}
} }
} }

View File

@ -9,7 +9,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Forms.Direcional namespace AgroBase.Forms.Direcional
{ {

View File

@ -16,7 +16,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting; using System.Windows.Forms.DataVisualization.Charting;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Forms.IHM namespace AgroBase.Forms.IHM
{ {
@ -72,8 +72,7 @@ namespace AgroBase.Forms.IHM
await IniciarDiagnostico(tabControl1.SelectedIndex); await IniciarDiagnostico(tabControl1.SelectedIndex);
tabControl1.SelectedIndex = 6; tabControl1.SelectedIndex = 6;
await IniciarDiagnostico(tabControl1.SelectedIndex); await IniciarDiagnostico(tabControl1.SelectedIndex);
tabControl1.SelectedIndex = 7; FinalizarDiagnostico();
AualizarDadosTabelaResultado(dgResultados);
picLoading.Image = null; picLoading.Image = null;
@ -93,6 +92,7 @@ namespace AgroBase.Forms.IHM
picLoading.Image = Properties.Resources.loading; picLoading.Image = Properties.Resources.loading;
bool Sucesso = await IniciarDiagnostico(tabControl1.SelectedIndex); bool Sucesso = await IniciarDiagnostico(tabControl1.SelectedIndex);
FinalizarDiagnostico();
picLoading.Image = null; picLoading.Image = null;
@ -232,6 +232,12 @@ namespace AgroBase.Forms.IHM
return Sucesso; return Sucesso;
} }
private void FinalizarDiagnostico()
{
tabControl1.SelectedIndex = 7;
AualizarDadosTabelaResultado(dgResultados);
}
#region TABELAS #region TABELAS
private int PreencheDadosLinha(DataGridView grid, List<ColunasDiagnosticoModel> Testes, int idx, double Valor) private int PreencheDadosLinha(DataGridView grid, List<ColunasDiagnosticoModel> Testes, int idx, double Valor)
@ -353,10 +359,10 @@ namespace AgroBase.Forms.IHM
var grid = Diagnostico.grid; var grid = Diagnostico.grid;
var Testes = Diagnostico.Testes; var Testes = Diagnostico.Testes;
bool Conectado = SerialService.DispositivosMapeados.Any(x => x.Dispositivo == Enuns.T_Code.Atu); bool Conectado = SerialService.DispositivosMapeados.Any(x => x.Dispositivo == Enums.T_Code.Atu);
idx = PreencheDadosLinha(grid, Testes, idx, Conectado ? 1 : 0); idx = PreencheDadosLinha(grid, Testes, idx, Conectado ? 1 : 0);
DispositivosService<AtuadorModel> Dispositivo = (DispositivosService<AtuadorModel>)Variaveis.DispositivosConectados.FirstOrDefault(x => x.Dispositivo == Enuns.T_Code.Atu); DispositivosService<AtuadorModel> Dispositivo = (DispositivosService<AtuadorModel>)Variaveis.DispositivosConectados.FirstOrDefault(x => x.Dispositivo == Enums.T_Code.Atu);
bool Inicializado = Dispositivo != null && Dispositivo.Dados.Conectado; bool Inicializado = Dispositivo != null && Dispositivo.Dados.Conectado;
idx = PreencheDadosLinha(grid, Testes, idx, Inicializado ? 1 : 0); idx = PreencheDadosLinha(grid, Testes, idx, Inicializado ? 1 : 0);
@ -364,15 +370,15 @@ namespace AgroBase.Forms.IHM
bool BombaInicializado = Bomba.Inicializado; bool BombaInicializado = Bomba.Inicializado;
idx = PreencheDadosLinha(grid, Testes, idx, BombaInicializado ? 1 : 0); idx = PreencheDadosLinha(grid, Testes, idx, BombaInicializado ? 1 : 0);
SensorModel sMAS = Dispositivo.Dados.Sensores.FirstOrDefault(x => x.Componente == Enuns.S_Code.sMAS); SensorModel sMAS = Dispositivo.Dados.Sensores.FirstOrDefault(x => x.Componente == Enums.S_Code.sMAS);
bool MassaInicializado = sMAS != null ? sMAS.Inicializado : false; bool MassaInicializado = sMAS != null ? sMAS.Inicializado : false;
idx = PreencheDadosLinha(grid, Testes, idx, MassaInicializado ? 1 : 0); idx = PreencheDadosLinha(grid, Testes, idx, MassaInicializado ? 1 : 0);
SensorModel sPRS = Dispositivo.Dados.Sensores.FirstOrDefault(x => x.Componente == Enuns.S_Code.sPRS); SensorModel sPRS = Dispositivo.Dados.Sensores.FirstOrDefault(x => x.Componente == Enums.S_Code.sPRS);
bool PressaoInicializado = sPRS != null ? sPRS.Inicializado : false; bool PressaoInicializado = sPRS != null ? sPRS.Inicializado : false;
idx = PreencheDadosLinha(grid, Testes, idx, PressaoInicializado ? 1 : 0); idx = PreencheDadosLinha(grid, Testes, idx, PressaoInicializado ? 1 : 0);
SensorModel sFLX = Dispositivo.Dados.Sensores.FirstOrDefault(x => x.Componente == Enuns.S_Code.sFLX); SensorModel sFLX = Dispositivo.Dados.Sensores.FirstOrDefault(x => x.Componente == Enums.S_Code.sFLX);
bool FluxoInicializado = sFLX != null ? sFLX.Inicializado : false; bool FluxoInicializado = sFLX != null ? sFLX.Inicializado : false;
idx = PreencheDadosLinha(grid, Testes, idx, FluxoInicializado ? 1 : 0); idx = PreencheDadosLinha(grid, Testes, idx, FluxoInicializado ? 1 : 0);
@ -393,7 +399,7 @@ namespace AgroBase.Forms.IHM
idx = PreencheDadosLinha(grid, Testes, idx, B04Inicializado ? 1 : 0); idx = PreencheDadosLinha(grid, Testes, idx, B04Inicializado ? 1 : 0);
await EnviarComandoBomba(Dispositivo, Bomba, true, 5000); await EnviarComandoBomba(true, 5000);
double Pressao = PressaoInicializado ? Dispositivo.Dados.PressaoLinha : -1; double Pressao = PressaoInicializado ? Dispositivo.Dados.PressaoLinha : -1;
idx = PreencheDadosLinha(grid, Testes, idx, Pressao); idx = PreencheDadosLinha(grid, Testes, idx, Pressao);
@ -403,7 +409,7 @@ namespace AgroBase.Forms.IHM
idx = PreencheDadosLinha(grid, Testes, idx, Pressao); idx = PreencheDadosLinha(grid, Testes, idx, Pressao);
await EnviarComandoBico(Dispositivo, B01, true, 1000); await EnviarComandoBico(B01, true, 1000);
double Fluxo = FluxoInicializado ? Dispositivo.Dados.VazaoFluxoMLpS : -1; double Fluxo = FluxoInicializado ? Dispositivo.Dados.VazaoFluxoMLpS : -1;
idx = PreencheDadosLinha(grid, Testes, idx, Fluxo); idx = PreencheDadosLinha(grid, Testes, idx, Fluxo);
@ -411,60 +417,58 @@ namespace AgroBase.Forms.IHM
bool statusB01_1 = B01 != null && B01.StatusBico; bool statusB01_1 = B01 != null && B01.StatusBico;
idx = PreencheDadosLinha(grid, Testes, idx, statusB01_1 ? 1 : 0); idx = PreencheDadosLinha(grid, Testes, idx, statusB01_1 ? 1 : 0);
await EnviarComandoBico(Dispositivo, B01, false, 1000); await EnviarComandoBico(B01, false, 1000);
bool statusB01_0 = B01 != null && B01.StatusBico; bool statusB01_0 = B01 != null && B01.StatusBico;
idx = PreencheDadosLinha(grid, Testes, idx, !statusB01_0 ? 0 : 1); idx = PreencheDadosLinha(grid, Testes, idx, !statusB01_0 ? 0 : 1);
await EnviarComandoBico(Dispositivo, B02, true, 1000); await EnviarComandoBico(B02, true, 1000);
bool statusB02_1 = B02 != null && B02.StatusBico; bool statusB02_1 = B02 != null && B02.StatusBico;
idx = PreencheDadosLinha(grid, Testes, idx, statusB02_1 ? 1 : 0); idx = PreencheDadosLinha(grid, Testes, idx, statusB02_1 ? 1 : 0);
await EnviarComandoBico(Dispositivo, B02, false, 1000); await EnviarComandoBico(B02, false, 1000);
bool statusB02_0 = B02 != null && B02.StatusBico; bool statusB02_0 = B02 != null && B02.StatusBico;
idx = PreencheDadosLinha(grid, Testes, idx, !statusB02_0 ? 0 : 1); idx = PreencheDadosLinha(grid, Testes, idx, !statusB02_0 ? 0 : 1);
await EnviarComandoBico(Dispositivo, B03, true, 1000); await EnviarComandoBico(B03, true, 1000);
bool statusB03_1 = B03 != null && B03.StatusBico; bool statusB03_1 = B03 != null && B03.StatusBico;
idx = PreencheDadosLinha(grid, Testes, idx, statusB03_1 ? 1 : 0); idx = PreencheDadosLinha(grid, Testes, idx, statusB03_1 ? 1 : 0);
await EnviarComandoBico(Dispositivo, B03, false, 1000); await EnviarComandoBico(B03, false, 1000);
bool statusB03_0 = B03 != null && B03.StatusBico; bool statusB03_0 = B03 != null && B03.StatusBico;
idx = PreencheDadosLinha(grid, Testes, idx, !statusB03_0 ? 0 : 1); idx = PreencheDadosLinha(grid, Testes, idx, !statusB03_0 ? 0 : 1);
await EnviarComandoBico(Dispositivo, B04, true, 1000); await EnviarComandoBico(B04, true, 1000);
bool statusB04_1 = B04 != null && B04.StatusBico; bool statusB04_1 = B04 != null && B04.StatusBico;
idx = PreencheDadosLinha(grid, Testes, idx, statusB04_1 ? 1 : 0); idx = PreencheDadosLinha(grid, Testes, idx, statusB04_1 ? 1 : 0);
await EnviarComandoBico(Dispositivo, B04, false, 1000); await EnviarComandoBico(B04, false, 1000);
bool statusB04_0 = B04 != null && B04.StatusBico; bool statusB04_0 = B04 != null && B04.StatusBico;
idx = PreencheDadosLinha(grid, Testes, idx, !statusB04_0 ? 0 : 1); idx = PreencheDadosLinha(grid, Testes, idx, !statusB04_0 ? 0 : 1);
await EnviarComandoBomba(Dispositivo, Bomba, false, 500); await EnviarComandoBomba(false, 500);
return true; return true;
} }
private async Task EnviarComandoBomba(DispositivosService<AtuadorModel> Dispositivo, AtuadorBombaModel Bomba, bool Ligar, int Delay) private async Task EnviarComandoBomba(bool Ligar, int Delay)
{ {
Variaveis.OperacaoEmAndamento.Controle.PressaoLinha = 85; Variaveis.OperacaoEmAndamento.Controle.PressaoLinha = 85;
Bomba.BombaAtuada = Ligar; GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, Ligar);
Dispositivo.AdicionarMensagemFila(Dispositivo.Dados.Modulo_ID, Bomba.ProtocoloComando(), true, false);
await Task.Delay(Delay); await Task.Delay(Delay);
} }
private async Task EnviarComandoBico(DispositivosService<AtuadorModel> Dispositivo, AtuadorBicoModel Bico, bool Ligar, int Delay) private async Task EnviarComandoBico(AtuadorBicoModel Bico, bool Ligar, int Delay)
{ {
Bico.Atuado = Ligar; GeneralJoystick.EnviarComandoAtuador(S_Code.sBIC, Ligar, Bico.ID);
Dispositivo.AdicionarMensagemFila(Dispositivo.Dados.Modulo_ID, Bico.ProtocoloComando(), true, false);
await Task.Delay(Delay); await Task.Delay(Delay);
} }
@ -568,6 +572,18 @@ namespace AgroBase.Forms.IHM
Teste = "Parado", Teste = "Parado",
ValorPadrao = 0 ValorPadrao = 0
}, },
new ColunasDiagnosticoModel()
{
Componente = x.Modulo_ID + " Servo Freio",
Teste = "Ativar",
ValorPadrao = VariaveisEquipamento.AnguloFreio[AcaoFreio.Ativar]
},
new ColunasDiagnosticoModel()
{
Componente = x.Modulo_ID + " Servo Freio",
Teste = "Desativar",
ValorPadrao = VariaveisEquipamento.AnguloFreio[AcaoFreio.Desativar]
},
})); }));
Diagnostico.Testes = Testes; Diagnostico.Testes = Testes;
@ -581,7 +597,7 @@ namespace AgroBase.Forms.IHM
var grid = Diagnostico.grid; var grid = Diagnostico.grid;
var Testes = Diagnostico.Testes; var Testes = Diagnostico.Testes;
DispositivosService<MovimentacaoUnificadaModel> Dispositivo = (DispositivosService<MovimentacaoUnificadaModel>)Variaveis.DispositivosConectados.FirstOrDefault(x => x.Dispositivo == Enuns.T_Code.Mvd); DispositivosService<MovimentacaoUnificadaModel> Dispositivo = (DispositivosService<MovimentacaoUnificadaModel>)Variaveis.DispositivosConectados.FirstOrDefault(x => x.Dispositivo == Enums.T_Code.Mvd);
if (Dispositivo == null) if (Dispositivo == null)
{ {
@ -599,7 +615,7 @@ namespace AgroBase.Forms.IHM
foreach (var Modulo in Dispositivo.Dados.Modulos) foreach (var Modulo in Dispositivo.Dados.Modulos)
{ {
bool Conectado = SerialService.DispositivosMapeados.Any(x => x.Dispositivo == Enuns.T_Code.Bld && x.Mod_ID == Modulo.Modulo_ID); bool Conectado = SerialService.DispositivosMapeados.Any(x => x.Dispositivo == Enums.T_Code.Bld && x.Mod_ID == Modulo.Modulo_ID);
idx = PreencheDadosLinha(grid, Testes, idx, Conectado ? 1 : 0); idx = PreencheDadosLinha(grid, Testes, idx, Conectado ? 1 : 0);
bool Inicializado = Modulo.MovMotor.BLD_Inicializado; bool Inicializado = Modulo.MovMotor.BLD_Inicializado;
@ -622,16 +638,23 @@ namespace AgroBase.Forms.IHM
double CodigoErro = Inicializado ? Modulo.MovMotor.CodigoAlarme : -1; double CodigoErro = Inicializado ? Modulo.MovMotor.CodigoAlarme : -1;
idx = PreencheDadosLinha(grid, Testes, idx, CodigoErro); idx = PreencheDadosLinha(grid, Testes, idx, CodigoErro);
bool ParaFrente = Inicializado ? await EnviarComandoMov(Dispositivo, Modulo, Enuns.Direcao.Frente, Testes[idx], 5000) : false; bool ParaFrente = Inicializado ? await EnviarComandoMov(Modulo, Enums.Direcao.Frente, Testes[idx], 5000) : false;
idx = PreencheDadosLinha(grid, Testes, idx, Inicializado ? Testes[idx].ValorAferido : -1); idx = PreencheDadosLinha(grid, Testes, idx, Inicializado ? Testes[idx].ValorAferido : -1);
bool Parado = Inicializado ? await EnviarComandoMov(Dispositivo, Modulo, Enuns.Direcao.Parado, Testes[idx], 5000) : false; bool Parado = Inicializado ? await EnviarComandoMov(Modulo, Enums.Direcao.Parado, Testes[idx], 5000) : false;
idx = PreencheDadosLinha(grid, Testes, idx, Inicializado ? Testes[idx].ValorAferido : -1); idx = PreencheDadosLinha(grid, Testes, idx, Inicializado ? Testes[idx].ValorAferido : -1);
bool ParaTras = Inicializado ? await EnviarComandoMov(Dispositivo, Modulo, Enuns.Direcao.Tras, Testes[idx], 5000) : false; bool ParaTras = Inicializado ? await EnviarComandoMov(Modulo, Enums.Direcao.Tras, Testes[idx], 5000) : false;
idx = PreencheDadosLinha(grid, Testes, idx, Inicializado ? Testes[idx].ValorAferido : -1); idx = PreencheDadosLinha(grid, Testes, idx, Inicializado ? Testes[idx].ValorAferido : -1);
Parado = Inicializado ? await EnviarComandoMov(Dispositivo, Modulo, Enuns.Direcao.Parado, Testes[idx], 5000) : false; Parado = Inicializado ? await EnviarComandoMov(Modulo, Enums.Direcao.Parado, Testes[idx], 5000) : false;
idx = PreencheDadosLinha(grid, Testes, idx, Inicializado ? Testes[idx].ValorAferido : -1);
var ServoFreio = Modulo_Sen.Servos.FirstOrDefault(x => x.ID.Contains(Modulo.Modulo_ID) && x.Inicializado);
bool AtivarFreio = SenIniciado && ServoFreio != null ? await EnviarComandoMovFreio(Variaveis.OperacaoEmAndamento.DispSen, ServoFreio, AcaoFreio.Ativar, Testes[idx], 2000) : false;
idx = PreencheDadosLinha(grid, Testes, idx, Inicializado ? Testes[idx].ValorAferido : -1);
bool DesativarFreio = SenIniciado && ServoFreio != null ? await EnviarComandoMovFreio(Variaveis.OperacaoEmAndamento.DispSen, ServoFreio, AcaoFreio.Desativar, Testes[idx], 2000) : false;
idx = PreencheDadosLinha(grid, Testes, idx, Inicializado ? Testes[idx].ValorAferido : -1); idx = PreencheDadosLinha(grid, Testes, idx, Inicializado ? Testes[idx].ValorAferido : -1);
} }
@ -639,14 +662,14 @@ namespace AgroBase.Forms.IHM
return true; return true;
} }
private async Task<bool> EnviarComandoMov(DispositivosService<MovimentacaoUnificadaModel> Dispositivo, ModuloMvdModel Modulo, Enuns.Direcao Sentido, ColunasDiagnosticoModel Teste, int Timeout) private async Task<bool> EnviarComandoMov(ModuloMvdModel Modulo, Direcao Sentido, ColunasDiagnosticoModel Teste, int Timeout)
{ {
Variaveis.OperacaoEmAndamento.Controle.RPM_SP = 20; Variaveis.OperacaoEmAndamento.Controle.RPM_SP = 20;
bool oldCmd = Modulo.MovMotor.Comandar; Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.ForEach(x => x.MovMotor.Comandar = false);
Modulo.MovMotor.Comandar = true; Modulo.MovMotor.Comandar = true;
Dispositivo.AdicionarMensagemFila(Modulo.Modulo_ID, Modulo.MovMotor.ProtocoloComando(Sentido), true, false); GeneralJoystick.EnviaComandoMotor(Sentido == Direcao.Frente ? Keys.Up : Sentido == Direcao.Tras ? Keys.Down : Keys.Escape, T_Code.Mov);
DateTime Inicio = DateTime.Now; DateTime Inicio = DateTime.Now;
bool Sucesso = false; bool Sucesso = false;
@ -656,9 +679,9 @@ namespace AgroBase.Forms.IHM
bool sentidoCorreto = Sentido == Direcao.Parado ? true : bool sentidoCorreto = Sentido == Direcao.Parado ? true :
Modulo.MovMotor.Sentido == Modulo.MovMotor.Sentido ==
(Sentido == Enuns.Direcao.Frente ? Modulo.MovMotor.ConfigSentidos.Frente : (Sentido == Enums.Direcao.Frente ? Modulo.MovMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Frente :
Sentido == Enuns.Direcao.Tras ? Modulo.MovMotor.ConfigSentidos.Tras : Sentido == Enums.Direcao.Tras ? Modulo.MovMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Tras :
Enuns.Sentido.Parado); Enums.Sentido.Parado);
bool rpmCorreto = bool rpmCorreto =
Teste.ComplementoValorPadrao == "<" ? Modulo.MovMotor.RPM_Roda < Teste.ValorPadrao : Teste.ComplementoValorPadrao == "<" ? Modulo.MovMotor.RPM_Roda < Teste.ValorPadrao :
@ -670,7 +693,31 @@ namespace AgroBase.Forms.IHM
Teste.ValorAferido = Modulo.MovMotor.RPM_Roda; Teste.ValorAferido = Modulo.MovMotor.RPM_Roda;
Modulo.MovMotor.Comandar = oldCmd; return Sucesso;
}
private async Task<bool> EnviarComandoMovFreio(DispositivosService<SensoriamentoModel> Dispositivo, SensorServoModel ServoFreio, AcaoFreio Acao, ColunasDiagnosticoModel Teste, int Timeout)
{
Dispositivo.Dados.Servos.ForEach(x => x.Controlar = false);
ServoFreio.Controlar = true;
GeneralJoystick.EnviarComandoSensoriamento(S_Code.sFRO, ServoFreio.ID, Acao);
//Dispositivo.AdicionarMensagemFila(Dispositivo.Dados.Modulo_ID, ServoFreio.ProtocoloComando(), true, false);
DateTime Inicio = DateTime.Now;
bool Sucesso = false;
while (!Sucesso && Inicio.AddMilliseconds(Timeout) > DateTime.Now)
{
Dispositivo.Dados.RequisitarDadosComponente(ServoFreio.Componente, ServoFreio.ID);
await Task.Delay(1000);
Sucesso =
Teste.ComplementoValorPadrao == "<" ? ServoFreio._AnguloLeitura < Teste.ValorPadrao :
Teste.ComplementoValorPadrao == ">" ? ServoFreio._AnguloLeitura > Teste.ValorPadrao :
ServoFreio._AnguloLeitura == Teste.ValorPadrao;
}
Teste.ValorAferido = ServoFreio._AnguloLeitura;
return Sucesso; return Sucesso;
} }
@ -738,7 +785,7 @@ namespace AgroBase.Forms.IHM
var grid = Diagnostico.grid; var grid = Diagnostico.grid;
var Testes = Diagnostico.Testes; var Testes = Diagnostico.Testes;
DispositivosService<MovimentacaoUnificadaModel> Dispositivo = (DispositivosService<MovimentacaoUnificadaModel>)Variaveis.DispositivosConectados.FirstOrDefault(x => x.Dispositivo == Enuns.T_Code.Mvd); DispositivosService<MovimentacaoUnificadaModel> Dispositivo = (DispositivosService<MovimentacaoUnificadaModel>)Variaveis.DispositivosConectados.FirstOrDefault(x => x.Dispositivo == Enums.T_Code.Mvd);
if (Dispositivo == null) if (Dispositivo == null)
{ {
@ -749,7 +796,7 @@ namespace AgroBase.Forms.IHM
{ {
var Leitura = MKS057DService.DadosLeitura.FirstOrDefault(x => x.Endereco == Convert.ToByte(Modulo.DirMotor.Endereco, 16)); var Leitura = MKS057DService.DadosLeitura.FirstOrDefault(x => x.Endereco == Convert.ToByte(Modulo.DirMotor.Endereco, 16));
bool Conectado = SerialService.DispositivosMapeados.Any(x => x.Dispositivo == Enuns.T_Code.Mks && x.Mod_ID == Modulo.Modulo_ID); bool Conectado = SerialService.DispositivosMapeados.Any(x => x.Dispositivo == Enums.T_Code.Mks && x.Mod_ID == Modulo.Modulo_ID);
idx = PreencheDadosLinha(grid, Testes, idx, Conectado ? 1 : 0); idx = PreencheDadosLinha(grid, Testes, idx, Conectado ? 1 : 0);
bool Inicializado = Modulo.DirMotor.MKS_Inicializado; bool Inicializado = Modulo.DirMotor.MKS_Inicializado;
@ -758,13 +805,13 @@ namespace AgroBase.Forms.IHM
int.TryParse(Leitura?.Mensagem ?? "", out int CodigoErro); int.TryParse(Leitura?.Mensagem ?? "", out int CodigoErro);
idx = PreencheDadosLinha(grid, Testes, idx, Inicializado ? CodigoErro : -1); idx = PreencheDadosLinha(grid, Testes, idx, Inicializado ? CodigoErro : -1);
bool ParaEsquerda = Inicializado ? await EnviarComandoDir(Dispositivo, Modulo, Enuns.Direcao.Esquerda, Testes[idx], 5000) : false; bool ParaEsquerda = Inicializado ? await EnviarComandoDir(Modulo, Enums.Direcao.Esquerda, Testes[idx], 5000) : false;
idx = PreencheDadosLinha(grid, Testes, idx, ParaEsquerda ? 1 : 0); idx = PreencheDadosLinha(grid, Testes, idx, ParaEsquerda ? 1 : 0);
bool ParaDireita = Inicializado ? await EnviarComandoDir(Dispositivo, Modulo, Enuns.Direcao.Direita, Testes[idx], 5000) : false; bool ParaDireita = Inicializado ? await EnviarComandoDir(Modulo, Enums.Direcao.Direita, Testes[idx], 5000) : false;
idx = PreencheDadosLinha(grid, Testes, idx, ParaDireita ? 1 : 0); idx = PreencheDadosLinha(grid, Testes, idx, ParaDireita ? 1 : 0);
bool Parado = Inicializado ? await EnviarComandoDir(Dispositivo, Modulo, Enuns.Direcao.Parado, Testes[idx], 5000) : true; bool Parado = Inicializado ? await EnviarComandoDir(Modulo, Enums.Direcao.Parado, Testes[idx], 5000) : true;
idx = PreencheDadosLinha(grid, Testes, idx, Parado ? 0 : 1); idx = PreencheDadosLinha(grid, Testes, idx, Parado ? 0 : 1);
} }
@ -772,14 +819,14 @@ namespace AgroBase.Forms.IHM
return true; return true;
} }
private async Task<bool> EnviarComandoDir(DispositivosService<MovimentacaoUnificadaModel> Dispositivo, ModuloMvdModel Modulo, Enuns.Direcao Sentido, ColunasDiagnosticoModel Teste, int Timeout) private async Task<bool> EnviarComandoDir(ModuloMvdModel Modulo, Enums.Direcao Sentido, ColunasDiagnosticoModel Teste, int Timeout)
{ {
Variaveis.OperacaoEmAndamento.Controle.Angulo = 25; Variaveis.OperacaoEmAndamento.Controle.Angulo = 25;
bool oldCmd = Modulo.DirMotor.Comandar; bool oldCmd = Modulo.DirMotor.Comandar;
Modulo.DirMotor.Comandar = true; Modulo.DirMotor.Comandar = true;
Dispositivo.AdicionarMensagemFila(Modulo.Modulo_ID, Modulo.DirMotor.ProtocoloComando(Sentido), true, false); GeneralJoystick.EnviaComandoMotor(Sentido == Direcao.Esquerda ? Keys.Left : Sentido == Direcao.Direita ? Keys.Right : Keys.Escape, T_Code.Dir);
DateTime Inicio = DateTime.Now; DateTime Inicio = DateTime.Now;
bool Sucesso = false; bool Sucesso = false;
@ -788,9 +835,9 @@ namespace AgroBase.Forms.IHM
await Task.Delay(200); await Task.Delay(200);
bool sentidoCorreto = Modulo.DirMotor.Sentido == bool sentidoCorreto = Modulo.DirMotor.Sentido ==
(Sentido == Enuns.Direcao.Esquerda ? Modulo.DirMotor.ConfigSentidos.Esquerda : (Sentido == Enums.Direcao.Esquerda ? Modulo.DirMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Esquerda :
Sentido == Enuns.Direcao.Direita ? Modulo.DirMotor.ConfigSentidos.Direita : Sentido == Enums.Direcao.Direita ? Modulo.DirMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Direita :
Enuns.Sentido.Parado); Enums.Sentido.Parado);
bool anguloCorreto = bool anguloCorreto =
Teste.ComplementoValorPadrao == "<" ? Modulo.DirMotor.Angulo < Teste.ValorPadrao : Teste.ComplementoValorPadrao == "<" ? Modulo.DirMotor.Angulo < Teste.ValorPadrao :
@ -940,7 +987,7 @@ namespace AgroBase.Forms.IHM
var grid = Diagnostico.grid; var grid = Diagnostico.grid;
var Testes = Diagnostico.Testes; var Testes = Diagnostico.Testes;
bool PzmConectado = SerialService.DispositivosMapeados.Any(x => x.Dispositivo == Enuns.T_Code.Pzm); bool PzmConectado = SerialService.DispositivosMapeados.Any(x => x.Dispositivo == Enums.T_Code.Pzm);
idx = PreencheDadosLinha(grid, Testes, idx, PzmConectado ? 1 : 0); idx = PreencheDadosLinha(grid, Testes, idx, PzmConectado ? 1 : 0);
bool PzmInicializado = PZEMService.Iniciado; bool PzmInicializado = PZEMService.Iniciado;
@ -974,7 +1021,7 @@ namespace AgroBase.Forms.IHM
double Corrente12V = S12V != null && S12V.Leituras.Count() > 0 ? S12V.Leituras[0] : -1; double Corrente12V = S12V != null && S12V.Leituras.Count() > 0 ? S12V.Leituras[0] : -1;
idx = PreencheDadosLinha(grid, Testes, idx, Corrente12V); idx = PreencheDadosLinha(grid, Testes, idx, Corrente12V);
bool WitConectado = SerialService.DispositivosMapeados.Any(x => x.Dispositivo == Enuns.T_Code.Wit); bool WitConectado = SerialService.DispositivosMapeados.Any(x => x.Dispositivo == Enums.T_Code.Wit);
idx = PreencheDadosLinha(grid, Testes, idx, WitConectado ? 1 : 0); idx = PreencheDadosLinha(grid, Testes, idx, WitConectado ? 1 : 0);
bool WitInicializado = WT901CService.Iniciado; bool WitInicializado = WT901CService.Iniciado;
@ -983,7 +1030,7 @@ namespace AgroBase.Forms.IHM
double Orientacao = WitInicializado ? WT901CService.DadosLeitura.AngleZ : -1; double Orientacao = WitInicializado ? WT901CService.DadosLeitura.AngleZ : -1;
idx = PreencheDadosLinha(grid, Testes, idx, Orientacao); idx = PreencheDadosLinha(grid, Testes, idx, Orientacao);
bool GpsConectado = SerialService.DispositivosMapeados.Any(x => x.Dispositivo == Enuns.T_Code.Gps); bool GpsConectado = SerialService.DispositivosMapeados.Any(x => x.Dispositivo == Enums.T_Code.Gps);
idx = PreencheDadosLinha(grid, Testes, idx, GpsConectado ? 1 : 0); idx = PreencheDadosLinha(grid, Testes, idx, GpsConectado ? 1 : 0);
bool GpsInicializado = GPSService.Iniciado; bool GpsInicializado = GPSService.Iniciado;
@ -1135,10 +1182,9 @@ 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;
Rele.StatusControle = novoEstado; GeneralJoystick.EnviarComandoSensoriamento(S_Code.sRLE, Rele.ID, novoEstado);
Dispositivo.AdicionarMensagemFila(Dispositivo.Dados.Modulo_ID, Rele.ProtocoloComando(), true, false);
await Task.Delay(Delay); await Task.Delay(Delay);
Dispositivo.AdicionarMensagemFila(Dispositivo.Dados.Modulo_ID, Dispositivo.Dados.ProtocoloAquisicaoDados(Rele.Componente, Rele.ID), true, false); Dispositivo.Dados.RequisitarDadosComponente(Rele.Componente, Rele.ID);
await Task.Delay(Delay); await Task.Delay(Delay);
} }
@ -1384,10 +1430,10 @@ namespace AgroBase.Forms.IHM
var grid = Diagnostico.grid; var grid = Diagnostico.grid;
var Testes = Diagnostico.Testes; var Testes = Diagnostico.Testes;
bool Conectado = SerialService.DispositivosMapeados.Any(x => x.Dispositivo == Enuns.T_Code.Sen); bool Conectado = SerialService.DispositivosMapeados.Any(x => x.Dispositivo == Enums.T_Code.Sen);
idx = PreencheDadosLinha(grid, Testes, idx, Conectado ? 1 : 0); idx = PreencheDadosLinha(grid, Testes, idx, Conectado ? 1 : 0);
DispositivosService<SensoriamentoModel> Dispositivo = (DispositivosService<SensoriamentoModel>)Variaveis.DispositivosConectados.FirstOrDefault(x => x.Dispositivo == Enuns.T_Code.Sen); DispositivosService<SensoriamentoModel> Dispositivo = (DispositivosService<SensoriamentoModel>)Variaveis.DispositivosConectados.FirstOrDefault(x => x.Dispositivo == Enums.T_Code.Sen);
bool Inicializado = Dispositivo != null && Dispositivo.Dados.Conectado; bool Inicializado = Dispositivo != null && Dispositivo.Dados.Conectado;
idx = PreencheDadosLinha(grid, Testes, idx, Inicializado ? 1 : 0); idx = PreencheDadosLinha(grid, Testes, idx, Inicializado ? 1 : 0);
@ -1420,11 +1466,11 @@ 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 statusLedAt = Ligar ? StatusLED.Aceso : StatusLED.Apagado; var Comportamento = VariaveisEquipamento.ComportamentoPorStatus(StatusOperacao.NaoIniciado);
Sinaleiro.Comportamento.statusLED = statusLedAt; Comportamento.statusLED = Ligar ? StatusLED.Aceso : StatusLED.Apagado;
Dispositivo.AdicionarMensagemFila(Dispositivo.Dados.Modulo_ID, Sinaleiro.ProtocoloComando(), true, false); GeneralJoystick.EnviarComandoSensoriamento(S_Code.sLED, Sinaleiro.ID, Comportamento);
await Task.Delay(Delay); await Task.Delay(Delay);
Dispositivo.AdicionarMensagemFila(Dispositivo.Dados.Modulo_ID, Dispositivo.Dados.ProtocoloAquisicaoDados(Sinaleiro.Componente, Sinaleiro.ID), true, false); Dispositivo.Dados.RequisitarDadosComponente(Sinaleiro.Componente, Sinaleiro.ID);
await Task.Delay(Delay); await Task.Delay(Delay);
} }

View File

@ -13,7 +13,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Forms.IHM namespace AgroBase.Forms.IHM
{ {

View File

@ -10,7 +10,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Forms.Operacoes namespace AgroBase.Forms.Operacoes
{ {

View File

@ -35,10 +35,6 @@ namespace AgroBase.Forms.Movimentacao
this.txtDFEndereco = new System.Windows.Forms.TextBox(); this.txtDFEndereco = new System.Windows.Forms.TextBox();
this.cmbDFFrente = new System.Windows.Forms.ComboBox(); this.cmbDFFrente = new System.Windows.Forms.ComboBox();
this.cmbDFTras = new System.Windows.Forms.ComboBox(); this.cmbDFTras = new System.Windows.Forms.ComboBox();
this.cmbDFDireita = new System.Windows.Forms.ComboBox();
this.cmbDFEsquerda = new System.Windows.Forms.ComboBox();
this.lblDFEsquerda = new System.Windows.Forms.Label();
this.lblDFDireita = new System.Windows.Forms.Label();
this.lblDFTras = new System.Windows.Forms.Label(); this.lblDFTras = new System.Windows.Forms.Label();
this.lblDFFrente = new System.Windows.Forms.Label(); this.lblDFFrente = new System.Windows.Forms.Label();
this.gpbEF = new System.Windows.Forms.GroupBox(); this.gpbEF = new System.Windows.Forms.GroupBox();
@ -46,10 +42,6 @@ namespace AgroBase.Forms.Movimentacao
this.txtEFEndereco = new System.Windows.Forms.TextBox(); this.txtEFEndereco = new System.Windows.Forms.TextBox();
this.cmbEFFrente = new System.Windows.Forms.ComboBox(); this.cmbEFFrente = new System.Windows.Forms.ComboBox();
this.cmbEFTras = new System.Windows.Forms.ComboBox(); this.cmbEFTras = new System.Windows.Forms.ComboBox();
this.cmbEFDireita = new System.Windows.Forms.ComboBox();
this.cmbEFEsquerda = new System.Windows.Forms.ComboBox();
this.lblEFEsquerda = new System.Windows.Forms.Label();
this.lblEFDireita = new System.Windows.Forms.Label();
this.lblEFTras = new System.Windows.Forms.Label(); this.lblEFTras = new System.Windows.Forms.Label();
this.lblEFFrente = new System.Windows.Forms.Label(); this.lblEFFrente = new System.Windows.Forms.Label();
this.gpbDT = new System.Windows.Forms.GroupBox(); this.gpbDT = new System.Windows.Forms.GroupBox();
@ -57,10 +49,6 @@ namespace AgroBase.Forms.Movimentacao
this.txtDTEndereco = new System.Windows.Forms.TextBox(); this.txtDTEndereco = new System.Windows.Forms.TextBox();
this.cmbDTFrente = new System.Windows.Forms.ComboBox(); this.cmbDTFrente = new System.Windows.Forms.ComboBox();
this.cmbDTTras = new System.Windows.Forms.ComboBox(); this.cmbDTTras = new System.Windows.Forms.ComboBox();
this.cmbDTDireita = new System.Windows.Forms.ComboBox();
this.cmbDTEsquerda = new System.Windows.Forms.ComboBox();
this.lblDTEsquerda = new System.Windows.Forms.Label();
this.lblDTDireita = new System.Windows.Forms.Label();
this.lblDTTras = new System.Windows.Forms.Label(); this.lblDTTras = new System.Windows.Forms.Label();
this.lblDTFrente = new System.Windows.Forms.Label(); this.lblDTFrente = new System.Windows.Forms.Label();
this.gpbET = new System.Windows.Forms.GroupBox(); this.gpbET = new System.Windows.Forms.GroupBox();
@ -68,39 +56,39 @@ namespace AgroBase.Forms.Movimentacao
this.txtETEndereco = new System.Windows.Forms.TextBox(); this.txtETEndereco = new System.Windows.Forms.TextBox();
this.cmbETFrente = new System.Windows.Forms.ComboBox(); this.cmbETFrente = new System.Windows.Forms.ComboBox();
this.cmbETTras = new System.Windows.Forms.ComboBox(); this.cmbETTras = new System.Windows.Forms.ComboBox();
this.cmbETDireita = new System.Windows.Forms.ComboBox();
this.cmbETEsquerda = new System.Windows.Forms.ComboBox();
this.lblETEsquerda = new System.Windows.Forms.Label();
this.lblETDireita = new System.Windows.Forms.Label();
this.lblETTras = new System.Windows.Forms.Label(); this.lblETTras = new System.Windows.Forms.Label();
this.lblETFrente = new System.Windows.Forms.Label(); this.lblETFrente = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.lblReducao = new System.Windows.Forms.Label();
this.nudReducao = new System.Windows.Forms.NumericUpDown();
this.btnSalvar = new System.Windows.Forms.Button();
this.lblDiametroRoda = new System.Windows.Forms.Label(); this.lblDiametroRoda = new System.Windows.Forms.Label();
this.nudDiametroRoda = new System.Windows.Forms.NumericUpDown(); this.nudDiametroRoda = new System.Windows.Forms.NumericUpDown();
this.lblRPMMax = new System.Windows.Forms.Label(); this.lblRPMMax = new System.Windows.Forms.Label();
this.nudRPMMax = new System.Windows.Forms.NumericUpDown(); this.nudRPMMax = new System.Windows.Forms.NumericUpDown();
this.lblNumPolos = new System.Windows.Forms.Label(); this.lblNumPolos = new System.Windows.Forms.Label();
this.nudNumPolos = new System.Windows.Forms.NumericUpDown();
this.lblRampa = new System.Windows.Forms.Label(); this.lblRampa = new System.Windows.Forms.Label();
this.nudRampa = new System.Windows.Forms.NumericUpDown(); this.nudRampa = new System.Windows.Forms.NumericUpDown();
this.btnSalvar = new System.Windows.Forms.Button(); this.lblTipoMovimento = new System.Windows.Forms.Label();
this.nudNumPolos = new System.Windows.Forms.NumericUpDown(); this.cmbTipoMovimento = new System.Windows.Forms.ComboBox();
this.lblReducao = new System.Windows.Forms.Label();
this.nudReducao = new System.Windows.Forms.NumericUpDown();
this.gpbSentido.SuspendLayout(); this.gpbSentido.SuspendLayout();
this.gpbDF.SuspendLayout(); this.gpbDF.SuspendLayout();
this.gpbEF.SuspendLayout(); this.gpbEF.SuspendLayout();
this.gpbDT.SuspendLayout(); this.gpbDT.SuspendLayout();
this.gpbET.SuspendLayout(); this.gpbET.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudReducao)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudDiametroRoda)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudDiametroRoda)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudRPMMax)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudRPMMax)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudRampa)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudNumPolos)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudNumPolos)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudReducao)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudRampa)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// gpbSentido // gpbSentido
// //
this.gpbSentido.Controls.Add(this.cmbTipoMovimento);
this.gpbSentido.Controls.Add(this.lblTipoMovimento);
this.gpbSentido.Controls.Add(this.gpbDF); this.gpbSentido.Controls.Add(this.gpbDF);
this.gpbSentido.Controls.Add(this.gpbEF); this.gpbSentido.Controls.Add(this.gpbEF);
this.gpbSentido.Controls.Add(this.gpbDT); this.gpbSentido.Controls.Add(this.gpbDT);
@ -109,7 +97,7 @@ namespace AgroBase.Forms.Movimentacao
this.gpbSentido.Margin = new System.Windows.Forms.Padding(2); this.gpbSentido.Margin = new System.Windows.Forms.Padding(2);
this.gpbSentido.Name = "gpbSentido"; this.gpbSentido.Name = "gpbSentido";
this.gpbSentido.Padding = new System.Windows.Forms.Padding(2); this.gpbSentido.Padding = new System.Windows.Forms.Padding(2);
this.gpbSentido.Size = new System.Drawing.Size(376, 349); this.gpbSentido.Size = new System.Drawing.Size(376, 283);
this.gpbSentido.TabIndex = 40; this.gpbSentido.TabIndex = 40;
this.gpbSentido.TabStop = false; this.gpbSentido.TabStop = false;
this.gpbSentido.Text = "Sentido de giro"; this.gpbSentido.Text = "Sentido de giro";
@ -120,17 +108,13 @@ namespace AgroBase.Forms.Movimentacao
this.gpbDF.Controls.Add(this.txtDFEndereco); this.gpbDF.Controls.Add(this.txtDFEndereco);
this.gpbDF.Controls.Add(this.cmbDFFrente); this.gpbDF.Controls.Add(this.cmbDFFrente);
this.gpbDF.Controls.Add(this.cmbDFTras); this.gpbDF.Controls.Add(this.cmbDFTras);
this.gpbDF.Controls.Add(this.cmbDFDireita);
this.gpbDF.Controls.Add(this.cmbDFEsquerda);
this.gpbDF.Controls.Add(this.lblDFEsquerda);
this.gpbDF.Controls.Add(this.lblDFDireita);
this.gpbDF.Controls.Add(this.lblDFTras); this.gpbDF.Controls.Add(this.lblDFTras);
this.gpbDF.Controls.Add(this.lblDFFrente); this.gpbDF.Controls.Add(this.lblDFFrente);
this.gpbDF.Location = new System.Drawing.Point(195, 21); this.gpbDF.Location = new System.Drawing.Point(195, 60);
this.gpbDF.Margin = new System.Windows.Forms.Padding(2); this.gpbDF.Margin = new System.Windows.Forms.Padding(2);
this.gpbDF.Name = "gpbDF"; this.gpbDF.Name = "gpbDF";
this.gpbDF.Padding = new System.Windows.Forms.Padding(2); this.gpbDF.Padding = new System.Windows.Forms.Padding(2);
this.gpbDF.Size = new System.Drawing.Size(168, 157); this.gpbDF.Size = new System.Drawing.Size(168, 105);
this.gpbDF.TabIndex = 9; this.gpbDF.TabIndex = 9;
this.gpbDF.TabStop = false; this.gpbDF.TabStop = false;
this.gpbDF.Text = "M4 - Direito Frente (DF)"; this.gpbDF.Text = "M4 - Direito Frente (DF)";
@ -138,7 +122,7 @@ namespace AgroBase.Forms.Movimentacao
// lblDFEndereco // lblDFEndereco
// //
this.lblDFEndereco.AutoSize = true; this.lblDFEndereco.AutoSize = true;
this.lblDFEndereco.Location = new System.Drawing.Point(10, 127); this.lblDFEndereco.Location = new System.Drawing.Point(10, 78);
this.lblDFEndereco.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblDFEndereco.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblDFEndereco.Name = "lblDFEndereco"; this.lblDFEndereco.Name = "lblDFEndereco";
this.lblDFEndereco.Size = new System.Drawing.Size(53, 13); this.lblDFEndereco.Size = new System.Drawing.Size(53, 13);
@ -147,7 +131,7 @@ namespace AgroBase.Forms.Movimentacao
// //
// txtDFEndereco // txtDFEndereco
// //
this.txtDFEndereco.Location = new System.Drawing.Point(66, 124); this.txtDFEndereco.Location = new System.Drawing.Point(66, 75);
this.txtDFEndereco.Margin = new System.Windows.Forms.Padding(2); this.txtDFEndereco.Margin = new System.Windows.Forms.Padding(2);
this.txtDFEndereco.Name = "txtDFEndereco"; this.txtDFEndereco.Name = "txtDFEndereco";
this.txtDFEndereco.Size = new System.Drawing.Size(92, 20); this.txtDFEndereco.Size = new System.Drawing.Size(92, 20);
@ -172,44 +156,6 @@ namespace AgroBase.Forms.Movimentacao
this.cmbDFTras.Size = new System.Drawing.Size(92, 21); this.cmbDFTras.Size = new System.Drawing.Size(92, 21);
this.cmbDFTras.TabIndex = 6; this.cmbDFTras.TabIndex = 6;
// //
// cmbDFDireita
//
this.cmbDFDireita.FormattingEnabled = true;
this.cmbDFDireita.Location = new System.Drawing.Point(66, 74);
this.cmbDFDireita.Margin = new System.Windows.Forms.Padding(2);
this.cmbDFDireita.Name = "cmbDFDireita";
this.cmbDFDireita.Size = new System.Drawing.Size(92, 21);
this.cmbDFDireita.TabIndex = 5;
//
// cmbDFEsquerda
//
this.cmbDFEsquerda.FormattingEnabled = true;
this.cmbDFEsquerda.Location = new System.Drawing.Point(66, 101);
this.cmbDFEsquerda.Margin = new System.Windows.Forms.Padding(2);
this.cmbDFEsquerda.Name = "cmbDFEsquerda";
this.cmbDFEsquerda.Size = new System.Drawing.Size(92, 21);
this.cmbDFEsquerda.TabIndex = 4;
//
// lblDFEsquerda
//
this.lblDFEsquerda.AutoSize = true;
this.lblDFEsquerda.Location = new System.Drawing.Point(10, 103);
this.lblDFEsquerda.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblDFEsquerda.Name = "lblDFEsquerda";
this.lblDFEsquerda.Size = new System.Drawing.Size(52, 13);
this.lblDFEsquerda.TabIndex = 3;
this.lblDFEsquerda.Text = "Esquerda";
//
// lblDFDireita
//
this.lblDFDireita.AutoSize = true;
this.lblDFDireita.Location = new System.Drawing.Point(10, 76);
this.lblDFDireita.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblDFDireita.Name = "lblDFDireita";
this.lblDFDireita.Size = new System.Drawing.Size(37, 13);
this.lblDFDireita.TabIndex = 2;
this.lblDFDireita.Text = "Direita";
//
// lblDFTras // lblDFTras
// //
this.lblDFTras.AutoSize = true; this.lblDFTras.AutoSize = true;
@ -236,17 +182,13 @@ namespace AgroBase.Forms.Movimentacao
this.gpbEF.Controls.Add(this.txtEFEndereco); this.gpbEF.Controls.Add(this.txtEFEndereco);
this.gpbEF.Controls.Add(this.cmbEFFrente); this.gpbEF.Controls.Add(this.cmbEFFrente);
this.gpbEF.Controls.Add(this.cmbEFTras); this.gpbEF.Controls.Add(this.cmbEFTras);
this.gpbEF.Controls.Add(this.cmbEFDireita);
this.gpbEF.Controls.Add(this.cmbEFEsquerda);
this.gpbEF.Controls.Add(this.lblEFEsquerda);
this.gpbEF.Controls.Add(this.lblEFDireita);
this.gpbEF.Controls.Add(this.lblEFTras); this.gpbEF.Controls.Add(this.lblEFTras);
this.gpbEF.Controls.Add(this.lblEFFrente); this.gpbEF.Controls.Add(this.lblEFFrente);
this.gpbEF.Location = new System.Drawing.Point(13, 21); this.gpbEF.Location = new System.Drawing.Point(13, 60);
this.gpbEF.Margin = new System.Windows.Forms.Padding(2); this.gpbEF.Margin = new System.Windows.Forms.Padding(2);
this.gpbEF.Name = "gpbEF"; this.gpbEF.Name = "gpbEF";
this.gpbEF.Padding = new System.Windows.Forms.Padding(2); this.gpbEF.Padding = new System.Windows.Forms.Padding(2);
this.gpbEF.Size = new System.Drawing.Size(168, 157); this.gpbEF.Size = new System.Drawing.Size(168, 105);
this.gpbEF.TabIndex = 9; this.gpbEF.TabIndex = 9;
this.gpbEF.TabStop = false; this.gpbEF.TabStop = false;
this.gpbEF.Text = "M2 - Esquerdo Frente (EF)"; this.gpbEF.Text = "M2 - Esquerdo Frente (EF)";
@ -254,7 +196,7 @@ namespace AgroBase.Forms.Movimentacao
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(10, 127); this.label1.Location = new System.Drawing.Point(10, 78);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(53, 13); this.label1.Size = new System.Drawing.Size(53, 13);
@ -263,7 +205,7 @@ namespace AgroBase.Forms.Movimentacao
// //
// txtEFEndereco // txtEFEndereco
// //
this.txtEFEndereco.Location = new System.Drawing.Point(66, 124); this.txtEFEndereco.Location = new System.Drawing.Point(66, 75);
this.txtEFEndereco.Margin = new System.Windows.Forms.Padding(2); this.txtEFEndereco.Margin = new System.Windows.Forms.Padding(2);
this.txtEFEndereco.Name = "txtEFEndereco"; this.txtEFEndereco.Name = "txtEFEndereco";
this.txtEFEndereco.Size = new System.Drawing.Size(92, 20); this.txtEFEndereco.Size = new System.Drawing.Size(92, 20);
@ -288,44 +230,6 @@ namespace AgroBase.Forms.Movimentacao
this.cmbEFTras.Size = new System.Drawing.Size(92, 21); this.cmbEFTras.Size = new System.Drawing.Size(92, 21);
this.cmbEFTras.TabIndex = 6; this.cmbEFTras.TabIndex = 6;
// //
// cmbEFDireita
//
this.cmbEFDireita.FormattingEnabled = true;
this.cmbEFDireita.Location = new System.Drawing.Point(66, 74);
this.cmbEFDireita.Margin = new System.Windows.Forms.Padding(2);
this.cmbEFDireita.Name = "cmbEFDireita";
this.cmbEFDireita.Size = new System.Drawing.Size(92, 21);
this.cmbEFDireita.TabIndex = 5;
//
// cmbEFEsquerda
//
this.cmbEFEsquerda.FormattingEnabled = true;
this.cmbEFEsquerda.Location = new System.Drawing.Point(66, 101);
this.cmbEFEsquerda.Margin = new System.Windows.Forms.Padding(2);
this.cmbEFEsquerda.Name = "cmbEFEsquerda";
this.cmbEFEsquerda.Size = new System.Drawing.Size(92, 21);
this.cmbEFEsquerda.TabIndex = 4;
//
// lblEFEsquerda
//
this.lblEFEsquerda.AutoSize = true;
this.lblEFEsquerda.Location = new System.Drawing.Point(10, 103);
this.lblEFEsquerda.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblEFEsquerda.Name = "lblEFEsquerda";
this.lblEFEsquerda.Size = new System.Drawing.Size(52, 13);
this.lblEFEsquerda.TabIndex = 3;
this.lblEFEsquerda.Text = "Esquerda";
//
// lblEFDireita
//
this.lblEFDireita.AutoSize = true;
this.lblEFDireita.Location = new System.Drawing.Point(10, 76);
this.lblEFDireita.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblEFDireita.Name = "lblEFDireita";
this.lblEFDireita.Size = new System.Drawing.Size(37, 13);
this.lblEFDireita.TabIndex = 2;
this.lblEFDireita.Text = "Direita";
//
// lblEFTras // lblEFTras
// //
this.lblEFTras.AutoSize = true; this.lblEFTras.AutoSize = true;
@ -352,17 +256,13 @@ namespace AgroBase.Forms.Movimentacao
this.gpbDT.Controls.Add(this.txtDTEndereco); this.gpbDT.Controls.Add(this.txtDTEndereco);
this.gpbDT.Controls.Add(this.cmbDTFrente); this.gpbDT.Controls.Add(this.cmbDTFrente);
this.gpbDT.Controls.Add(this.cmbDTTras); this.gpbDT.Controls.Add(this.cmbDTTras);
this.gpbDT.Controls.Add(this.cmbDTDireita);
this.gpbDT.Controls.Add(this.cmbDTEsquerda);
this.gpbDT.Controls.Add(this.lblDTEsquerda);
this.gpbDT.Controls.Add(this.lblDTDireita);
this.gpbDT.Controls.Add(this.lblDTTras); this.gpbDT.Controls.Add(this.lblDTTras);
this.gpbDT.Controls.Add(this.lblDTFrente); this.gpbDT.Controls.Add(this.lblDTFrente);
this.gpbDT.Location = new System.Drawing.Point(195, 181); this.gpbDT.Location = new System.Drawing.Point(195, 169);
this.gpbDT.Margin = new System.Windows.Forms.Padding(2); this.gpbDT.Margin = new System.Windows.Forms.Padding(2);
this.gpbDT.Name = "gpbDT"; this.gpbDT.Name = "gpbDT";
this.gpbDT.Padding = new System.Windows.Forms.Padding(2); this.gpbDT.Padding = new System.Windows.Forms.Padding(2);
this.gpbDT.Size = new System.Drawing.Size(168, 157); this.gpbDT.Size = new System.Drawing.Size(168, 105);
this.gpbDT.TabIndex = 9; this.gpbDT.TabIndex = 9;
this.gpbDT.TabStop = false; this.gpbDT.TabStop = false;
this.gpbDT.Text = "M3 - Direito Trás (DT)"; this.gpbDT.Text = "M3 - Direito Trás (DT)";
@ -370,7 +270,7 @@ namespace AgroBase.Forms.Movimentacao
// label3 // label3
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(10, 127); this.label3.Location = new System.Drawing.Point(10, 78);
this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(53, 13); this.label3.Size = new System.Drawing.Size(53, 13);
@ -379,7 +279,7 @@ namespace AgroBase.Forms.Movimentacao
// //
// txtDTEndereco // txtDTEndereco
// //
this.txtDTEndereco.Location = new System.Drawing.Point(66, 124); this.txtDTEndereco.Location = new System.Drawing.Point(66, 75);
this.txtDTEndereco.Margin = new System.Windows.Forms.Padding(2); this.txtDTEndereco.Margin = new System.Windows.Forms.Padding(2);
this.txtDTEndereco.Name = "txtDTEndereco"; this.txtDTEndereco.Name = "txtDTEndereco";
this.txtDTEndereco.Size = new System.Drawing.Size(92, 20); this.txtDTEndereco.Size = new System.Drawing.Size(92, 20);
@ -404,44 +304,6 @@ namespace AgroBase.Forms.Movimentacao
this.cmbDTTras.Size = new System.Drawing.Size(92, 21); this.cmbDTTras.Size = new System.Drawing.Size(92, 21);
this.cmbDTTras.TabIndex = 6; this.cmbDTTras.TabIndex = 6;
// //
// cmbDTDireita
//
this.cmbDTDireita.FormattingEnabled = true;
this.cmbDTDireita.Location = new System.Drawing.Point(66, 74);
this.cmbDTDireita.Margin = new System.Windows.Forms.Padding(2);
this.cmbDTDireita.Name = "cmbDTDireita";
this.cmbDTDireita.Size = new System.Drawing.Size(92, 21);
this.cmbDTDireita.TabIndex = 5;
//
// cmbDTEsquerda
//
this.cmbDTEsquerda.FormattingEnabled = true;
this.cmbDTEsquerda.Location = new System.Drawing.Point(66, 101);
this.cmbDTEsquerda.Margin = new System.Windows.Forms.Padding(2);
this.cmbDTEsquerda.Name = "cmbDTEsquerda";
this.cmbDTEsquerda.Size = new System.Drawing.Size(92, 21);
this.cmbDTEsquerda.TabIndex = 4;
//
// lblDTEsquerda
//
this.lblDTEsquerda.AutoSize = true;
this.lblDTEsquerda.Location = new System.Drawing.Point(10, 103);
this.lblDTEsquerda.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblDTEsquerda.Name = "lblDTEsquerda";
this.lblDTEsquerda.Size = new System.Drawing.Size(52, 13);
this.lblDTEsquerda.TabIndex = 3;
this.lblDTEsquerda.Text = "Esquerda";
//
// lblDTDireita
//
this.lblDTDireita.AutoSize = true;
this.lblDTDireita.Location = new System.Drawing.Point(10, 76);
this.lblDTDireita.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblDTDireita.Name = "lblDTDireita";
this.lblDTDireita.Size = new System.Drawing.Size(37, 13);
this.lblDTDireita.TabIndex = 2;
this.lblDTDireita.Text = "Direita";
//
// lblDTTras // lblDTTras
// //
this.lblDTTras.AutoSize = true; this.lblDTTras.AutoSize = true;
@ -468,17 +330,13 @@ namespace AgroBase.Forms.Movimentacao
this.gpbET.Controls.Add(this.txtETEndereco); this.gpbET.Controls.Add(this.txtETEndereco);
this.gpbET.Controls.Add(this.cmbETFrente); this.gpbET.Controls.Add(this.cmbETFrente);
this.gpbET.Controls.Add(this.cmbETTras); this.gpbET.Controls.Add(this.cmbETTras);
this.gpbET.Controls.Add(this.cmbETDireita);
this.gpbET.Controls.Add(this.cmbETEsquerda);
this.gpbET.Controls.Add(this.lblETEsquerda);
this.gpbET.Controls.Add(this.lblETDireita);
this.gpbET.Controls.Add(this.lblETTras); this.gpbET.Controls.Add(this.lblETTras);
this.gpbET.Controls.Add(this.lblETFrente); this.gpbET.Controls.Add(this.lblETFrente);
this.gpbET.Location = new System.Drawing.Point(13, 181); this.gpbET.Location = new System.Drawing.Point(13, 169);
this.gpbET.Margin = new System.Windows.Forms.Padding(2); this.gpbET.Margin = new System.Windows.Forms.Padding(2);
this.gpbET.Name = "gpbET"; this.gpbET.Name = "gpbET";
this.gpbET.Padding = new System.Windows.Forms.Padding(2); this.gpbET.Padding = new System.Windows.Forms.Padding(2);
this.gpbET.Size = new System.Drawing.Size(168, 157); this.gpbET.Size = new System.Drawing.Size(168, 105);
this.gpbET.TabIndex = 0; this.gpbET.TabIndex = 0;
this.gpbET.TabStop = false; this.gpbET.TabStop = false;
this.gpbET.Text = "M1 - Esquerdo Trás (ET)"; this.gpbET.Text = "M1 - Esquerdo Trás (ET)";
@ -486,7 +344,7 @@ namespace AgroBase.Forms.Movimentacao
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(10, 127); this.label2.Location = new System.Drawing.Point(10, 78);
this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 13); this.label2.Size = new System.Drawing.Size(53, 13);
@ -495,7 +353,7 @@ namespace AgroBase.Forms.Movimentacao
// //
// txtETEndereco // txtETEndereco
// //
this.txtETEndereco.Location = new System.Drawing.Point(66, 124); this.txtETEndereco.Location = new System.Drawing.Point(66, 75);
this.txtETEndereco.Margin = new System.Windows.Forms.Padding(2); this.txtETEndereco.Margin = new System.Windows.Forms.Padding(2);
this.txtETEndereco.Name = "txtETEndereco"; this.txtETEndereco.Name = "txtETEndereco";
this.txtETEndereco.Size = new System.Drawing.Size(92, 20); this.txtETEndereco.Size = new System.Drawing.Size(92, 20);
@ -520,44 +378,6 @@ namespace AgroBase.Forms.Movimentacao
this.cmbETTras.Size = new System.Drawing.Size(92, 21); this.cmbETTras.Size = new System.Drawing.Size(92, 21);
this.cmbETTras.TabIndex = 6; this.cmbETTras.TabIndex = 6;
// //
// cmbETDireita
//
this.cmbETDireita.FormattingEnabled = true;
this.cmbETDireita.Location = new System.Drawing.Point(66, 74);
this.cmbETDireita.Margin = new System.Windows.Forms.Padding(2);
this.cmbETDireita.Name = "cmbETDireita";
this.cmbETDireita.Size = new System.Drawing.Size(92, 21);
this.cmbETDireita.TabIndex = 5;
//
// cmbETEsquerda
//
this.cmbETEsquerda.FormattingEnabled = true;
this.cmbETEsquerda.Location = new System.Drawing.Point(66, 101);
this.cmbETEsquerda.Margin = new System.Windows.Forms.Padding(2);
this.cmbETEsquerda.Name = "cmbETEsquerda";
this.cmbETEsquerda.Size = new System.Drawing.Size(92, 21);
this.cmbETEsquerda.TabIndex = 4;
//
// lblETEsquerda
//
this.lblETEsquerda.AutoSize = true;
this.lblETEsquerda.Location = new System.Drawing.Point(10, 103);
this.lblETEsquerda.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblETEsquerda.Name = "lblETEsquerda";
this.lblETEsquerda.Size = new System.Drawing.Size(52, 13);
this.lblETEsquerda.TabIndex = 3;
this.lblETEsquerda.Text = "Esquerda";
//
// lblETDireita
//
this.lblETDireita.AutoSize = true;
this.lblETDireita.Location = new System.Drawing.Point(10, 76);
this.lblETDireita.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblETDireita.Name = "lblETDireita";
this.lblETDireita.Size = new System.Drawing.Size(37, 13);
this.lblETDireita.TabIndex = 2;
this.lblETDireita.Text = "Direita";
//
// lblETTras // lblETTras
// //
this.lblETTras.AutoSize = true; this.lblETTras.AutoSize = true;
@ -591,7 +411,7 @@ namespace AgroBase.Forms.Movimentacao
this.groupBox1.Controls.Add(this.nudNumPolos); this.groupBox1.Controls.Add(this.nudNumPolos);
this.groupBox1.Controls.Add(this.lblRampa); this.groupBox1.Controls.Add(this.lblRampa);
this.groupBox1.Controls.Add(this.nudRampa); this.groupBox1.Controls.Add(this.nudRampa);
this.groupBox1.Location = new System.Drawing.Point(11, 363); this.groupBox1.Location = new System.Drawing.Point(11, 298);
this.groupBox1.Margin = new System.Windows.Forms.Padding(2); this.groupBox1.Margin = new System.Windows.Forms.Padding(2);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(2); this.groupBox1.Padding = new System.Windows.Forms.Padding(2);
@ -600,10 +420,50 @@ namespace AgroBase.Forms.Movimentacao
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Ajustes"; this.groupBox1.Text = "Ajustes";
// //
// lblReducao
//
this.lblReducao.AutoSize = true;
this.lblReducao.Location = new System.Drawing.Point(5, 67);
this.lblReducao.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblReducao.Name = "lblReducao";
this.lblReducao.Size = new System.Drawing.Size(51, 13);
this.lblReducao.TabIndex = 138;
this.lblReducao.Text = "Redução";
//
// nudReducao
//
this.nudReducao.Location = new System.Drawing.Point(8, 84);
this.nudReducao.Margin = new System.Windows.Forms.Padding(2);
this.nudReducao.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.nudReducao.Name = "nudReducao";
this.nudReducao.Size = new System.Drawing.Size(85, 20);
this.nudReducao.TabIndex = 137;
this.nudReducao.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.nudReducao.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// btnSalvar
//
this.btnSalvar.Location = new System.Drawing.Point(283, 67);
this.btnSalvar.Margin = new System.Windows.Forms.Padding(2);
this.btnSalvar.Name = "btnSalvar";
this.btnSalvar.Size = new System.Drawing.Size(85, 41);
this.btnSalvar.TabIndex = 136;
this.btnSalvar.Text = "Salvar";
this.btnSalvar.UseVisualStyleBackColor = true;
this.btnSalvar.Click += new System.EventHandler(this.btnSalvar_Click);
//
// lblDiametroRoda // lblDiametroRoda
// //
this.lblDiametroRoda.AutoSize = true; this.lblDiametroRoda.AutoSize = true;
this.lblDiametroRoda.Location = new System.Drawing.Point(280, 20); this.lblDiametroRoda.Location = new System.Drawing.Point(98, 67);
this.lblDiametroRoda.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblDiametroRoda.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblDiametroRoda.Name = "lblDiametroRoda"; this.lblDiametroRoda.Name = "lblDiametroRoda";
this.lblDiametroRoda.Size = new System.Drawing.Size(78, 13); this.lblDiametroRoda.Size = new System.Drawing.Size(78, 13);
@ -612,7 +472,7 @@ namespace AgroBase.Forms.Movimentacao
// //
// nudDiametroRoda // nudDiametroRoda
// //
this.nudDiametroRoda.Location = new System.Drawing.Point(283, 37); this.nudDiametroRoda.Location = new System.Drawing.Point(101, 84);
this.nudDiametroRoda.Margin = new System.Windows.Forms.Padding(2); this.nudDiametroRoda.Margin = new System.Windows.Forms.Padding(2);
this.nudDiametroRoda.Maximum = new decimal(new int[] { this.nudDiametroRoda.Maximum = new decimal(new int[] {
20000, 20000,
@ -669,6 +529,25 @@ namespace AgroBase.Forms.Movimentacao
this.lblNumPolos.TabIndex = 36; this.lblNumPolos.TabIndex = 36;
this.lblNumPolos.Text = "Número de Polos"; this.lblNumPolos.Text = "Número de Polos";
// //
// nudNumPolos
//
this.nudNumPolos.Location = new System.Drawing.Point(100, 37);
this.nudNumPolos.Margin = new System.Windows.Forms.Padding(2);
this.nudNumPolos.Maximum = new decimal(new int[] {
999,
0,
0,
0});
this.nudNumPolos.Name = "nudNumPolos";
this.nudNumPolos.Size = new System.Drawing.Size(85, 20);
this.nudNumPolos.TabIndex = 35;
this.nudNumPolos.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.nudNumPolos.Value = new decimal(new int[] {
2,
0,
0,
0});
//
// lblRampa // lblRampa
// //
this.lblRampa.AutoSize = true; this.lblRampa.AutoSize = true;
@ -693,71 +572,31 @@ namespace AgroBase.Forms.Movimentacao
this.nudRampa.TabIndex = 31; this.nudRampa.TabIndex = 31;
this.nudRampa.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.nudRampa.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
// //
// btnSalvar // lblTipoMovimento
// //
this.btnSalvar.Location = new System.Drawing.Point(283, 67); this.lblTipoMovimento.AutoSize = true;
this.btnSalvar.Margin = new System.Windows.Forms.Padding(2); this.lblTipoMovimento.Location = new System.Drawing.Point(15, 21);
this.btnSalvar.Name = "btnSalvar"; this.lblTipoMovimento.Name = "lblTipoMovimento";
this.btnSalvar.Size = new System.Drawing.Size(85, 41); this.lblTipoMovimento.Size = new System.Drawing.Size(98, 13);
this.btnSalvar.TabIndex = 136; this.lblTipoMovimento.TabIndex = 10;
this.btnSalvar.Text = "Salvar"; this.lblTipoMovimento.Text = "Tipo de Movimento";
this.btnSalvar.UseVisualStyleBackColor = true;
this.btnSalvar.Click += new System.EventHandler(this.btnSalvar_Click);
// //
// nudNumPolos // cmbTipoMovimento
// //
this.nudNumPolos.Location = new System.Drawing.Point(100, 37); this.cmbTipoMovimento.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.nudNumPolos.Margin = new System.Windows.Forms.Padding(2); this.cmbTipoMovimento.FormattingEnabled = true;
this.nudNumPolos.Maximum = new decimal(new int[] { this.cmbTipoMovimento.Location = new System.Drawing.Point(195, 18);
999, this.cmbTipoMovimento.Name = "cmbTipoMovimento";
0, this.cmbTipoMovimento.Size = new System.Drawing.Size(168, 21);
0, this.cmbTipoMovimento.TabIndex = 11;
0}); this.cmbTipoMovimento.SelectedIndexChanged += new System.EventHandler(this.cmbTipoMovimento_SelectedIndexChanged);
this.nudNumPolos.Name = "nudNumPolos";
this.nudNumPolos.Size = new System.Drawing.Size(85, 20);
this.nudNumPolos.TabIndex = 35;
this.nudNumPolos.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.nudNumPolos.Value = new decimal(new int[] {
2,
0,
0,
0});
//
// lblReducao
//
this.lblReducao.AutoSize = true;
this.lblReducao.Location = new System.Drawing.Point(5, 67);
this.lblReducao.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblReducao.Name = "lblReducao";
this.lblReducao.Size = new System.Drawing.Size(51, 13);
this.lblReducao.TabIndex = 138;
this.lblReducao.Text = "Redução";
//
// nudReducao
//
this.nudReducao.Location = new System.Drawing.Point(8, 84);
this.nudReducao.Margin = new System.Windows.Forms.Padding(2);
this.nudReducao.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.nudReducao.Name = "nudReducao";
this.nudReducao.Size = new System.Drawing.Size(85, 20);
this.nudReducao.TabIndex = 137;
this.nudReducao.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.nudReducao.Value = new decimal(new int[] {
1,
0,
0,
0});
// //
// frmMovConfig // frmMovConfig
// //
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.BackColor = System.Drawing.Color.White; this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(398, 482); this.ClientSize = new System.Drawing.Size(398, 424);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.Controls.Add(this.gpbSentido); this.Controls.Add(this.gpbSentido);
this.Margin = new System.Windows.Forms.Padding(2); this.Margin = new System.Windows.Forms.Padding(2);
@ -768,6 +607,7 @@ namespace AgroBase.Forms.Movimentacao
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmMovConfig_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmMovConfig_FormClosing);
this.Load += new System.EventHandler(this.frmMovConfig_Load); this.Load += new System.EventHandler(this.frmMovConfig_Load);
this.gpbSentido.ResumeLayout(false); this.gpbSentido.ResumeLayout(false);
this.gpbSentido.PerformLayout();
this.gpbDF.ResumeLayout(false); this.gpbDF.ResumeLayout(false);
this.gpbDF.PerformLayout(); this.gpbDF.PerformLayout();
this.gpbEF.ResumeLayout(false); this.gpbEF.ResumeLayout(false);
@ -778,11 +618,11 @@ namespace AgroBase.Forms.Movimentacao
this.gpbET.PerformLayout(); this.gpbET.PerformLayout();
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudReducao)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudDiametroRoda)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nudDiametroRoda)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudRPMMax)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nudRPMMax)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudRampa)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudNumPolos)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nudNumPolos)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudReducao)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nudRampa)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -792,37 +632,21 @@ namespace AgroBase.Forms.Movimentacao
private System.Windows.Forms.GroupBox gpbDF; private System.Windows.Forms.GroupBox gpbDF;
private System.Windows.Forms.ComboBox cmbDFFrente; private System.Windows.Forms.ComboBox cmbDFFrente;
private System.Windows.Forms.ComboBox cmbDFTras; private System.Windows.Forms.ComboBox cmbDFTras;
private System.Windows.Forms.ComboBox cmbDFDireita;
private System.Windows.Forms.ComboBox cmbDFEsquerda;
private System.Windows.Forms.Label lblDFEsquerda;
private System.Windows.Forms.Label lblDFDireita;
private System.Windows.Forms.Label lblDFTras; private System.Windows.Forms.Label lblDFTras;
private System.Windows.Forms.Label lblDFFrente; private System.Windows.Forms.Label lblDFFrente;
private System.Windows.Forms.GroupBox gpbEF; private System.Windows.Forms.GroupBox gpbEF;
private System.Windows.Forms.ComboBox cmbEFFrente; private System.Windows.Forms.ComboBox cmbEFFrente;
private System.Windows.Forms.ComboBox cmbEFTras; private System.Windows.Forms.ComboBox cmbEFTras;
private System.Windows.Forms.ComboBox cmbEFDireita;
private System.Windows.Forms.ComboBox cmbEFEsquerda;
private System.Windows.Forms.Label lblEFEsquerda;
private System.Windows.Forms.Label lblEFDireita;
private System.Windows.Forms.Label lblEFTras; private System.Windows.Forms.Label lblEFTras;
private System.Windows.Forms.Label lblEFFrente; private System.Windows.Forms.Label lblEFFrente;
private System.Windows.Forms.GroupBox gpbDT; private System.Windows.Forms.GroupBox gpbDT;
private System.Windows.Forms.ComboBox cmbDTFrente; private System.Windows.Forms.ComboBox cmbDTFrente;
private System.Windows.Forms.ComboBox cmbDTTras; private System.Windows.Forms.ComboBox cmbDTTras;
private System.Windows.Forms.ComboBox cmbDTDireita;
private System.Windows.Forms.ComboBox cmbDTEsquerda;
private System.Windows.Forms.Label lblDTEsquerda;
private System.Windows.Forms.Label lblDTDireita;
private System.Windows.Forms.Label lblDTTras; private System.Windows.Forms.Label lblDTTras;
private System.Windows.Forms.Label lblDTFrente; private System.Windows.Forms.Label lblDTFrente;
private System.Windows.Forms.GroupBox gpbET; private System.Windows.Forms.GroupBox gpbET;
private System.Windows.Forms.ComboBox cmbETFrente; private System.Windows.Forms.ComboBox cmbETFrente;
private System.Windows.Forms.ComboBox cmbETTras; private System.Windows.Forms.ComboBox cmbETTras;
private System.Windows.Forms.ComboBox cmbETDireita;
private System.Windows.Forms.ComboBox cmbETEsquerda;
private System.Windows.Forms.Label lblETEsquerda;
private System.Windows.Forms.Label lblETDireita;
private System.Windows.Forms.Label lblETTras; private System.Windows.Forms.Label lblETTras;
private System.Windows.Forms.Label lblETFrente; private System.Windows.Forms.Label lblETFrente;
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
@ -845,5 +669,7 @@ namespace AgroBase.Forms.Movimentacao
private System.Windows.Forms.Label lblReducao; private System.Windows.Forms.Label lblReducao;
private System.Windows.Forms.NumericUpDown nudReducao; private System.Windows.Forms.NumericUpDown nudReducao;
private System.Windows.Forms.NumericUpDown nudNumPolos; private System.Windows.Forms.NumericUpDown nudNumPolos;
private System.Windows.Forms.ComboBox cmbTipoMovimento;
private System.Windows.Forms.Label lblTipoMovimento;
} }
} }

View File

@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Forms.Movimentacao namespace AgroBase.Forms.Movimentacao
{ {
@ -28,6 +28,15 @@ namespace AgroBase.Forms.Movimentacao
return; return;
} }
cmbTipoMovimento.Items.Clear();
cmbTipoMovimento.Items.AddRange(Enum.GetNames(typeof(TipoMovimentoDirecional)));
cmbTipoMovimento.SelectedIndex = (int)Variaveis.OperacaoEmAndamento.Controle.TipoMovimento;
AtualizarConfiguracaoSentido();
}
private void AtualizarConfiguracaoSentido()
{
var cmbsSentido = gpbET.Controls.OfType<ComboBox>().ToList().Union(gpbEF.Controls.OfType<ComboBox>().ToList()).Union(gpbDT.Controls.OfType<ComboBox>().ToList()).Union(gpbDF.Controls.OfType<ComboBox>().ToList()).ToList(); var cmbsSentido = gpbET.Controls.OfType<ComboBox>().ToList().Union(gpbEF.Controls.OfType<ComboBox>().ToList()).Union(gpbDT.Controls.OfType<ComboBox>().ToList()).Union(gpbDF.Controls.OfType<ComboBox>().ToList()).ToList();
foreach (var cmb in cmbsSentido) foreach (var cmb in cmbsSentido)
{ {
@ -41,19 +50,19 @@ namespace AgroBase.Forms.Movimentacao
Sentido sentido = Sentido.Parado; Sentido sentido = Sentido.Parado;
if (cmb.Name.Contains("Frente")) if (cmb.Name.Contains("Frente"))
{ {
sentido = Modulo.MovMotor.ConfigSentidos.Frente; sentido = Modulo.MovMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Frente;
} }
else if (cmb.Name.Contains("Tras")) else if (cmb.Name.Contains("Tras"))
{ {
sentido = Modulo.MovMotor.ConfigSentidos.Tras; sentido = Modulo.MovMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Tras;
} }
else if (cmb.Name.Contains("Esquerda")) else if (cmb.Name.Contains("Esquerda"))
{ {
sentido = Modulo.MovMotor.ConfigSentidos.Esquerda; sentido = Modulo.MovMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Esquerda;
} }
else if (cmb.Name.Contains("Direita")) else if (cmb.Name.Contains("Direita"))
{ {
sentido = Modulo.MovMotor.ConfigSentidos.Direita; sentido = Modulo.MovMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Direita;
} }
cmb.SelectedItem = Enum.GetName(typeof(Sentido), sentido); cmb.SelectedItem = Enum.GetName(typeof(Sentido), sentido);
@ -63,12 +72,9 @@ namespace AgroBase.Forms.Movimentacao
nudRPMMax.Value = Modulo.MovMotor.RPM_Max; nudRPMMax.Value = Modulo.MovMotor.RPM_Max;
nudReducao.Value = Modulo.MovMotor.Reducao; nudReducao.Value = Modulo.MovMotor.Reducao;
nudDiametroRoda.Value = Convert.ToInt32(VariaveisEquipamento.DiametroRoda * 1000);
TextBox txtEndereco = FuncoesGlobais.FindControlRecursive<TextBox>(gpbSentido, "txt" + Modulo.Modulo_ID + "Endereco"); TextBox txtEndereco = FuncoesGlobais.FindControlRecursive<TextBox>(gpbSentido, "txt" + Modulo.Modulo_ID + "Endereco");
txtEndereco.Text = Modulo.MovMotor.Endereco; txtEndereco.Text = Modulo.MovMotor.Endereco;
} }
} }
} }
@ -89,19 +95,19 @@ namespace AgroBase.Forms.Movimentacao
Sentido sentido = (Sentido)cmb.SelectedIndex; Sentido sentido = (Sentido)cmb.SelectedIndex;
if (cmb.Name.Contains("Frente")) if (cmb.Name.Contains("Frente"))
{ {
Modulo.MovMotor.ConfigSentidos.Frente = sentido; Modulo.MovMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Frente = sentido;
} }
else if (cmb.Name.Contains("Tras")) else if (cmb.Name.Contains("Tras"))
{ {
Modulo.MovMotor.ConfigSentidos.Tras = sentido; Modulo.MovMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Tras = sentido;
} }
else if (cmb.Name.Contains("Esquerda")) else if (cmb.Name.Contains("Esquerda"))
{ {
Modulo.MovMotor.ConfigSentidos.Esquerda = sentido; Modulo.MovMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Esquerda = sentido;
} }
else if (cmb.Name.Contains("Direita")) else if (cmb.Name.Contains("Direita"))
{ {
Modulo.MovMotor.ConfigSentidos.Direita = sentido; Modulo.MovMotor.ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Direita = sentido;
} }
Modulo.MovMotor.NumeroPolos = Convert.ToInt32(nudNumPolos.Value); Modulo.MovMotor.NumeroPolos = Convert.ToInt32(nudNumPolos.Value);
@ -123,5 +129,11 @@ namespace AgroBase.Forms.Movimentacao
{ {
VariaveisEquipamento.DiametroRoda = Convert.ToDouble(nudDiametroRoda.Value / 1000); VariaveisEquipamento.DiametroRoda = Convert.ToDouble(nudDiametroRoda.Value / 1000);
} }
private void cmbTipoMovimento_SelectedIndexChanged(object sender, EventArgs e)
{
Variaveis.OperacaoEmAndamento.Controle.TipoMovimento = (TipoMovimentoDirecional)cmbTipoMovimento.SelectedIndex;
AtualizarConfiguracaoSentido();
}
} }
} }

View File

@ -9,7 +9,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Forms namespace AgroBase.Forms
{ {

View File

@ -10,7 +10,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting; using System.Windows.Forms.DataVisualization.Charting;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Forms namespace AgroBase.Forms
{ {

View File

@ -28,9 +28,9 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); System.Windows.Forms.DataVisualization.Charting.Legend legend2 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series();
this.pnlCamerasSolo = new System.Windows.Forms.Panel(); this.pnlCamerasSolo = new System.Windows.Forms.Panel();
this.pnlCameraSoloE = new System.Windows.Forms.Panel(); this.pnlCameraSoloE = new System.Windows.Forms.Panel();
this.pnlCameraSoloD = new System.Windows.Forms.Panel(); this.pnlCameraSoloD = new System.Windows.Forms.Panel();
@ -64,21 +64,9 @@
this.btnLigarBomba = new System.Windows.Forms.Button(); this.btnLigarBomba = new System.Windows.Forms.Button();
this.pnlCameraRua = new System.Windows.Forms.Panel(); this.pnlCameraRua = new System.Windows.Forms.Panel();
this.pnlDir_EF = new System.Windows.Forms.Panel(); this.pnlDir_EF = new System.Windows.Forms.Panel();
this.chbLivre_EF = new System.Windows.Forms.CheckBox();
this.chbCmd_EF = new System.Windows.Forms.CheckBox();
this.btnRef_EF = new System.Windows.Forms.Button();
this.pnlDir_ET = new System.Windows.Forms.Panel(); this.pnlDir_ET = new System.Windows.Forms.Panel();
this.chbLivre_ET = new System.Windows.Forms.CheckBox();
this.chbCmd_ET = new System.Windows.Forms.CheckBox();
this.btnRef_ET = new System.Windows.Forms.Button();
this.pnlDir_DT = new System.Windows.Forms.Panel(); this.pnlDir_DT = new System.Windows.Forms.Panel();
this.chbLivre_DT = new System.Windows.Forms.CheckBox();
this.chbCmd_DT = new System.Windows.Forms.CheckBox();
this.btnRef_DT = new System.Windows.Forms.Button();
this.pnlDir_DF = new System.Windows.Forms.Panel(); this.pnlDir_DF = new System.Windows.Forms.Panel();
this.chbLivre_DF = new System.Windows.Forms.CheckBox();
this.chbCmd_DF = new System.Windows.Forms.CheckBox();
this.btnRef_DF = new System.Windows.Forms.Button();
this.lblDistanciaEsquerda = new System.Windows.Forms.Label(); this.lblDistanciaEsquerda = new System.Windows.Forms.Label();
this.lblDistanciaDireita = new System.Windows.Forms.Label(); this.lblDistanciaDireita = new System.Windows.Forms.Label();
this.chbSonar = new System.Windows.Forms.CheckBox(); this.chbSonar = new System.Windows.Forms.CheckBox();
@ -87,6 +75,8 @@
this.lblRPM = new System.Windows.Forms.Label(); this.lblRPM = new System.Windows.Forms.Label();
this.lblVelocidade = new System.Windows.Forms.Label(); this.lblVelocidade = new System.Windows.Forms.Label();
this.lblKmh = new System.Windows.Forms.Label(); this.lblKmh = new System.Windows.Forms.Label();
this.cmbTipoMovimento = new System.Windows.Forms.ComboBox();
this.lblTipoMovimento = new System.Windows.Forms.Label();
this.pnlCamerasSolo.SuspendLayout(); this.pnlCamerasSolo.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.chartGraficos)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.chartGraficos)).BeginInit();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
@ -159,17 +149,17 @@
// //
this.chartGraficos.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.chartGraficos.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
chartArea1.Name = "ChartArea1"; chartArea2.Name = "ChartArea1";
this.chartGraficos.ChartAreas.Add(chartArea1); this.chartGraficos.ChartAreas.Add(chartArea2);
legend1.Name = "Legend1"; legend2.Name = "Legend1";
this.chartGraficos.Legends.Add(legend1); this.chartGraficos.Legends.Add(legend2);
this.chartGraficos.Location = new System.Drawing.Point(640, 7); this.chartGraficos.Location = new System.Drawing.Point(640, 7);
this.chartGraficos.Margin = new System.Windows.Forms.Padding(2); this.chartGraficos.Margin = new System.Windows.Forms.Padding(2);
this.chartGraficos.Name = "chartGraficos"; this.chartGraficos.Name = "chartGraficos";
series1.ChartArea = "ChartArea1"; series2.ChartArea = "ChartArea1";
series1.Legend = "Legend1"; series2.Legend = "Legend1";
series1.Name = "Series1"; series2.Name = "Series1";
this.chartGraficos.Series.Add(series1); this.chartGraficos.Series.Add(series2);
this.chartGraficos.Size = new System.Drawing.Size(591, 318); this.chartGraficos.Size = new System.Drawing.Size(591, 318);
this.chartGraficos.TabIndex = 2; this.chartGraficos.TabIndex = 2;
this.chartGraficos.Text = "chart1"; this.chartGraficos.Text = "chart1";
@ -473,9 +463,6 @@
// //
// pnlDir_EF // pnlDir_EF
// //
this.pnlDir_EF.Controls.Add(this.chbLivre_EF);
this.pnlDir_EF.Controls.Add(this.chbCmd_EF);
this.pnlDir_EF.Controls.Add(this.btnRef_EF);
this.pnlDir_EF.Controls.Add(this.lblDir_EF); this.pnlDir_EF.Controls.Add(this.lblDir_EF);
this.pnlDir_EF.Location = new System.Drawing.Point(0, 0); this.pnlDir_EF.Location = new System.Drawing.Point(0, 0);
this.pnlDir_EF.Margin = new System.Windows.Forms.Padding(2); this.pnlDir_EF.Margin = new System.Windows.Forms.Padding(2);
@ -483,44 +470,8 @@
this.pnlDir_EF.Size = new System.Drawing.Size(150, 162); this.pnlDir_EF.Size = new System.Drawing.Size(150, 162);
this.pnlDir_EF.TabIndex = 23; this.pnlDir_EF.TabIndex = 23;
// //
// chbLivre_EF
//
this.chbLivre_EF.AutoSize = true;
this.chbLivre_EF.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.chbLivre_EF.Location = new System.Drawing.Point(101, 144);
this.chbLivre_EF.Margin = new System.Windows.Forms.Padding(2);
this.chbLivre_EF.Name = "chbLivre_EF";
this.chbLivre_EF.Size = new System.Drawing.Size(49, 17);
this.chbLivre_EF.TabIndex = 17;
this.chbLivre_EF.Text = "Livre";
this.chbLivre_EF.UseVisualStyleBackColor = true;
//
// chbCmd_EF
//
this.chbCmd_EF.AutoSize = true;
this.chbCmd_EF.Location = new System.Drawing.Point(3, 144);
this.chbCmd_EF.Margin = new System.Windows.Forms.Padding(2);
this.chbCmd_EF.Name = "chbCmd_EF";
this.chbCmd_EF.Size = new System.Drawing.Size(68, 17);
this.chbCmd_EF.TabIndex = 15;
this.chbCmd_EF.Text = "Controlar";
this.chbCmd_EF.UseVisualStyleBackColor = true;
//
// btnRef_EF
//
this.btnRef_EF.Location = new System.Drawing.Point(111, 2);
this.btnRef_EF.Margin = new System.Windows.Forms.Padding(2);
this.btnRef_EF.Name = "btnRef_EF";
this.btnRef_EF.Size = new System.Drawing.Size(37, 19);
this.btnRef_EF.TabIndex = 13;
this.btnRef_EF.Text = "REF";
this.btnRef_EF.UseVisualStyleBackColor = true;
//
// pnlDir_ET // pnlDir_ET
// //
this.pnlDir_ET.Controls.Add(this.chbLivre_ET);
this.pnlDir_ET.Controls.Add(this.chbCmd_ET);
this.pnlDir_ET.Controls.Add(this.btnRef_ET);
this.pnlDir_ET.Controls.Add(this.lblDir_ET); this.pnlDir_ET.Controls.Add(this.lblDir_ET);
this.pnlDir_ET.Location = new System.Drawing.Point(0, 162); this.pnlDir_ET.Location = new System.Drawing.Point(0, 162);
this.pnlDir_ET.Margin = new System.Windows.Forms.Padding(2); this.pnlDir_ET.Margin = new System.Windows.Forms.Padding(2);
@ -528,44 +479,8 @@
this.pnlDir_ET.Size = new System.Drawing.Size(150, 162); this.pnlDir_ET.Size = new System.Drawing.Size(150, 162);
this.pnlDir_ET.TabIndex = 24; this.pnlDir_ET.TabIndex = 24;
// //
// chbLivre_ET
//
this.chbLivre_ET.AutoSize = true;
this.chbLivre_ET.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.chbLivre_ET.Location = new System.Drawing.Point(101, 144);
this.chbLivre_ET.Margin = new System.Windows.Forms.Padding(2);
this.chbLivre_ET.Name = "chbLivre_ET";
this.chbLivre_ET.Size = new System.Drawing.Size(49, 17);
this.chbLivre_ET.TabIndex = 16;
this.chbLivre_ET.Text = "Livre";
this.chbLivre_ET.UseVisualStyleBackColor = true;
//
// chbCmd_ET
//
this.chbCmd_ET.AutoSize = true;
this.chbCmd_ET.Location = new System.Drawing.Point(3, 144);
this.chbCmd_ET.Margin = new System.Windows.Forms.Padding(2);
this.chbCmd_ET.Name = "chbCmd_ET";
this.chbCmd_ET.Size = new System.Drawing.Size(68, 17);
this.chbCmd_ET.TabIndex = 15;
this.chbCmd_ET.Text = "Controlar";
this.chbCmd_ET.UseVisualStyleBackColor = true;
//
// btnRef_ET
//
this.btnRef_ET.Location = new System.Drawing.Point(111, 2);
this.btnRef_ET.Margin = new System.Windows.Forms.Padding(2);
this.btnRef_ET.Name = "btnRef_ET";
this.btnRef_ET.Size = new System.Drawing.Size(37, 19);
this.btnRef_ET.TabIndex = 13;
this.btnRef_ET.Text = "REF";
this.btnRef_ET.UseVisualStyleBackColor = true;
//
// pnlDir_DT // pnlDir_DT
// //
this.pnlDir_DT.Controls.Add(this.chbLivre_DT);
this.pnlDir_DT.Controls.Add(this.chbCmd_DT);
this.pnlDir_DT.Controls.Add(this.btnRef_DT);
this.pnlDir_DT.Controls.Add(this.lblDir_DT); this.pnlDir_DT.Controls.Add(this.lblDir_DT);
this.pnlDir_DT.Location = new System.Drawing.Point(486, 162); this.pnlDir_DT.Location = new System.Drawing.Point(486, 162);
this.pnlDir_DT.Margin = new System.Windows.Forms.Padding(2); this.pnlDir_DT.Margin = new System.Windows.Forms.Padding(2);
@ -573,44 +488,8 @@
this.pnlDir_DT.Size = new System.Drawing.Size(150, 162); this.pnlDir_DT.Size = new System.Drawing.Size(150, 162);
this.pnlDir_DT.TabIndex = 24; this.pnlDir_DT.TabIndex = 24;
// //
// chbLivre_DT
//
this.chbLivre_DT.AutoSize = true;
this.chbLivre_DT.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.chbLivre_DT.Location = new System.Drawing.Point(101, 144);
this.chbLivre_DT.Margin = new System.Windows.Forms.Padding(2);
this.chbLivre_DT.Name = "chbLivre_DT";
this.chbLivre_DT.Size = new System.Drawing.Size(49, 17);
this.chbLivre_DT.TabIndex = 19;
this.chbLivre_DT.Text = "Livre";
this.chbLivre_DT.UseVisualStyleBackColor = true;
//
// chbCmd_DT
//
this.chbCmd_DT.AutoSize = true;
this.chbCmd_DT.Location = new System.Drawing.Point(3, 144);
this.chbCmd_DT.Margin = new System.Windows.Forms.Padding(2);
this.chbCmd_DT.Name = "chbCmd_DT";
this.chbCmd_DT.Size = new System.Drawing.Size(68, 17);
this.chbCmd_DT.TabIndex = 13;
this.chbCmd_DT.Text = "Controlar";
this.chbCmd_DT.UseVisualStyleBackColor = true;
//
// btnRef_DT
//
this.btnRef_DT.Location = new System.Drawing.Point(111, 2);
this.btnRef_DT.Margin = new System.Windows.Forms.Padding(2);
this.btnRef_DT.Name = "btnRef_DT";
this.btnRef_DT.Size = new System.Drawing.Size(37, 19);
this.btnRef_DT.TabIndex = 12;
this.btnRef_DT.Text = "REF";
this.btnRef_DT.UseVisualStyleBackColor = true;
//
// pnlDir_DF // pnlDir_DF
// //
this.pnlDir_DF.Controls.Add(this.chbLivre_DF);
this.pnlDir_DF.Controls.Add(this.chbCmd_DF);
this.pnlDir_DF.Controls.Add(this.btnRef_DF);
this.pnlDir_DF.Controls.Add(this.lblDir_DF); this.pnlDir_DF.Controls.Add(this.lblDir_DF);
this.pnlDir_DF.Location = new System.Drawing.Point(486, 0); this.pnlDir_DF.Location = new System.Drawing.Point(486, 0);
this.pnlDir_DF.Margin = new System.Windows.Forms.Padding(2); this.pnlDir_DF.Margin = new System.Windows.Forms.Padding(2);
@ -618,39 +497,6 @@
this.pnlDir_DF.Size = new System.Drawing.Size(150, 162); this.pnlDir_DF.Size = new System.Drawing.Size(150, 162);
this.pnlDir_DF.TabIndex = 24; this.pnlDir_DF.TabIndex = 24;
// //
// chbLivre_DF
//
this.chbLivre_DF.AutoSize = true;
this.chbLivre_DF.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.chbLivre_DF.Location = new System.Drawing.Point(101, 144);
this.chbLivre_DF.Margin = new System.Windows.Forms.Padding(2);
this.chbLivre_DF.Name = "chbLivre_DF";
this.chbLivre_DF.Size = new System.Drawing.Size(49, 17);
this.chbLivre_DF.TabIndex = 18;
this.chbLivre_DF.Text = "Livre";
this.chbLivre_DF.UseVisualStyleBackColor = true;
//
// chbCmd_DF
//
this.chbCmd_DF.AutoSize = true;
this.chbCmd_DF.Location = new System.Drawing.Point(3, 144);
this.chbCmd_DF.Margin = new System.Windows.Forms.Padding(2);
this.chbCmd_DF.Name = "chbCmd_DF";
this.chbCmd_DF.Size = new System.Drawing.Size(68, 17);
this.chbCmd_DF.TabIndex = 14;
this.chbCmd_DF.Text = "Controlar";
this.chbCmd_DF.UseVisualStyleBackColor = true;
//
// btnRef_DF
//
this.btnRef_DF.Location = new System.Drawing.Point(111, 2);
this.btnRef_DF.Margin = new System.Windows.Forms.Padding(2);
this.btnRef_DF.Name = "btnRef_DF";
this.btnRef_DF.Size = new System.Drawing.Size(37, 19);
this.btnRef_DF.TabIndex = 13;
this.btnRef_DF.Text = "REF";
this.btnRef_DF.UseVisualStyleBackColor = true;
//
// lblDistanciaEsquerda // lblDistanciaEsquerda
// //
this.lblDistanciaEsquerda.AutoSize = true; this.lblDistanciaEsquerda.AutoSize = true;
@ -738,12 +584,33 @@
this.lblKmh.TabIndex = 20; this.lblKmh.TabIndex = 20;
this.lblKmh.Text = "km/h"; this.lblKmh.Text = "km/h";
// //
// cmbTipoMovimento
//
this.cmbTipoMovimento.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbTipoMovimento.FormattingEnabled = true;
this.cmbTipoMovimento.Location = new System.Drawing.Point(1119, 556);
this.cmbTipoMovimento.Name = "cmbTipoMovimento";
this.cmbTipoMovimento.Size = new System.Drawing.Size(113, 21);
this.cmbTipoMovimento.TabIndex = 33;
this.cmbTipoMovimento.SelectedIndexChanged += new System.EventHandler(this.cmbTipoMovimento_SelectedIndexChanged);
//
// lblTipoMovimento
//
this.lblTipoMovimento.AutoSize = true;
this.lblTipoMovimento.Location = new System.Drawing.Point(1116, 540);
this.lblTipoMovimento.Name = "lblTipoMovimento";
this.lblTipoMovimento.Size = new System.Drawing.Size(98, 13);
this.lblTipoMovimento.TabIndex = 34;
this.lblTipoMovimento.Text = "Tipo de Movimento";
//
// frmOperacaoManual // frmOperacaoManual
// //
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.BackColor = System.Drawing.Color.White; this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(1243, 649); this.ClientSize = new System.Drawing.Size(1243, 649);
this.Controls.Add(this.lblTipoMovimento);
this.Controls.Add(this.cmbTipoMovimento);
this.Controls.Add(this.lblKmh); this.Controls.Add(this.lblKmh);
this.Controls.Add(this.lblVelocidade); this.Controls.Add(this.lblVelocidade);
this.Controls.Add(this.lblRPM); this.Controls.Add(this.lblRPM);
@ -833,18 +700,6 @@
private System.Windows.Forms.Label lblGPSaltitude; private System.Windows.Forms.Label lblGPSaltitude;
private System.Windows.Forms.Label lblGPSvelocidade; private System.Windows.Forms.Label lblGPSvelocidade;
private System.Windows.Forms.Label lblGPSprecisao; private System.Windows.Forms.Label lblGPSprecisao;
private System.Windows.Forms.Button btnRef_EF;
private System.Windows.Forms.Button btnRef_ET;
private System.Windows.Forms.Button btnRef_DT;
private System.Windows.Forms.Button btnRef_DF;
private System.Windows.Forms.CheckBox chbCmd_EF;
private System.Windows.Forms.CheckBox chbCmd_ET;
private System.Windows.Forms.CheckBox chbCmd_DT;
private System.Windows.Forms.CheckBox chbCmd_DF;
private System.Windows.Forms.CheckBox chbLivre_EF;
private System.Windows.Forms.CheckBox chbLivre_ET;
private System.Windows.Forms.CheckBox chbLivre_DT;
private System.Windows.Forms.CheckBox chbLivre_DF;
private System.Windows.Forms.PictureBox picSonar; private System.Windows.Forms.PictureBox picSonar;
private System.Windows.Forms.CheckBox chbSonar; private System.Windows.Forms.CheckBox chbSonar;
private System.Windows.Forms.Label lblTensao; private System.Windows.Forms.Label lblTensao;
@ -852,5 +707,7 @@
private System.Windows.Forms.Label lblRPM; private System.Windows.Forms.Label lblRPM;
private System.Windows.Forms.Label lblVelocidade; private System.Windows.Forms.Label lblVelocidade;
private System.Windows.Forms.Label lblKmh; private System.Windows.Forms.Label lblKmh;
private System.Windows.Forms.ComboBox cmbTipoMovimento;
private System.Windows.Forms.Label lblTipoMovimento;
} }
} }

View File

@ -9,7 +9,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
using AForge.Video.DirectShow; using AForge.Video.DirectShow;
using AForge.Video; using AForge.Video;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
@ -45,6 +45,10 @@ namespace AgroBase.Forms.Operacoes
private void frmOperacaoManual_Load(object sender, EventArgs e) private void frmOperacaoManual_Load(object sender, EventArgs e)
{ {
cmbTipoMovimento.Items.Clear();
cmbTipoMovimento.Items.AddRange(Enum.GetNames(typeof(TipoMovimentoDirecional)));
cmbTipoMovimento.SelectedIndex = (int)Variaveis.OperacaoEmAndamento.Controle.TipoMovimento;
Variaveis.OperacaoEmAndamento.AtualizaListaCameras(pnlCameraRua, new List<Panel>() { pnlCameraSoloE, pnlCameraSoloD }, true); Variaveis.OperacaoEmAndamento.AtualizaListaCameras(pnlCameraRua, new List<Panel>() { pnlCameraSoloE, pnlCameraSoloD }, true);
InicializarComandosDirecional(); InicializarComandosDirecional();
@ -154,30 +158,6 @@ namespace AgroBase.Forms.Operacoes
pnlDir_DT.Paint += pnlDir_Paint; pnlDir_DT.Paint += pnlDir_Paint;
pnlDir_EF.Paint += pnlDir_Paint; pnlDir_EF.Paint += pnlDir_Paint;
pnlDir_ET.Paint += pnlDir_Paint; pnlDir_ET.Paint += pnlDir_Paint;
btnRef_DF.Click += btnRef_Click;
btnRef_DT.Click += btnRef_Click;
btnRef_EF.Click += btnRef_Click;
btnRef_ET.Click += btnRef_Click;
chbCmd_DF.CheckedChanged += chbCmd_CheckedChanged;
chbCmd_DT.CheckedChanged += chbCmd_CheckedChanged;
chbCmd_EF.CheckedChanged += chbCmd_CheckedChanged;
chbCmd_ET.CheckedChanged += chbCmd_CheckedChanged;
chbLivre_DF.CheckedChanged += chbLivre_CheckedChanged;
chbLivre_DT.CheckedChanged += chbLivre_CheckedChanged;
chbLivre_EF.CheckedChanged += chbLivre_CheckedChanged;
chbLivre_ET.CheckedChanged += chbLivre_CheckedChanged;
DefinirStatusInicialChb(chbCmd_DF, chbLivre_DF);
DefinirStatusInicialChb(chbCmd_DT, chbLivre_DT);
DefinirStatusInicialChb(chbCmd_EF, chbLivre_EF);
DefinirStatusInicialChb(chbCmd_ET, chbLivre_ET);
}
private void DefinirStatusInicialChb(CheckBox chbCmd, CheckBox chbLivre)
{
string ID = chbCmd.Name.Split('_')[1];
var Modulo = Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.FirstOrDefault(x => x.Modulo_ID == ID);
chbCmd.Checked = Modulo.DirMotor.Comandar;
//chbLivre.Checked = Modulo.DirMotor.Livre;
} }
private void pnlDir_Paint(object sender, PaintEventArgs e) private void pnlDir_Paint(object sender, PaintEventArgs e)
@ -330,31 +310,6 @@ namespace AgroBase.Forms.Operacoes
} }
private void btnRef_Click(object sender, EventArgs e)
{
string ID = ((Button)sender).Name.Replace("btnRef_", "");
var Dispositivo = Variaveis.OperacaoEmAndamento.DispMvd;
var Modulo = Dispositivo.Dados.Modulos.FirstOrDefault(x => x.Modulo_ID == ID);
//var Comando = Modulo.DirMotor.ProtocoloComando(Direcao.Parado);
//Dispositivo.AdicionarMensagemFila(Modulo.Modulo_ID, Comando, true, false);
}
private void chbCmd_CheckedChanged(object sender, EventArgs e)
{
string ID = ((CheckBox)sender).Name.Replace("chbCmd_", "");
var Dispositivo = Variaveis.OperacaoEmAndamento.DispMvd;
var Modulo = Dispositivo.Dados.Modulos.FirstOrDefault(x => x.Modulo_ID == ID);
Modulo.DirMotor.Comandar = ((CheckBox)sender).Checked;
}
private void chbLivre_CheckedChanged(object sender, EventArgs e)
{
string ID = ((CheckBox)sender).Name.Replace("chbLivre_", "");
var Dispositivo = Variaveis.OperacaoEmAndamento.DispMvd;
var Modulo = Dispositivo.Dados.Modulos.FirstOrDefault(x => x.Modulo_ID == ID);
//Modulo.DirMotor.Livre = ((CheckBox)sender).Checked;
}
#endregion #endregion
#region Angulo orientacao Magnetica #region Angulo orientacao Magnetica
@ -508,9 +463,7 @@ namespace AgroBase.Forms.Operacoes
var Bico = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BicosPulverizadores.FirstOrDefault(x => x.ID == ID); var Bico = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BicosPulverizadores.FirstOrDefault(x => x.ID == ID);
if (Bico != null) if (Bico != null)
{ {
Bico.Atuado = Bico.Atuado ? !Variaveis.OperacaoEmAndamento.DispAtu.Dados.AtuacaoNivelAlto : Variaveis.OperacaoEmAndamento.DispAtu.Dados.AtuacaoNivelAlto; GeneralJoystick.EnviarComandoAtuador(S_Code.sBIC, !Bico.Atuado, Bico.ID);
string Protocolo = Bico.ProtocoloComando();
Variaveis.OperacaoEmAndamento.DispAtu.AdicionarMensagemFila(Variaveis.OperacaoEmAndamento.DispAtu.Dados.Modulo_ID, Protocolo, true, false);
pnlAtuadores.Controls.OfType<Label>().First(x => x.Name == "lblCmd_" + ID).Text = "Comando: " + (Bico.Atuado ? "Ligado" : "Desligado"); pnlAtuadores.Controls.OfType<Label>().First(x => x.Name == "lblCmd_" + ID).Text = "Comando: " + (Bico.Atuado ? "Ligado" : "Desligado");
btn.Text = Bico.Atuado ? "Desligar" : "Ligar"; btn.Text = Bico.Atuado ? "Desligar" : "Ligar";
@ -519,26 +472,18 @@ namespace AgroBase.Forms.Operacoes
private void btnLigarBomba_Click(object sender, EventArgs e) private void btnLigarBomba_Click(object sender, EventArgs e)
{ {
Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombaPressurizadora.BombaAtuada = true; GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, true);
EnviarProtocoloComandoBomba();
} }
private void btnDesligarBomba_Click(object sender, EventArgs e) private void btnDesligarBomba_Click(object sender, EventArgs e)
{ {
Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombaPressurizadora.BombaAtuada = false; GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, false);
EnviarProtocoloComandoBomba();
} }
private void nudPressaoSP_ValueChanged(object sender, EventArgs e) private void nudPressaoSP_ValueChanged(object sender, EventArgs e)
{ {
Variaveis.OperacaoEmAndamento.Controle.PressaoLinha = Convert.ToInt32(((NumericUpDown)sender).Value); Variaveis.OperacaoEmAndamento.Controle.PressaoLinha = Convert.ToInt32(((NumericUpDown)sender).Value);
EnviarProtocoloComandoBomba(); GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombaPressurizadora.BombaAtuada);
}
private void EnviarProtocoloComandoBomba()
{
string Protocolo = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombaPressurizadora.ProtocoloComando();
Variaveis.OperacaoEmAndamento.DispAtu.AdicionarMensagemFila(Variaveis.OperacaoEmAndamento.DispAtu.Dados.Modulo_ID, Protocolo, true, false);
} }
private void pnlAtuadores_Paint(object sender, PaintEventArgs e) private void pnlAtuadores_Paint(object sender, PaintEventArgs e)
@ -616,5 +561,10 @@ namespace AgroBase.Forms.Operacoes
#endregion #endregion
private void cmbTipoMovimento_SelectedIndexChanged(object sender, EventArgs e)
{
Variaveis.OperacaoEmAndamento.Controle.TipoMovimento = (TipoMovimentoDirecional)cmbTipoMovimento.SelectedIndex;
}
} }
} }

View File

@ -7,7 +7,7 @@ using System.Data;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Forms.Operacoes namespace AgroBase.Forms.Operacoes
{ {

View File

@ -223,25 +223,33 @@
this.cmbMOV_Geral_Filtro = new System.Windows.Forms.ComboBox(); this.cmbMOV_Geral_Filtro = new System.Windows.Forms.ComboBox();
this.label61 = new System.Windows.Forms.Label(); this.label61 = new System.Windows.Forms.Label();
this.gpbMOV_Geral_DF = new System.Windows.Forms.GroupBox(); this.gpbMOV_Geral_DF = new System.Windows.Forms.GroupBox();
this.chbMOV_Brk_DF = new System.Windows.Forms.CheckBox();
this.chbMOV_En_DF = new System.Windows.Forms.CheckBox();
this.chbMOV_Alm_DF = new System.Windows.Forms.CheckBox(); this.chbMOV_Alm_DF = new System.Windows.Forms.CheckBox();
this.txtMOV_SentidoSP_DF = new System.Windows.Forms.TextBox(); this.txtMOV_SentidoSP_DF = new System.Windows.Forms.TextBox();
this.txtMOV_Sentido_DF = new System.Windows.Forms.TextBox(); this.txtMOV_Sentido_DF = new System.Windows.Forms.TextBox();
this.label29 = new System.Windows.Forms.Label(); this.label29 = new System.Windows.Forms.Label();
this.label34 = new System.Windows.Forms.Label(); this.label34 = new System.Windows.Forms.Label();
this.gpbMOV_Geral_DT = new System.Windows.Forms.GroupBox(); this.gpbMOV_Geral_DT = new System.Windows.Forms.GroupBox();
this.chbMOV_Brk_DT = new System.Windows.Forms.CheckBox();
this.chbMOV_En_DT = new System.Windows.Forms.CheckBox();
this.chbMOV_Alm_DT = new System.Windows.Forms.CheckBox(); this.chbMOV_Alm_DT = new System.Windows.Forms.CheckBox();
this.txtMOV_SentidoSP_DT = new System.Windows.Forms.TextBox(); this.txtMOV_SentidoSP_DT = new System.Windows.Forms.TextBox();
this.txtMOV_Sentido_DT = new System.Windows.Forms.TextBox(); this.txtMOV_Sentido_DT = new System.Windows.Forms.TextBox();
this.label26 = new System.Windows.Forms.Label(); this.label26 = new System.Windows.Forms.Label();
this.label28 = new System.Windows.Forms.Label(); this.label28 = new System.Windows.Forms.Label();
this.gpbMOV_Geral_ET = new System.Windows.Forms.GroupBox(); this.gpbMOV_Geral_ET = new System.Windows.Forms.GroupBox();
this.chbMOV_Brk_ET = new System.Windows.Forms.CheckBox();
this.chbMOV_Alm_ET = new System.Windows.Forms.CheckBox(); this.chbMOV_Alm_ET = new System.Windows.Forms.CheckBox();
this.chbMOV_En_ET = new System.Windows.Forms.CheckBox();
this.txtMOV_SentidoSP_ET = new System.Windows.Forms.TextBox(); this.txtMOV_SentidoSP_ET = new System.Windows.Forms.TextBox();
this.txtMOV_Sentido_ET = new System.Windows.Forms.TextBox(); this.txtMOV_Sentido_ET = new System.Windows.Forms.TextBox();
this.label12 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label();
this.label19 = new System.Windows.Forms.Label(); this.label19 = new System.Windows.Forms.Label();
this.gpbMOV_Geral_EF = new System.Windows.Forms.GroupBox(); this.gpbMOV_Geral_EF = new System.Windows.Forms.GroupBox();
this.chbMOV_Brk_EF = new System.Windows.Forms.CheckBox();
this.chbMOV_Alm_EF = new System.Windows.Forms.CheckBox(); this.chbMOV_Alm_EF = new System.Windows.Forms.CheckBox();
this.chbMOV_En_EF = new System.Windows.Forms.CheckBox();
this.txtMOV_SentidoSP_EF = new System.Windows.Forms.TextBox(); this.txtMOV_SentidoSP_EF = new System.Windows.Forms.TextBox();
this.txtMOV_Sentido_EF = new System.Windows.Forms.TextBox(); this.txtMOV_Sentido_EF = new System.Windows.Forms.TextBox();
this.label35 = new System.Windows.Forms.Label(); this.label35 = new System.Windows.Forms.Label();
@ -316,14 +324,8 @@
this.label36 = new System.Windows.Forms.Label(); this.label36 = new System.Windows.Forms.Label();
this.txtMomento = new System.Windows.Forms.TextBox(); this.txtMomento = new System.Windows.Forms.TextBox();
this.btnPlay = new System.Windows.Forms.Button(); this.btnPlay = new System.Windows.Forms.Button();
this.chbMOV_En_EF = new System.Windows.Forms.CheckBox(); this.txtTipoMovimento = new System.Windows.Forms.TextBox();
this.chbMOV_Brk_EF = new System.Windows.Forms.CheckBox(); this.lblTipoMovimento = new System.Windows.Forms.Label();
this.chbMOV_Brk_ET = new System.Windows.Forms.CheckBox();
this.chbMOV_En_ET = new System.Windows.Forms.CheckBox();
this.chbMOV_Brk_DT = new System.Windows.Forms.CheckBox();
this.chbMOV_En_DT = new System.Windows.Forms.CheckBox();
this.chbMOV_Brk_DF = new System.Windows.Forms.CheckBox();
this.chbMOV_En_DF = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.trbMomento)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.trbMomento)).BeginInit();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.panel2.SuspendLayout(); this.panel2.SuspendLayout();
@ -2375,6 +2377,30 @@
this.gpbMOV_Geral_DF.TabStop = false; this.gpbMOV_Geral_DF.TabStop = false;
this.gpbMOV_Geral_DF.Text = "M4 (DF)"; this.gpbMOV_Geral_DF.Text = "M4 (DF)";
// //
// chbMOV_Brk_DF
//
this.chbMOV_Brk_DF.AutoSize = true;
this.chbMOV_Brk_DF.Enabled = false;
this.chbMOV_Brk_DF.Location = new System.Drawing.Point(7, 59);
this.chbMOV_Brk_DF.Margin = new System.Windows.Forms.Padding(2);
this.chbMOV_Brk_DF.Name = "chbMOV_Brk_DF";
this.chbMOV_Brk_DF.Size = new System.Drawing.Size(49, 17);
this.chbMOV_Brk_DF.TabIndex = 129;
this.chbMOV_Brk_DF.Text = "Freio";
this.chbMOV_Brk_DF.UseVisualStyleBackColor = true;
//
// chbMOV_En_DF
//
this.chbMOV_En_DF.AutoSize = true;
this.chbMOV_En_DF.Enabled = false;
this.chbMOV_En_DF.Location = new System.Drawing.Point(7, 38);
this.chbMOV_En_DF.Margin = new System.Windows.Forms.Padding(2);
this.chbMOV_En_DF.Name = "chbMOV_En_DF";
this.chbMOV_En_DF.Size = new System.Drawing.Size(62, 17);
this.chbMOV_En_DF.TabIndex = 128;
this.chbMOV_En_DF.Text = "Ativado";
this.chbMOV_En_DF.UseVisualStyleBackColor = true;
//
// chbMOV_Alm_DF // chbMOV_Alm_DF
// //
this.chbMOV_Alm_DF.AutoSize = true; this.chbMOV_Alm_DF.AutoSize = true;
@ -2445,6 +2471,30 @@
this.gpbMOV_Geral_DT.TabStop = false; this.gpbMOV_Geral_DT.TabStop = false;
this.gpbMOV_Geral_DT.Text = "M3 (DT)"; this.gpbMOV_Geral_DT.Text = "M3 (DT)";
// //
// chbMOV_Brk_DT
//
this.chbMOV_Brk_DT.AutoSize = true;
this.chbMOV_Brk_DT.Enabled = false;
this.chbMOV_Brk_DT.Location = new System.Drawing.Point(7, 59);
this.chbMOV_Brk_DT.Margin = new System.Windows.Forms.Padding(2);
this.chbMOV_Brk_DT.Name = "chbMOV_Brk_DT";
this.chbMOV_Brk_DT.Size = new System.Drawing.Size(49, 17);
this.chbMOV_Brk_DT.TabIndex = 129;
this.chbMOV_Brk_DT.Text = "Freio";
this.chbMOV_Brk_DT.UseVisualStyleBackColor = true;
//
// chbMOV_En_DT
//
this.chbMOV_En_DT.AutoSize = true;
this.chbMOV_En_DT.Enabled = false;
this.chbMOV_En_DT.Location = new System.Drawing.Point(7, 38);
this.chbMOV_En_DT.Margin = new System.Windows.Forms.Padding(2);
this.chbMOV_En_DT.Name = "chbMOV_En_DT";
this.chbMOV_En_DT.Size = new System.Drawing.Size(62, 17);
this.chbMOV_En_DT.TabIndex = 128;
this.chbMOV_En_DT.Text = "Ativado";
this.chbMOV_En_DT.UseVisualStyleBackColor = true;
//
// chbMOV_Alm_DT // chbMOV_Alm_DT
// //
this.chbMOV_Alm_DT.AutoSize = true; this.chbMOV_Alm_DT.AutoSize = true;
@ -2515,6 +2565,18 @@
this.gpbMOV_Geral_ET.TabStop = false; this.gpbMOV_Geral_ET.TabStop = false;
this.gpbMOV_Geral_ET.Text = "M2 (ET)"; this.gpbMOV_Geral_ET.Text = "M2 (ET)";
// //
// chbMOV_Brk_ET
//
this.chbMOV_Brk_ET.AutoSize = true;
this.chbMOV_Brk_ET.Enabled = false;
this.chbMOV_Brk_ET.Location = new System.Drawing.Point(7, 59);
this.chbMOV_Brk_ET.Margin = new System.Windows.Forms.Padding(2);
this.chbMOV_Brk_ET.Name = "chbMOV_Brk_ET";
this.chbMOV_Brk_ET.Size = new System.Drawing.Size(49, 17);
this.chbMOV_Brk_ET.TabIndex = 129;
this.chbMOV_Brk_ET.Text = "Freio";
this.chbMOV_Brk_ET.UseVisualStyleBackColor = true;
//
// chbMOV_Alm_ET // chbMOV_Alm_ET
// //
this.chbMOV_Alm_ET.AutoSize = true; this.chbMOV_Alm_ET.AutoSize = true;
@ -2527,6 +2589,18 @@
this.chbMOV_Alm_ET.Text = "Alarme"; this.chbMOV_Alm_ET.Text = "Alarme";
this.chbMOV_Alm_ET.UseVisualStyleBackColor = true; this.chbMOV_Alm_ET.UseVisualStyleBackColor = true;
// //
// chbMOV_En_ET
//
this.chbMOV_En_ET.AutoSize = true;
this.chbMOV_En_ET.Enabled = false;
this.chbMOV_En_ET.Location = new System.Drawing.Point(7, 38);
this.chbMOV_En_ET.Margin = new System.Windows.Forms.Padding(2);
this.chbMOV_En_ET.Name = "chbMOV_En_ET";
this.chbMOV_En_ET.Size = new System.Drawing.Size(62, 17);
this.chbMOV_En_ET.TabIndex = 128;
this.chbMOV_En_ET.Text = "Ativado";
this.chbMOV_En_ET.UseVisualStyleBackColor = true;
//
// txtMOV_SentidoSP_ET // txtMOV_SentidoSP_ET
// //
this.txtMOV_SentidoSP_ET.Location = new System.Drawing.Point(7, 98); this.txtMOV_SentidoSP_ET.Location = new System.Drawing.Point(7, 98);
@ -2585,6 +2659,18 @@
this.gpbMOV_Geral_EF.TabStop = false; this.gpbMOV_Geral_EF.TabStop = false;
this.gpbMOV_Geral_EF.Text = "M1 (EF)"; this.gpbMOV_Geral_EF.Text = "M1 (EF)";
// //
// chbMOV_Brk_EF
//
this.chbMOV_Brk_EF.AutoSize = true;
this.chbMOV_Brk_EF.Enabled = false;
this.chbMOV_Brk_EF.Location = new System.Drawing.Point(7, 59);
this.chbMOV_Brk_EF.Margin = new System.Windows.Forms.Padding(2);
this.chbMOV_Brk_EF.Name = "chbMOV_Brk_EF";
this.chbMOV_Brk_EF.Size = new System.Drawing.Size(49, 17);
this.chbMOV_Brk_EF.TabIndex = 127;
this.chbMOV_Brk_EF.Text = "Freio";
this.chbMOV_Brk_EF.UseVisualStyleBackColor = true;
//
// chbMOV_Alm_EF // chbMOV_Alm_EF
// //
this.chbMOV_Alm_EF.AutoSize = true; this.chbMOV_Alm_EF.AutoSize = true;
@ -2597,6 +2683,18 @@
this.chbMOV_Alm_EF.Text = "Alarme"; this.chbMOV_Alm_EF.Text = "Alarme";
this.chbMOV_Alm_EF.UseVisualStyleBackColor = true; this.chbMOV_Alm_EF.UseVisualStyleBackColor = true;
// //
// chbMOV_En_EF
//
this.chbMOV_En_EF.AutoSize = true;
this.chbMOV_En_EF.Enabled = false;
this.chbMOV_En_EF.Location = new System.Drawing.Point(7, 38);
this.chbMOV_En_EF.Margin = new System.Windows.Forms.Padding(2);
this.chbMOV_En_EF.Name = "chbMOV_En_EF";
this.chbMOV_En_EF.Size = new System.Drawing.Size(62, 17);
this.chbMOV_En_EF.TabIndex = 126;
this.chbMOV_En_EF.Text = "Ativado";
this.chbMOV_En_EF.UseVisualStyleBackColor = true;
//
// txtMOV_SentidoSP_EF // txtMOV_SentidoSP_EF
// //
this.txtMOV_SentidoSP_EF.Location = new System.Drawing.Point(7, 98); this.txtMOV_SentidoSP_EF.Location = new System.Drawing.Point(7, 98);
@ -3086,6 +3184,8 @@
// //
// panel6 // panel6
// //
this.panel6.Controls.Add(this.txtTipoMovimento);
this.panel6.Controls.Add(this.lblTipoMovimento);
this.panel6.Controls.Add(this.txtErvasNoRadar); this.panel6.Controls.Add(this.txtErvasNoRadar);
this.panel6.Controls.Add(this.label79); this.panel6.Controls.Add(this.label79);
this.panel6.Controls.Add(this.txtDirecaoCarro); this.panel6.Controls.Add(this.txtDirecaoCarro);
@ -3404,101 +3504,25 @@
this.btnPlay.UseVisualStyleBackColor = true; this.btnPlay.UseVisualStyleBackColor = true;
this.btnPlay.Click += new System.EventHandler(this.btnPlay_Click); this.btnPlay.Click += new System.EventHandler(this.btnPlay_Click);
// //
// chbMOV_En_EF // txtTipoMovimento
// //
this.chbMOV_En_EF.AutoSize = true; this.txtTipoMovimento.Location = new System.Drawing.Point(4, 459);
this.chbMOV_En_EF.Enabled = false; this.txtTipoMovimento.Margin = new System.Windows.Forms.Padding(2);
this.chbMOV_En_EF.Location = new System.Drawing.Point(7, 38); this.txtTipoMovimento.Name = "txtTipoMovimento";
this.chbMOV_En_EF.Margin = new System.Windows.Forms.Padding(2); this.txtTipoMovimento.ReadOnly = true;
this.chbMOV_En_EF.Name = "chbMOV_En_EF"; this.txtTipoMovimento.Size = new System.Drawing.Size(117, 20);
this.chbMOV_En_EF.Size = new System.Drawing.Size(62, 17); this.txtTipoMovimento.TabIndex = 52;
this.chbMOV_En_EF.TabIndex = 126; this.txtTipoMovimento.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.chbMOV_En_EF.Text = "Ativado";
this.chbMOV_En_EF.UseVisualStyleBackColor = true;
// //
// chbMOV_Brk_EF // lblTipoMovimento
// //
this.chbMOV_Brk_EF.AutoSize = true; this.lblTipoMovimento.AutoSize = true;
this.chbMOV_Brk_EF.Enabled = false; this.lblTipoMovimento.Location = new System.Drawing.Point(2, 443);
this.chbMOV_Brk_EF.Location = new System.Drawing.Point(7, 59); this.lblTipoMovimento.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.chbMOV_Brk_EF.Margin = new System.Windows.Forms.Padding(2); this.lblTipoMovimento.Name = "lblTipoMovimento";
this.chbMOV_Brk_EF.Name = "chbMOV_Brk_EF"; this.lblTipoMovimento.Size = new System.Drawing.Size(98, 13);
this.chbMOV_Brk_EF.Size = new System.Drawing.Size(49, 17); this.lblTipoMovimento.TabIndex = 51;
this.chbMOV_Brk_EF.TabIndex = 127; this.lblTipoMovimento.Text = "Tipo de Movimento";
this.chbMOV_Brk_EF.Text = "Freio";
this.chbMOV_Brk_EF.UseVisualStyleBackColor = true;
//
// chbMOV_Brk_ET
//
this.chbMOV_Brk_ET.AutoSize = true;
this.chbMOV_Brk_ET.Enabled = false;
this.chbMOV_Brk_ET.Location = new System.Drawing.Point(7, 59);
this.chbMOV_Brk_ET.Margin = new System.Windows.Forms.Padding(2);
this.chbMOV_Brk_ET.Name = "chbMOV_Brk_ET";
this.chbMOV_Brk_ET.Size = new System.Drawing.Size(49, 17);
this.chbMOV_Brk_ET.TabIndex = 129;
this.chbMOV_Brk_ET.Text = "Freio";
this.chbMOV_Brk_ET.UseVisualStyleBackColor = true;
//
// chbMOV_En_ET
//
this.chbMOV_En_ET.AutoSize = true;
this.chbMOV_En_ET.Enabled = false;
this.chbMOV_En_ET.Location = new System.Drawing.Point(7, 38);
this.chbMOV_En_ET.Margin = new System.Windows.Forms.Padding(2);
this.chbMOV_En_ET.Name = "chbMOV_En_ET";
this.chbMOV_En_ET.Size = new System.Drawing.Size(62, 17);
this.chbMOV_En_ET.TabIndex = 128;
this.chbMOV_En_ET.Text = "Ativado";
this.chbMOV_En_ET.UseVisualStyleBackColor = true;
//
// chbMOV_Brk_DT
//
this.chbMOV_Brk_DT.AutoSize = true;
this.chbMOV_Brk_DT.Enabled = false;
this.chbMOV_Brk_DT.Location = new System.Drawing.Point(7, 59);
this.chbMOV_Brk_DT.Margin = new System.Windows.Forms.Padding(2);
this.chbMOV_Brk_DT.Name = "chbMOV_Brk_DT";
this.chbMOV_Brk_DT.Size = new System.Drawing.Size(49, 17);
this.chbMOV_Brk_DT.TabIndex = 129;
this.chbMOV_Brk_DT.Text = "Freio";
this.chbMOV_Brk_DT.UseVisualStyleBackColor = true;
//
// chbMOV_En_DT
//
this.chbMOV_En_DT.AutoSize = true;
this.chbMOV_En_DT.Enabled = false;
this.chbMOV_En_DT.Location = new System.Drawing.Point(7, 38);
this.chbMOV_En_DT.Margin = new System.Windows.Forms.Padding(2);
this.chbMOV_En_DT.Name = "chbMOV_En_DT";
this.chbMOV_En_DT.Size = new System.Drawing.Size(62, 17);
this.chbMOV_En_DT.TabIndex = 128;
this.chbMOV_En_DT.Text = "Ativado";
this.chbMOV_En_DT.UseVisualStyleBackColor = true;
//
// chbMOV_Brk_DF
//
this.chbMOV_Brk_DF.AutoSize = true;
this.chbMOV_Brk_DF.Enabled = false;
this.chbMOV_Brk_DF.Location = new System.Drawing.Point(7, 59);
this.chbMOV_Brk_DF.Margin = new System.Windows.Forms.Padding(2);
this.chbMOV_Brk_DF.Name = "chbMOV_Brk_DF";
this.chbMOV_Brk_DF.Size = new System.Drawing.Size(49, 17);
this.chbMOV_Brk_DF.TabIndex = 129;
this.chbMOV_Brk_DF.Text = "Freio";
this.chbMOV_Brk_DF.UseVisualStyleBackColor = true;
//
// chbMOV_En_DF
//
this.chbMOV_En_DF.AutoSize = true;
this.chbMOV_En_DF.Enabled = false;
this.chbMOV_En_DF.Location = new System.Drawing.Point(7, 38);
this.chbMOV_En_DF.Margin = new System.Windows.Forms.Padding(2);
this.chbMOV_En_DF.Name = "chbMOV_En_DF";
this.chbMOV_En_DF.Size = new System.Drawing.Size(62, 17);
this.chbMOV_En_DF.TabIndex = 128;
this.chbMOV_En_DF.Text = "Ativado";
this.chbMOV_En_DF.UseVisualStyleBackColor = true;
// //
// frmResultadosOperacao // frmResultadosOperacao
// //
@ -3870,5 +3894,7 @@
private System.Windows.Forms.CheckBox chbMOV_En_EF; private System.Windows.Forms.CheckBox chbMOV_En_EF;
private System.Windows.Forms.CheckBox chbMOV_Brk_DF; private System.Windows.Forms.CheckBox chbMOV_Brk_DF;
private System.Windows.Forms.CheckBox chbMOV_En_DF; private System.Windows.Forms.CheckBox chbMOV_En_DF;
private System.Windows.Forms.TextBox txtTipoMovimento;
private System.Windows.Forms.Label lblTipoMovimento;
} }
} }

View File

@ -125,13 +125,13 @@ namespace AgroBase.Forms.Operacoes
OperacaoDadosModel data = JsonConvert.DeserializeObject<OperacaoDadosModel>(File.ReadAllText(ofd.FileName)); OperacaoDadosModel data = JsonConvert.DeserializeObject<OperacaoDadosModel>(File.ReadAllText(ofd.FileName));
LogsOperacao = JsonConvert.DeserializeObject<OperacaoSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.operacao)).ToList(); LogsOperacao = JsonConvert.DeserializeObject<OperacaoSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.operacao)).ToList();
LogsGPS = JsonConvert.DeserializeObject<GPSModel[]>(DeserializarDadosOperacao(ofd.FileName, data.gps ?? Enuns.T_Code.Gps.ToString())).ToList(); LogsGPS = JsonConvert.DeserializeObject<GPSModel[]>(DeserializarDadosOperacao(ofd.FileName, data.gps ?? Enums.T_Code.Gps.ToString())).ToList();
LogsDirecional = JsonConvert.DeserializeObject<DirSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.dir ?? Enuns.T_Code.Dir.ToString())).ToList(); LogsDirecional = JsonConvert.DeserializeObject<DirSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.dir ?? Enums.T_Code.Dir.ToString())).ToList();
LogsMovimentacao = JsonConvert.DeserializeObject<MovSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.mov ?? Enuns.T_Code.Mov.ToString())).ToList(); LogsMovimentacao = JsonConvert.DeserializeObject<MovSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.mov ?? Enums.T_Code.Mov.ToString())).ToList();
LogsAtuador = JsonConvert.DeserializeObject<AtuSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.atu ?? Enuns.T_Code.Atu.ToString())).ToList(); LogsAtuador = JsonConvert.DeserializeObject<AtuSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.atu ?? Enums.T_Code.Atu.ToString())).ToList();
LogsSensoriamento = JsonConvert.DeserializeObject<SenSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.sen ?? Enuns.T_Code.Sen.ToString())).ToList(); LogsSensoriamento = JsonConvert.DeserializeObject<SenSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.sen ?? Enums.T_Code.Sen.ToString())).ToList();
LogsPzem = JsonConvert.DeserializeObject<PzmSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.pzm ?? Enuns.T_Code.Pzm.ToString())).ToList(); LogsPzem = JsonConvert.DeserializeObject<PzmSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.pzm ?? Enums.T_Code.Pzm.ToString())).ToList();
LogsWt901C = JsonConvert.DeserializeObject<WitSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.wit ?? Enuns.T_Code.Wit.ToString())).ToList(); LogsWt901C = JsonConvert.DeserializeObject<WitSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.wit ?? Enums.T_Code.Wit.ToString())).ToList();
pathImagensCaminho = ofd.FileName.Replace("data.lgop", data.caminho + "/"); pathImagensCaminho = ofd.FileName.Replace("data.lgop", data.caminho + "/");
pathImagensSoloE = ofd.FileName.Replace("data.lgop", data.soloE + "/"); pathImagensSoloE = ofd.FileName.Replace("data.lgop", data.soloE + "/");
pathImagensSoloD = ofd.FileName.Replace("data.lgop", data.soloD + "/"); pathImagensSoloD = ofd.FileName.Replace("data.lgop", data.soloD + "/");
@ -584,6 +584,7 @@ namespace AgroBase.Forms.Operacoes
txtDentroRua.Text = Log.DentroDaRua ? "Sim" : "Não"; txtDentroRua.Text = Log.DentroDaRua ? "Sim" : "Não";
txtDirecaoCarro.Text = Log.Direcao.ToString(); txtDirecaoCarro.Text = Log.Direcao.ToString();
txtErvasNoRadar.Text = Log.ErvasNoRadar.ToString(); txtErvasNoRadar.Text = Log.ErvasNoRadar.ToString();
txtTipoMovimento.Text = Log.TipoMovimento.ToString();
pnlOrientacaoCaminho.Invalidate(); pnlOrientacaoCaminho.Invalidate();
pnlOrientacaoDif.Invalidate(); pnlOrientacaoDif.Invalidate();
@ -631,7 +632,7 @@ namespace AgroBase.Forms.Operacoes
var Log = LogsDirecional.Where(x => x.Modulo_ID == ID).FirstOrDefault(x => x.Momento == MomentoAtual); var Log = LogsDirecional.Where(x => x.Modulo_ID == ID).FirstOrDefault(x => x.Momento == MomentoAtual);
double Angulo = Log?.Angulo ?? 0; double Angulo = Log?.Angulo ?? 0;
double Multiplicador = (Log?.Sentido ?? Enuns.Sentido.Parado) == Enuns.Sentido.Horario ? 1 : -1; double Multiplicador = (Log?.Sentido ?? Enums.Sentido.Parado) == Enums.Sentido.Horario ? 1 : -1;
Image img = Resources.roda_superior; Image img = Resources.roda_superior;
if (ID.StartsWith("D")) if (ID.StartsWith("D"))
{ {
@ -649,9 +650,9 @@ namespace AgroBase.Forms.Operacoes
TextBox txtAngulo = FuncoesGlobais.FindControlRecursive<TextBox>(tabDirecional, "txtDIR_Angulo_" + ID); TextBox txtAngulo = FuncoesGlobais.FindControlRecursive<TextBox>(tabDirecional, "txtDIR_Angulo_" + ID);
txtAngulo.Text = (Log?.Angulo ?? 0).ToString(); txtAngulo.Text = (Log?.Angulo ?? 0).ToString();
TextBox txtSentidoSP = FuncoesGlobais.FindControlRecursive<TextBox>(tabDirecional, "txtDIR_SentidoSP_" + ID); TextBox txtSentidoSP = FuncoesGlobais.FindControlRecursive<TextBox>(tabDirecional, "txtDIR_SentidoSP_" + ID);
txtSentidoSP.Text = (Log?.Sentido_SP ?? Enuns.Sentido.Parado).ToString(); txtSentidoSP.Text = (Log?.Sentido_SP ?? Enums.Sentido.Parado).ToString();
TextBox txtSentido = FuncoesGlobais.FindControlRecursive<TextBox>(tabDirecional, "txtDIR_Sentido_" + ID); TextBox txtSentido = FuncoesGlobais.FindControlRecursive<TextBox>(tabDirecional, "txtDIR_Sentido_" + ID);
txtSentido.Text = (Log?.Sentido ?? Enuns.Sentido.Parado).ToString(); txtSentido.Text = (Log?.Sentido ?? Enums.Sentido.Parado).ToString();
TextBox txtVelocidade = FuncoesGlobais.FindControlRecursive<TextBox>(tabDirecional, "txtDIR_Velocidade_" + ID); TextBox txtVelocidade = FuncoesGlobais.FindControlRecursive<TextBox>(tabDirecional, "txtDIR_Velocidade_" + ID);
txtVelocidade.Text = (Log?.Velocidade ?? 0).ToString(); txtVelocidade.Text = (Log?.Velocidade ?? 0).ToString();
TextBox txtControlar = FuncoesGlobais.FindControlRecursive<TextBox>(tabDirecional, "txtDIR_Controlar_" + ID); TextBox txtControlar = FuncoesGlobais.FindControlRecursive<TextBox>(tabDirecional, "txtDIR_Controlar_" + ID);
@ -746,9 +747,9 @@ namespace AgroBase.Forms.Operacoes
glControl.Invalidate(); glControl.Invalidate();
var LogSen = LogsSensoriamento.FirstOrDefault(x => x.Momento == MomentoAtual); var LogSen = LogsSensoriamento.FirstOrDefault(x => x.Momento == MomentoAtual);
pnlManual.BackColor = LogSen.StatusSinaleiroMN == Enuns.StatusLED.Aceso ? Color.Yellow : Color.Gold; pnlManual.BackColor = LogSen.StatusSinaleiroMN == Enums.StatusLED.Aceso ? Color.Yellow : Color.Gold;
pnlAutomatico.BackColor = LogSen.StatusSinaleiroAT == Enuns.StatusLED.Aceso ? Color.Yellow : Color.Gold; pnlAutomatico.BackColor = LogSen.StatusSinaleiroAT == Enums.StatusLED.Aceso ? Color.Yellow : Color.Gold;
pnlOperacao.BackColor = LogSen.StatusSinaleiroOP == Enuns.StatusLED.Aceso ? Color.Green : Color.DarkGreen; pnlOperacao.BackColor = LogSen.StatusSinaleiroOP == Enums.StatusLED.Aceso ? Color.Green : Color.DarkGreen;
} }

View File

@ -12,7 +12,7 @@ using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Forms.Sensoriamento namespace AgroBase.Forms.Sensoriamento
{ {

View File

@ -52,14 +52,6 @@ namespace AgroBase.Forms
this.lblDistanciaTotal = new System.Windows.Forms.Label(); this.lblDistanciaTotal = new System.Windows.Forms.Label();
this.lblTempoEmMovimento = new System.Windows.Forms.Label(); this.lblTempoEmMovimento = new System.Windows.Forms.Label();
this.lblTempoConectado = new System.Windows.Forms.Label(); this.lblTempoConectado = new System.Windows.Forms.Label();
this.chbDTLivre = new System.Windows.Forms.CheckBox();
this.chbDTControlar = new System.Windows.Forms.CheckBox();
this.chbETLivre = new System.Windows.Forms.CheckBox();
this.chbETControlar = new System.Windows.Forms.CheckBox();
this.chbDFLivre = new System.Windows.Forms.CheckBox();
this.chbDFControlar = new System.Windows.Forms.CheckBox();
this.chbEFLivre = new System.Windows.Forms.CheckBox();
this.chbEFControlar = new System.Windows.Forms.CheckBox();
this.chartET = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.chartET = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.chartDT = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.chartDT = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.chartDF = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.chartDF = new System.Windows.Forms.DataVisualization.Charting.Chart();
@ -97,36 +89,28 @@ namespace AgroBase.Forms
this.lblEFM_Tensao = new System.Windows.Forms.Label(); this.lblEFM_Tensao = new System.Windows.Forms.Label();
this.lblEFM_Velocidade = new System.Windows.Forms.Label(); this.lblEFM_Velocidade = new System.Windows.Forms.Label();
this.lblEFM_RPM = new System.Windows.Forms.Label(); this.lblEFM_RPM = new System.Windows.Forms.Label();
this.btnDTReverter = new System.Windows.Forms.Button();
this.btnETReverter = new System.Windows.Forms.Button();
this.btnDFReverter = new System.Windows.Forms.Button();
this.btnEFReverter = new System.Windows.Forms.Button();
this.lblDTA_SentidoSP = new System.Windows.Forms.Label(); this.lblDTA_SentidoSP = new System.Windows.Forms.Label();
this.lblDTA_Sentido = new System.Windows.Forms.Label(); this.lblDTA_Sentido = new System.Windows.Forms.Label();
this.lblDTA = new System.Windows.Forms.Label(); this.lblDTA = new System.Windows.Forms.Label();
this.lblDTA_SP = new System.Windows.Forms.Label(); this.lblDTA_SP = new System.Windows.Forms.Label();
this.btnDTReferenciar = new System.Windows.Forms.Button();
this.lblM_DT = new System.Windows.Forms.Label(); this.lblM_DT = new System.Windows.Forms.Label();
this.picDT = new System.Windows.Forms.PictureBox(); this.picDT = new System.Windows.Forms.PictureBox();
this.lblDFA_SentidoSP = new System.Windows.Forms.Label(); this.lblDFA_SentidoSP = new System.Windows.Forms.Label();
this.lblDFA_Sentido = new System.Windows.Forms.Label(); this.lblDFA_Sentido = new System.Windows.Forms.Label();
this.lblDFA = new System.Windows.Forms.Label(); this.lblDFA = new System.Windows.Forms.Label();
this.lblDFA_SP = new System.Windows.Forms.Label(); this.lblDFA_SP = new System.Windows.Forms.Label();
this.btnDFReferenciar = new System.Windows.Forms.Button();
this.lblM_DF = new System.Windows.Forms.Label(); this.lblM_DF = new System.Windows.Forms.Label();
this.picDF = new System.Windows.Forms.PictureBox(); this.picDF = new System.Windows.Forms.PictureBox();
this.lblETA_SentidoSP = new System.Windows.Forms.Label(); this.lblETA_SentidoSP = new System.Windows.Forms.Label();
this.lblETA_Sentido = new System.Windows.Forms.Label(); this.lblETA_Sentido = new System.Windows.Forms.Label();
this.lblETA = new System.Windows.Forms.Label(); this.lblETA = new System.Windows.Forms.Label();
this.lblETA_SP = new System.Windows.Forms.Label(); this.lblETA_SP = new System.Windows.Forms.Label();
this.btnETReferenciar = new System.Windows.Forms.Button();
this.lblM_ET = new System.Windows.Forms.Label(); this.lblM_ET = new System.Windows.Forms.Label();
this.picET = new System.Windows.Forms.PictureBox(); this.picET = new System.Windows.Forms.PictureBox();
this.lblEFA_SentidoSP = new System.Windows.Forms.Label(); this.lblEFA_SentidoSP = new System.Windows.Forms.Label();
this.lblEFA_Sentido = new System.Windows.Forms.Label(); this.lblEFA_Sentido = new System.Windows.Forms.Label();
this.lblEFA = new System.Windows.Forms.Label(); this.lblEFA = new System.Windows.Forms.Label();
this.lblEFA_SP = new System.Windows.Forms.Label(); this.lblEFA_SP = new System.Windows.Forms.Label();
this.btnEFReferenciar = new System.Windows.Forms.Button();
this.lblM_EF = new System.Windows.Forms.Label(); this.lblM_EF = new System.Windows.Forms.Label();
this.picEF = new System.Windows.Forms.PictureBox(); this.picEF = new System.Windows.Forms.PictureBox();
this.pnlFundo.SuspendLayout(); this.pnlFundo.SuspendLayout();
@ -155,14 +139,6 @@ namespace AgroBase.Forms
this.pnlFundo.Controls.Add(this.lblDistanciaTotal); this.pnlFundo.Controls.Add(this.lblDistanciaTotal);
this.pnlFundo.Controls.Add(this.lblTempoEmMovimento); this.pnlFundo.Controls.Add(this.lblTempoEmMovimento);
this.pnlFundo.Controls.Add(this.lblTempoConectado); this.pnlFundo.Controls.Add(this.lblTempoConectado);
this.pnlFundo.Controls.Add(this.chbDTLivre);
this.pnlFundo.Controls.Add(this.chbDTControlar);
this.pnlFundo.Controls.Add(this.chbETLivre);
this.pnlFundo.Controls.Add(this.chbETControlar);
this.pnlFundo.Controls.Add(this.chbDFLivre);
this.pnlFundo.Controls.Add(this.chbDFControlar);
this.pnlFundo.Controls.Add(this.chbEFLivre);
this.pnlFundo.Controls.Add(this.chbEFControlar);
this.pnlFundo.Controls.Add(this.chartET); this.pnlFundo.Controls.Add(this.chartET);
this.pnlFundo.Controls.Add(this.chartDT); this.pnlFundo.Controls.Add(this.chartDT);
this.pnlFundo.Controls.Add(this.chartDF); this.pnlFundo.Controls.Add(this.chartDF);
@ -200,41 +176,33 @@ namespace AgroBase.Forms
this.pnlFundo.Controls.Add(this.lblEFM_Tensao); this.pnlFundo.Controls.Add(this.lblEFM_Tensao);
this.pnlFundo.Controls.Add(this.lblEFM_Velocidade); this.pnlFundo.Controls.Add(this.lblEFM_Velocidade);
this.pnlFundo.Controls.Add(this.lblEFM_RPM); this.pnlFundo.Controls.Add(this.lblEFM_RPM);
this.pnlFundo.Controls.Add(this.btnDTReverter);
this.pnlFundo.Controls.Add(this.btnETReverter);
this.pnlFundo.Controls.Add(this.btnDFReverter);
this.pnlFundo.Controls.Add(this.btnEFReverter);
this.pnlFundo.Controls.Add(this.lblDTA_SentidoSP); this.pnlFundo.Controls.Add(this.lblDTA_SentidoSP);
this.pnlFundo.Controls.Add(this.lblDTA_Sentido); this.pnlFundo.Controls.Add(this.lblDTA_Sentido);
this.pnlFundo.Controls.Add(this.lblDTA); this.pnlFundo.Controls.Add(this.lblDTA);
this.pnlFundo.Controls.Add(this.lblDTA_SP); this.pnlFundo.Controls.Add(this.lblDTA_SP);
this.pnlFundo.Controls.Add(this.btnDTReferenciar);
this.pnlFundo.Controls.Add(this.lblM_DT); this.pnlFundo.Controls.Add(this.lblM_DT);
this.pnlFundo.Controls.Add(this.picDT); this.pnlFundo.Controls.Add(this.picDT);
this.pnlFundo.Controls.Add(this.lblDFA_SentidoSP); this.pnlFundo.Controls.Add(this.lblDFA_SentidoSP);
this.pnlFundo.Controls.Add(this.lblDFA_Sentido); this.pnlFundo.Controls.Add(this.lblDFA_Sentido);
this.pnlFundo.Controls.Add(this.lblDFA); this.pnlFundo.Controls.Add(this.lblDFA);
this.pnlFundo.Controls.Add(this.lblDFA_SP); this.pnlFundo.Controls.Add(this.lblDFA_SP);
this.pnlFundo.Controls.Add(this.btnDFReferenciar);
this.pnlFundo.Controls.Add(this.lblM_DF); this.pnlFundo.Controls.Add(this.lblM_DF);
this.pnlFundo.Controls.Add(this.picDF); this.pnlFundo.Controls.Add(this.picDF);
this.pnlFundo.Controls.Add(this.lblETA_SentidoSP); this.pnlFundo.Controls.Add(this.lblETA_SentidoSP);
this.pnlFundo.Controls.Add(this.lblETA_Sentido); this.pnlFundo.Controls.Add(this.lblETA_Sentido);
this.pnlFundo.Controls.Add(this.lblETA); this.pnlFundo.Controls.Add(this.lblETA);
this.pnlFundo.Controls.Add(this.lblETA_SP); this.pnlFundo.Controls.Add(this.lblETA_SP);
this.pnlFundo.Controls.Add(this.btnETReferenciar);
this.pnlFundo.Controls.Add(this.lblM_ET); this.pnlFundo.Controls.Add(this.lblM_ET);
this.pnlFundo.Controls.Add(this.picET); this.pnlFundo.Controls.Add(this.picET);
this.pnlFundo.Controls.Add(this.lblEFA_SentidoSP); this.pnlFundo.Controls.Add(this.lblEFA_SentidoSP);
this.pnlFundo.Controls.Add(this.lblEFA_Sentido); this.pnlFundo.Controls.Add(this.lblEFA_Sentido);
this.pnlFundo.Controls.Add(this.lblEFA); this.pnlFundo.Controls.Add(this.lblEFA);
this.pnlFundo.Controls.Add(this.lblEFA_SP); this.pnlFundo.Controls.Add(this.lblEFA_SP);
this.pnlFundo.Controls.Add(this.btnEFReferenciar);
this.pnlFundo.Controls.Add(this.lblM_EF); this.pnlFundo.Controls.Add(this.lblM_EF);
this.pnlFundo.Controls.Add(this.picEF); this.pnlFundo.Controls.Add(this.picEF);
this.pnlFundo.Dock = System.Windows.Forms.DockStyle.Fill; this.pnlFundo.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlFundo.Location = new System.Drawing.Point(0, 0); this.pnlFundo.Location = new System.Drawing.Point(0, 0);
this.pnlFundo.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.pnlFundo.Margin = new System.Windows.Forms.Padding(2);
this.pnlFundo.Name = "pnlFundo"; this.pnlFundo.Name = "pnlFundo";
this.pnlFundo.Size = new System.Drawing.Size(1473, 811); this.pnlFundo.Size = new System.Drawing.Size(1473, 811);
this.pnlFundo.TabIndex = 0; this.pnlFundo.TabIndex = 0;
@ -243,7 +211,7 @@ namespace AgroBase.Forms
// //
this.lblB12V.AutoSize = true; this.lblB12V.AutoSize = true;
this.lblB12V.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblB12V.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblB12V.Location = new System.Drawing.Point(656, 672); this.lblB12V.Location = new System.Drawing.Point(656, 676);
this.lblB12V.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblB12V.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblB12V.Name = "lblB12V"; this.lblB12V.Name = "lblB12V";
this.lblB12V.Size = new System.Drawing.Size(129, 12); this.lblB12V.Size = new System.Drawing.Size(129, 12);
@ -254,7 +222,7 @@ namespace AgroBase.Forms
// //
this.lblB7V2.AutoSize = true; this.lblB7V2.AutoSize = true;
this.lblB7V2.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblB7V2.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblB7V2.Location = new System.Drawing.Point(656, 655); this.lblB7V2.Location = new System.Drawing.Point(656, 659);
this.lblB7V2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblB7V2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblB7V2.Name = "lblB7V2"; this.lblB7V2.Name = "lblB7V2";
this.lblB7V2.Size = new System.Drawing.Size(129, 12); this.lblB7V2.Size = new System.Drawing.Size(129, 12);
@ -265,7 +233,7 @@ namespace AgroBase.Forms
// //
this.lblB5V.AutoSize = true; this.lblB5V.AutoSize = true;
this.lblB5V.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblB5V.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblB5V.Location = new System.Drawing.Point(656, 639); this.lblB5V.Location = new System.Drawing.Point(656, 643);
this.lblB5V.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblB5V.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblB5V.Name = "lblB5V"; this.lblB5V.Name = "lblB5V";
this.lblB5V.Size = new System.Drawing.Size(124, 12); this.lblB5V.Size = new System.Drawing.Size(124, 12);
@ -276,7 +244,7 @@ namespace AgroBase.Forms
// //
this.lblB3V.AutoSize = true; this.lblB3V.AutoSize = true;
this.lblB3V.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblB3V.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblB3V.Location = new System.Drawing.Point(656, 623); this.lblB3V.Location = new System.Drawing.Point(656, 627);
this.lblB3V.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblB3V.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblB3V.Name = "lblB3V"; this.lblB3V.Name = "lblB3V";
this.lblB3V.Size = new System.Drawing.Size(124, 12); this.lblB3V.Size = new System.Drawing.Size(124, 12);
@ -287,7 +255,7 @@ namespace AgroBase.Forms
// //
this.lblTemperatura.AutoSize = true; this.lblTemperatura.AutoSize = true;
this.lblTemperatura.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblTemperatura.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblTemperatura.Location = new System.Drawing.Point(636, 485); this.lblTemperatura.Location = new System.Drawing.Point(656, 692);
this.lblTemperatura.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblTemperatura.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblTemperatura.Name = "lblTemperatura"; this.lblTemperatura.Name = "lblTemperatura";
this.lblTemperatura.Size = new System.Drawing.Size(33, 12); this.lblTemperatura.Size = new System.Drawing.Size(33, 12);
@ -298,7 +266,7 @@ namespace AgroBase.Forms
// //
this.lblTensao.AutoSize = true; this.lblTensao.AutoSize = true;
this.lblTensao.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblTensao.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblTensao.Location = new System.Drawing.Point(656, 610); this.lblTensao.Location = new System.Drawing.Point(656, 611);
this.lblTensao.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblTensao.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblTensao.Name = "lblTensao"; this.lblTensao.Name = "lblTensao";
this.lblTensao.Size = new System.Drawing.Size(136, 12); this.lblTensao.Size = new System.Drawing.Size(136, 12);
@ -308,7 +276,7 @@ namespace AgroBase.Forms
// lblDistanciaParcial // lblDistanciaParcial
// //
this.lblDistanciaParcial.AutoSize = true; this.lblDistanciaParcial.AutoSize = true;
this.lblDistanciaParcial.Location = new System.Drawing.Point(655, 186); this.lblDistanciaParcial.Location = new System.Drawing.Point(655, 185);
this.lblDistanciaParcial.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblDistanciaParcial.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblDistanciaParcial.Name = "lblDistanciaParcial"; this.lblDistanciaParcial.Name = "lblDistanciaParcial";
this.lblDistanciaParcial.Size = new System.Drawing.Size(158, 13); this.lblDistanciaParcial.Size = new System.Drawing.Size(158, 13);
@ -318,7 +286,7 @@ namespace AgroBase.Forms
// lblDistanciaTotal // lblDistanciaTotal
// //
this.lblDistanciaTotal.AutoSize = true; this.lblDistanciaTotal.AutoSize = true;
this.lblDistanciaTotal.Location = new System.Drawing.Point(655, 173); this.lblDistanciaTotal.Location = new System.Drawing.Point(655, 169);
this.lblDistanciaTotal.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblDistanciaTotal.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblDistanciaTotal.Name = "lblDistanciaTotal"; this.lblDistanciaTotal.Name = "lblDistanciaTotal";
this.lblDistanciaTotal.Size = new System.Drawing.Size(147, 13); this.lblDistanciaTotal.Size = new System.Drawing.Size(147, 13);
@ -328,7 +296,7 @@ namespace AgroBase.Forms
// lblTempoEmMovimento // lblTempoEmMovimento
// //
this.lblTempoEmMovimento.AutoSize = true; this.lblTempoEmMovimento.AutoSize = true;
this.lblTempoEmMovimento.Location = new System.Drawing.Point(652, 160); this.lblTempoEmMovimento.Location = new System.Drawing.Point(655, 153);
this.lblTempoEmMovimento.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblTempoEmMovimento.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblTempoEmMovimento.Name = "lblTempoEmMovimento"; this.lblTempoEmMovimento.Name = "lblTempoEmMovimento";
this.lblTempoEmMovimento.Size = new System.Drawing.Size(176, 13); this.lblTempoEmMovimento.Size = new System.Drawing.Size(176, 13);
@ -338,101 +306,13 @@ namespace AgroBase.Forms
// lblTempoConectado // lblTempoConectado
// //
this.lblTempoConectado.AutoSize = true; this.lblTempoConectado.AutoSize = true;
this.lblTempoConectado.Location = new System.Drawing.Point(652, 147); this.lblTempoConectado.Location = new System.Drawing.Point(655, 137);
this.lblTempoConectado.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblTempoConectado.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblTempoConectado.Name = "lblTempoConectado"; this.lblTempoConectado.Name = "lblTempoConectado";
this.lblTempoConectado.Size = new System.Drawing.Size(159, 13); this.lblTempoConectado.Size = new System.Drawing.Size(159, 13);
this.lblTempoConectado.TabIndex = 167; this.lblTempoConectado.TabIndex = 167;
this.lblTempoConectado.Text = "Tempo conectado: 00:00:00 hrs"; this.lblTempoConectado.Text = "Tempo conectado: 00:00:00 hrs";
// //
// chbDTLivre
//
this.chbDTLivre.AutoSize = true;
this.chbDTLivre.Location = new System.Drawing.Point(770, 722);
this.chbDTLivre.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.chbDTLivre.Name = "chbDTLivre";
this.chbDTLivre.Size = new System.Drawing.Size(49, 17);
this.chbDTLivre.TabIndex = 166;
this.chbDTLivre.Text = "Livre";
this.chbDTLivre.UseVisualStyleBackColor = true;
//
// chbDTControlar
//
this.chbDTControlar.AutoSize = true;
this.chbDTControlar.Location = new System.Drawing.Point(754, 704);
this.chbDTControlar.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.chbDTControlar.Name = "chbDTControlar";
this.chbDTControlar.Size = new System.Drawing.Size(68, 17);
this.chbDTControlar.TabIndex = 165;
this.chbDTControlar.Text = "Controlar";
this.chbDTControlar.UseVisualStyleBackColor = true;
//
// chbETLivre
//
this.chbETLivre.AutoSize = true;
this.chbETLivre.Location = new System.Drawing.Point(655, 722);
this.chbETLivre.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.chbETLivre.Name = "chbETLivre";
this.chbETLivre.Size = new System.Drawing.Size(49, 17);
this.chbETLivre.TabIndex = 164;
this.chbETLivre.Text = "Livre";
this.chbETLivre.UseVisualStyleBackColor = true;
//
// chbETControlar
//
this.chbETControlar.AutoSize = true;
this.chbETControlar.Location = new System.Drawing.Point(655, 704);
this.chbETControlar.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.chbETControlar.Name = "chbETControlar";
this.chbETControlar.Size = new System.Drawing.Size(68, 17);
this.chbETControlar.TabIndex = 163;
this.chbETControlar.Text = "Controlar";
this.chbETControlar.UseVisualStyleBackColor = true;
//
// chbDFLivre
//
this.chbDFLivre.AutoSize = true;
this.chbDFLivre.Location = new System.Drawing.Point(770, 89);
this.chbDFLivre.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.chbDFLivre.Name = "chbDFLivre";
this.chbDFLivre.Size = new System.Drawing.Size(49, 17);
this.chbDFLivre.TabIndex = 162;
this.chbDFLivre.Text = "Livre";
this.chbDFLivre.UseVisualStyleBackColor = true;
//
// chbDFControlar
//
this.chbDFControlar.AutoSize = true;
this.chbDFControlar.Location = new System.Drawing.Point(754, 72);
this.chbDFControlar.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.chbDFControlar.Name = "chbDFControlar";
this.chbDFControlar.Size = new System.Drawing.Size(68, 17);
this.chbDFControlar.TabIndex = 161;
this.chbDFControlar.Text = "Controlar";
this.chbDFControlar.UseVisualStyleBackColor = true;
//
// chbEFLivre
//
this.chbEFLivre.AutoSize = true;
this.chbEFLivre.Location = new System.Drawing.Point(655, 89);
this.chbEFLivre.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.chbEFLivre.Name = "chbEFLivre";
this.chbEFLivre.Size = new System.Drawing.Size(49, 17);
this.chbEFLivre.TabIndex = 160;
this.chbEFLivre.Text = "Livre";
this.chbEFLivre.UseVisualStyleBackColor = true;
//
// chbEFControlar
//
this.chbEFControlar.AutoSize = true;
this.chbEFControlar.Location = new System.Drawing.Point(655, 72);
this.chbEFControlar.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.chbEFControlar.Name = "chbEFControlar";
this.chbEFControlar.Size = new System.Drawing.Size(68, 17);
this.chbEFControlar.TabIndex = 159;
this.chbEFControlar.Text = "Controlar";
this.chbEFControlar.UseVisualStyleBackColor = true;
//
// chartET // chartET
// //
chartArea1.Name = "ChartArea1"; chartArea1.Name = "ChartArea1";
@ -440,7 +320,7 @@ namespace AgroBase.Forms
legend1.Name = "Legend1"; legend1.Name = "Legend1";
this.chartET.Legends.Add(legend1); this.chartET.Legends.Add(legend1);
this.chartET.Location = new System.Drawing.Point(201, 410); this.chartET.Location = new System.Drawing.Point(201, 410);
this.chartET.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.chartET.Margin = new System.Windows.Forms.Padding(2);
this.chartET.Name = "chartET"; this.chartET.Name = "chartET";
series1.ChartArea = "ChartArea1"; series1.ChartArea = "ChartArea1";
series1.Legend = "Legend1"; series1.Legend = "Legend1";
@ -457,7 +337,7 @@ namespace AgroBase.Forms
legend2.Name = "Legend1"; legend2.Name = "Legend1";
this.chartDT.Legends.Add(legend2); this.chartDT.Legends.Add(legend2);
this.chartDT.Location = new System.Drawing.Point(834, 410); this.chartDT.Location = new System.Drawing.Point(834, 410);
this.chartDT.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.chartDT.Margin = new System.Windows.Forms.Padding(2);
this.chartDT.Name = "chartDT"; this.chartDT.Name = "chartDT";
series2.ChartArea = "ChartArea1"; series2.ChartArea = "ChartArea1";
series2.Legend = "Legend1"; series2.Legend = "Legend1";
@ -474,7 +354,7 @@ namespace AgroBase.Forms
legend3.Name = "Legend1"; legend3.Name = "Legend1";
this.chartDF.Legends.Add(legend3); this.chartDF.Legends.Add(legend3);
this.chartDF.Location = new System.Drawing.Point(834, 4); this.chartDF.Location = new System.Drawing.Point(834, 4);
this.chartDF.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.chartDF.Margin = new System.Windows.Forms.Padding(2);
this.chartDF.Name = "chartDF"; this.chartDF.Name = "chartDF";
series3.ChartArea = "ChartArea1"; series3.ChartArea = "ChartArea1";
series3.Legend = "Legend1"; series3.Legend = "Legend1";
@ -491,7 +371,7 @@ namespace AgroBase.Forms
legend4.Name = "Legend1"; legend4.Name = "Legend1";
this.chartEF.Legends.Add(legend4); this.chartEF.Legends.Add(legend4);
this.chartEF.Location = new System.Drawing.Point(201, 4); this.chartEF.Location = new System.Drawing.Point(201, 4);
this.chartEF.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.chartEF.Margin = new System.Windows.Forms.Padding(2);
this.chartEF.Name = "chartEF"; this.chartEF.Name = "chartEF";
series4.ChartArea = "ChartArea1"; series4.ChartArea = "ChartArea1";
series4.Legend = "Legend1"; series4.Legend = "Legend1";
@ -505,7 +385,7 @@ namespace AgroBase.Forms
// //
this.picRobo.Image = global::AgroBase.Properties.Resources.robo_superior; this.picRobo.Image = global::AgroBase.Properties.Resources.robo_superior;
this.picRobo.Location = new System.Drawing.Point(615, 206); this.picRobo.Location = new System.Drawing.Point(615, 206);
this.picRobo.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.picRobo.Margin = new System.Windows.Forms.Padding(2);
this.picRobo.Name = "picRobo"; this.picRobo.Name = "picRobo";
this.picRobo.Size = new System.Drawing.Size(235, 395); this.picRobo.Size = new System.Drawing.Size(235, 395);
this.picRobo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.picRobo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
@ -832,46 +712,6 @@ namespace AgroBase.Forms
this.lblEFM_RPM.TabIndex = 126; this.lblEFM_RPM.TabIndex = 126;
this.lblEFM_RPM.Text = "RPM: 0"; this.lblEFM_RPM.Text = "RPM: 0";
// //
// btnDTReverter
//
this.btnDTReverter.Location = new System.Drawing.Point(736, 774);
this.btnDTReverter.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnDTReverter.Name = "btnDTReverter";
this.btnDTReverter.Size = new System.Drawing.Size(93, 23);
this.btnDTReverter.TabIndex = 125;
this.btnDTReverter.Text = "Reverter";
this.btnDTReverter.UseVisualStyleBackColor = true;
//
// btnETReverter
//
this.btnETReverter.Location = new System.Drawing.Point(639, 774);
this.btnETReverter.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnETReverter.Name = "btnETReverter";
this.btnETReverter.Size = new System.Drawing.Size(93, 23);
this.btnETReverter.TabIndex = 124;
this.btnETReverter.Text = "Reverter";
this.btnETReverter.UseVisualStyleBackColor = true;
//
// btnDFReverter
//
this.btnDFReverter.Location = new System.Drawing.Point(736, 37);
this.btnDFReverter.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnDFReverter.Name = "btnDFReverter";
this.btnDFReverter.Size = new System.Drawing.Size(93, 23);
this.btnDFReverter.TabIndex = 123;
this.btnDFReverter.Text = "Reverter";
this.btnDFReverter.UseVisualStyleBackColor = true;
//
// btnEFReverter
//
this.btnEFReverter.Location = new System.Drawing.Point(639, 37);
this.btnEFReverter.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnEFReverter.Name = "btnEFReverter";
this.btnEFReverter.Size = new System.Drawing.Size(93, 23);
this.btnEFReverter.TabIndex = 122;
this.btnEFReverter.Text = "Reverter";
this.btnEFReverter.UseVisualStyleBackColor = true;
//
// lblDTA_SentidoSP // lblDTA_SentidoSP
// //
this.lblDTA_SentidoSP.AutoSize = true; this.lblDTA_SentidoSP.AutoSize = true;
@ -912,16 +752,6 @@ namespace AgroBase.Forms
this.lblDTA_SP.TabIndex = 118; this.lblDTA_SP.TabIndex = 118;
this.lblDTA_SP.Text = "Angulo SP: 00º"; this.lblDTA_SP.Text = "Angulo SP: 00º";
// //
// btnDTReferenciar
//
this.btnDTReferenciar.Location = new System.Drawing.Point(736, 747);
this.btnDTReferenciar.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnDTReferenciar.Name = "btnDTReferenciar";
this.btnDTReferenciar.Size = new System.Drawing.Size(93, 23);
this.btnDTReferenciar.TabIndex = 117;
this.btnDTReferenciar.Text = "Referenciar";
this.btnDTReferenciar.UseVisualStyleBackColor = true;
//
// lblM_DT // lblM_DT
// //
this.lblM_DT.AutoSize = true; this.lblM_DT.AutoSize = true;
@ -936,7 +766,7 @@ namespace AgroBase.Forms
// picDT // picDT
// //
this.picDT.Location = new System.Drawing.Point(1271, 432); this.picDT.Location = new System.Drawing.Point(1271, 432);
this.picDT.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.picDT.Margin = new System.Windows.Forms.Padding(2);
this.picDT.Name = "picDT"; this.picDT.Name = "picDT";
this.picDT.Size = new System.Drawing.Size(188, 203); this.picDT.Size = new System.Drawing.Size(188, 203);
this.picDT.TabIndex = 115; this.picDT.TabIndex = 115;
@ -982,16 +812,6 @@ namespace AgroBase.Forms
this.lblDFA_SP.TabIndex = 111; this.lblDFA_SP.TabIndex = 111;
this.lblDFA_SP.Text = "Angulo SP: 00º"; this.lblDFA_SP.Text = "Angulo SP: 00º";
// //
// btnDFReferenciar
//
this.btnDFReferenciar.Location = new System.Drawing.Point(736, 9);
this.btnDFReferenciar.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnDFReferenciar.Name = "btnDFReferenciar";
this.btnDFReferenciar.Size = new System.Drawing.Size(93, 23);
this.btnDFReferenciar.TabIndex = 108;
this.btnDFReferenciar.Text = "Referenciar";
this.btnDFReferenciar.UseVisualStyleBackColor = true;
//
// lblM_DF // lblM_DF
// //
this.lblM_DF.AutoSize = true; this.lblM_DF.AutoSize = true;
@ -1006,7 +826,7 @@ namespace AgroBase.Forms
// picDF // picDF
// //
this.picDF.Location = new System.Drawing.Point(1271, 27); this.picDF.Location = new System.Drawing.Point(1271, 27);
this.picDF.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.picDF.Margin = new System.Windows.Forms.Padding(2);
this.picDF.Name = "picDF"; this.picDF.Name = "picDF";
this.picDF.Size = new System.Drawing.Size(188, 203); this.picDF.Size = new System.Drawing.Size(188, 203);
this.picDF.TabIndex = 106; this.picDF.TabIndex = 106;
@ -1052,16 +872,6 @@ namespace AgroBase.Forms
this.lblETA_SP.TabIndex = 102; this.lblETA_SP.TabIndex = 102;
this.lblETA_SP.Text = "Angulo SP: 00º"; this.lblETA_SP.Text = "Angulo SP: 00º";
// //
// btnETReferenciar
//
this.btnETReferenciar.Location = new System.Drawing.Point(639, 747);
this.btnETReferenciar.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnETReferenciar.Name = "btnETReferenciar";
this.btnETReferenciar.Size = new System.Drawing.Size(93, 23);
this.btnETReferenciar.TabIndex = 101;
this.btnETReferenciar.Text = "Referenciar";
this.btnETReferenciar.UseVisualStyleBackColor = true;
//
// lblM_ET // lblM_ET
// //
this.lblM_ET.AutoSize = true; this.lblM_ET.AutoSize = true;
@ -1076,7 +886,7 @@ namespace AgroBase.Forms
// picET // picET
// //
this.picET.Location = new System.Drawing.Point(9, 432); this.picET.Location = new System.Drawing.Point(9, 432);
this.picET.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.picET.Margin = new System.Windows.Forms.Padding(2);
this.picET.Name = "picET"; this.picET.Name = "picET";
this.picET.Size = new System.Drawing.Size(188, 203); this.picET.Size = new System.Drawing.Size(188, 203);
this.picET.TabIndex = 99; this.picET.TabIndex = 99;
@ -1122,16 +932,6 @@ namespace AgroBase.Forms
this.lblEFA_SP.TabIndex = 95; this.lblEFA_SP.TabIndex = 95;
this.lblEFA_SP.Text = "Angulo SP: 00º"; this.lblEFA_SP.Text = "Angulo SP: 00º";
// //
// btnEFReferenciar
//
this.btnEFReferenciar.Location = new System.Drawing.Point(639, 9);
this.btnEFReferenciar.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnEFReferenciar.Name = "btnEFReferenciar";
this.btnEFReferenciar.Size = new System.Drawing.Size(93, 23);
this.btnEFReferenciar.TabIndex = 92;
this.btnEFReferenciar.Text = "Referenciar";
this.btnEFReferenciar.UseVisualStyleBackColor = true;
//
// lblM_EF // lblM_EF
// //
this.lblM_EF.AutoSize = true; this.lblM_EF.AutoSize = true;
@ -1146,7 +946,7 @@ namespace AgroBase.Forms
// picEF // picEF
// //
this.picEF.Location = new System.Drawing.Point(9, 29); this.picEF.Location = new System.Drawing.Point(9, 29);
this.picEF.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.picEF.Margin = new System.Windows.Forms.Padding(2);
this.picEF.Name = "picEF"; this.picEF.Name = "picEF";
this.picEF.Size = new System.Drawing.Size(188, 203); this.picEF.Size = new System.Drawing.Size(188, 203);
this.picEF.TabIndex = 90; this.picEF.TabIndex = 90;
@ -1158,7 +958,7 @@ namespace AgroBase.Forms
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1473, 811); this.ClientSize = new System.Drawing.Size(1473, 811);
this.Controls.Add(this.pnlFundo); this.Controls.Add(this.pnlFundo);
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.Margin = new System.Windows.Forms.Padding(2);
this.Name = "frmAcompanhamento"; this.Name = "frmAcompanhamento";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Acompanhamento"; this.Text = "Acompanhamento";
@ -1219,46 +1019,30 @@ namespace AgroBase.Forms
private System.Windows.Forms.Label lblEFM_RPMSP; private System.Windows.Forms.Label lblEFM_RPMSP;
private System.Windows.Forms.Label lblEFM_Velocidade; private System.Windows.Forms.Label lblEFM_Velocidade;
private System.Windows.Forms.Label lblEFM_RPM; private System.Windows.Forms.Label lblEFM_RPM;
private System.Windows.Forms.Button btnDTReverter;
private System.Windows.Forms.Button btnETReverter;
private System.Windows.Forms.Button btnDFReverter;
private System.Windows.Forms.Button btnEFReverter;
private System.Windows.Forms.Label lblDTA_SentidoSP; private System.Windows.Forms.Label lblDTA_SentidoSP;
private System.Windows.Forms.Label lblDTA_Sentido; private System.Windows.Forms.Label lblDTA_Sentido;
private System.Windows.Forms.Label lblDTA; private System.Windows.Forms.Label lblDTA;
private System.Windows.Forms.Label lblDTA_SP; private System.Windows.Forms.Label lblDTA_SP;
private System.Windows.Forms.Button btnDTReferenciar;
private System.Windows.Forms.Label lblM_DT; private System.Windows.Forms.Label lblM_DT;
private System.Windows.Forms.PictureBox picDT; private System.Windows.Forms.PictureBox picDT;
private System.Windows.Forms.Label lblDFA_SentidoSP; private System.Windows.Forms.Label lblDFA_SentidoSP;
private System.Windows.Forms.Label lblDFA_Sentido; private System.Windows.Forms.Label lblDFA_Sentido;
private System.Windows.Forms.Label lblDFA; private System.Windows.Forms.Label lblDFA;
private System.Windows.Forms.Label lblDFA_SP; private System.Windows.Forms.Label lblDFA_SP;
private System.Windows.Forms.Button btnDFReferenciar;
private System.Windows.Forms.Label lblM_DF; private System.Windows.Forms.Label lblM_DF;
private System.Windows.Forms.PictureBox picDF; private System.Windows.Forms.PictureBox picDF;
private System.Windows.Forms.Label lblETA_SentidoSP; private System.Windows.Forms.Label lblETA_SentidoSP;
private System.Windows.Forms.Label lblETA_Sentido; private System.Windows.Forms.Label lblETA_Sentido;
private System.Windows.Forms.Label lblETA; private System.Windows.Forms.Label lblETA;
private System.Windows.Forms.Label lblETA_SP; private System.Windows.Forms.Label lblETA_SP;
private System.Windows.Forms.Button btnETReferenciar;
private System.Windows.Forms.Label lblM_ET; private System.Windows.Forms.Label lblM_ET;
private System.Windows.Forms.PictureBox picET; private System.Windows.Forms.PictureBox picET;
private System.Windows.Forms.Label lblEFA_SentidoSP; private System.Windows.Forms.Label lblEFA_SentidoSP;
private System.Windows.Forms.Label lblEFA_Sentido; private System.Windows.Forms.Label lblEFA_Sentido;
private System.Windows.Forms.Label lblEFA; private System.Windows.Forms.Label lblEFA;
private System.Windows.Forms.Label lblEFA_SP; private System.Windows.Forms.Label lblEFA_SP;
private System.Windows.Forms.Button btnEFReferenciar;
private System.Windows.Forms.Label lblM_EF; private System.Windows.Forms.Label lblM_EF;
private System.Windows.Forms.PictureBox picEF; private System.Windows.Forms.PictureBox picEF;
private System.Windows.Forms.CheckBox chbDTLivre;
private System.Windows.Forms.CheckBox chbDTControlar;
private System.Windows.Forms.CheckBox chbETLivre;
private System.Windows.Forms.CheckBox chbETControlar;
private System.Windows.Forms.CheckBox chbDFLivre;
private System.Windows.Forms.CheckBox chbDFControlar;
private System.Windows.Forms.CheckBox chbEFLivre;
private System.Windows.Forms.CheckBox chbEFControlar;
private System.Windows.Forms.Label lblDistanciaParcial; private System.Windows.Forms.Label lblDistanciaParcial;
private System.Windows.Forms.Label lblDistanciaTotal; private System.Windows.Forms.Label lblDistanciaTotal;
private System.Windows.Forms.Label lblTempoEmMovimento; private System.Windows.Forms.Label lblTempoEmMovimento;

View File

@ -12,7 +12,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting; using System.Windows.Forms.DataVisualization.Charting;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Forms namespace AgroBase.Forms
{ {
@ -29,27 +29,11 @@ namespace AgroBase.Forms
picET.Paint += pic_Paint; picET.Paint += pic_Paint;
picDF.Paint += pic_Paint; picDF.Paint += pic_Paint;
picDT.Paint += pic_Paint; picDT.Paint += pic_Paint;
btnEFReferenciar.Click += btnReferenciar_Click;
btnETReferenciar.Click += btnReferenciar_Click;
btnDFReferenciar.Click += btnReferenciar_Click;
btnDTReferenciar.Click += btnReferenciar_Click;
btnEFReverter.Click += btnReverter_Click;
btnETReverter.Click += btnReverter_Click;
btnDFReverter.Click += btnReverter_Click;
btnDTReverter.Click += btnReverter_Click;
chbEFControlar.CheckedChanged += ChbControlar_CheckedChanged;
chbETControlar.CheckedChanged += ChbControlar_CheckedChanged;
chbDFControlar.CheckedChanged += ChbControlar_CheckedChanged;
chbDTControlar.CheckedChanged += ChbControlar_CheckedChanged;
chbEFLivre.CheckedChanged += ChbLivre_CheckedChanged;
chbETLivre.CheckedChanged += ChbLivre_CheckedChanged;
chbDFLivre.CheckedChanged += ChbLivre_CheckedChanged;
chbDTLivre.CheckedChanged += ChbLivre_CheckedChanged;
} }
private void frmAcompanhamento_Shown(object sender, EventArgs e) private void frmAcompanhamento_Shown(object sender, EventArgs e)
{ {
PreencherOpcoes();
} }
private void frmAcompanhamento_FormClosing(object sender, FormClosingEventArgs e) private void frmAcompanhamento_FormClosing(object sender, FormClosingEventArgs e)
@ -58,16 +42,6 @@ namespace AgroBase.Forms
this.Hide(); this.Hide();
} }
private void PreencherOpcoes()
{
foreach (var Modulo in Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos)
{
CheckBox chbControlar = pnlFundo.Controls.OfType<CheckBox>().FirstOrDefault(ctrl => ctrl.Name == "chb" + Modulo.Modulo_ID + "Controlar");
chbControlar.Checked = Modulo.DirMotor.Comandar;
}
}
public void AtualizaGrafico() public void AtualizaGrafico()
{ {
picET.Invalidate(); picET.Invalidate();
@ -352,41 +326,6 @@ namespace AgroBase.Forms
} }
private void btnReferenciar_Click(object sender, EventArgs e)
{
string ID = ((Button)sender).Name.Substring(3, 2);
var Modulo = Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.FirstOrDefault(x => x.Modulo_ID == ID);
string Comando = Modulo.DirMotor.ProtocoloComando(Direcao.Parado);
Variaveis.OperacaoEmAndamento.DispMvd.AdicionarMensagemFila(Modulo.Modulo_ID, Comando, true, false);
}
private void btnReverter_Click(object sender, EventArgs e)
{
/*string ID = ((Button)sender).Name.Substring(3, 2);
var DispCon = Variaveis.DispositivosConectados.Where(x => x._Porta.IsOpen && x.Dispositivo == T_Code.Mov).ToList();
foreach (var Dispositivo in DispCon)
{
var Motor = ((MovimentacaoModel)Dispositivo.Dados).Motores.FirstOrDefault(x => x.ID == ID);
string Comando = Motor.ProtocoloComando(MovimentacaoModel.UltimaDirecao, true);
Dispositivo.EnviarDadosSerial(Comando);
}*/
}
private void ChbLivre_CheckedChanged(object sender, EventArgs e)
{
string ID = ((CheckBox)sender).Name.Substring(3, 2);
var Modulo = Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.FirstOrDefault(x => x.Modulo_ID == ID);
//Modulo.DirMotor.Livre = ((CheckBox)sender).Checked;
}
private void ChbControlar_CheckedChanged(object sender, EventArgs e)
{
string ID = ((CheckBox)sender).Name.Substring(3, 2);
var Modulo = Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.FirstOrDefault(x => x.Modulo_ID == ID);
Modulo.DirMotor.Comandar = ((CheckBox)sender).Checked;
}
delegate void AtualizarSensoresDelegate(string Texto); delegate void AtualizarSensoresDelegate(string Texto);
public void AtualizarSensores(string Texto) public void AtualizarSensores(string Texto)

View File

@ -165,7 +165,7 @@ namespace AgroBase.Forms
{ {
Endereco = Addr, Endereco = Addr,
Parametro = BLD300RService.Parametros.First(x => x.Chave == "Direction"), Parametro = BLD300RService.Parametros.First(x => x.Chave == "Direction"),
Valor = Leitura != null ? (Leitura.Direcao == Enuns.Sentido.Horario ? 0 : 1) : 0, Valor = Leitura != null ? (Leitura.Direcao == Enums.Sentido.Horario ? 0 : 1) : 0,
Get = false, Get = false,
AguardaResposta = true, AguardaResposta = true,
TimeoutResposta = 200, TimeoutResposta = 200,

View File

@ -12,7 +12,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Forms namespace AgroBase.Forms
{ {

View File

@ -9,7 +9,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Forms namespace AgroBase.Forms
{ {

View File

@ -21,6 +21,10 @@ namespace AgroBase.Forms
DateTime UltimaLeituraObstaculo = DateTime.Now; DateTime UltimaLeituraObstaculo = DateTime.Now;
List<Obstaculo> Obstaculos = new List<Obstaculo>(); List<Obstaculo> Obstaculos = new List<Obstaculo>();
private DepthImagePixel[] depthPixels;
private byte[] colorPixels;
private Bitmap bitmap;
private const int DepthThreshold = 2000; // Limiar de distância em milímetros para segmentação
public frmKinect() public frmKinect()
{ {
@ -30,22 +34,27 @@ namespace AgroBase.Forms
private void frmKinect_Load(object sender, EventArgs e) private void frmKinect_Load(object sender, EventArgs e)
{ {
// Inicialize o Kinect Sensor // Inicialize o Kinect Sensor
kinectSensor = KinectSensor.KinectSensors.FirstOrDefault(); kinectSensor = KinectSensor.KinectSensors.FirstOrDefault(x => x.Status == KinectStatus.Connected);
if (kinectSensor != null) if (kinectSensor != null)
{ {
// Habilitar a câmera RGB // Habilitar a câmera RGB
kinectSensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30); kinectSensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
kinectSensor.ColorFrameReady += KinectSensor_ColorFrameReady;
// Habilitar a câmera de profundidade // Habilitar a câmera de profundidade
kinectSensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30); kinectSensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
kinectSensor.DepthFrameReady += KinectSensor_DepthFrameReady;
// Associar eventos de captura de imagem // Associar eventos de captura de imagem
kinectSensor.AllFramesReady += KinectSensor_AllFramesReady; //kinectSensor.AllFramesReady += KinectSensor_AllFramesReady;
// Iniciar o sensor // Iniciar o sensor
kinectSensor.Start(); kinectSensor.Start();
colorPixels = new byte[kinectSensor.ColorStream.FramePixelDataLength];
bitmap = new Bitmap(kinectSensor.ColorStream.FrameWidth, kinectSensor.ColorStream.FrameHeight, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
trackBarAngle.Maximum = kinectSensor.MaxElevationAngle; trackBarAngle.Maximum = kinectSensor.MaxElevationAngle;
@ -412,6 +421,106 @@ namespace AgroBase.Forms
} }
private void KinectSensor_ColorFrameReady(object sender, ColorImageFrameReadyEventArgs e)
{
using (ColorImageFrame colorFrame = e.OpenColorImageFrame())
{
if (colorFrame != null)
{
colorFrame.CopyPixelDataTo(colorPixels);
UpdateBitmap(colorPixels);
}
}
AtualizarGrid();
}
private void UpdateBitmap(byte[] colorPixels)
{
BitmapData bitmapData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.WriteOnly, bitmap.PixelFormat);
IntPtr ptr = bitmapData.Scan0;
System.Runtime.InteropServices.Marshal.Copy(colorPixels, 0, ptr, colorPixels.Length);
bitmap.UnlockBits(bitmapData);
}
private void KinectSensor_DepthFrameReady(object sender, DepthImageFrameReadyEventArgs e)
{
using (DepthImageFrame depthFrame = e.OpenDepthImageFrame())
{
if (depthFrame != null)
{
Bitmap depthBitmap = ConvertDepthFrameToBitmap(depthFrame);
picProfundidade.Image = depthBitmap;
depthPixels = new DepthImagePixel[depthFrame.PixelDataLength];
depthFrame.CopyDepthImagePixelDataTo(depthPixels);
ProcessDepthData(depthPixels);
}
}
}
private void ProcessDepthData(DepthImagePixel[] depthPixels)
{
List<Point> points = new List<Point>();
int totalDepth = 0;
int validPixelCount = 0;
int width = kinectSensor.DepthStream.FrameWidth;
int height = kinectSensor.DepthStream.FrameHeight;
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
int index = x + y * width;
int depth = depthPixels[index].Depth;
// Considerar apenas pixels dentro de um certo limiar de distância
if (depth > 0 && depth < DepthThreshold)
{
points.Add(new Point(x, y));
totalDepth += depth;
validPixelCount++;
}
}
}
if (validPixelCount > 0)
{
int avgDepth = totalDepth / validPixelCount;
DrawContourAndDistance(points, avgDepth);
}
}
private void DrawContourAndDistance(List<Point> points, int avgDepth)
{
if (points.Count == 0)
return;
using (Graphics g = Graphics.FromImage(bitmap))
{
// Encontrar o retângulo que circunscreve os pontos
int minX = points.Min(p => p.X);
int minY = points.Min(p => p.Y);
int maxX = points.Max(p => p.X);
int maxY = points.Max(p => p.Y);
Rectangle rect = new Rectangle(minX, minY, maxX - minX, maxY - minY);
g.DrawRectangle(Pens.Red, rect);
// Desenhar a distância média no centro do retângulo
string distanceText = $"{avgDepth} mm";
Font font = new Font("Arial", 12);
SizeF textSize = g.MeasureString(distanceText, font);
PointF textLocation = new PointF(minX + (rect.Width - textSize.Width) / 2, minY + (rect.Height - textSize.Height) / 2);
g.DrawString(distanceText, font, Brushes.Red, textLocation);
}
// Atualizar o PictureBox com a imagem processada
picRGB.Image = bitmap;
}
} }

View File

@ -13,7 +13,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Forms namespace AgroBase.Forms
{ {

View File

@ -10,7 +10,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
using AgroBase.Services; using AgroBase.Services;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;

View File

@ -94,6 +94,7 @@ namespace AgroBase
this.btnIniciarOperacao = new System.Windows.Forms.Button(); this.btnIniciarOperacao = new System.Windows.Forms.Button();
this.lblModoOperacao = new System.Windows.Forms.Label(); this.lblModoOperacao = new System.Windows.Forms.Label();
this.cmbModoOperacao = new System.Windows.Forms.ComboBox(); this.cmbModoOperacao = new System.Windows.Forms.ComboBox();
this.lblStatusConexao = new System.Windows.Forms.ToolStripStatusLabel();
this.gpbAcoes.SuspendLayout(); this.gpbAcoes.SuspendLayout();
this.erroStrip.SuspendLayout(); this.erroStrip.SuspendLayout();
this.pnlLateral.SuspendLayout(); this.pnlLateral.SuspendLayout();
@ -130,7 +131,8 @@ namespace AgroBase
// //
this.erroStrip.ImageScalingSize = new System.Drawing.Size(20, 20); this.erroStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
this.erroStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.erroStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.lblStripErro}); this.lblStripErro,
this.lblStatusConexao});
this.erroStrip.Location = new System.Drawing.Point(2, 585); this.erroStrip.Location = new System.Drawing.Point(2, 585);
this.erroStrip.Name = "erroStrip"; this.erroStrip.Name = "erroStrip";
this.erroStrip.Padding = new System.Windows.Forms.Padding(1, 0, 10, 0); this.erroStrip.Padding = new System.Windows.Forms.Padding(1, 0, 10, 0);
@ -829,6 +831,12 @@ namespace AgroBase
this.cmbModoOperacao.TabIndex = 13; this.cmbModoOperacao.TabIndex = 13;
this.cmbModoOperacao.SelectedIndexChanged += new System.EventHandler(this.cmbModoOperacao_SelectedIndexChanged); this.cmbModoOperacao.SelectedIndexChanged += new System.EventHandler(this.cmbModoOperacao_SelectedIndexChanged);
// //
// lblStatusConexao
//
this.lblStatusConexao.Name = "lblStatusConexao";
this.lblStatusConexao.Size = new System.Drawing.Size(16, 17);
this.lblStatusConexao.Text = "...";
//
// frmPrincipal // frmPrincipal
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -942,6 +950,7 @@ namespace AgroBase
private System.Windows.Forms.Button btnWT901C; private System.Windows.Forms.Button btnWT901C;
private System.Windows.Forms.Button btnBLD300R; private System.Windows.Forms.Button btnBLD300R;
private System.Windows.Forms.Button btnMKS; private System.Windows.Forms.Button btnMKS;
public System.Windows.Forms.ToolStripStatusLabel lblStatusConexao;
} }
} }

View File

@ -22,7 +22,7 @@ using System.Text.Json.Serialization;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase namespace AgroBase
{ {
@ -130,7 +130,7 @@ namespace AgroBase
Text = Text =
x.FirstOrDefault().PortaCOM + " - " + Enum.GetName(typeof(T_Code), x.Key) + " v" + x.FirstOrDefault().Versao + x.FirstOrDefault().PortaCOM + " - " + Enum.GetName(typeof(T_Code), x.Key) + " v" + x.FirstOrDefault().Versao +
(SerialService.DispositivosMultiplos.Contains(x.FirstOrDefault().Dispositivo) ? (" (" + string.Join(", ", x.Select(y => y.Mod_ID)) + ")") : (SerialService.DispositivosMultiplos.Contains(x.FirstOrDefault().Dispositivo) ? (" (" + string.Join(", ", x.Where(y => y.Conectado).Select(y => y.Mod_ID)) + ")") :
"") + " - " + "") + " - " +
(x.Any(y => y.Conectado) ? "Conectado" : "Desconectado") (x.Any(y => y.Conectado) ? "Conectado" : "Desconectado")

View File

@ -11,7 +11,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Forms namespace AgroBase.Forms
{ {

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Models namespace AgroBase.Models
{ {

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
using static AgroBase.Services.BLD300RService; using static AgroBase.Services.BLD300RService;
namespace AgroBase.Models namespace AgroBase.Models
@ -11,8 +11,23 @@ namespace AgroBase.Models
public class BLD300RModel public class BLD300RModel
{ {
public byte Endereco { get; set; } public byte Endereco { get; set; }
public bool Iniciado { get; set; } public bool Iniciado
{
get
{
// Houve comandos recebidos do driver dentro dos ultimos 10 segundos
bool iniciado = UltimoComandoRecebido.AddSeconds(10) > DateTime.Now;
if (!iniciado && Configurado)
{
Configurado = false;
}
return iniciado;
}
}
public bool Configurado { get; set; } public bool Configurado { get; set; }
public DateTime UltimoComandoRecebido { get; set; }
public int Versao public int Versao
{ {
get get

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace AgroBase.Models namespace AgroBase.Models
{ {
public class Enuns public class Enums
{ {
public enum Estado public enum Estado
{ {
@ -195,5 +195,15 @@ namespace AgroBase.Models
Desativar = 2 Desativar = 2
} }
public enum TipoMovimentoDirecional
{
RodasDianteiras = 0,
RodasTraseiras = 1,
RotacionarNoEixo = 2,
MovimentoArco = 3,
MovimentoLateral = 4,
MovimentoDiagonal = 5,
}
} }
} }

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Models namespace AgroBase.Models
{ {

View File

@ -4,7 +4,7 @@ using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System; using System;
using AgroBase.Comum; using AgroBase.Comum;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
using AgroBase.Forms; using AgroBase.Forms;
using AgroBase.Models; using AgroBase.Models;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -12,6 +12,8 @@ using Windows.Gaming.Input;
using AgroBase.Models.Modules; using AgroBase.Models.Modules;
using SharpDX.DirectInput; using SharpDX.DirectInput;
using AgroBase.Services; using AgroBase.Services;
using AgroBase.Forms.IHM;
using System.Data;
namespace AgroBase namespace AgroBase
{ {
@ -39,6 +41,11 @@ namespace AgroBase
new DeParaComandos() { key = Keys.D4, Dispositivo = T_Code.Atu, botaoJoy = BotoesJoystick.R2, PararAoSoltar = true, IDcontrolar = "B04" }, new DeParaComandos() { key = Keys.D4, Dispositivo = T_Code.Atu, botaoJoy = BotoesJoystick.R2, PararAoSoltar = true, IDcontrolar = "B04" },
}; };
public static List<BotoesJoystick> BotoesJoyPressionados = new List<BotoesJoystick>() { }; public static List<BotoesJoystick> BotoesJoyPressionados = new List<BotoesJoystick>() { };
public static List<TipoMovimentoDirecional> MovimentosCombinados = new List<TipoMovimentoDirecional>()
{
TipoMovimentoDirecional.MovimentoLateral,
TipoMovimentoDirecional.RotacionarNoEixo
};
public static Direcao UltimaDirecao = Direcao.Parado; public static Direcao UltimaDirecao = Direcao.Parado;
public static bool Pressionado = false; public static bool Pressionado = false;
@ -459,6 +466,7 @@ namespace AgroBase
public static void EnviaComandoMotor(Keys Tecla, T_Code Disp = T_Code.Vzo, bool MensagemBase = false) public static void EnviaComandoMotor(Keys Tecla, T_Code Disp = T_Code.Vzo, bool MensagemBase = false)
{ {
if ( if (
!frmDiagnosticos.Diagnosticando &&
(!Variaveis.OperacaoEmAndamento.OperacaoLiberada || (!Variaveis.OperacaoEmAndamento.OperacaoLiberada ||
!Variaveis.OperacaoEmAndamento.Iniciado || !Variaveis.OperacaoEmAndamento.Iniciado ||
Variaveis.OperacaoEmAndamento.Modo != ModoOperacao.Manual) Variaveis.OperacaoEmAndamento.Modo != ModoOperacao.Manual)
@ -542,7 +550,7 @@ namespace AgroBase
Pressionado = true; Pressionado = true;
} }
// Controle dos Bicos Pulverizadores (ATU) // Controle dos Bicos Pulverizadores (ATU)
else if ((Comando.Comando == Keys.D1 || Comando.Comando == Keys.D2 || Comando.Comando == Keys.D3 || Comando.Comando == Keys.D4) && !Variaveis.OperacaoEmAndamento.DispAtu.Dados.BicosPulverizadores.FirstOrDefault(x => x.ID == Comando.IDcontrolar).Atuado) else if ((Comando.Comando == Keys.D1 || Comando.Comando == Keys.D2 || Comando.Comando == Keys.D3 || Comando.Comando == Keys.D4) && Variaveis.OperacaoEmAndamento.DispAtu.Dados.BicosPulverizadores.Any(x => x.ID == Comando.IDcontrolar && !x.Atuado))
{ {
Comando.Dispositivo = T_Code.Atu; Comando.Dispositivo = T_Code.Atu;
Pressionado = true; Pressionado = true;
@ -589,18 +597,21 @@ namespace AgroBase
break; break;
} }
case T_Code.Dir: case T_Code.Dir:
{
if (MovimentosCombinados.Contains(Variaveis.OperacaoEmAndamento.Controle.TipoMovimento))
{
Variaveis.OperacaoEmAndamento.DispMvd.Dados.ExecutarMovimentoDirecionalCombinado(DirecaoAtual).ConfigureAwait(false);
}
else
{ {
Protocolos = Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.ToDictionary(x => x.Modulo_ID, x => x.DirMotor.ProtocoloComando(DirecaoAtual)); Protocolos = Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.ToDictionary(x => x.Modulo_ID, x => x.DirMotor.ProtocoloComando(DirecaoAtual));
Dispositivo = Variaveis.OperacaoEmAndamento.DispMvd; Dispositivo = Variaveis.OperacaoEmAndamento.DispMvd;
}
break; break;
} }
case T_Code.Atu: case T_Code.Atu:
{ {
/*var Bico = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BicosPulverizadores.FirstOrDefault(x => x.ID == Comando.IDcontrolar); EnviarComandoAtuador(S_Code.sBIC, Comando.Comando == Keys.Escape ? false : true, Comando.IDcontrolar);
Bico.Atuado = Comando.Comando == Keys.Escape ? false : true;
Protocolos.Add(Bico.ProtocoloComando());
Dispositivo = Variaveis.OperacaoEmAndamento.DispAtu;
ModuloID = Variaveis.OperacaoEmAndamento.DispAtu.Dados.Modulo_ID;*/
break; break;
} }
} }
@ -617,6 +628,66 @@ namespace AgroBase
} }
} }
public static void EnviarComandoAtuador(S_Code Componente, bool Status, string ID = "")
{
var DispAtu = Variaveis.OperacaoEmAndamento.DispAtu;
switch (Componente)
{
case S_Code.sBMB:
DispAtu.Dados.BombaPressurizadora.BombaAtuada = Status;
string ProtocoloBomba = DispAtu.Dados.BombaPressurizadora.ProtocoloComando();
DispAtu.AdicionarMensagemFila(DispAtu.Dados.Modulo_ID, ProtocoloBomba, true, true);
break;
case S_Code.sBIC:
var Bico = DispAtu.Dados.BicosPulverizadores.FirstOrDefault(x => x.ID == ID);
if (Bico != null)
{
Bico.Atuado = Status;
string ProtocoloBico = Bico.ProtocoloComando();
DispAtu.AdicionarMensagemFila(DispAtu.Dados.Modulo_ID, ProtocoloBico, true, false);
}
break;
}
}
public static void EnviarComandoSensoriamento(S_Code Componente, string ID, dynamic Status)
{
var DispSen = Variaveis.OperacaoEmAndamento.DispSen;
switch (Componente)
{
case S_Code.sLED:
var Sinaleiro = DispSen.Dados.Sinaleiros.FirstOrDefault(x => x.ID == ID);
if (Sinaleiro != null)
{
Sinaleiro.Comportamento = Status;
string ProtocoloSinaleiro = Sinaleiro.ProtocoloComando();
DispSen.AdicionarMensagemFila(DispSen.Dados.Modulo_ID, ProtocoloSinaleiro, true, false);
}
break;
case S_Code.sRLE:
var Rele = DispSen.Dados.Reles.FirstOrDefault(x => x.ID == ID);
if (Rele != null)
{
Rele.StatusControle = (Estado)Status;
string ProtocoloRele = Rele.ProtocoloComando();
DispSen.AdicionarMensagemFila(DispSen.Dados.Modulo_ID, ProtocoloRele, true, false);
}
break;
case S_Code.sFRO:
var ServoFreio = DispSen.Dados.Servos.FirstOrDefault(x => x.ID == ID);
if (ServoFreio != null)
{
ServoFreio._AnguloControle = VariaveisEquipamento.AnguloFreio[(AcaoFreio)Status];
string ProtocoloFreio = ServoFreio.ProtocoloComando();
DispSen.AdicionarMensagemFila(DispSen.Dados.Modulo_ID, ProtocoloFreio, true, false);
}
break;
}
}
private static void AtualizaConsole(string Mensagem) private static void AtualizaConsole(string Mensagem)
{ {
frmInstancial.frmJoystick.lblConsole.Text = Mensagem; frmInstancial.frmJoystick.lblConsole.Text = Mensagem;

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Models namespace AgroBase.Models
{ {

View File

@ -4,14 +4,22 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Models namespace AgroBase.Models
{ {
public class MKS057DModel public class MKS057DModel
{ {
public byte Endereco { get; set; } public byte Endereco { get; set; }
public bool Iniciado { get; set; } public bool Iniciado
{
get
{
// Houve comandos recebidos do driver dentro dos ultimos 10 segundos
return UltimoComandoRecebido.AddSeconds(10) > DateTime.Now;
}
}
public DateTime UltimoComandoRecebido { get; set; }
public double ErroCarregado { get; set; } public double ErroCarregado { get; set; }
public string ErroCarregado_Hex { get; set; } public string ErroCarregado_Hex { get; set; }
public double ErroAcumulado { get; set; } public double ErroAcumulado { get; set; }

View File

@ -11,7 +11,7 @@ using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Models namespace AgroBase.Models
{ {
@ -779,7 +779,7 @@ namespace AgroBase.Models
double anguloCaminho = Variaveis.OperacaoEmAndamento.Mapa.AnguloCaminho; double anguloCaminho = Variaveis.OperacaoEmAndamento.Mapa.AnguloCaminho;
// Calcular o ângulo e distância para o desvio // Calcular o ângulo e distância para o desvio
double anguloDesvio = anguloCaminho + ((obstaculo.DirecaoDesvio == Enuns.Direcao.Direita ? 270 : 90) + obstaculo.AnguloParaDesvio); double anguloDesvio = anguloCaminho + ((obstaculo.DirecaoDesvio == Enums.Direcao.Direita ? 270 : 90) + obstaculo.AnguloParaDesvio);
double deslocamento = (double)obstaculo.DistanciaMedia / 100; // Math.Sqrt(Math.Pow(((double)obstaculo.DeslocamentoNecessarioDesvio / 100), 2) + Math.Pow(((double)obstaculo.DistanciaMedia / 100), 2)); double deslocamento = (double)obstaculo.DistanciaMedia / 100; // Math.Sqrt(Math.Pow(((double)obstaculo.DeslocamentoNecessarioDesvio / 100), 2) + Math.Pow(((double)obstaculo.DistanciaMedia / 100), 2));
// Waypoint de início do desvio // Waypoint de início do desvio
@ -792,7 +792,7 @@ namespace AgroBase.Models
waypointsDesvio.Add(waypointContornoObstaculo); waypointsDesvio.Add(waypointContornoObstaculo);
// Waypoint de retorno à trajetória // Waypoint de retorno à trajetória
double anguloRetorno = anguloCaminho + ((obstaculo.DirecaoDesvio == Enuns.Direcao.Direita ? 90 : 270) - obstaculo.AnguloParaDesvio); //anguloDesvio - obstaculo.AnguloParaDesvio - 180;// Variaveis.OperacaoEmAndamento.OpMapaGPS.ReferencialRuaGPS.AnguloCaminho + (obstaculo.AnguloParaDesvio); // Pode precisar ajustar baseado na orientação do desvio double anguloRetorno = anguloCaminho + ((obstaculo.DirecaoDesvio == Enums.Direcao.Direita ? 90 : 270) - obstaculo.AnguloParaDesvio); //anguloDesvio - obstaculo.AnguloParaDesvio - 180;// Variaveis.OperacaoEmAndamento.OpMapaGPS.ReferencialRuaGPS.AnguloCaminho + (obstaculo.AnguloParaDesvio); // Pode precisar ajustar baseado na orientação do desvio
GPSModel waypointRetorno = CalcularNovoWaypoint(waypointContornoObstaculo, anguloRetorno, deslocamento); GPSModel waypointRetorno = CalcularNovoWaypoint(waypointContornoObstaculo, anguloRetorno, deslocamento);
waypointsDesvio.Add(waypointRetorno); waypointsDesvio.Add(waypointRetorno);

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Models namespace AgroBase.Models
{ {

View File

@ -9,7 +9,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Models.Modules namespace AgroBase.Models.Modules
{ {

View File

@ -9,7 +9,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Models.Modules namespace AgroBase.Models.Modules
{ {

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Models namespace AgroBase.Models
{ {

View File

@ -9,7 +9,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Models namespace AgroBase.Models
{ {

View File

@ -8,7 +8,8 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using static AgroBase.Models.Enuns; using System.Windows.Forms;
using static AgroBase.Models.Enums;
using static AgroBase.Services.BLD300RService; using static AgroBase.Services.BLD300RService;
namespace AgroBase.Models.Modules namespace AgroBase.Models.Modules
@ -36,14 +37,7 @@ namespace AgroBase.Models.Modules
public int TempoEmAtividade { get; set; } = 0; public int TempoEmAtividade { get; set; } = 0;
public double DistanciaPercorridaTotal { get; set; } = 0; public double DistanciaPercorridaTotal { get; set; } = 0;
public double DistanciaPercorridaParcial { get; set; } = 0; public double DistanciaPercorridaParcial { get; set; } = 0;
public double RelacaoRPM
{
get
{
double RelacaoRPM = Modulos.Average(x => x.MovMotor.RPM_Max) / VariaveisEquipamento.RPM_Max_Roda;
return RelacaoRPM;
}
}
public static MovimentacaoUnificadaModel CarregarParametrosIniciais() public static MovimentacaoUnificadaModel CarregarParametrosIniciais()
@ -61,14 +55,14 @@ namespace AgroBase.Models.Modules
new ModuloMvdModel() new ModuloMvdModel()
{ {
Modulo_ID = "EF", Modulo_ID = "EF",
MovMotor = MvdMotorBLDC.CarregarParametrosIniciais("EF", "0x02"), MovMotor = MvdMotorBLDC.CarregarParametrosIniciais("EF", "0x03"),
DirMotor = MvdMotorPasso.CarregarParametrosIniciais("EF", "0x02") DirMotor = MvdMotorPasso.CarregarParametrosIniciais("EF", "0x03")
}, },
new ModuloMvdModel() new ModuloMvdModel()
{ {
Modulo_ID = "DT", Modulo_ID = "DT",
MovMotor = MvdMotorBLDC.CarregarParametrosIniciais("DT", "0x03"), MovMotor = MvdMotorBLDC.CarregarParametrosIniciais("DT", "0x02"),
DirMotor = MvdMotorPasso.CarregarParametrosIniciais("DT", "0x03") DirMotor = MvdMotorPasso.CarregarParametrosIniciais("DT", "0x02")
}, },
new ModuloMvdModel() new ModuloMvdModel()
{ {
@ -103,6 +97,7 @@ namespace AgroBase.Models.Modules
x.MovMotor.CodigoAlarme = 0; x.MovMotor.CodigoAlarme = 0;
x.MovMotor.Corrente = 0; x.MovMotor.Corrente = 0;
x.MovMotor.Tensao = 0; x.MovMotor.Tensao = 0;
x.UltimoProtocoloRecebido = DateTime.MaxValue.AddDays(-1);
x.DirMotor.Inicializado = false; x.DirMotor.Inicializado = false;
x.DirMotor.Angulo = 0; x.DirMotor.Angulo = 0;
@ -340,6 +335,8 @@ namespace AgroBase.Models.Modules
} }
public async Task LoopRegistrador() public async Task LoopRegistrador()
{
while (true)
{ {
await Task.Delay(_TaxaAmostragem); await Task.Delay(_TaxaAmostragem);
@ -384,10 +381,47 @@ namespace AgroBase.Models.Modules
Variaveis.OperacaoEmAndamento.DispMvd.AdicionarMensagemFila(Modulo.Modulo_ID, Protocolo, false, false); Variaveis.OperacaoEmAndamento.DispMvd.AdicionarMensagemFila(Modulo.Modulo_ID, Protocolo, false, false);
} }
} }
}
await LoopRegistrador();
} }
public async Task ExecutarMovimentoDirecionalCombinado(Direcao DirecaoAtual)
{
switch (Variaveis.OperacaoEmAndamento.Controle.TipoMovimento)
{
case TipoMovimentoDirecional.RotacionarNoEixo:
case TipoMovimentoDirecional.MovimentoLateral:
foreach (var Modulo in Modulos.Where(x => !x.DirMotor.PosicaoTipoMovimentoConcluido))
{
Modulo.DirMotor.ProtocoloComando(DirecaoAtual);
}
DateTime Agora = DateTime.Now;
bool Sucesso = Modulos.All(x => x.DirMotor.PosicaoTipoMovimentoConcluido);
while (Agora.AddMilliseconds(5000) > DateTime.Now && !Sucesso)
{
await Task.Delay(100);
Sucesso = Modulos.All(x => x.DirMotor.PosicaoTipoMovimentoConcluido);
}
if (Sucesso)
{
foreach (var Modulo in Modulos)
{
Modulo.MovMotor.ProtocoloComando(
DirecaoAtual == Direcao.Direita ? Direcao.Frente :
DirecaoAtual == Direcao.Esquerda ? Direcao.Tras :
Direcao.Parado
);
}
}
break;
}
}
} }
public class ModuloMvdModel public class ModuloMvdModel
@ -403,7 +437,7 @@ namespace AgroBase.Models.Modules
return MovMotor.BLD_Inicializado || DirMotor.MKS_Inicializado; return MovMotor.BLD_Inicializado || DirMotor.MKS_Inicializado;
} }
} }
public DateTime UltimoProtocoloRecebido { get; set; } = DateTime.MaxValue; public DateTime UltimoProtocoloRecebido { get; set; } = DateTime.MaxValue.AddDays(-1);
public MvdMotorBLDC MovMotor { get; set; } public MvdMotorBLDC MovMotor { get; set; }
public MvdMotorPasso DirMotor { get; set; } public MvdMotorPasso DirMotor { get; set; }
@ -561,16 +595,16 @@ namespace AgroBase.Models.Modules
public string ID { get; set; } = T_Code.Mov.ToString(); public string ID { get; set; } = T_Code.Mov.ToString();
// SETs // SETs
public string Endereco { get; set; } = "0x01"; public string Endereco { get; set; }
public bool Ligado { get; set; } = false; public bool Ligado { get; set; } = false;
public bool Freio { get; set; } = false; public bool Freio { get; set; } = false;
public int CodigoAlarme { get; set; } = 0; public int CodigoAlarme { get; set; } = 0;
public int RPM_SP { get; set; } = 0; public int RPM_SP { get; set; } = 0;
public int RPM_SP_C { get; set; } = 0; public int RPM_SP_C { get; set; } = 0;
public Sentido Sentido_SP { get; set; } = Sentido.Parado; public Sentido Sentido_SP { get; set; } = Sentido.Parado;
public int NumeroPolos { get; set; } = 2; public int NumeroPolos { get; set; } = 16;
public int Rampa { get; set; } = 0; public int Rampa { get; set; } = 0;
public int RPM_Max { get; set; } = 800; public int RPM_Max { get; set; } = 600;
public int Reducao { get; set; } = 27; public int Reducao { get; set; } = 27;
@ -586,7 +620,7 @@ namespace AgroBase.Models.Modules
{ {
get get
{ {
return Convert.ToInt32(RPM_Motor / Variaveis.OperacaoEmAndamento.DispMvd.Dados.RelacaoRPM); return Convert.ToInt32(RPM_Motor / VariaveisEquipamento.RelacaoRPM);
} }
} }
public double VelocidadeInstantanea public double VelocidadeInstantanea
@ -611,7 +645,7 @@ namespace AgroBase.Models.Modules
public ConfiguracaoSentidoMotor ConfigSentidos { get; set; } public Dictionary<TipoMovimentoDirecional,ConfiguracaoSentidoMotor> ConfigSentidos { get; set; }
public List<FuncoesPinout> Funcoes { get; set; } public List<FuncoesPinout> Funcoes { get; set; }
public List<MvdMotorMOVSensorimanetoGrafico> LogGrafico { get; set; } = new List<MvdMotorMOVSensorimanetoGrafico>(); public List<MvdMotorMOVSensorimanetoGrafico> LogGrafico { get; set; } = new List<MvdMotorMOVSensorimanetoGrafico>();
@ -624,13 +658,6 @@ namespace AgroBase.Models.Modules
{ {
ID = T_Code.Mov.ToString(), ID = T_Code.Mov.ToString(),
Endereco = _Endereco, Endereco = _Endereco,
ConfigSentidos = new ConfiguracaoSentidoMotor()
{
Direita = Sentido.Parado,
Esquerda = Sentido.Parado,
Frente = Mod_ID.Contains("E") ? Sentido.Antihorario : Sentido.Horario,
Tras = Mod_ID.Contains("E") ? Sentido.Horario : Sentido.Antihorario
},
Funcoes = new List<FuncoesPinout>() Funcoes = new List<FuncoesPinout>()
{ {
FuncoesPinout.TMP, FuncoesPinout.TMP,
@ -639,6 +666,69 @@ namespace AgroBase.Models.Modules
FuncoesPinout.PWM, FuncoesPinout.PWM,
FuncoesPinout.BRK, FuncoesPinout.BRK,
}, },
ConfigSentidos = new Dictionary<TipoMovimentoDirecional, ConfiguracaoSentidoMotor>()
{
{
TipoMovimentoDirecional.RodasDianteiras,
new ConfiguracaoSentidoMotor()
{
Direita = Sentido.Parado,
Esquerda = Sentido.Parado,
Frente = Mod_ID.Contains("E") ? Sentido.Antihorario : Sentido.Horario,
Tras = Mod_ID.Contains("E") ? Sentido.Horario : Sentido.Antihorario
}
},
{
TipoMovimentoDirecional.RodasTraseiras,
new ConfiguracaoSentidoMotor()
{
Direita = Sentido.Parado,
Esquerda = Sentido.Parado,
Frente = Mod_ID.Contains("E") ? Sentido.Antihorario : Sentido.Horario,
Tras = Mod_ID.Contains("E") ? Sentido.Horario : Sentido.Antihorario
}
},
{
TipoMovimentoDirecional.MovimentoDiagonal,
new ConfiguracaoSentidoMotor()
{
Direita = Sentido.Parado,
Esquerda = Sentido.Parado,
Frente = Mod_ID.Contains("E") ? Sentido.Antihorario : Sentido.Horario,
Tras = Mod_ID.Contains("E") ? Sentido.Horario : Sentido.Antihorario
}
},
{
TipoMovimentoDirecional.MovimentoArco,
new ConfiguracaoSentidoMotor()
{
Direita = Sentido.Parado,
Esquerda = Sentido.Parado,
Frente = Mod_ID.Contains("E") ? Sentido.Antihorario : Sentido.Horario,
Tras = Mod_ID.Contains("E") ? Sentido.Horario : Sentido.Antihorario
}
},
{
TipoMovimentoDirecional.RotacionarNoEixo,
new ConfiguracaoSentidoMotor()
{
Direita = Sentido.Parado,
Esquerda = Sentido.Parado,
Frente = Sentido.Antihorario,
Tras = Sentido.Horario
}
},
{
TipoMovimentoDirecional.MovimentoLateral,
new ConfiguracaoSentidoMotor()
{
Direita = Sentido.Parado,
Esquerda = Sentido.Parado,
Frente = Mod_ID.Contains("T") ? Sentido.Antihorario : Sentido.Horario,
Tras = Mod_ID.Contains("T") ? Sentido.Horario : Sentido.Antihorario
}
},
},
}; };
} }
@ -689,10 +779,10 @@ namespace AgroBase.Models.Modules
switch (DirecaoAtual) switch (DirecaoAtual)
{ {
case Direcao.Frente: case Direcao.Frente:
Sentido_SP = ConfigSentidos.Frente; Sentido_SP = ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Frente;
break; break;
case Direcao.Tras: case Direcao.Tras:
Sentido_SP = ConfigSentidos.Tras; Sentido_SP = ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Tras;
break; break;
} }
@ -702,11 +792,13 @@ namespace AgroBase.Models.Modules
{ {
byte Addr = Convert.ToByte(Endereco.Replace("0x", ""), 16); byte Addr = Convert.ToByte(Endereco.Replace("0x", ""), 16);
var Leitura = BLD300RService.DadosLeitura.FirstOrDefault(x => x.Endereco == Addr); var Leitura = BLD300RService.DadosLeitura.FirstOrDefault(x => x.Endereco == Addr);
DateTime Agora = DateTime.Now;
if (Leitura == null || Leitura.Direcao != Sentido_SP) if (Leitura == null || Leitura.Direcao != Sentido_SP)
{ {
BLD300RService.AdicionarComandoNaFila(new BLDComandoModel() BLD300RService.AdicionarComandoNaFila(new BLDComandoModel()
{ {
Momento = Agora,
Endereco = Addr, Endereco = Addr,
Parametro = BLD300RService.Parametros.First(x => x.Chave == "Direction"), Parametro = BLD300RService.Parametros.First(x => x.Chave == "Direction"),
Valor = Sentido_SP == Sentido.Horario ? 1 : 0, Valor = Sentido_SP == Sentido.Horario ? 1 : 0,
@ -715,10 +807,11 @@ namespace AgroBase.Models.Modules
TimeoutResposta = 200, TimeoutResposta = 200,
}); });
} }
if (Ligado && Leitura == null || Leitura.RPM_SP != RPM_SP_C) if (Ligado && (Leitura == null || Leitura.RPM_SP != RPM_SP_C))
{ {
BLD300RService.AdicionarComandoNaFila(new BLDComandoModel() BLD300RService.AdicionarComandoNaFila(new BLDComandoModel()
{ {
Momento = Agora.AddSeconds(1),
Endereco = Addr, Endereco = Addr,
Parametro = BLD300RService.Parametros.First(x => x.Chave == "RPM_SP"), Parametro = BLD300RService.Parametros.First(x => x.Chave == "RPM_SP"),
Valor = RPM_SP, Valor = RPM_SP,
@ -727,22 +820,11 @@ namespace AgroBase.Models.Modules
TimeoutResposta = 200, TimeoutResposta = 200,
}); });
} }
if (Leitura == null || Leitura.Ativado != Ligado)
{
BLD300RService.AdicionarComandoNaFila(new BLDComandoModel()
{
Endereco = Addr,
Parametro = BLD300RService.Parametros.First(x => x.Chave == "Enabled"),
Valor = RPM_SP > 0 ? 1 : 0,
Get = false,
AguardaResposta = true,
TimeoutResposta = 200,
});
}
if (Leitura == null || Leitura.Freado != Freio) if (Leitura == null || Leitura.Freado != Freio)
{ {
BLD300RService.AdicionarComandoNaFila(new BLDComandoModel() BLD300RService.AdicionarComandoNaFila(new BLDComandoModel()
{ {
Momento = Agora.AddSeconds(2),
Endereco = Addr, Endereco = Addr,
Parametro = BLD300RService.Parametros.First(x => x.Chave == "Breaked"), Parametro = BLD300RService.Parametros.First(x => x.Chave == "Breaked"),
Valor = Freio ? 1 : 0, Valor = Freio ? 1 : 0,
@ -753,6 +835,19 @@ namespace AgroBase.Models.Modules
AcaoDoFreio = Freio ? AcaoFreio.Ativar : AcaoFreio.Desativar; AcaoDoFreio = Freio ? AcaoFreio.Ativar : AcaoFreio.Desativar;
} }
if (Leitura == null || Leitura.Ativado != Ligado)
{
BLD300RService.AdicionarComandoNaFila(new BLDComandoModel()
{
Momento = Agora.AddSeconds(3),
Endereco = Addr,
Parametro = BLD300RService.Parametros.First(x => x.Chave == "Enabled"),
Valor = RPM_SP > 0 ? 1 : 0,
Get = false,
AguardaResposta = true,
TimeoutResposta = 200,
});
}
} }
else if (Inicializado) else if (Inicializado)
{ {
@ -771,8 +866,7 @@ namespace AgroBase.Models.Modules
var ServoFreio = Variaveis.OperacaoEmAndamento.DispSen.Dados.Servos.FirstOrDefault(x => x.ID.Contains(Mod_ID) && x.Inicializado && x.Controlar); var ServoFreio = Variaveis.OperacaoEmAndamento.DispSen.Dados.Servos.FirstOrDefault(x => x.ID.Contains(Mod_ID) && x.Inicializado && x.Controlar);
if (ServoFreio != null) if (ServoFreio != null)
{ {
ServoFreio._AnguloControle = VariaveisEquipamento.AnguloFreio[AcaoDoFreio]; GeneralJoystick.EnviarComandoSensoriamento(S_Code.sFRO, ServoFreio.ID, AcaoDoFreio);
Variaveis.OperacaoEmAndamento.DispSen.AdicionarMensagemFila(Variaveis.OperacaoEmAndamento.DispSen.Dados.Modulo_ID, ServoFreio.ProtocoloComando(), true, false);
} }
} }
@ -787,13 +881,10 @@ namespace AgroBase.Models.Modules
public string ID { get; set; } = T_Code.Dir.ToString(); public string ID { get; set; } = T_Code.Dir.ToString();
// SETs // SETs
public string Endereco { get; set; } = "0x01"; public string Endereco { get; set; }
public Sentido Sentido_SP { get; set; } = Sentido.Parado; public Sentido Sentido_SP { get; set; } = Sentido.Parado;
public double Angulo_SP { get; set; } = 0; public double Angulo_SP { get; set; } = 0;
//public int Velocidade { get; set; } = 50;
public double Angulo_Offset { get; set; } = 0; public double Angulo_Offset { get; set; } = 0;
//public bool Estabilizar { get; set; } = false;
//public bool Livre { get; set; } = false;
// GETs // GETs
public Sentido Sentido { get; set; } = Sentido.Parado; public Sentido Sentido { get; set; } = Sentido.Parado;
@ -801,7 +892,6 @@ namespace AgroBase.Models.Modules
public bool Comandar { get; set; } = false; public bool Comandar { get; set; } = false;
//public bool Controlar { get; set; } = false;
public bool Inicializado { get; set; } = false; public bool Inicializado { get; set; } = false;
public bool MKS_Inicializado public bool MKS_Inicializado
{ {
@ -810,9 +900,24 @@ namespace AgroBase.Models.Modules
return MKS057DService.DadosLeitura.Any(x => x.Iniciado && Convert.ToByte(Endereco.Replace("0x", ""), 16) == x.Endereco); return MKS057DService.DadosLeitura.Any(x => x.Iniciado && Convert.ToByte(Endereco.Replace("0x", ""), 16) == x.Endereco);
} }
} }
public bool PosicaoTipoMovimentoConcluido
{
get
{
var TipoMovimento = Variaveis.OperacaoEmAndamento.Controle.TipoMovimento;
switch (TipoMovimento)
{
case TipoMovimentoDirecional.RotacionarNoEixo:
case TipoMovimentoDirecional.MovimentoLateral:
return !Comandar || VariaveisEquipamento.AnguloMovimento[TipoMovimento] == Angulo;
default:
return !Comandar || Angulo_SP == Angulo;
}
}
}
public ConfiguracaoSentidoMotor ConfigSentidos { get; set; } public Dictionary<TipoMovimentoDirecional, ConfiguracaoSentidoMotor> ConfigSentidos { get; set; }
public List<FuncoesPinout> Funcoes { get; set; } public List<FuncoesPinout> Funcoes { get; set; }
@ -822,13 +927,6 @@ namespace AgroBase.Models.Modules
{ {
ID = T_Code.Dir.ToString(), ID = T_Code.Dir.ToString(),
Endereco = _Endereco, Endereco = _Endereco,
ConfigSentidos = new ConfiguracaoSentidoMotor()
{
Direita = Mod_ID.Contains("F") ? Sentido.Horario : Sentido.Antihorario,
Esquerda = Mod_ID.Contains("F") ? Sentido.Antihorario : Sentido.Horario,
Frente = Sentido.Parado,
Tras = Sentido.Parado
},
Funcoes = new List<FuncoesPinout>() Funcoes = new List<FuncoesPinout>()
{ {
FuncoesPinout.PUL, FuncoesPinout.PUL,
@ -836,6 +934,69 @@ namespace AgroBase.Models.Modules
FuncoesPinout.ENA, FuncoesPinout.ENA,
FuncoesPinout.EncoderAbsoluto FuncoesPinout.EncoderAbsoluto
}, },
ConfigSentidos = new Dictionary<TipoMovimentoDirecional, ConfiguracaoSentidoMotor>()
{
{
TipoMovimentoDirecional.RodasDianteiras,
new ConfiguracaoSentidoMotor()
{
Direita = Mod_ID.Contains("F") ? Sentido.Horario : Sentido.Antihorario,
Esquerda = Mod_ID.Contains("F") ? Sentido.Antihorario : Sentido.Horario,
Frente = Sentido.Parado,
Tras = Sentido.Parado
}
},
{
TipoMovimentoDirecional.RodasTraseiras,
new ConfiguracaoSentidoMotor()
{
Direita = Mod_ID.Contains("F") ? Sentido.Horario : Sentido.Antihorario,
Esquerda = Mod_ID.Contains("F") ? Sentido.Antihorario : Sentido.Horario,
Frente = Sentido.Parado,
Tras = Sentido.Parado
}
},
{
TipoMovimentoDirecional.MovimentoDiagonal,
new ConfiguracaoSentidoMotor()
{
Direita = Sentido.Horario,
Esquerda = Sentido.Antihorario,
Frente = Sentido.Parado,
Tras = Sentido.Parado
}
},
{
TipoMovimentoDirecional.MovimentoArco,
new ConfiguracaoSentidoMotor()
{
Direita = Mod_ID.Contains("F") ? Sentido.Horario : Sentido.Antihorario,
Esquerda = Mod_ID.Contains("F") ? Sentido.Antihorario : Sentido.Horario,
Frente = Sentido.Parado,
Tras = Sentido.Parado
}
},
{
TipoMovimentoDirecional.RotacionarNoEixo,
new ConfiguracaoSentidoMotor()
{
Direita = Mod_ID == "EF" || Mod_ID == "DT" ? Sentido.Horario : Sentido.Antihorario,
Esquerda = Mod_ID == "EF" || Mod_ID == "DT" ? Sentido.Antihorario : Sentido.Horario,
Frente = Sentido.Parado,
Tras = Sentido.Parado
}
},
{
TipoMovimentoDirecional.MovimentoLateral,
new ConfiguracaoSentidoMotor()
{
Direita = Mod_ID == "EF" || Mod_ID == "DT" ? Sentido.Horario : Sentido.Antihorario,
Esquerda = Mod_ID == "EF" || Mod_ID == "DT" ? Sentido.Antihorario : Sentido.Horario,
Frente = Sentido.Parado,
Tras = Sentido.Parado
}
},
}
}; };
} }
@ -867,11 +1028,16 @@ namespace AgroBase.Models.Modules
if (Comandar) if (Comandar)
{ {
Angulo_SP = (Direcao != Direcao.Esquerda && Direcao != Direcao.Direita) ? 0 : Variaveis.OperacaoEmAndamento.Controle.Angulo; int AnguloTipoMovimento = VariaveisEquipamento.AnguloMovimento[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento];
Angulo_SP =
(Direcao != Direcao.Esquerda && Direcao != Direcao.Direita) ? 0 :
AnguloTipoMovimento != -1 ? AnguloTipoMovimento :
Variaveis.OperacaoEmAndamento.Controle.Angulo;
Sentido_SP = Sentido_SP =
Direcao == Direcao.Direita ? ConfigSentidos.Direita : Direcao == Direcao.Direita ? ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Direita :
Direcao == Direcao.Esquerda ? ConfigSentidos.Esquerda : Direcao == Direcao.Esquerda ? ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Esquerda :
Sentido_SP == Sentido.Horario ? Sentido.Antihorario : Sentido_SP == Sentido.Horario ? Sentido.Antihorario :
Sentido_SP == Sentido.Antihorario ? Sentido.Horario : Sentido_SP == Sentido.Antihorario ? Sentido.Horario :
Sentido.Parado; Sentido.Parado;

View File

@ -12,7 +12,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Models.Modules namespace AgroBase.Models.Modules
{ {
@ -81,7 +81,7 @@ namespace AgroBase.Models.Modules
{ {
FuncoesPinout.Sinaleiro, FuncoesPinout.Sinaleiro,
}, },
Comportamento = Variaveis.ComportamentoPorStatus(StatusOperacao.NaoIniciado) Comportamento = VariaveisEquipamento.ComportamentoPorStatus(StatusOperacao.NaoIniciado)
}, },
new SensorSinaleiroModel() new SensorSinaleiroModel()
{ {
@ -92,7 +92,7 @@ namespace AgroBase.Models.Modules
{ {
FuncoesPinout.Sinaleiro, FuncoesPinout.Sinaleiro,
}, },
Comportamento = Variaveis.ComportamentoPorStatus(StatusOperacao.NaoIniciado) Comportamento = VariaveisEquipamento.ComportamentoPorStatus(StatusOperacao.NaoIniciado)
}, },
new SensorSinaleiroModel() new SensorSinaleiroModel()
{ {
@ -103,7 +103,7 @@ namespace AgroBase.Models.Modules
{ {
FuncoesPinout.Sinaleiro, FuncoesPinout.Sinaleiro,
}, },
Comportamento = Variaveis.ComportamentoPorStatus(StatusOperacao.NaoIniciado) Comportamento = VariaveisEquipamento.ComportamentoPorStatus(StatusOperacao.NaoIniciado)
}, },
}, },
Sensores = new List<SensorModel>() Sensores = new List<SensorModel>()
@ -541,7 +541,7 @@ namespace AgroBase.Models.Modules
} }
} }
public string ProtocoloAquisicaoDados(S_Code Componente, string ID) private string ProtocoloAquisicaoDados(S_Code Componente, string ID)
{ {
string ProtocoloMotor = string ProtocoloMotor =
((int)F_Code.Req).ToString() + SerialService.SplitMessage + ((int)F_Code.Req).ToString() + SerialService.SplitMessage +
@ -821,8 +821,7 @@ namespace AgroBase.Models.Modules
{ {
foreach (var _Modulo in Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos) foreach (var _Modulo in Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos)
{ {
string ProtocoloParada = _Modulo.MovMotor.ProtocoloComando(Direcao.Frente, true); GeneralJoystick.EnviaComandoMotor(Keys.Escape, T_Code.Mov);
Variaveis.OperacaoEmAndamento.DispMvd.AdicionarMensagemFila(_Modulo.Modulo_ID, ProtocoloParada, true, false);
} }
} }
} }
@ -937,6 +936,11 @@ namespace AgroBase.Models.Modules
} }
public void RequisitarDadosComponente(S_Code Componente, string ID)
{
string ProtocoloAquisicao = ProtocoloAquisicaoDados(Componente, ID);
Variaveis.OperacaoEmAndamento.DispSen.AdicionarMensagemFila(Modulo_ID, ProtocoloAquisicao, true, false);
}
} }

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Models namespace AgroBase.Models
{ {

View File

@ -12,7 +12,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Models.Operacoes namespace AgroBase.Models.Operacoes
{ {
@ -79,17 +79,6 @@ namespace AgroBase.Models.Operacoes
} }
Variaveis.OperacaoEmAndamento.Controle.Angulo = correcaoAngulo; Variaveis.OperacaoEmAndamento.Controle.Angulo = correcaoAngulo;
if (statusCarroRua == StatusCarroMapa.Manobrando)
{
Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.ForEach(x => x.DirMotor.Comandar = true);
}
else
{
Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.ForEach(x => x.DirMotor.Comandar = false);
Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.Where(x => x.Modulo_ID == "EF" || x.Modulo_ID == "DF").ToList().ForEach(x => x.DirMotor.Comandar = true);
}
} }
private double CalcularErroCombinado(double erroLateral, double erroOrientacao, double anguloCarro, StatusCarroMapa statusCarroRua) private double CalcularErroCombinado(double erroLateral, double erroOrientacao, double anguloCarro, StatusCarroMapa statusCarroRua)
@ -147,6 +136,11 @@ namespace AgroBase.Models.Operacoes
return erroCombinado; return erroCombinado;
} }
private void DefinirTipoMovimento(StatusCarroMapa statusCarro)
{
Variaveis.OperacaoEmAndamento.Controle.TipoMovimento = statusCarro == StatusCarroMapa.Manobrando ? TipoMovimentoDirecional.MovimentoArco : TipoMovimentoDirecional.RodasDianteiras;
}
public void CalculaDadosMovimentacaoAutonoma() public void CalculaDadosMovimentacaoAutonoma()
{ {
if (Variaveis.OperacaoEmAndamento.Modo != ModoOperacao.MapaGPS) if (Variaveis.OperacaoEmAndamento.Modo != ModoOperacao.MapaGPS)
@ -156,6 +150,8 @@ namespace AgroBase.Models.Operacoes
var statusAtual = ReferencialRuaGPS.StatusAtual; var statusAtual = ReferencialRuaGPS.StatusAtual;
DefinirTipoMovimento(statusAtual);
CalcularAnguloInclinacao(statusAtual); CalcularAnguloInclinacao(statusAtual);
if (statusAtual == StatusCarroMapa.Parado) if (statusAtual == StatusCarroMapa.Parado)

View File

@ -16,7 +16,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
using CefSharp.DevTools.Page; using CefSharp.DevTools.Page;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
@ -602,13 +602,17 @@ namespace AgroBase.Models
if (OperacaoCarregar.DispSen != null && OperacaoCarregar.DispSen.Dados.Conectado) if (OperacaoCarregar.DispSen != null && OperacaoCarregar.DispSen.Dados.Conectado)
{ {
OperacaoCarregar.DispSen.Dados.Sinaleiros.ForEach(x => x.Comportamento = Variaveis.ComportamentoPorStatus(StatusOperacao.NaoIniciado)); OperacaoCarregar.DispSen.Dados.Sinaleiros.ForEach(x => x.Comportamento = VariaveisEquipamento.ComportamentoPorStatus(StatusOperacao.NaoIniciado));
OperacaoCarregar.DispSen.Dados.Sinaleiros.First(x => x.ID == (Modo == ModoOperacao.Manual ? "LEDMN" : "LEDAT")).Comportamento.statusLED = StatusLED.Aceso; OperacaoCarregar.DispSen.Dados.Sinaleiros.First(x => x.ID == (Modo == ModoOperacao.Manual ? "LEDMN" : "LEDAT")).Comportamento.statusLED = StatusLED.Aceso;
OperacaoCarregar.DispSen.Dados.Sinaleiros.First(x => x.ID == "LEDOP").Comportamento = Variaveis.ComportamentoPorStatus(); OperacaoCarregar.DispSen.Dados.Sinaleiros.First(x => x.ID == "LEDOP").Comportamento = VariaveisEquipamento.ComportamentoPorStatus();
OperacaoCarregar.DispSen.Dados.Sinaleiros.ForEach(x => OperacaoCarregar.DispSen.AdicionarMensagemFila(OperacaoCarregar.DispSen.Dados.Modulo_ID, x.ProtocoloComando(), true, false)); //OperacaoCarregar.DispSen.Dados.Sinaleiros.ForEach(x => OperacaoCarregar.DispSen.AdicionarMensagemFila(OperacaoCarregar.DispSen.Dados.Modulo_ID, x.ProtocoloComando(), true, false));
foreach (var Sinaleiro in OperacaoCarregar.DispSen.Dados.Sinaleiros)
{
GeneralJoystick.EnviarComandoSensoriamento(S_Code.sLED, Sinaleiro.ID, Sinaleiro.Comportamento);
}
} }
@ -863,9 +867,7 @@ namespace AgroBase.Models
} }
if (DispAtu.Dados.BombaPressurizadora.Inicializado) if (DispAtu.Dados.BombaPressurizadora.Inicializado)
{ {
DispAtu.Dados.BombaPressurizadora.BombaAtuada = false; GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, false);
string Protocolo = DispAtu.Dados.BombaPressurizadora.ProtocoloComando();
DispAtu.AdicionarMensagemFila(DispAtu.Dados.Modulo_ID, Protocolo, true, false);
} }
Iniciado = false; Iniciado = false;
@ -886,9 +888,7 @@ namespace AgroBase.Models
// Ligar bomba // Ligar bomba
if (DispAtu.Dados.BombaPressurizadora.Inicializado) if (DispAtu.Dados.BombaPressurizadora.Inicializado)
{ {
DispAtu.Dados.BombaPressurizadora.BombaAtuada = true; GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, true);
string Protocolo = DispAtu.Dados.BombaPressurizadora.ProtocoloComando();
DispAtu.AdicionarMensagemFila(DispAtu.Dados.Modulo_ID, Protocolo, true, true);
} }
await Task.Delay(5000); await Task.Delay(5000);
@ -899,13 +899,11 @@ namespace AgroBase.Models
var Bico = DispAtu.Dados.BicosPulverizadores[i]; var Bico = DispAtu.Dados.BicosPulverizadores[i];
if (Bico.Inicializado) if (Bico.Inicializado)
{ {
Bico.Atuado = true; GeneralJoystick.EnviarComandoAtuador(S_Code.sBIC, true, Bico.ID);
DispAtu.AdicionarMensagemFila(DispAtu.Dados.Modulo_ID, Bico.ProtocoloComando(), true, true);
await Task.Delay(1000); await Task.Delay(1000);
Bico.Atuado = false; GeneralJoystick.EnviarComandoAtuador(S_Code.sBIC, false, Bico.ID);
DispAtu.AdicionarMensagemFila(DispAtu.Dados.Modulo_ID, Bico.ProtocoloComando(), true, true);
} }
} }
@ -1010,7 +1008,15 @@ namespace AgroBase.Models
} }
} }
var Protocolos = GeneralJoystick.EnviaComandoMotor(
Controle.Direcao == Direcao.Frente ? Keys.Up :
Controle.Direcao == Direcao.Tras ? Keys.Down :
Controle.Direcao == Direcao.Esquerda ? Keys.Left :
Controle.Direcao == Direcao.Direita ? Keys.Right :
Keys.Escape
, Tipo);
/*var Protocolos =
Tipo == T_Code.Mov ? ((MovimentacaoUnificadaModel)Dispositivo.Dados).Modulos.Select(x => new { Mod_ID = x.Modulo_ID, Protocolo = x.MovMotor.ProtocoloComando(Controle.Direcao) }) : Tipo == T_Code.Mov ? ((MovimentacaoUnificadaModel)Dispositivo.Dados).Modulos.Select(x => new { Mod_ID = x.Modulo_ID, Protocolo = x.MovMotor.ProtocoloComando(Controle.Direcao) }) :
Tipo == T_Code.Dir ? ((MovimentacaoUnificadaModel)Dispositivo.Dados).Modulos.Select(x => new { Mod_ID = x.Modulo_ID, Protocolo = x.DirMotor.ProtocoloComando(Controle.Direcao) }) : Tipo == T_Code.Dir ? ((MovimentacaoUnificadaModel)Dispositivo.Dados).Modulos.Select(x => new { Mod_ID = x.Modulo_ID, Protocolo = x.DirMotor.ProtocoloComando(Controle.Direcao) }) :
Tipo == T_Code.Atu ? ((AtuadorModel)Dispositivo.Dados).BicosPulverizadores.Select(x => new { Mod_ID = ((AtuadorModel)Dispositivo.Dados).Modulo_ID, Protocolo = x.ProtocoloComando() }) : Tipo == T_Code.Atu ? ((AtuadorModel)Dispositivo.Dados).BicosPulverizadores.Select(x => new { Mod_ID = ((AtuadorModel)Dispositivo.Dados).Modulo_ID, Protocolo = x.ProtocoloComando() }) :
@ -1019,8 +1025,15 @@ namespace AgroBase.Models
{ {
Dispositivo.AdicionarMensagemFila(Protocolo.Mod_ID, Protocolo.Protocolo, true, false); Dispositivo.AdicionarMensagemFila(Protocolo.Mod_ID, Protocolo.Protocolo, true, false);
} }
return Protocolos.Select(x => x.Protocolo).ToList(); return Protocolos.Select(x => x.Protocolo).ToList();
*/
var Protocolos = new List<string>()
{
Tipo.ToString() + ";" + Controle.Direcao.ToString() + ";" + Controle.RPM_SP.ToString() + ";" + Controle.Angulo.ToString()
};
return Protocolos;
} }
private void AtualizarDadosOperacao() private void AtualizarDadosOperacao()
@ -1102,7 +1115,14 @@ namespace AgroBase.Models
Variaveis.OperacaoEmAndamento.OpMapaGPS.AtualizarRuasSelecionadas(); Variaveis.OperacaoEmAndamento.OpMapaGPS.AtualizarRuasSelecionadas();
} }
try
{
AtualizarGrafico(); AtualizarGrafico();
}
catch (Exception ex)
{
}
AtualizarDadosPerformance(); AtualizarDadosPerformance();
AtualizaInformacoesControleOperacao(); AtualizaInformacoesControleOperacao();
} }
@ -1387,22 +1407,13 @@ namespace AgroBase.Models
int oldRPM = Controle.RPM_SP; int oldRPM = Controle.RPM_SP;
double oldAngulo = Controle.Angulo; double oldAngulo = Controle.Angulo;
double oldVelocidadeMP = Controle.VelocidadeMP; double oldVelocidadeMP = Controle.VelocidadeMP;
Dictionary<string, bool> oldControleMov = Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.ToDictionary(x => x.Modulo_ID, x => x.MovMotor.Comandar); TipoMovimentoDirecional oldTipoMovimento = Controle.TipoMovimento;
Dictionary<string, bool> oldControleDir = Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.ToDictionary(x => x.Modulo_ID, x => x.DirMotor.Comandar);
// Atualizar estado atual com os valores do controleBase // Atualizar estado atual com os valores do controleBase
Controle.RPM_SP = controleBase.RPM; Controle.RPM_SP = controleBase.RPM;
Controle.Angulo = controleBase.AnguloMP; Controle.Angulo = controleBase.AnguloMP;
Controle.VelocidadeMP = controleBase.VelocidadeMP; Controle.VelocidadeMP = controleBase.VelocidadeMP;
Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.ForEach(x => Controle.TipoMovimento = controleBase.TipoMovimento;
{
bool controlarMov = controleBase.ControleMov != null && controleBase.ControleMov.Any(y => y.Key == x.Modulo_ID) ? controleBase.ControleMov[x.Modulo_ID] : oldControleMov[x.Modulo_ID];
bool controlarDir = controleBase.ControleDir != null && controleBase.ControleDir.Any(y => y.Key == x.Modulo_ID) ? controleBase.ControleDir[x.Modulo_ID] : oldControleDir[x.Modulo_ID];
x.MovMotor.Comandar = controlarMov;
x.DirMotor.Comandar = controlarDir;
});
// Enviar comando // Enviar comando
GeneralJoystick.EnviaComandoMotor(controleBase.Tecla, controleBase.Dispositivo, true); GeneralJoystick.EnviaComandoMotor(controleBase.Tecla, controleBase.Dispositivo, true);
@ -1411,11 +1422,7 @@ namespace AgroBase.Models
Controle.RPM_SP = oldRPM; Controle.RPM_SP = oldRPM;
Controle.Angulo = oldAngulo; Controle.Angulo = oldAngulo;
Controle.VelocidadeMP = oldVelocidadeMP; Controle.VelocidadeMP = oldVelocidadeMP;
Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.ForEach(x => Controle.TipoMovimento = oldTipoMovimento;
{
x.MovMotor.Comandar = oldControleMov[x.Modulo_ID];
x.DirMotor.Comandar = oldControleDir[x.Modulo_ID];
});
} }
#endregion #endregion
@ -1464,6 +1471,7 @@ namespace AgroBase.Models
IdxPontoAproximadoRua = OpMapaGPS.ReferencialRuaGPS.IdxPontoAproximadoRua, IdxPontoAproximadoRua = OpMapaGPS.ReferencialRuaGPS.IdxPontoAproximadoRua,
IdxRuaAtual = Mapa.IdxRuaAtual, IdxRuaAtual = Mapa.IdxRuaAtual,
AnguloDif = Sensoriamento.AnguloDif, AnguloDif = Sensoriamento.AnguloDif,
TipoMovimento = Controle.TipoMovimento,
}; };
SalvarLog("operacao", logGeral, Fim); SalvarLog("operacao", logGeral, Fim);
@ -1777,25 +1785,24 @@ namespace AgroBase.Models
var ledAT = DispSen.Dados.Sinaleiros.FirstOrDefault(x => x.ID == "LEDAT"); var ledAT = DispSen.Dados.Sinaleiros.FirstOrDefault(x => x.ID == "LEDAT");
var ledMN = DispSen.Dados.Sinaleiros.FirstOrDefault(x => x.ID == "LEDMN"); var ledMN = DispSen.Dados.Sinaleiros.FirstOrDefault(x => x.ID == "LEDMN");
var comportamento = Variaveis.ComportamentoPorStatus(); var comportamento = VariaveisEquipamento.ComportamentoPorStatus();
if (!ledOP.Comportamento.Equals(comportamento)) if (!ledOP.Comportamento.Equals(comportamento))
{ {
ledOP.Comportamento = comportamento; GeneralJoystick.EnviarComandoSensoriamento(S_Code.sLED, ledOP.ID, comportamento);
DispSen.AdicionarMensagemFila(DispSen.Dados.Modulo_ID, ledOP.ProtocoloComando(), true, false);
} }
var statusLedAt = Modo == ModoOperacao.MapaGPS ? StatusLED.Aceso : StatusLED.Apagado; var statusLedAt = Modo == ModoOperacao.MapaGPS ? StatusLED.Aceso : StatusLED.Apagado;
if (!ledAT.Comportamento.statusLED.Equals(statusLedAt)) if (!ledAT.Comportamento.statusLED.Equals(statusLedAt))
{ {
ledAT.Comportamento.statusLED = statusLedAt; ledAT.Comportamento.statusLED = statusLedAt;
DispSen.AdicionarMensagemFila(DispSen.Dados.Modulo_ID, ledAT.ProtocoloComando(), true, false); GeneralJoystick.EnviarComandoSensoriamento(S_Code.sLED, ledAT.ID, ledAT.Comportamento);
} }
var statusLedMn = Modo == ModoOperacao.Manual ? StatusLED.Aceso : StatusLED.Apagado; var statusLedMn = Modo == ModoOperacao.Manual ? StatusLED.Aceso : StatusLED.Apagado;
if (!ledMN.Comportamento.statusLED.Equals(statusLedMn)) if (!ledMN.Comportamento.statusLED.Equals(statusLedMn))
{ {
ledMN.Comportamento.statusLED = statusLedMn; ledMN.Comportamento.statusLED = statusLedMn;
DispSen.AdicionarMensagemFila(DispSen.Dados.Modulo_ID, ledMN.ProtocoloComando(), true, false); GeneralJoystick.EnviarComandoSensoriamento(S_Code.sLED, ledMN.ID, ledMN.Comportamento);
} }
} }
} }
@ -1865,10 +1872,50 @@ namespace AgroBase.Models
{ {
get get
{ {
return Convert.ToInt32(RPM_SP * Variaveis.OperacaoEmAndamento.DispMvd.Dados.RelacaoRPM); return Convert.ToInt32(RPM_SP * VariaveisEquipamento.RelacaoRPM);
} }
} }
public Direcao Direcao { get; set; } = Direcao.Parado; public Direcao Direcao { get; set; } = Direcao.Parado;
private TipoMovimentoDirecional _tipoMovimento;
public TipoMovimentoDirecional TipoMovimento
{
get
{
return _tipoMovimento;
}
set
{
var DispMvd = Variaveis.OperacaoEmAndamento.DispMvd;
if (DispMvd != null)
{
switch (value)
{
case TipoMovimentoDirecional.RodasDianteiras:
DispMvd.Dados.Modulos.ForEach(x =>
{
x.MovMotor.Comandar = true;
x.DirMotor.Comandar = x.Modulo_ID.Contains("F");
});
break;
case TipoMovimentoDirecional.RodasTraseiras:
DispMvd.Dados.Modulos.ForEach(x =>
{
x.MovMotor.Comandar = true;
x.DirMotor.Comandar = x.Modulo_ID.Contains("T");
});
break;
default:
DispMvd.Dados.Modulos.ForEach(x =>
{
x.MovMotor.Comandar = true;
x.DirMotor.Comandar = true;
});
break;
}
}
_tipoMovimento = value;
}
}
public double PercentualInicioPulverizacao { get; set; } = 0.3; public double PercentualInicioPulverizacao { get; set; } = 0.3;
public List<AtuadorBicoModel> BicosAtuados { get; set; } = new List<AtuadorBicoModel>(); public List<AtuadorBicoModel> BicosAtuados { get; set; } = new List<AtuadorBicoModel>();
@ -1912,8 +1959,7 @@ namespace AgroBase.Models
public double AnguloMP { get; set; } public double AnguloMP { get; set; }
public double VelocidadeMP { get; set; } public double VelocidadeMP { get; set; }
public bool Emergencia { get; set; } public bool Emergencia { get; set; }
public Dictionary<string, bool> ControleMov { get; set; } public TipoMovimentoDirecional TipoMovimento { get; set; }
public Dictionary<string, bool> ControleDir { get; set; }
} }
@ -2022,6 +2068,7 @@ namespace AgroBase.Models
public double Temperatura { get; set; } = 0; public double Temperatura { get; set; } = 0;
public double Pressao { get; set; } = 0; public double Pressao { get; set; } = 0;
public double Altitude { get; set; } = 0; public double Altitude { get; set; } = 0;
public TipoMovimentoDirecional TipoMovimento { get; set; }
} }

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Models.Operacoes namespace AgroBase.Models.Operacoes
{ {

View File

@ -7,7 +7,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Models namespace AgroBase.Models
{ {

View File

@ -9,13 +9,14 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using Microsoft.Win32; using Microsoft.Win32;
using System.Reflection; using System.Reflection;
using AgroBase.Forms.Operacoes; using AgroBase.Forms.Operacoes;
using CefSharp.WinForms; using CefSharp.WinForms;
using System.IO; using System.IO;
using CefSharp.DevTools.Memory;
namespace AgroBase.Models namespace AgroBase.Models
{ {
@ -30,11 +31,62 @@ namespace AgroBase.Models
public static List<IDispositivosService> DispositivosConectados { get; set; } = new List<IDispositivosService>(); public static List<IDispositivosService> DispositivosConectados { get; set; } = new List<IDispositivosService>();
public static OperacaoModel OperacaoEmAndamento { get; set; } = new OperacaoModel(ModoOperacao.Manual); public static OperacaoModel OperacaoEmAndamento { get; set; } = new OperacaoModel(ModoOperacao.Manual);
public static MqttService MqttService { get; set; } = new MqttService("localhost", 1883); public static MqttService MqttService { get; set; } = new MqttService("localhost", 1883);
public static LoRaService ConexaoLoRa = new LoRaService();
public static bool IsAgroMonitor
{
get
{
return CaminhoSistema.Contains("AgroMonitor");
}
}
}
public static class VariaveisPortas
{
public static int GPS { get; } = 6512;
public static int CameraSolo { get; } = 6522;
public static int CameraCaminho { get; } = 6544;
public static int SocketSolo { get; } = 6568;
public static int SocketCaminho { get; } = 6588;
}
public static class VariaveisEquipamento
{
public static double LarguraEsquerda { get; } = 40;
public static double LarguraDireita { get; } = 40;
public static double DiametroRoda { get; set; } = 0.3556;
public static double BateriaMax { get; set; } = 20;
public static double ReducaoDirecional { get; set; } = 20.0;
public static int RPM_Max_Roda { get; set; } = 100;
public static double RelacaoRPM
{
get
{
double RelacaoRPM = Variaveis.OperacaoEmAndamento.DispMvd != null ? Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.Average(x => x.MovMotor.RPM_Max) / VariaveisEquipamento.RPM_Max_Roda : 1;
return RelacaoRPM;
}
}
public static int TempoEntrePingsConexao { get; set; } = 10000;
public static Dictionary<AcaoFreio, int> AnguloFreio { get; } = new Dictionary<AcaoFreio, int>()
{
{ AcaoFreio.Ativar, 90 },
{ AcaoFreio.Desativar, 0 }
};
public static Dictionary<TipoMovimentoDirecional, int> AnguloMovimento { get; } = new Dictionary<TipoMovimentoDirecional, int>()
{
{ TipoMovimentoDirecional.RodasDianteiras, -1 },
{ TipoMovimentoDirecional.RodasTraseiras, -1 },
{ TipoMovimentoDirecional.MovimentoDiagonal, -1 },
{ TipoMovimentoDirecional.MovimentoArco, -1 },
{ TipoMovimentoDirecional.RotacionarNoEixo, 45 },
{ TipoMovimentoDirecional.MovimentoLateral, 90 },
};
public static SensorSinaleiroComportamentoModel ComportamentoPorStatus(StatusOperacao? _status = null) public static SensorSinaleiroComportamentoModel ComportamentoPorStatus(StatusOperacao? _status = null)
{ {
if (_status == null) if (_status == null)
{ {
_status = OperacaoEmAndamento.StatusAtual; _status = Variaveis.OperacaoEmAndamento.StatusAtual;
} }
SensorSinaleiroComportamentoModel comportamento = new SensorSinaleiroComportamentoModel() SensorSinaleiroComportamentoModel comportamento = new SensorSinaleiroComportamentoModel()
@ -107,39 +159,8 @@ namespace AgroBase.Models
return comportamento; return comportamento;
} }
public static LoRaService ConexaoLoRa = new LoRaService();
public static bool IsAgroMonitor
{
get
{
return CaminhoSistema.Contains("AgroMonitor");
}
}
}
public static class VariaveisPortas
{
public static int GPS { get; } = 6512;
public static int CameraSolo { get; } = 6522;
public static int CameraCaminho { get; } = 6544;
public static int SocketSolo { get; } = 6568;
public static int SocketCaminho { get; } = 6588;
}
public static class VariaveisEquipamento
{
public static double LarguraEsquerda { get; } = 40;
public static double LarguraDireita { get; } = 40;
public static double DiametroRoda { get; set; } = 0.3556;
public static double BateriaMax { get; set; } = 20;
public static double ReducaoDirecional { get; set; } = 20.0;
public static int RPM_Max_Roda { get; set; } = 100;
public static int TempoEntrePingsConexao { get; set; } = 10000;
public static Dictionary<AcaoFreio, int> AnguloFreio { get; } = new Dictionary<AcaoFreio, int>()
{
{ AcaoFreio.Ativar, 90 },
{ AcaoFreio.Desativar, 0 }
};
} }
public static class VariaveisOperacao public static class VariaveisOperacao

View File

@ -6,23 +6,43 @@ using System.IO.Ports;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
using System.Windows.Forms; using System.Windows.Forms;
using Emgu.CV.Structure; using Emgu.CV.Structure;
using System.Drawing.Printing; using System.Drawing.Printing;
using System.Threading;
using System.IO;
namespace AgroBase.Services namespace AgroBase.Services
{ {
public class BLD300RService public class BLD300RService
{ {
public static bool Iniciado { get; set; } public static bool Iniciado
{
get
{
if (!SerialService.DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Bld) && DadosLeitura.All(x => !x.Iniciado))
{
return false;
}
if (_PortaBLD != null && !_PortaBLD.IsOpen)
{
try
{
_PortaBLD.Open();
}
catch
{
_PortaBLD = null;
}
}
return _PortaBLD != null && _PortaBLD.IsOpen && DadosLeitura.Any(x => x.Iniciado);
}
}
public static int TaxaAmostragem { get; set; } = 1000; public static int TaxaAmostragem { get; set; } = 1000;
public static SerialPort _PortaBLD = new SerialPort(); public static SerialPort _PortaBLD = new SerialPort();
public static List<BLD300RModel> DadosLeitura = new List<BLD300RModel>(); public static List<BLD300RModel> DadosLeitura = new List<BLD300RModel>();
public static bool EnvioLiberado = true;
public static bool FilaEmEspera = false;
public static bool Respondido = false;
public static List<ModbusParametrosModel> Parametros = new List<ModbusParametrosModel>() public static List<ModbusParametrosModel> Parametros = new List<ModbusParametrosModel>()
{ {
@ -212,6 +232,11 @@ namespace AgroBase.Services
private static List<BLDComandoModel> FilaComandos = new List<BLDComandoModel>(); private static List<BLDComandoModel> FilaComandos = new List<BLDComandoModel>();
private static readonly object FilaLock = new object();
private static System.Windows.Forms.Timer tmrLoopComandos = new System.Windows.Forms.Timer() { Interval = 100 };
private static bool EnvioLiberado { get; set; } = true;
public static async Task<bool> VerificaPortaBLD(SerialPort porta) public static async Task<bool> VerificaPortaBLD(SerialPort porta)
{ {
@ -223,6 +248,8 @@ namespace AgroBase.Services
AtualizarPortaCOM(porta); AtualizarPortaCOM(porta);
} }
EnvioLiberado = false;
var Parametro = Parametros.First(x => x.Chave == "Versao"); var Parametro = Parametros.First(x => x.Chave == "Versao");
List<string> Mod_IDs = new List<string>(); List<string> Mod_IDs = new List<string>();
@ -256,8 +283,6 @@ namespace AgroBase.Services
} }
} }
Iniciado = DadosLeitura.Any(x => x.Iniciado);
if (Iniciado) if (Iniciado)
{ {
DefinirDispositivo(Mod_IDs); DefinirDispositivo(Mod_IDs);
@ -268,6 +293,8 @@ namespace AgroBase.Services
_PortaBLD = null; _PortaBLD = null;
} }
EnvioLiberado = true;
return Iniciado; return Iniciado;
} }
@ -312,11 +339,28 @@ namespace AgroBase.Services
public static void IniciarRotinas() public static void IniciarRotinas()
{ {
LoopEnvioComandos().ConfigureAwait(false); //Task.Run(() => LoopEnvioComandos()); // Inicia o loop de comandos em segundo plano
ReceberDados().ConfigureAwait(false); Task.Run(() => ReceberDados()); // Inicia a recepção de dados em segundo plano
if (!tmrLoopComandos.Enabled)
{
tmrLoopComandos.Tick += TmrLoopComandos_Tick;
tmrLoopComandos.Start();
}
}
private static void TmrLoopComandos_Tick(object sender, EventArgs e)
{
if (Iniciado && EnvioLiberado)
{
Task.Run(() => LoopEnvioComandos());
}
} }
private static void EnviarComando(SerialPort _Porta, byte[] Comando) private static void EnviarComando(SerialPort _Porta, byte[] Comando)
{
lock (FilaLock)
{
try
{ {
if (_Porta != null) if (_Porta != null)
{ {
@ -330,6 +374,12 @@ namespace AgroBase.Services
} }
} }
} }
catch (Exception ex)
{
throw ex;
}
}
}
private static async Task ReceberDados() private static async Task ReceberDados()
{ {
@ -385,7 +435,7 @@ namespace AgroBase.Services
Leitura = new BLD300RModel() Leitura = new BLD300RModel()
{ {
Endereco = Addr, Endereco = Addr,
Iniciado = false, UltimoComandoRecebido = DateTime.MinValue,
parametros = new List<BLDParametrosRequisitar>() parametros = new List<BLDParametrosRequisitar>()
{ {
new BLDParametrosRequisitar() new BLDParametrosRequisitar()
@ -431,7 +481,7 @@ namespace AgroBase.Services
} }
ParametroLeitura.Valor = Parametro.Valor; ParametroLeitura.Valor = Parametro.Valor;
Leitura.Iniciado = true; Leitura.UltimoComandoRecebido = DateTime.Now;
} }
} }
catch (Exception ex) catch (Exception ex)
@ -504,16 +554,8 @@ namespace AgroBase.Services
public static async Task EnviarComandoControle(BLDComandoModel Comando) public static async Task EnviarComandoControle(BLDComandoModel Comando)
{ {
while (!EnvioLiberado) try
{ {
await Task.Delay(FilaEmEspera ? 200 : 100);
FilaEmEspera = true;
}
EnvioLiberado = false;
FilaEmEspera = false;
Respondido = false;
byte[] comando = null; byte[] comando = null;
if (Comando.Get) if (Comando.Get)
@ -535,43 +577,70 @@ namespace AgroBase.Services
{ {
byte[] resposta = await SerialService.LerDadosDaPortaSerialAsync(_PortaBLD, 7, Comando.TimeoutResposta); byte[] resposta = await SerialService.LerDadosDaPortaSerialAsync(_PortaBLD, 7, Comando.TimeoutResposta);
DecifrarResposta(resposta, Comando.Parametro, Comando.Endereco); DecifrarResposta(resposta, Comando.Parametro, Comando.Endereco);
Respondido = true;
} }
} }
}
catch (IOException ex)
{
Console.WriteLine("Erro ao enviar comando BLD300R: " + ex.Message);
Comando.Enviado = false;
Comando.Momento = DateTime.Now.AddSeconds(1);
}
finally
{
EnvioLiberado = true; EnvioLiberado = true;
} }
}
public static void AdicionarComandoNaFila(BLDComandoModel Comando) public static void AdicionarComandoNaFila(BLDComandoModel Comando)
{
lock (FilaLock)
{ {
if (!FilaComandos.Any(x => x.Endereco == Comando.Endereco && x.Parametro.Registro == Comando.Parametro.Registro && x.Get == Comando.Get && !x.Enviado)) if (!FilaComandos.Any(x => x.Endereco == Comando.Endereco && x.Parametro.Registro == Comando.Parametro.Registro && x.Get == Comando.Get && !x.Enviado))
{ {
FilaComandos.Add(Comando); FilaComandos.Add(Comando);
} }
} }
}
private static async Task LoopEnvioComandos() private static async Task LoopEnvioComandos()
{ {
while (true) EnvioLiberado = false;
{
await Task.Delay(100);
try
{
await ProcessarFilaPrioridade(); await ProcessarFilaPrioridade();
var FilaLeitura = FilaComandos.Where(x => !x.Enviado && x.Get).OrderBy(x => x.Momento).ToList(); List<BLDComandoModel> comandosParaEnviar;
foreach (var Comando in FilaLeitura)
lock (FilaLock)
{
comandosParaEnviar = FilaComandos.Where(x => !x.Enviado && x.Get).OrderBy(x => x.Momento).ToList();
}
foreach (var Comando in comandosParaEnviar)
{ {
await EnviarComandoControle(Comando); await EnviarComandoControle(Comando);
await ProcessarFilaPrioridade(); await ProcessarFilaPrioridade();
} }
} }
catch (Exception ex)
{
Console.WriteLine("Erro ao processar fila de comandos BLD300R: " + ex.Message);
}
finally
{
EnvioLiberado = true;
}
} }
private static async Task ProcessarFilaPrioridade() private static async Task ProcessarFilaPrioridade()
{ {
var FilaPrioridade = FilaComandos.Where(x => !x.Enviado && !x.Get).OrderBy(x => x.Momento).ToList(); var FilaPrioridade = new List<BLDComandoModel>();
lock (FilaLock)
{
FilaPrioridade = FilaComandos.Where(x => !x.Enviado && !x.Get).OrderBy(x => x.Momento).ToList();
}
while (FilaPrioridade.Count > 0) while (FilaPrioridade.Count > 0)
{ {
@ -580,9 +649,12 @@ namespace AgroBase.Services
await EnviarComandoControle(Comando); await EnviarComandoControle(Comando);
} }
lock (FilaLock)
{
FilaPrioridade = FilaComandos.Where(x => !x.Enviado && !x.Get).OrderBy(x => x.Momento).ToList(); FilaPrioridade = FilaComandos.Where(x => !x.Enviado && !x.Get).OrderBy(x => x.Momento).ToList();
} }
} }
}
public class BLDParametrosRequisitar public class BLDParametrosRequisitar

View File

@ -19,7 +19,21 @@ namespace AgroBase.Services
private double CargaMaxima { get; set; } private double CargaMaxima { get; set; }
private double CargaAtual { get; set; } private double CargaAtual { get; set; }
private double CargaAtualAmp
{
get
{
return CargaAtual / 3600.0;
}
}
private double Consumido { get; set; } private double Consumido { get; set; }
private double ConsumidoAmp
{
get
{
return Consumido / 3600.0;
}
}
public double PercentualAtual public double PercentualAtual
{ {
get get

View File

@ -14,7 +14,7 @@ using System.IO.Ports;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Comum namespace AgroBase.Comum
{ {

View File

@ -7,7 +7,7 @@ using System.IO.Ports;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Services namespace AgroBase.Services
{ {

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Services namespace AgroBase.Services
{ {

View File

@ -11,7 +11,7 @@ using System.Net.Http;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
using static AgroBase.Services.SerialService; using static AgroBase.Services.SerialService;
namespace AgroBase.Services namespace AgroBase.Services
@ -700,7 +700,7 @@ namespace AgroBase.Services
AtualizarCoordenadasGPS(); AtualizarCoordenadasGPS();
var StatusCarro = Variaveis.OperacaoEmAndamento.OpMapaGPS.ReferencialRuaGPS.StatusAtual; var StatusCarro = Variaveis.OperacaoEmAndamento.OpMapaGPS.ReferencialRuaGPS.StatusAtual;
if (StatusCarro == Enuns.StatusCarroMapa.Parado || StatusCarro == Enuns.StatusCarroMapa.Direcionando) if (StatusCarro == Enums.StatusCarroMapa.Parado || StatusCarro == Enums.StatusCarroMapa.Direcionando)
{ {
return; return;
} }

View File

@ -6,7 +6,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Services namespace AgroBase.Services
{ {

View File

@ -7,7 +7,7 @@ using System.Runtime.Serialization.Formatters.Binary;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Services namespace AgroBase.Services
{ {
@ -181,23 +181,8 @@ namespace AgroBase.Services
// Serializar Emergencia // Serializar Emergencia
bytes.AddRange(BitConverter.GetBytes(model.Emergencia)); bytes.AddRange(BitConverter.GetBytes(model.Emergencia));
// Serializar ControleMov // Serializar TipoMovimento (int)
bytes.AddRange(BitConverter.GetBytes(model.ControleMov.Count)); bytes.AddRange(BitConverter.GetBytes((int)model.TipoMovimento));
foreach (var kvp in model.ControleMov)
{
bytes.AddRange(BitConverter.GetBytes(kvp.Key.Length));
bytes.AddRange(System.Text.Encoding.UTF8.GetBytes(kvp.Key));
bytes.Add(kvp.Value ? (byte)1 : (byte)0);
}
// Serializar ControleDir
bytes.AddRange(BitConverter.GetBytes(model.ControleDir.Count));
foreach (var kvp in model.ControleDir)
{
bytes.AddRange(BitConverter.GetBytes(kvp.Key.Length));
bytes.AddRange(System.Text.Encoding.UTF8.GetBytes(kvp.Key));
bytes.Add(kvp.Value ? (byte)1 : (byte)0);
}
return bytes.ToArray(); return bytes.ToArray();
} }
@ -235,35 +220,9 @@ namespace AgroBase.Services
model.Emergencia = BitConverter.ToBoolean(bytes, index); model.Emergencia = BitConverter.ToBoolean(bytes, index);
index += sizeof(bool); index += sizeof(bool);
// Desserializar ControleMov // Desserializar TipoMovimento (int)
int controleMovCount = BitConverter.ToInt32(bytes, index); model.TipoMovimento = (TipoMovimentoDirecional)BitConverter.ToInt32(bytes, index);
index += sizeof(int); index += sizeof(int);
model.ControleMov = new Dictionary<string, bool>();
for (int i = 0; i < controleMovCount; i++)
{
int keyLength = BitConverter.ToInt32(bytes, index);
index += sizeof(int);
string key = System.Text.Encoding.UTF8.GetString(bytes, index, keyLength);
index += keyLength;
bool value = bytes[index] == 1;
index += sizeof(byte);
model.ControleMov[key] = value;
}
// Desserializar ControleDir
int controleDirCount = BitConverter.ToInt32(bytes, index);
index += sizeof(int);
model.ControleDir = new Dictionary<string, bool>();
for (int i = 0; i < controleDirCount; i++)
{
int keyLength = BitConverter.ToInt32(bytes, index);
index += sizeof(int);
string key = System.Text.Encoding.UTF8.GetString(bytes, index, keyLength);
index += keyLength;
bool value = bytes[index] == 1;
index += sizeof(byte);
model.ControleDir[key] = value;
}
return model; return model;
} }

View File

@ -15,7 +15,7 @@ using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
using static Emgu.CV.ML.KNearest; using static Emgu.CV.ML.KNearest;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window; using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
@ -516,8 +516,7 @@ namespace AgroBase.Services
if (!Variaveis.IsAgroMonitor) if (!Variaveis.IsAgroMonitor)
{ {
ReleLra.StatusControle = novoEstado; GeneralJoystick.EnviarComandoSensoriamento(S_Code.sRLE, ReleLra.ID, novoEstado);
DispSen.AdicionarMensagemFila(DispSen.Dados.Modulo_ID, ReleLra.ProtocoloComando(), true, false);
await Task.Delay(1000); await Task.Delay(1000);
} }

View File

@ -10,13 +10,34 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Services namespace AgroBase.Services
{ {
public class MKS057DService public class MKS057DService
{ {
public static bool Iniciado { get; set; } = false; public static bool Iniciado
{
get
{
if (!SerialService.DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Mks) && DadosLeitura.All(x => !x.Iniciado))
{
return false;
}
if (_PortaMKS != null && !_PortaMKS.IsOpen)
{
try
{
_PortaMKS.Open();
}
catch
{
_PortaMKS = null;
}
}
return _PortaMKS != null && _PortaMKS.IsOpen && DadosLeitura.Any(x => x.Iniciado);
}
}
public static int TaxaAmostragem { get; set; } = 1000; public static int TaxaAmostragem { get; set; } = 1000;
public static SerialPort _PortaMKS = new SerialPort(); public static SerialPort _PortaMKS = new SerialPort();
@ -57,8 +78,6 @@ namespace AgroBase.Services
} }
} }
Iniciado = DadosLeitura.Any(x => x.Iniciado);
if (Iniciado) if (Iniciado)
{ {
DefinirDispositivo(Mod_IDs); DefinirDispositivo(Mod_IDs);
@ -439,6 +458,8 @@ namespace AgroBase.Services
} }
private static void ProcessarDadosRecebidos() private static void ProcessarDadosRecebidos()
{
if (Iniciado)
{ {
SerialBuffer_RX = new byte[11] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // SerialBuffer_RX[0] Cabeçalho do quadro [1] Endereço do escravo [2] Número da instrução SerialBuffer_RX = new byte[11] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // SerialBuffer_RX[0] Cabeçalho do quadro [1] Endereço do escravo [2] Número da instrução
Data_Number = _PortaMKS.BytesToRead; // Número de bytes recebidos Data_Number = _PortaMKS.BytesToRead; // Número de bytes recebidos
@ -451,6 +472,7 @@ namespace AgroBase.Services
Text_display(); Text_display();
} }
} }
}
private static async Task SendRelevantData(int data) // Verifica o tipo de dados e envia private static async Task SendRelevantData(int data) // Verifica o tipo de dados e envia
{ {
@ -1400,6 +1422,7 @@ namespace AgroBase.Services
leitura = new MKS057DModel() leitura = new MKS057DModel()
{ {
Endereco = addr, Endereco = addr,
UltimoComandoRecebido = DateTime.MinValue,
}; };
DadosLeitura.Add(leitura); DadosLeitura.Add(leitura);
} }
@ -2023,7 +2046,7 @@ namespace AgroBase.Services
break; break;
} }
leitura.Iniciado = true; leitura.UltimoComandoRecebido = DateTime.Now;
} }
Respondido = true; Respondido = true;

View File

@ -12,7 +12,7 @@ using Emgu.CV.CvEnum;
using Emgu.CV.Aruco; using Emgu.CV.Aruco;
using System.Threading.Tasks; using System.Threading.Tasks;
using AgroBase.Forms; using AgroBase.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Services namespace AgroBase.Services
{ {

View File

@ -11,7 +11,7 @@ using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Services namespace AgroBase.Services
{ {
@ -23,7 +23,7 @@ namespace AgroBase.Services
public static string BeginSensor = "#"; public static string BeginSensor = "#";
public static string SplitMessage = ";"; public static string SplitMessage = ";";
public static string SplitParams = ","; public static string SplitParams = ",";
public static List<T_Code> DispositivosMotores = new List<T_Code>() { T_Code.Mov, T_Code.Dir }; public static List<T_Code> DispositivosMotores = new List<T_Code>() { T_Code.Mov, T_Code.Dir, T_Code.Mvd };
public static List<T_Code> DispositivosConexaoInicial = new List<T_Code>() { T_Code.Mvd, T_Code.Atu, T_Code.Sen }; public static List<T_Code> DispositivosConexaoInicial = new List<T_Code>() { T_Code.Mvd, T_Code.Atu, T_Code.Sen };
public static List<T_Code> DispositivosModbus = new List<T_Code>() { T_Code.Pzm, T_Code.Wit }; public static List<T_Code> DispositivosModbus = new List<T_Code>() { T_Code.Pzm, T_Code.Wit };
public static List<T_Code> DispositivosMultiplos = new List<T_Code>() { T_Code.Bld, T_Code.Mks, T_Code.Mvd }; public static List<T_Code> DispositivosMultiplos = new List<T_Code>() { T_Code.Bld, T_Code.Mks, T_Code.Mvd };
@ -59,7 +59,13 @@ namespace AgroBase.Services
} }
else if (Dispositivo == T_Code.Bld) else if (Dispositivo == T_Code.Bld)
{ {
DispositivoConectado = BLD300RService.Iniciado; var Modulo = Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.FirstOrDefault(x => x.Modulo_ID == Mod_ID);
DispositivoConectado = Modulo?.MovMotor?.BLD_Inicializado ?? false;
}
else if (Dispositivo == T_Code.Mks)
{
var Modulo = Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.FirstOrDefault(x => x.Modulo_ID == Mod_ID);
DispositivoConectado = Modulo?.DirMotor?.MKS_Inicializado ?? false;
} }
else else
{ {
@ -67,12 +73,9 @@ namespace AgroBase.Services
if (dispositivoService != null) if (dispositivoService != null)
{ {
if (!dispositivoService._Porta.IsOpen) if (!dispositivoService._Porta.IsOpen)
{
if (dispositivoService.Dispositivo != T_Code.Sen || (dispositivoService.Dispositivo == T_Code.Sen && SerialService.DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Lra && !x.Erro)))
{ {
dispositivoService.btnConectar_Click(new object(), new EventArgs()); dispositivoService.btnConectar_Click(new object(), new EventArgs());
} }
}
DispositivoConectado = dispositivoService._Porta.IsOpen; DispositivoConectado = dispositivoService._Porta.IsOpen;
} }
else else
@ -110,7 +113,7 @@ namespace AgroBase.Services
for (int i = 0; i < PortasNaoMapeadas.Count(); i++) for (int i = 0; i < PortasNaoMapeadas.Count(); i++)
{ {
string PortaCom = PortasNaoMapeadas[i].ToString(); string PortaCom = PortasNaoMapeadas[i].ToString();
Console.WriteLine("Procurando dispositivos conectados à porta " + PortaCom + "..."); AtualizarConsole("Procurando dispositivos conectados à porta " + PortaCom + "...");
SerialPort _Porta = new SerialPort() { PortName = PortaCom, BaudRate = 115200 }; SerialPort _Porta = new SerialPort() { PortName = PortaCom, BaudRate = 115200 };
if (Variaveis.IsAgroMonitor) if (Variaveis.IsAgroMonitor)
@ -153,6 +156,7 @@ namespace AgroBase.Services
string ProtocoloCheck = Variaveis.OperacaoEmAndamento.DispAtu.Dados.ProtocoloVerificacao(true); string ProtocoloCheck = Variaveis.OperacaoEmAndamento.DispAtu.Dados.ProtocoloVerificacao(true);
AtualizarConsole("Procurando dispositivo ATU");
_Porta.Open(); _Porta.Open();
_Porta.Write(ProtocoloCheck); _Porta.Write(ProtocoloCheck);
@ -164,6 +168,7 @@ namespace AgroBase.Services
{ {
ProtocoloCheck = Variaveis.OperacaoEmAndamento.DispSen.Dados.ProtocoloVerificacao(true); ProtocoloCheck = Variaveis.OperacaoEmAndamento.DispSen.Dados.ProtocoloVerificacao(true);
AtualizarConsole("Procurando dispositivo SEN");
_Porta.Open(); _Porta.Open();
_Porta.Write(ProtocoloCheck); _Porta.Write(ProtocoloCheck);
@ -171,10 +176,18 @@ namespace AgroBase.Services
DispositivoSen = ProcessarRespostaDispositivo(_Porta); DispositivoSen = ProcessarRespostaDispositivo(_Porta);
_Porta.Close(); _Porta.Close();
if (!DispositivoSen) if (!DispositivoSen && false)
{ {
DispositivoMvd = await ProcuraDispositivoMvd(_Porta); DispositivoMvd = await ProcuraDispositivoMvd(_Porta);
} }
else
{
AtualizarConsole("Dispositivo SEN encontrado");
}
}
else
{
AtualizarConsole("Dispositivo ATU encontrado");
} }
PortaDispositivoProprio = DispositivoMvd || DispositivoAtu || DispositivoSen; PortaDispositivoProprio = DispositivoMvd || DispositivoAtu || DispositivoSen;
@ -214,27 +227,13 @@ namespace AgroBase.Services
await ProcuraDispositivoModbus(ModbusService._PortaModbus, false); await ProcuraDispositivoModbus(ModbusService._PortaModbus, false);
} }
if (MKS057DService.Iniciado) if (MKS057DService.Iniciado)
{
if (DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Mks))
{ {
await ProcuraDispositivoMKS(MKS057DService._PortaMKS); await ProcuraDispositivoMKS(MKS057DService._PortaMKS);
} }
else
{
MKS057DService.Iniciado = false;
}
}
if (BLD300RService.Iniciado) if (BLD300RService.Iniciado)
{
if (DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Bld))
{ {
await ProcuraDispositivoBLD(BLD300RService._PortaBLD); await ProcuraDispositivoBLD(BLD300RService._PortaBLD);
} }
else
{
MKS057DService.Iniciado = false;
}
}
/*if (DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Mvd) && Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.Any(x => !DispositivosMapeados.Any(y => y.Mod_ID == x.Modulo_ID))) /*if (DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Mvd) && Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.Any(x => !DispositivosMapeados.Any(y => y.Mod_ID == x.Modulo_ID)))
{ {
await ProcuraDispositivoMvd(new SerialPort() { PortName = DispositivosMapeados.First(x => x.Dispositivo == T_Code.Mvd).PortaCOM, BaudRate = 115200 }); await ProcuraDispositivoMvd(new SerialPort() { PortName = DispositivosMapeados.First(x => x.Dispositivo == T_Code.Mvd).PortaCOM, BaudRate = 115200 });
@ -252,13 +251,13 @@ namespace AgroBase.Services
private static bool ProcessarRespostaDispositivo(SerialPort Porta) private static bool ProcessarRespostaDispositivo(SerialPort Porta)
{ {
if (Porta.BytesToRead <= 15) if (Porta.BytesToRead <= 15 || Porta.BytesToRead >= 30)
{ {
VerificarRespostaPortasDesconhecidas(Porta); VerificarRespostaPortasDesconhecidas(Porta);
return false; return false;
} }
string Recebido = Porta.ReadLine(); string Recebido = ReadLineWithTimeout(Porta, 1000);
if (Recebido.Length > 2) if (Recebido.Length > 2)
{ {
@ -316,6 +315,22 @@ namespace AgroBase.Services
return false; return false;
} }
private static string ReadLineWithTimeout(SerialPort porta, int timeout)
{
CancellationTokenSource cts = new CancellationTokenSource();
Task<string> task = Task.Run(() => porta.ReadLine(), cts.Token);
if (task.Wait(timeout))
{
return task.Result;
}
else
{
cts.Cancel();
return null; // ou string.Empty, dependendo de como você deseja lidar com isso
}
}
public static void AtualizarDispositivos() public static void AtualizarDispositivos()
{ {
DispositivosConexaoInicial.ForEach(Dispositivo => DispositivosConexaoInicial.ForEach(Dispositivo =>
@ -451,22 +466,27 @@ namespace AgroBase.Services
private static async Task<bool> ProcuraDispositivoModbus(SerialPort porta, bool PararAoEncontrar) private static async Task<bool> ProcuraDispositivoModbus(SerialPort porta, bool PararAoEncontrar)
{ {
AtualizarConsole("Procurando dispositivos Modbus");
bool Encontrado = false; bool Encontrado = false;
if (!PZEMService.Iniciado || !DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Pzm)) if (!PZEMService.Iniciado || !DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Pzm))
{ {
AtualizarConsole("Procurando dispositivo PZM");
Encontrado = await PZEMService.VerificaPortaPZEM(ModbusService.Iniciado ? ModbusService._PortaModbus : porta); Encontrado = await PZEMService.VerificaPortaPZEM(ModbusService.Iniciado ? ModbusService._PortaModbus : porta);
if (Encontrado && PararAoEncontrar) if (Encontrado && PararAoEncontrar)
{ {
AtualizarConsole("Dispositivo PZM encontrado");
return Encontrado; return Encontrado;
} }
} }
if (!WT901CService.Iniciado || !DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Wit)) if (!WT901CService.Iniciado || !DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Wit))
{ {
AtualizarConsole("Procurando dispositivo WIT");
Encontrado = await WT901CService.VerificaPortaWT901C(ModbusService.Iniciado ? ModbusService._PortaModbus : porta); Encontrado = await WT901CService.VerificaPortaWT901C(ModbusService.Iniciado ? ModbusService._PortaModbus : porta);
if (Encontrado && PararAoEncontrar) if (Encontrado && PararAoEncontrar)
{ {
AtualizarConsole("Dispositivo WIT encontrado");
return Encontrado; return Encontrado;
} }
} }
@ -498,9 +518,11 @@ namespace AgroBase.Services
if (!BLD300RService.Iniciado || BLD300RService.DadosLeitura.Any(x => !x.Iniciado)) if (!BLD300RService.Iniciado || BLD300RService.DadosLeitura.Any(x => !x.Iniciado))
{ {
AtualizarConsole("Procurando dispositivos BLD");
bool Encontrado = await BLD300RService.VerificaPortaBLD(porta); bool Encontrado = await BLD300RService.VerificaPortaBLD(porta);
if (Encontrado) if (Encontrado)
{ {
AtualizarConsole("Dispositivo BLD encontrado");
return Encontrado; return Encontrado;
} }
} }
@ -508,7 +530,6 @@ namespace AgroBase.Services
return BLD300RService.Iniciado; return BLD300RService.Iniciado;
} }
private static async Task<bool> ProcuraDispositivoMKS(SerialPort porta) private static async Task<bool> ProcuraDispositivoMKS(SerialPort porta)
{ {
if (MKS057DService.Iniciado && porta.PortName != MKS057DService._PortaMKS.PortName) if (MKS057DService.Iniciado && porta.PortName != MKS057DService._PortaMKS.PortName)
@ -518,9 +539,11 @@ namespace AgroBase.Services
if (!MKS057DService.Iniciado || MKS057DService.DadosLeitura.Any(x => !x.Iniciado)) if (!MKS057DService.Iniciado || MKS057DService.DadosLeitura.Any(x => !x.Iniciado))
{ {
AtualizarConsole("Procurando dispositivos MKS");
bool Encontrado = await MKS057DService.VerificaPortaMKS(porta); bool Encontrado = await MKS057DService.VerificaPortaMKS(porta);
if (Encontrado) if (Encontrado)
{ {
AtualizarConsole("Dispositivo MKS encontrado");
return Encontrado; return Encontrado;
} }
} }
@ -532,7 +555,12 @@ namespace AgroBase.Services
{ {
if (!LoRaService.Iniciado) if (!LoRaService.Iniciado)
{ {
AtualizarConsole("Procurando dispositivo LRA");
bool Encontrado = await LoRaService.VerificaPortaLoRa(porta); bool Encontrado = await LoRaService.VerificaPortaLoRa(porta);
if (Encontrado)
{
AtualizarConsole("Dispositivo LRA encontrado");
}
return Encontrado; return Encontrado;
} }
else else
@ -543,6 +571,7 @@ namespace AgroBase.Services
private static bool VerificaRespostaGPS(SerialPort Porta, string Recebido = null) private static bool VerificaRespostaGPS(SerialPort Porta, string Recebido = null)
{ {
AtualizarConsole("Procurando dispositivo GPS");
if (string.IsNullOrEmpty(Recebido)) if (string.IsNullOrEmpty(Recebido))
{ {
//Recebido = Porta.ReadLine(); //Recebido = Porta.ReadLine();
@ -553,6 +582,7 @@ namespace AgroBase.Services
if (Recebido.Contains("$GPTXT")) if (Recebido.Contains("$GPTXT"))
{ {
GPSService.AtualizarPortaCOM(Porta); GPSService.AtualizarPortaCOM(Porta);
AtualizarConsole("Dispositivo GPS encontrado");
return true; return true;
} }
@ -619,5 +649,12 @@ namespace AgroBase.Services
} }
} }
private static void AtualizarConsole(string msg)
{
frmInstancial.frmPrincipal.lblStatusConexao.Text = msg;
Console.WriteLine(msg);
}
} }
} }

View File

@ -7,7 +7,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static AgroBase.Models.Enuns; using static AgroBase.Models.Enums;
namespace AgroBase.Services namespace AgroBase.Services
{ {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
{"Conectado":false,"Modulos":[{"Modulo_ID":"ET","Disponivel":false,"RequisitarDados":false,"Conectado":false,"UltimoProtocoloRecebido":"2024-07-19T14:36:52.470751-03:00","MovMotor":{"ID":"Mov","Endereco":"0x01","Ligado":false,"Freio":false,"CodigoAlarme":0,"RPM_SP":0,"RPM_SP_C":0,"Sentido_SP":1,"NumeroPolos":2,"Rampa":0,"RPM_Max":800,"Reducao":27,"RPM_Motor":0.0,"Sentido":0,"Temperatura":0.0,"TemperaturaDriver":0.0,"Tensao":0.0,"Corrente_Max":0.0,"Corrente":0.0,"RPM_Roda":0.0,"VelocidadeInstantanea":0.0,"Comandar":true,"Alarme":false,"Inicializado":false,"BLD_Inicializado":false,"ConfigSentidos":{"Frente":2,"Tras":1,"Esquerda":0,"Direita":0,"Parado":0},"Funcoes":[12,14,9,5,10],"LogGrafico":[],"Alarmes":[{"Tipo":411,"Valor":26.8,"Minimo":false,"Maximo":true,"ParaMinimo":false,"ParaMaximo":false}]},"DirMotor":{"ID":"Dir","Endereco":"0x01","Sentido_SP":0,"Angulo_SP":0.0,"Angulo_Offset":22.0,"Sentido":0,"Angulo":0.0,"Comandar":true,"Inicializado":false,"MKS_Inicializado":false,"ConfigSentidos":{"Frente":0,"Tras":0,"Esquerda":1,"Direita":2,"Parado":0},"Funcoes":[13,9,14,41]}},{"Modulo_ID":"EF","Disponivel":false,"RequisitarDados":false,"Conectado":false,"UltimoProtocoloRecebido":"2024-07-19T14:36:52.0937506-03:00","MovMotor":{"ID":"Mov","Endereco":"0x03","Ligado":false,"Freio":false,"CodigoAlarme":0,"RPM_SP":0,"RPM_SP_C":0,"Sentido_SP":1,"NumeroPolos":2,"Rampa":0,"RPM_Max":800,"Reducao":27,"RPM_Motor":0.0,"Sentido":0,"Temperatura":0.0,"TemperaturaDriver":0.0,"Tensao":0.0,"Corrente_Max":0.0,"Corrente":0.0,"RPM_Roda":0.0,"VelocidadeInstantanea":0.0,"Comandar":true,"Alarme":false,"Inicializado":false,"BLD_Inicializado":false,"ConfigSentidos":{"Frente":2,"Tras":1,"Esquerda":0,"Direita":0,"Parado":0},"Funcoes":[12,14,9,5,10],"LogGrafico":[],"Alarmes":[{"Tipo":411,"Valor":25.29,"Minimo":false,"Maximo":true,"ParaMinimo":false,"ParaMaximo":false}]},"DirMotor":{"ID":"Dir","Endereco":"0x03","Sentido_SP":0,"Angulo_SP":0.0,"Angulo_Offset":22.0,"Sentido":0,"Angulo":0.0,"Comandar":true,"Inicializado":false,"MKS_Inicializado":false,"ConfigSentidos":{"Frente":0,"Tras":0,"Esquerda":2,"Direita":1,"Parado":0},"Funcoes":[13,9,14,41]}},{"Modulo_ID":"DT","Disponivel":false,"RequisitarDados":false,"Conectado":false,"UltimoProtocoloRecebido":"2024-07-19T14:36:52.4827508-03:00","MovMotor":{"ID":"Mov","Endereco":"0x02","Ligado":false,"Freio":false,"CodigoAlarme":0,"RPM_SP":0,"RPM_SP_C":0,"Sentido_SP":2,"NumeroPolos":2,"Rampa":0,"RPM_Max":800,"Reducao":27,"RPM_Motor":0.0,"Sentido":0,"Temperatura":0.0,"TemperaturaDriver":0.0,"Tensao":0.0,"Corrente_Max":0.0,"Corrente":0.0,"RPM_Roda":0.0,"VelocidadeInstantanea":0.0,"Comandar":true,"Alarme":false,"Inicializado":false,"BLD_Inicializado":false,"ConfigSentidos":{"Frente":1,"Tras":2,"Esquerda":0,"Direita":0,"Parado":0},"Funcoes":[12,14,9,5,10],"LogGrafico":[],"Alarmes":[{"Tipo":411,"Valor":34.72,"Minimo":false,"Maximo":true,"ParaMinimo":false,"ParaMaximo":false}]},"DirMotor":{"ID":"Dir","Endereco":"0x02","Sentido_SP":0,"Angulo_SP":0.0,"Angulo_Offset":0.0,"Sentido":0,"Angulo":0.0,"Comandar":true,"Inicializado":false,"MKS_Inicializado":false,"ConfigSentidos":{"Frente":0,"Tras":0,"Esquerda":1,"Direita":2,"Parado":0},"Funcoes":[13,9,14,41]}},{"Modulo_ID":"DF","Disponivel":false,"RequisitarDados":false,"Conectado":false,"UltimoProtocoloRecebido":"2024-07-19T14:36:52.0857501-03:00","MovMotor":{"ID":"Mov","Endereco":"0x04","Ligado":false,"Freio":false,"CodigoAlarme":0,"RPM_SP":0,"RPM_SP_C":0,"Sentido_SP":2,"NumeroPolos":2,"Rampa":0,"RPM_Max":800,"Reducao":27,"RPM_Motor":0.0,"Sentido":0,"Temperatura":0.0,"TemperaturaDriver":0.0,"Tensao":0.0,"Corrente_Max":0.0,"Corrente":0.0,"RPM_Roda":0.0,"VelocidadeInstantanea":0.0,"Comandar":true,"Alarme":false,"Inicializado":false,"BLD_Inicializado":false,"ConfigSentidos":{"Frente":1,"Tras":2,"Esquerda":0,"Direita":0,"Parado":0},"Funcoes":[12,14,9,5,10],"LogGrafico":[],"Alarmes":[{"Tipo":411,"Valor":31.49,"Minimo":false,"Maximo":true,"ParaMinimo":false,"ParaMaximo":false}]},"DirMotor":{"ID":"Dir","Endereco":"0x04","Sentido_SP":0,"Angulo_SP":0.0,"Angulo_Offset":15.0,"Sentido":0,"Angulo":0.0,"Comandar":true,"Inicializado":false,"MKS_Inicializado":false,"ConfigSentidos":{"Frente":0,"Tras":0,"Esquerda":2,"Direita":1,"Parado":0},"Funcoes":[13,9,14,41]}}],"DistanciaPercorridaOperacao":0.0,"TempoEmAtividade":0,"DistanciaPercorridaTotal":0.0,"DistanciaPercorridaParcial":0.0,"RelacaoRPM":8.0}

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"ExpansorGPIO":false,"EnderecoExpansor":"","Pinos":[{"Controlador":1,"Barramento":0,"Pino":99,"Descricao":"1","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":98,"Descricao":"2","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":36,"Descricao":"3","Funcao":12,"Habilitado":true,"ComponenteID":"TMVET"},{"Controlador":1,"Barramento":0,"Pino":39,"Descricao":"4","Funcao":12,"Habilitado":true,"ComponenteID":"TMVEF"},{"Controlador":1,"Barramento":0,"Pino":34,"Descricao":"5","Funcao":12,"Habilitado":true,"ComponenteID":"TMVDT"},{"Controlador":1,"Barramento":0,"Pino":35,"Descricao":"6","Funcao":12,"Habilitado":true,"ComponenteID":"TMVDF"},{"Controlador":1,"Barramento":0,"Pino":32,"Descricao":"7","Funcao":45,"Habilitado":true,"ComponenteID":"FRO_ET"},{"Controlador":1,"Barramento":0,"Pino":33,"Descricao":"8","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":25,"Descricao":"9","Funcao":45,"Habilitado":true,"ComponenteID":"FRO_DT"},{"Controlador":1,"Barramento":0,"Pino":26,"Descricao":"10","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":27,"Descricao":"11","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":14,"Descricao":"12","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":12,"Descricao":"13","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":97,"Descricao":"14","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":13,"Descricao":"15","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":9,"Descricao":"16","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":10,"Descricao":"17","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":11,"Descricao":"18","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":96,"Descricao":"19","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":6,"Descricao":"26","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":7,"Descricao":"27","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":8,"Descricao":"28","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":15,"Descricao":"29","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":2,"Descricao":"30","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":0,"Descricao":"31","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":4,"Descricao":"32","Funcao":38,"Habilitado":true,"ComponenteID":"LEDMN"},{"Controlador":1,"Barramento":0,"Pino":16,"Descricao":"33","Funcao":38,"Habilitado":true,"ComponenteID":"LEDAT"},{"Controlador":1,"Barramento":0,"Pino":17,"Descricao":"34","Funcao":38,"Habilitado":true,"ComponenteID":"LEDOP"},{"Controlador":1,"Barramento":0,"Pino":5,"Descricao":"35","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":18,"Descricao":"36","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":19,"Descricao":"37","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":95,"Descricao":"38","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":21,"Descricao":"39","Funcao":33,"Habilitado":true,"ComponenteID":"Sen"},{"Controlador":1,"Barramento":0,"Pino":3,"Descricao":"40","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":1,"Descricao":"41","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":22,"Descricao":"42","Funcao":34,"Habilitado":true,"ComponenteID":"Sen"},{"Controlador":1,"Barramento":0,"Pino":23,"Descricao":"43","Funcao":26,"Habilitado":true,"ComponenteID":"RLLRA"},{"Controlador":1,"Barramento":0,"Pino":94,"Descricao":"44","Funcao":0,"Habilitado":false,"ComponenteID":""}]} {"ExpansorGPIO":false,"EnderecoExpansor":"","Pinos":[{"Controlador":1,"Barramento":0,"Pino":99,"Descricao":"1","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":98,"Descricao":"2","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":36,"Descricao":"3","Funcao":12,"Habilitado":true,"ComponenteID":"TMVET"},{"Controlador":1,"Barramento":0,"Pino":39,"Descricao":"4","Funcao":12,"Habilitado":true,"ComponenteID":"TMVDT"},{"Controlador":1,"Barramento":0,"Pino":34,"Descricao":"5","Funcao":12,"Habilitado":true,"ComponenteID":"TMVEF"},{"Controlador":1,"Barramento":0,"Pino":35,"Descricao":"6","Funcao":12,"Habilitado":true,"ComponenteID":"TMVDF"},{"Controlador":1,"Barramento":0,"Pino":32,"Descricao":"7","Funcao":45,"Habilitado":true,"ComponenteID":"FRO_ET"},{"Controlador":1,"Barramento":0,"Pino":33,"Descricao":"8","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":25,"Descricao":"9","Funcao":45,"Habilitado":true,"ComponenteID":"FRO_DT"},{"Controlador":1,"Barramento":0,"Pino":26,"Descricao":"10","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":27,"Descricao":"11","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":14,"Descricao":"12","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":12,"Descricao":"13","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":97,"Descricao":"14","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":13,"Descricao":"15","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":9,"Descricao":"16","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":10,"Descricao":"17","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":11,"Descricao":"18","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":96,"Descricao":"19","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":6,"Descricao":"26","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":7,"Descricao":"27","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":8,"Descricao":"28","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":15,"Descricao":"29","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":2,"Descricao":"30","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":0,"Descricao":"31","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":4,"Descricao":"32","Funcao":38,"Habilitado":true,"ComponenteID":"LEDMN"},{"Controlador":1,"Barramento":0,"Pino":16,"Descricao":"33","Funcao":38,"Habilitado":true,"ComponenteID":"LEDAT"},{"Controlador":1,"Barramento":0,"Pino":17,"Descricao":"34","Funcao":38,"Habilitado":true,"ComponenteID":"LEDOP"},{"Controlador":1,"Barramento":0,"Pino":5,"Descricao":"35","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":18,"Descricao":"36","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":19,"Descricao":"37","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":95,"Descricao":"38","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":21,"Descricao":"39","Funcao":33,"Habilitado":true,"ComponenteID":"Sen"},{"Controlador":1,"Barramento":0,"Pino":3,"Descricao":"40","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":1,"Descricao":"41","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":22,"Descricao":"42","Funcao":34,"Habilitado":true,"ComponenteID":"Sen"},{"Controlador":1,"Barramento":0,"Pino":23,"Descricao":"43","Funcao":26,"Habilitado":true,"ComponenteID":"RLLRA"},{"Controlador":1,"Barramento":0,"Pino":94,"Descricao":"44","Funcao":0,"Habilitado":false,"ComponenteID":""}]}

View File

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

View File

@ -1 +1 @@
ab167a1e9f8f1c9d367b89a53bdc6b7dc0ba8c1784611293d01e3bb951448869 177e51703557b384719a793e13b3dd29f92301810e542114ccdfa2c69ad52fdc

View File

@ -454,3 +454,4 @@ C:\ZendionInc\agrobot_base\AgroBase\AgroBase\obj\Debug\AgroBase.Forms.IHM.frmAju
C:\ZendionINC\agrobot_base\AgroBase\AgroBase\bin\Debug\Python\Scripts\map-follow.py C:\ZendionINC\agrobot_base\AgroBase\AgroBase\bin\Debug\Python\Scripts\map-follow.py
C:\ZendionINC\agrobot_base\AgroBase\AgroBase\obj\Debug\AgroBase.Forms.IHM.frmDiagnosticos.resources C:\ZendionINC\agrobot_base\AgroBase\AgroBase\obj\Debug\AgroBase.Forms.IHM.frmDiagnosticos.resources
C:\ZendionInc\agrobot_base\AgroBase\AgroBase\obj\Debug\AgroBase.csproj.CopyComplete C:\ZendionInc\agrobot_base\AgroBase\AgroBase\obj\Debug\AgroBase.csproj.CopyComplete
C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\Debug\Microsoft.Kinect.dll

Some files were not shown because too many files have changed in this diff Show More