otimização de software e melhorias de firmware
This commit is contained in:
parent
1ae1be349b
commit
c09986e146
|
|
@ -2,7 +2,7 @@
|
||||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||||
|
|
||||||
#define MyAppName "OrionTard Pro"
|
#define MyAppName "OrionTard Pro"
|
||||||
#define MyAppVersion "1.0.1.8"
|
#define MyAppVersion "1.1.0.0"
|
||||||
#define MyAppPublisher "Zendion, Inc."
|
#define MyAppPublisher "Zendion, Inc."
|
||||||
#define MyAppURL "https://zendioninc.com.br"
|
#define MyAppURL "https://zendioninc.com.br"
|
||||||
#define MyAppExeName "OrionTardPro.exe"
|
#define MyAppExeName "OrionTardPro.exe"
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@ namespace OrionTardPro
|
||||||
Ods, // Odometro
|
Ods, // Odometro
|
||||||
Pns, // Ping
|
Pns, // Ping
|
||||||
Mod, // Dados Modulo
|
Mod, // Dados Modulo
|
||||||
|
Inf, // Infiltração
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TipoEmbreagem
|
public enum TipoEmbreagem
|
||||||
|
|
@ -131,7 +132,8 @@ namespace OrionTardPro
|
||||||
InclinacaoHorizontal,
|
InclinacaoHorizontal,
|
||||||
Pressao,
|
Pressao,
|
||||||
Altitude,
|
Altitude,
|
||||||
Odometro
|
Odometro,
|
||||||
|
InfiltracaoRisco
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TipoArquivoVersionado
|
public enum TipoArquivoVersionado
|
||||||
|
|
@ -148,6 +150,13 @@ namespace OrionTardPro
|
||||||
Factor4 = 4,
|
Factor4 = 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum VersaoProtocolo
|
||||||
|
{
|
||||||
|
desconhecido = 0,
|
||||||
|
v1 = 1,
|
||||||
|
v2 = 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,16 +31,23 @@ namespace OrionTardPro
|
||||||
|
|
||||||
public void LimpaTabela()
|
public void LimpaTabela()
|
||||||
{
|
{
|
||||||
dtAlarmes.Columns.Clear();
|
// A implementação antiga destruía e recriava todas as colunas
|
||||||
|
// a cada frame de telemetria. As colunas são estáticas, então
|
||||||
|
// criamos somente uma vez e limpamos apenas as linhas.
|
||||||
|
if (dtAlarmes.Columns.Count == 0)
|
||||||
|
{
|
||||||
|
dtAlarmes.Columns.Add("clAlarme", "Alarme");
|
||||||
|
dtAlarmes.Columns.Add("clLimite", "Limite");
|
||||||
|
dtAlarmes.Columns.Add("clValor", "Valor");
|
||||||
|
dtAlarmes.Columns.Add("clAlerta", "Alerta");
|
||||||
|
dtAlarmes.Columns[0].Width = 180;
|
||||||
|
dtAlarmes.Columns[1].Width = 70;
|
||||||
|
dtAlarmes.Columns[2].Width = 70;
|
||||||
|
dtAlarmes.Columns[3].AutoSizeMode =
|
||||||
|
DataGridViewAutoSizeColumnMode.AllCells;
|
||||||
|
}
|
||||||
|
|
||||||
dtAlarmes.Rows.Clear();
|
dtAlarmes.Rows.Clear();
|
||||||
dtAlarmes.Columns.Add("clAlarme", "Alarme");
|
|
||||||
dtAlarmes.Columns.Add("clLimite", "Limite");
|
|
||||||
dtAlarmes.Columns.Add("clValor", "Valor");
|
|
||||||
dtAlarmes.Columns.Add("clAlerta", "Alerta");
|
|
||||||
dtAlarmes.Columns[0].Width = 180;
|
|
||||||
dtAlarmes.Columns[1].Width = 70;
|
|
||||||
dtAlarmes.Columns[2].Width = 70;
|
|
||||||
dtAlarmes.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using AForge.Video;
|
using AForge.Video;
|
||||||
using AForge.Video.DirectShow;
|
using AForge.Video.DirectShow;
|
||||||
|
using OrionTardPro.Services;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
@ -8,6 +9,7 @@ using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Management;
|
using System.Management;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
|
@ -15,57 +17,105 @@ namespace OrionTardPro
|
||||||
{
|
{
|
||||||
public partial class frmCamera : Form
|
public partial class frmCamera : Form
|
||||||
{
|
{
|
||||||
|
private readonly SemaphoreSlim _cameraDiscoveryLock =
|
||||||
|
new SemaphoreSlim(1, 1);
|
||||||
|
|
||||||
public frmCamera()
|
public frmCamera()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Compatibilidade com chamadas antigas. O fluxo novo usa a versão
|
||||||
|
// async para não executar WMI na thread da interface.
|
||||||
public void AtualizaListaCameras()
|
public void AtualizaListaCameras()
|
||||||
{
|
{
|
||||||
|
_ = AtualizaListaCamerasAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task AtualizaListaCamerasAsync()
|
||||||
|
{
|
||||||
|
if (!await _cameraDiscoveryLock.WaitAsync(0))
|
||||||
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//Variaveis.videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
|
btnAtualizar.Enabled = false;
|
||||||
|
|
||||||
var cameraNames = new List<string>();
|
long inicioDiscoveryPerf =
|
||||||
var camerasList = new Dictionary<string, string>();
|
PerformanceMonitorService.MarcarInicio();
|
||||||
using (var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PnPEntity WHERE (PNPClass = 'Image' OR PNPClass = 'Camera')"))
|
|
||||||
|
List<string> cameraNames = await Task.Run(() =>
|
||||||
{
|
{
|
||||||
foreach (var device in searcher.Get())
|
var nomes = new List<string>();
|
||||||
|
|
||||||
|
using (var searcher = new ManagementObjectSearcher(
|
||||||
|
"SELECT * FROM Win32_PnPEntity WHERE (PNPClass = 'Image' OR PNPClass = 'Camera')"))
|
||||||
{
|
{
|
||||||
camerasList.Add(device["DeviceID"].ToString(), device["Caption"].ToString());
|
foreach (ManagementObject device in searcher.Get())
|
||||||
cameraNames.Add(device["Caption"].ToString());
|
{
|
||||||
|
string caption = device["Caption"]?.ToString();
|
||||||
|
if (!string.IsNullOrWhiteSpace(caption) &&
|
||||||
|
!nomes.Contains(caption))
|
||||||
|
{
|
||||||
|
nomes.Add(caption);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//cameraNames = camerasList.OrderByDescending(x => x.Key).Select(x => x.Value).ToList();
|
return nomes;
|
||||||
|
});
|
||||||
|
|
||||||
cmbCamera.Items.Clear();
|
cmbCamera.BeginUpdate();
|
||||||
cmbCamera.Items.Add("Sem vídeo");
|
try
|
||||||
if (cameraNames.Count == 0)
|
|
||||||
throw new ApplicationException();
|
|
||||||
|
|
||||||
foreach (string device in cameraNames)
|
|
||||||
{
|
{
|
||||||
cmbCamera.Items.Add(device);
|
cmbCamera.Items.Clear();
|
||||||
|
cmbCamera.Items.Add("Sem vídeo");
|
||||||
|
|
||||||
|
foreach (string device in cameraNames)
|
||||||
|
cmbCamera.Items.Add(device);
|
||||||
|
|
||||||
|
cmbCamera.SelectedIndex = 0;
|
||||||
}
|
}
|
||||||
cmbCamera.SelectedIndex = 0;
|
finally
|
||||||
if (cmbCamera.SelectedIndex > 0)
|
{
|
||||||
VideoService.LigarCamera();
|
cmbCamera.EndUpdate();
|
||||||
else
|
}
|
||||||
LimpaCamera();
|
|
||||||
|
if (cameraNames.Count == 0)
|
||||||
|
{
|
||||||
|
Variaveis.frmPrincipal.lblCameraconexao.Text =
|
||||||
|
"Câmera: Desconectado";
|
||||||
|
}
|
||||||
|
|
||||||
|
PerformanceMonitorService.ReportarSeLento(
|
||||||
|
"frmCamera.DiscoveryWMI",
|
||||||
|
inicioDiscoveryPerf,
|
||||||
|
1200,
|
||||||
|
"devices=" + cameraNames.Count);
|
||||||
|
|
||||||
|
LimpaCamera();
|
||||||
}
|
}
|
||||||
catch (ApplicationException)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine(
|
||||||
|
"[CAMERA] Falha ao enumerar dispositivos: " + ex.Message);
|
||||||
|
|
||||||
cmbCamera.Items.Clear();
|
cmbCamera.Items.Clear();
|
||||||
cmbCamera.Items.Add("Nenhum dispositivo encontrado!");
|
cmbCamera.Items.Add("Nenhum dispositivo encontrado!");
|
||||||
Variaveis.frmPrincipal.lblCameraconexao.Text = "Câmera: Desconectado";
|
cmbCamera.SelectedIndex = 0;
|
||||||
|
Variaveis.frmPrincipal.lblCameraconexao.Text =
|
||||||
|
"Câmera: Desconectado";
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
btnAtualizar.Enabled = true;
|
||||||
|
_cameraDiscoveryLock.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnAtualizar_Click(object sender, EventArgs e)
|
private async void btnAtualizar_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
AtualizaListaCameras();
|
await AtualizaListaCamerasAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnSalvar_Click(object sender, EventArgs e)
|
private void btnSalvar_Click(object sender, EventArgs e)
|
||||||
|
|
@ -93,12 +143,9 @@ namespace OrionTardPro
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Variaveis.frmPrincipal.lblCameraconexao.Text = "Câmera: Desconectado";
|
Variaveis.frmPrincipal.lblCameraconexao.Text = "Câmera: Desconectado";
|
||||||
VideoService.camera.Abort();
|
VideoService.DesligarCamera();
|
||||||
VideoService._videoCapture.Release();
|
|
||||||
VideoService._videoCapture = null;
|
|
||||||
Variaveis.frmPrincipal.gpbImagem.Enabled = false;
|
Variaveis.frmPrincipal.gpbImagem.Enabled = false;
|
||||||
Variaveis.frmPrincipal.gpbGravacao.Enabled = false;
|
Variaveis.frmPrincipal.gpbGravacao.Enabled = false;
|
||||||
Variaveis.VideoIsRuning = false;
|
|
||||||
LimpaCamera();
|
LimpaCamera();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -108,9 +155,12 @@ namespace OrionTardPro
|
||||||
{
|
{
|
||||||
PictureBox img = Variaveis.frmPrincipal.imgCamera;
|
PictureBox img = Variaveis.frmPrincipal.imgCamera;
|
||||||
Bitmap bmp = new Bitmap(img.Width, img.Height);
|
Bitmap bmp = new Bitmap(img.Width, img.Height);
|
||||||
Graphics g = Graphics.FromImage(bmp);
|
using (Graphics g = Graphics.FromImage(bmp))
|
||||||
g.Clear(Color.Black);
|
{
|
||||||
Variaveis.frmPrincipal.imgCamera.Image = bmp;
|
g.Clear(Color.Black);
|
||||||
|
}
|
||||||
|
|
||||||
|
VideoService.ExibirImagemEstatica(bmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void frmCamera_FormClosing(object sender, FormClosingEventArgs e)
|
private void frmCamera_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@
|
||||||
this.lblTempoenvio = new System.Windows.Forms.Label();
|
this.lblTempoenvio = new System.Windows.Forms.Label();
|
||||||
this.chbProtocolocompleto = new System.Windows.Forms.CheckBox();
|
this.chbProtocolocompleto = new System.Windows.Forms.CheckBox();
|
||||||
this.tabTransmissor = new System.Windows.Forms.TabPage();
|
this.tabTransmissor = new System.Windows.Forms.TabPage();
|
||||||
|
this.chbPingCamera = new System.Windows.Forms.CheckBox();
|
||||||
this.chbCamera = new System.Windows.Forms.CheckBox();
|
this.chbCamera = new System.Windows.Forms.CheckBox();
|
||||||
this.lblSegundos = new System.Windows.Forms.Label();
|
this.lblSegundos = new System.Windows.Forms.Label();
|
||||||
this.lblTempoPings = new System.Windows.Forms.Label();
|
this.lblTempoPings = new System.Windows.Forms.Label();
|
||||||
|
|
@ -50,7 +51,6 @@
|
||||||
this.lblEnvios = new System.Windows.Forms.Label();
|
this.lblEnvios = new System.Windows.Forms.Label();
|
||||||
this.txtEnvios = new System.Windows.Forms.NumericUpDown();
|
this.txtEnvios = new System.Windows.Forms.NumericUpDown();
|
||||||
this.btnConectar = new System.Windows.Forms.Button();
|
this.btnConectar = new System.Windows.Forms.Button();
|
||||||
this.chbPingCamera = new System.Windows.Forms.CheckBox();
|
|
||||||
this.tabControl1.SuspendLayout();
|
this.tabControl1.SuspendLayout();
|
||||||
this.tabConexao.SuspendLayout();
|
this.tabConexao.SuspendLayout();
|
||||||
this.tabReceptor.SuspendLayout();
|
this.tabReceptor.SuspendLayout();
|
||||||
|
|
@ -249,6 +249,16 @@
|
||||||
this.tabTransmissor.Text = "Transmissor";
|
this.tabTransmissor.Text = "Transmissor";
|
||||||
this.tabTransmissor.UseVisualStyleBackColor = true;
|
this.tabTransmissor.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
// chbPingCamera
|
||||||
|
//
|
||||||
|
this.chbPingCamera.AutoSize = true;
|
||||||
|
this.chbPingCamera.Location = new System.Drawing.Point(11, 89);
|
||||||
|
this.chbPingCamera.Name = "chbPingCamera";
|
||||||
|
this.chbPingCamera.Size = new System.Drawing.Size(184, 20);
|
||||||
|
this.chbPingCamera.TabIndex = 6;
|
||||||
|
this.chbPingCamera.Text = "Enviar ping para a câmera";
|
||||||
|
this.chbPingCamera.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// chbCamera
|
// chbCamera
|
||||||
//
|
//
|
||||||
this.chbCamera.AutoSize = true;
|
this.chbCamera.AutoSize = true;
|
||||||
|
|
@ -345,16 +355,6 @@
|
||||||
this.btnConectar.UseVisualStyleBackColor = true;
|
this.btnConectar.UseVisualStyleBackColor = true;
|
||||||
this.btnConectar.Click += new System.EventHandler(this.btnConectar_Click);
|
this.btnConectar.Click += new System.EventHandler(this.btnConectar_Click);
|
||||||
//
|
//
|
||||||
// chbPingCamera
|
|
||||||
//
|
|
||||||
this.chbPingCamera.AutoSize = true;
|
|
||||||
this.chbPingCamera.Location = new System.Drawing.Point(11, 89);
|
|
||||||
this.chbPingCamera.Name = "chbPingCamera";
|
|
||||||
this.chbPingCamera.Size = new System.Drawing.Size(184, 20);
|
|
||||||
this.chbPingCamera.TabIndex = 6;
|
|
||||||
this.chbPingCamera.Text = "Enviar ping para a câmera";
|
|
||||||
this.chbPingCamera.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// frmConexao
|
// frmConexao
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||||
|
|
@ -374,6 +374,7 @@
|
||||||
this.Text = "Gerenciador de conexão";
|
this.Text = "Gerenciador de conexão";
|
||||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmConexao_FormClosing);
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmConexao_FormClosing);
|
||||||
this.Load += new System.EventHandler(this.frmConexao_Load);
|
this.Load += new System.EventHandler(this.frmConexao_Load);
|
||||||
|
this.Shown += new System.EventHandler(this.frmConexao_Shown);
|
||||||
this.tabControl1.ResumeLayout(false);
|
this.tabControl1.ResumeLayout(false);
|
||||||
this.tabConexao.ResumeLayout(false);
|
this.tabConexao.ResumeLayout(false);
|
||||||
this.tabConexao.PerformLayout();
|
this.tabConexao.PerformLayout();
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,16 @@
|
||||||
using OrionTardPro.Services;
|
using OrionTardPro.Services;
|
||||||
using System;
|
using System;
|
||||||
using System.IO.Ports;
|
using System.IO.Ports;
|
||||||
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using static OrionTardPro.Enuns;
|
||||||
|
|
||||||
namespace OrionTardPro
|
namespace OrionTardPro
|
||||||
{
|
{
|
||||||
public partial class frmConexao : Form
|
public partial class frmConexao : Form
|
||||||
{
|
{
|
||||||
|
private bool _conectando;
|
||||||
|
|
||||||
public frmConexao()
|
public frmConexao()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
@ -14,70 +18,302 @@ namespace OrionTardPro
|
||||||
|
|
||||||
private void frmConexao_Load(object sender, EventArgs e)
|
private void frmConexao_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//AtualizaListadePortas();
|
AtualizarControlesProtocolo();
|
||||||
|
AtualizaListadePortas(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AtualizaListadePortas()
|
private void frmConexao_Shown(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
cmbPorta.Items.Clear();
|
AtualizarControlesProtocolo();
|
||||||
for (int i = 0; i < SerialPort.GetPortNames().Length; i++)
|
AtualizaListadePortas(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ProtocoloV2Selecionado()
|
||||||
|
{
|
||||||
|
return Variaveis.PerfilVigente.VersaoProtocolo == VersaoProtocolo.v2;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AtualizarControlesProtocolo()
|
||||||
|
{
|
||||||
|
bool protocoloV2 = ProtocoloV2Selecionado();
|
||||||
|
|
||||||
|
// Configuráveis tanto na V1 quanto na V2.
|
||||||
|
txtTempoPings.Enabled = true;
|
||||||
|
txtDelay.Enabled = true;
|
||||||
|
chbRequisitarDados.Enabled = true;
|
||||||
|
chbCamera.Enabled = true;
|
||||||
|
chbPingCamera.Enabled = true;
|
||||||
|
|
||||||
|
if (protocoloV2)
|
||||||
{
|
{
|
||||||
cmbPorta.Items.Add(SerialPort.GetPortNames()[i].ToString());
|
cmbBaud.Text = "9600";
|
||||||
|
cmbBaud.Enabled = false;
|
||||||
|
|
||||||
|
// V2 usa ACK, sequência, timeout e retry próprios.
|
||||||
|
txtEnvios.Enabled = false;
|
||||||
|
|
||||||
|
// Frame completo e CRC são obrigatórios na V2.
|
||||||
|
chbProtocolocompleto.Checked = true;
|
||||||
|
chbProtocolocompleto.Enabled = false;
|
||||||
}
|
}
|
||||||
if (cmbPorta.Items.Count > 1)
|
|
||||||
cmbPorta.SelectedIndex = 1;
|
|
||||||
else if (cmbPorta.Items.Count > 0)
|
|
||||||
cmbPorta.SelectedIndex = 0;
|
|
||||||
else
|
else
|
||||||
throw new Exception("Não foi encontrado um conversor ligado ao computador, favor conferir!");
|
{
|
||||||
int idxBaud = cmbBaud.Items.IndexOf(Variaveis.PerfilVigente.BaudRate.ToString());
|
cmbBaud.Enabled = true;
|
||||||
cmbBaud.SelectedIndex = idxBaud;
|
txtEnvios.Enabled = true;
|
||||||
|
chbProtocolocompleto.Enabled = true;
|
||||||
|
|
||||||
|
cmbBaud.Text =
|
||||||
|
Variaveis.PerfilVigente.BaudRate.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AtualizaListadePortas(bool exibirErro = true)
|
||||||
|
{
|
||||||
|
string portaAnterior = cmbPorta.Text;
|
||||||
|
|
||||||
|
string[] portas = SerialPort
|
||||||
|
.GetPortNames()
|
||||||
|
.OrderBy(x => x)
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
cmbPorta.BeginUpdate();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cmbPorta.Items.Clear();
|
||||||
|
cmbPorta.Items.AddRange(portas);
|
||||||
|
|
||||||
|
if (portas.Length == 0)
|
||||||
|
{
|
||||||
|
cmbPorta.SelectedIndex = -1;
|
||||||
|
|
||||||
|
if (exibirErro)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Não foi encontrada nenhuma porta serial. " +
|
||||||
|
"Confira o conversor USB/RS485 e o driver.",
|
||||||
|
"Porta serial não encontrada",
|
||||||
|
MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int indiceAnterior = Array.IndexOf(portas, portaAnterior);
|
||||||
|
|
||||||
|
cmbPorta.SelectedIndex =
|
||||||
|
indiceAnterior >= 0
|
||||||
|
? indiceAnterior
|
||||||
|
: 0;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
cmbPorta.EndUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool AplicarConfiguracoes()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(cmbPorta.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Selecione uma porta serial.",
|
||||||
|
"Configuração incompleta",
|
||||||
|
MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Warning);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool protocoloV2 = ProtocoloV2Selecionado();
|
||||||
|
|
||||||
|
int tempoPing =
|
||||||
|
Convert.ToInt32(txtTempoPings.Value);
|
||||||
|
|
||||||
|
int tempoTelemetria =
|
||||||
|
Convert.ToInt32(txtDelay.Value);
|
||||||
|
|
||||||
|
if (protocoloV2)
|
||||||
|
{
|
||||||
|
if (tempoPing < 1 || tempoPing > 4)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Na versão V2, o intervalo de heartbeat deve estar " +
|
||||||
|
"entre 1 e 4 segundos.",
|
||||||
|
"Heartbeat inválido",
|
||||||
|
MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Warning);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tempoTelemetria < 250 ||
|
||||||
|
tempoTelemetria > 10000)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Na versão V2, o intervalo de telemetria deve estar " +
|
||||||
|
"entre 250 e 10.000 ms.",
|
||||||
|
"Intervalo inválido",
|
||||||
|
MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Warning);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (tempoPing < 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"O intervalo entre pings deve ser maior que zero.",
|
||||||
|
"Intervalo inválido",
|
||||||
|
MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Warning);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tempoTelemetria < 100)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"O intervalo de sensores deve ser de pelo menos 100 ms.",
|
||||||
|
"Intervalo inválido",
|
||||||
|
MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Warning);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SerialService.PortaCom = cmbPorta.Text.Trim();
|
||||||
|
|
||||||
|
// Configurações compartilhadas entre V1 e V2.
|
||||||
|
Variaveis.PerfilVigente.TempoEntrePings =
|
||||||
|
tempoPing;
|
||||||
|
|
||||||
|
Variaveis.PerfilVigente.TempoRecepcaoSensores =
|
||||||
|
tempoTelemetria;
|
||||||
|
|
||||||
|
Variaveis.PerfilVigente.RequisitarDados =
|
||||||
|
chbRequisitarDados.Checked;
|
||||||
|
|
||||||
|
Variaveis.PerfilVigente.ControleIndividualCamera =
|
||||||
|
chbCamera.Checked;
|
||||||
|
|
||||||
|
Variaveis.PerfilVigente.EnviarPingCamera =
|
||||||
|
chbPingCamera.Checked;
|
||||||
|
|
||||||
|
if (protocoloV2)
|
||||||
|
{
|
||||||
|
Variaveis.PerfilVigente.BaudRate = 9600;
|
||||||
|
|
||||||
|
// Obrigatório na V2.
|
||||||
|
Variaveis.PerfilVigente.ReceberProtocoloCompleto = true;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!int.TryParse(cmbBaud.Text, out int baudRate) ||
|
||||||
|
baudRate <= 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Selecione um baud rate válido.",
|
||||||
|
"Configuração inválida",
|
||||||
|
MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Warning);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Configurações exclusivamente legadas.
|
||||||
|
Variaveis.PerfilVigente.BaudRate = baudRate;
|
||||||
|
|
||||||
|
Variaveis.PerfilVigente.QuantidadeEnvios =
|
||||||
|
Convert.ToInt32(txtEnvios.Value);
|
||||||
|
|
||||||
|
Variaveis.PerfilVigente.ReceberProtocoloCompleto =
|
||||||
|
chbProtocolocompleto.Checked;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void btnConectar_Click(object sender, EventArgs e)
|
private async void btnConectar_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Variaveis.PerfilVigente.QuantidadeEnvios = Convert.ToInt32(txtEnvios.Value);
|
if (_conectando)
|
||||||
Variaveis.PerfilVigente.TempoEntrePings = Convert.ToInt32(txtTempoPings.Value);
|
return;
|
||||||
SerialService.PortaCom = cmbPorta.Text;
|
|
||||||
Variaveis.PerfilVigente.BaudRate = Convert.ToInt32(cmbBaud.Text);
|
|
||||||
Variaveis.PerfilVigente.TempoRecepcaoSensores = Convert.ToInt32(txtDelay.Value);
|
|
||||||
Variaveis.PerfilVigente.RequisitarDados = chbRequisitarDados.Checked;
|
|
||||||
SerialService.SensoresTimer.Interval = Variaveis.PerfilVigente.TempoRecepcaoSensores;
|
|
||||||
|
|
||||||
bool Sucesso = await SerialService.ConectaPortaSerial();
|
if (!AplicarConfiguracoes())
|
||||||
|
return;
|
||||||
|
|
||||||
if (Sucesso)
|
_conectando = true;
|
||||||
|
btnConectar.Enabled = false;
|
||||||
|
//btnCancelar.Enabled = false;
|
||||||
|
UseWaitCursor = true;
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
|
bool sucesso =
|
||||||
|
await SerialService.ConectaPortaSerial();
|
||||||
|
|
||||||
|
if (!sucesso)
|
||||||
|
return;
|
||||||
|
|
||||||
SerialService.Pings = 0;
|
SerialService.Pings = 0;
|
||||||
GeneralJoystick.joystickTimer.Start();
|
|
||||||
SerialService.Conectado = true;
|
/*
|
||||||
this.Hide();
|
* Por enquanto estes timers são iniciados aqui porque
|
||||||
SerialService.SensoresTimer.Interval = Convert.ToInt32(txtDelay.Value);
|
* ConectaPortaSerial ainda não os inicia internamente.
|
||||||
|
*
|
||||||
|
* Não alteramos os intervalos: o SerialService já escolheu
|
||||||
|
* os valores corretos de acordo com V1 ou V2.
|
||||||
|
*/
|
||||||
SerialService.SensoresTimer.Start();
|
SerialService.SensoresTimer.Start();
|
||||||
SerialService.EnvioTimer.Start();
|
SerialService.EnvioTimer.Start();
|
||||||
Variaveis.frmPrincipal.lblCarroconexao.Text = $"Carro: Conectado ({Variaveis._Model.ToString()} | NS {Variaveis._RobotNS} | FV {Variaveis._FirmwareVersion})";
|
|
||||||
|
if (GeneralJoystick.JoystickExist)
|
||||||
|
GeneralJoystick.joystickTimer?.Start();
|
||||||
|
|
||||||
|
Hide();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Não foi possível concluir a conexão.\r\n\r\n" +
|
||||||
|
ex.Message,
|
||||||
|
"Erro de conexão",
|
||||||
|
MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_conectando = false;
|
||||||
|
btnConectar.Enabled = true;
|
||||||
|
//btnCancelar.Enabled = true;
|
||||||
|
UseWaitCursor = false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
MessageBox.Show("Houve um erro ao tentar conectar-se à prota " + SerialService.PortaCom + ".", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnCancelar_Click(object sender, EventArgs e)
|
private void btnCancelar_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
AtualizaListadePortas();
|
||||||
{
|
|
||||||
AtualizaListadePortas();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Erro ao listar dispositivos", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void frmConexao_FormClosing(object sender, FormClosingEventArgs e)
|
private void frmConexao_FormClosing(
|
||||||
|
object sender,
|
||||||
|
FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
Variaveis.PerfilVigente.QuantidadeEnvios = Convert.ToInt32(txtEnvios.Value);
|
/*
|
||||||
Variaveis.PerfilVigente.TempoEntrePings = Convert.ToInt32(txtTempoPings.Value);
|
* Este formulário é reutilizado durante toda a execução.
|
||||||
Variaveis.PerfilVigente.TempoRecepcaoSensores = Convert.ToInt32(txtDelay.Value);
|
* O fechamento real ocorrerá junto com o encerramento da aplicação.
|
||||||
|
*/
|
||||||
|
if (e.CloseReason == CloseReason.UserClosing)
|
||||||
|
{
|
||||||
|
e.Cancel = true;
|
||||||
|
Hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -46,10 +46,18 @@ namespace OrionTardPro
|
||||||
|
|
||||||
#region EVENTOS DOS BOTOES
|
#region EVENTOS DOS BOTOES
|
||||||
|
|
||||||
private void btnAtualizar_Click(object sender, EventArgs e)
|
private async void btnAtualizar_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
GeneralJoystick.InstanciaJoystick();
|
btnAtualizar.Enabled = false;
|
||||||
AtualizaLista();
|
try
|
||||||
|
{
|
||||||
|
await GeneralJoystick.InstanciaJoystickAsync();
|
||||||
|
AtualizaLista();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
btnAtualizar.Enabled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void btnOK_Click(object sender, EventArgs e)
|
public void btnOK_Click(object sender, EventArgs e)
|
||||||
|
|
@ -74,15 +82,28 @@ namespace OrionTardPro
|
||||||
((Button)sender).ForeColor = Color.DarkRed;
|
((Button)sender).ForeColor = Color.DarkRed;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnEscolher_Click(object sender, EventArgs e)
|
private async void btnEscolher_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!cmbJoysticks.Enabled)
|
if (!cmbJoysticks.Enabled)
|
||||||
|
{
|
||||||
btnEscolher.Text = "Salvar";
|
btnEscolher.Text = "Salvar";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
btnEscolher.Text = "Editar";
|
btnEscolher.Enabled = false;
|
||||||
GeneralJoystick.InstanciaJoystick(false, cmbJoysticks.SelectedIndex);
|
try
|
||||||
|
{
|
||||||
|
await GeneralJoystick.InstanciaJoystickAsync(
|
||||||
|
false,
|
||||||
|
cmbJoysticks.SelectedIndex);
|
||||||
|
btnEscolher.Text = "Editar";
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
btnEscolher.Enabled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
btnAtualizar.Enabled = !btnAtualizar.Enabled;
|
btnAtualizar.Enabled = !btnAtualizar.Enabled;
|
||||||
cmbJoysticks.Enabled = !cmbJoysticks.Enabled;
|
cmbJoysticks.Enabled = !cmbJoysticks.Enabled;
|
||||||
}
|
}
|
||||||
|
|
@ -280,7 +301,7 @@ namespace OrionTardPro
|
||||||
private void trkVelocidade_Scroll(object sender, EventArgs e)
|
private void trkVelocidade_Scroll(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Variaveis.frmPrincipal.trkVelocidade.Value = trkVelocidade.Value;
|
Variaveis.frmPrincipal.trkVelocidade.Value = trkVelocidade.Value;
|
||||||
GeneralJoystick.AtualizaPotenciaAtual(trkVelocidade.Value * 10);
|
GeneralJoystick.AtualizaPotenciaAtual(trkVelocidade.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,7 @@
|
||||||
using OrionTardPro.Services;
|
using OrionTardPro.Services;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.Runtime.InteropServices;
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using static OrionTardPro.Enuns;
|
using static OrionTardPro.Enuns;
|
||||||
|
|
||||||
|
|
@ -15,114 +10,490 @@ namespace OrionTardPro
|
||||||
{
|
{
|
||||||
public partial class frmControlecarro : Form
|
public partial class frmControlecarro : Form
|
||||||
{
|
{
|
||||||
|
private readonly HashSet<Keys> _teclasPressionadas =
|
||||||
|
new HashSet<Keys>();
|
||||||
|
|
||||||
|
private bool _processandoFechamento;
|
||||||
|
private readonly System.Windows.Forms.Timer _supervisorTecladoTimer;
|
||||||
|
private const int IntervaloSupervisorTecladoMs = 50;
|
||||||
|
|
||||||
|
// GetAsyncKeyState consulta o estado físico atual da tecla e não depende de o
|
||||||
|
// Windows ter entregado o KeyUp ao formulário. O bit alto indica pressionada.
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern short GetAsyncKeyState(int vKey);
|
||||||
|
|
||||||
|
private static bool TeclaFisicamentePressionada(Keys tecla)
|
||||||
|
{
|
||||||
|
return (GetAsyncKeyState((int)tecla) & 0x8000) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
public frmControlecarro()
|
public frmControlecarro()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
// Permite ao form receber teclas antes dos controles filhos.
|
||||||
|
KeyPreview = true;
|
||||||
|
|
||||||
|
Deactivate += frmControlecarro_Deactivate;
|
||||||
|
VisibleChanged += frmControlecarro_VisibleChanged;
|
||||||
|
FormClosed += frmControlecarro_FormClosed;
|
||||||
|
|
||||||
|
_supervisorTecladoTimer = new System.Windows.Forms.Timer
|
||||||
|
{
|
||||||
|
Interval = IntervaloSupervisorTecladoMs
|
||||||
|
};
|
||||||
|
_supervisorTecladoTimer.Tick += SupervisorTecladoTimer_Tick;
|
||||||
|
_supervisorTecladoTimer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void frmControlecarro_KeyDown(object sender, KeyEventArgs e)
|
public void frmControlecarro_KeyDown(
|
||||||
|
object sender,
|
||||||
|
KeyEventArgs e)
|
||||||
{
|
{
|
||||||
var ListaTeclasPressionadas = GeneralJoystick.ListaTeclasPressionadas;
|
Comando comando =
|
||||||
|
GeneralJoystick.TipoControle(e.KeyCode);
|
||||||
|
|
||||||
switch (GeneralJoystick.TipoControle(e.KeyCode))
|
if (comando == Comando.Vazio)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add retorna false quando a tecla já estava pressionada.
|
||||||
|
* Isso bloqueia o auto-repeat do Windows para relés,
|
||||||
|
* câmeras, iluminação e outros comandos de alternância.
|
||||||
|
*
|
||||||
|
* Na V2, a renovação de MOT é feita pelo supervisor do
|
||||||
|
* GeneralJoystick, não por KeyDown repetido.
|
||||||
|
*/
|
||||||
|
if (!_teclasPressionadas.Add(e.KeyCode))
|
||||||
|
{
|
||||||
|
e.Handled = true;
|
||||||
|
e.SuppressKeyPress = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
e.Handled = true;
|
||||||
|
e.SuppressKeyPress = true;
|
||||||
|
|
||||||
|
switch (comando)
|
||||||
{
|
{
|
||||||
case Comando.Motor:
|
case Comando.Motor:
|
||||||
if (ListaTeclasPressionadas[ListaTeclasPressionadas.Count - 1] != e.KeyCode.ToString())
|
AtualizarIntencaoMotores();
|
||||||
{
|
break;
|
||||||
if (ListaTeclasPressionadas[ListaTeclasPressionadas.Count - 1] == "Stop")
|
|
||||||
ListaTeclasPressionadas.Clear();
|
|
||||||
|
|
||||||
ListaTeclasPressionadas.Add(e.KeyCode.ToString());
|
|
||||||
GeneralJoystick.ProcessaComandoCarro(e.KeyCode.ToString());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Comando.Camera:
|
case Comando.Camera:
|
||||||
GeneralJoystick.ProcessaComandoCamera(e.KeyCode);
|
AtualizarIntencaoCamera();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Comando.Iluminacao:
|
case Comando.Iluminacao:
|
||||||
GeneralJoystick.AlternarStatusIluminacao();
|
GeneralJoystick.AlternarStatusIluminacao();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Comando.Laser:
|
case Comando.Laser:
|
||||||
GeneralJoystick.AlternarStatusLaser();
|
GeneralJoystick.AlternarStatusLaser();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Comando.BrilhoMais:
|
case Comando.BrilhoMais:
|
||||||
GeneralJoystick.AumentarIntensidadeBrilhoLED();
|
GeneralJoystick
|
||||||
|
.AumentarIntensidadeBrilhoLED();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Comando.BrilhoMenos:
|
case Comando.BrilhoMenos:
|
||||||
GeneralJoystick.ReduzirIntensidadeBrilhoLED();
|
GeneralJoystick
|
||||||
|
.ReduzirIntensidadeBrilhoLED();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Comando.Embreagem:
|
case Comando.Embreagem:
|
||||||
GeneralJoystick.AlternarStatusEmbreagem();
|
GeneralJoystick.AlternarStatusEmbreagem();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Comando.MudaCamera:
|
case Comando.MudaCamera:
|
||||||
GeneralJoystick.AlternarCamera();
|
GeneralJoystick.AlternarCamera();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Comando.CaputrarImagem:
|
case Comando.CaputrarImagem:
|
||||||
GeneralJoystick.EditarImagem();
|
GeneralJoystick.EditarImagem();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Comando.Marcador:
|
case Comando.Marcador:
|
||||||
GeneralJoystick.AdicionarMarcador();
|
GeneralJoystick.AdicionarMarcador();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Comando.IniciaOdometroParcial:
|
case Comando.IniciaOdometroParcial:
|
||||||
GeneralJoystick.IniciarOdometroParcial();
|
GeneralJoystick.IniciarOdometroParcial();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Comando.ReleGeral:
|
case Comando.ReleGeral:
|
||||||
GeneralJoystick.AlternarStatusReleGeral();
|
GeneralJoystick.AlternarStatusReleGeral();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Comando.MedidorEspessura:
|
case Comando.MedidorEspessura:
|
||||||
bool carimbar = e.KeyCode == Keys.Q;
|
ProcessarMedidorEspessura(e.KeyCode);
|
||||||
if (!carimbar)
|
|
||||||
{
|
|
||||||
Variaveis.frmPrincipal.trkMedidorEspessura.Value = Variaveis.Angulo_MedidorEspessuraVertical == 0 ? Variaveis.PerfilVigente.AnguloMedicaoIdeal : 0;
|
|
||||||
GeneralJoystick.AtualizaAnguloMedidorEspessura(Variaveis.frmPrincipal.trkMedidorEspessura.Value);
|
|
||||||
}
|
|
||||||
GeneralJoystick.AlternarAnguloMedidorEspessura(carimbar);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void frmControlecarro_KeyUp(object sender, KeyEventArgs e)
|
private void frmControlecarro_KeyUp(
|
||||||
|
object sender,
|
||||||
|
KeyEventArgs e)
|
||||||
{
|
{
|
||||||
var ListaTeclasPressionadas = GeneralJoystick.ListaTeclasPressionadas;
|
Comando comando =
|
||||||
|
GeneralJoystick.TipoControle(e.KeyCode);
|
||||||
|
|
||||||
switch (GeneralJoystick.TipoControle(e.KeyCode))
|
if (comando == Comando.Vazio)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_teclasPressionadas.Remove(e.KeyCode);
|
||||||
|
|
||||||
|
e.Handled = true;
|
||||||
|
e.SuppressKeyPress = true;
|
||||||
|
|
||||||
|
switch (comando)
|
||||||
{
|
{
|
||||||
case Comando.Motor:
|
case Comando.Motor:
|
||||||
if (ListaTeclasPressionadas.Count == 1)
|
/*
|
||||||
{
|
* Se ainda houver uma seta pressionada, recalcula
|
||||||
ListaTeclasPressionadas[0] = "Stop";
|
* a direção. Caso contrário, envia parada.
|
||||||
GeneralJoystick.ProcessaComandoCarro("Stop");
|
*/
|
||||||
}
|
AtualizarIntencaoMotores();
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int i = 0; i < ListaTeclasPressionadas.Count; i++)
|
|
||||||
{
|
|
||||||
if (ListaTeclasPressionadas[i] == e.KeyCode.ToString())
|
|
||||||
{
|
|
||||||
ListaTeclasPressionadas.RemoveAt(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
GeneralJoystick.ProcessaComandoCarro(ListaTeclasPressionadas[0]);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Comando.Camera:
|
case Comando.Camera:
|
||||||
GeneralJoystick.ProcessaComandoCamera(Keys.Escape);
|
// Recalcula os dois eixos. Soltar D em W+D para apenas o
|
||||||
|
// horizontal, mantendo W ativo.
|
||||||
|
AtualizarIntencaoCamera();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void frmControlecarro_FormClosing(object sender, FormClosingEventArgs e)
|
private void AtualizarIntencaoMotores()
|
||||||
{
|
{
|
||||||
if(!Variaveis.frmPrincipal.FechandoControle)
|
bool cima =
|
||||||
|
_teclasPressionadas.Contains(Keys.Up);
|
||||||
|
|
||||||
|
bool baixo =
|
||||||
|
_teclasPressionadas.Contains(Keys.Down);
|
||||||
|
|
||||||
|
bool esquerda =
|
||||||
|
_teclasPressionadas.Contains(Keys.Left);
|
||||||
|
|
||||||
|
bool direita =
|
||||||
|
_teclasPressionadas.Contains(Keys.Right);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Teclas opostas se anulam. Isso impede comandos
|
||||||
|
* ambíguos como Up + Down.
|
||||||
|
*/
|
||||||
|
int eixoVertical =
|
||||||
|
(cima ? 1 : 0) -
|
||||||
|
(baixo ? 1 : 0);
|
||||||
|
|
||||||
|
int eixoHorizontal =
|
||||||
|
(direita ? 1 : 0) -
|
||||||
|
(esquerda ? 1 : 0);
|
||||||
|
|
||||||
|
List<string> listaCompatibilidade =
|
||||||
|
GeneralJoystick.ListaTeclasPressionadas;
|
||||||
|
|
||||||
|
listaCompatibilidade.Clear();
|
||||||
|
|
||||||
|
if (eixoVertical == 0 &&
|
||||||
|
eixoHorizontal == 0)
|
||||||
{
|
{
|
||||||
Variaveis.frmPrincipal.FechandoControle = true;
|
listaCompatibilidade.Add("Stop");
|
||||||
Variaveis.frmPrincipal.FecharControleAnalogico();
|
|
||||||
|
GeneralJoystick.ProcessaComandoCarro(
|
||||||
|
"Stop");
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
e.Cancel = true;
|
|
||||||
this.Hide();
|
/*
|
||||||
|
* O GeneralJoystick atual monta diagonais consultando
|
||||||
|
* a primeira tecla da lista. Por isso colocamos primeiro
|
||||||
|
* a direção horizontal e processamos a vertical.
|
||||||
|
*/
|
||||||
|
if (eixoHorizontal < 0 &&
|
||||||
|
eixoVertical > 0)
|
||||||
|
{
|
||||||
|
listaCompatibilidade.Add("Left");
|
||||||
|
listaCompatibilidade.Add("Up");
|
||||||
|
|
||||||
|
GeneralJoystick.ProcessaComandoCarro("Up");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eixoHorizontal > 0 &&
|
||||||
|
eixoVertical > 0)
|
||||||
|
{
|
||||||
|
listaCompatibilidade.Add("Right");
|
||||||
|
listaCompatibilidade.Add("Up");
|
||||||
|
|
||||||
|
GeneralJoystick.ProcessaComandoCarro("Up");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eixoHorizontal < 0 &&
|
||||||
|
eixoVertical < 0)
|
||||||
|
{
|
||||||
|
listaCompatibilidade.Add("Left");
|
||||||
|
listaCompatibilidade.Add("Down");
|
||||||
|
|
||||||
|
GeneralJoystick.ProcessaComandoCarro("Down");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eixoHorizontal > 0 &&
|
||||||
|
eixoVertical < 0)
|
||||||
|
{
|
||||||
|
listaCompatibilidade.Add("Right");
|
||||||
|
listaCompatibilidade.Add("Down");
|
||||||
|
|
||||||
|
GeneralJoystick.ProcessaComandoCarro("Down");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eixoVertical > 0)
|
||||||
|
{
|
||||||
|
listaCompatibilidade.Add("Up");
|
||||||
|
GeneralJoystick.ProcessaComandoCarro("Up");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eixoVertical < 0)
|
||||||
|
{
|
||||||
|
listaCompatibilidade.Add("Down");
|
||||||
|
GeneralJoystick.ProcessaComandoCarro("Down");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eixoHorizontal < 0)
|
||||||
|
{
|
||||||
|
listaCompatibilidade.Add("Left");
|
||||||
|
GeneralJoystick.ProcessaComandoCarro("Left");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
listaCompatibilidade.Add("Right");
|
||||||
|
GeneralJoystick.ProcessaComandoCarro("Right");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AtualizarIntencaoCamera()
|
||||||
|
{
|
||||||
|
bool cima = _teclasPressionadas.Contains(Keys.W);
|
||||||
|
bool baixo = _teclasPressionadas.Contains(Keys.S);
|
||||||
|
bool esquerda = _teclasPressionadas.Contains(Keys.A);
|
||||||
|
bool direita = _teclasPressionadas.Contains(Keys.D);
|
||||||
|
|
||||||
|
// O GeneralJoystick também anula pares opostos, mas fazemos isso aqui
|
||||||
|
// explicitamente para o estado do formulário representar a intenção real.
|
||||||
|
if (cima && baixo)
|
||||||
|
cima = baixo = false;
|
||||||
|
|
||||||
|
if (esquerda && direita)
|
||||||
|
esquerda = direita = false;
|
||||||
|
|
||||||
|
GeneralJoystick.AtualizarEstadoCameraTeclado(
|
||||||
|
cima, baixo, esquerda, direita);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SupervisorTecladoTimer_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// Movimento por teclado só é válido enquanto esta tela estiver visível e
|
||||||
|
// possuir foco (diretamente ou por um controle filho).
|
||||||
|
if (!Visible || !ContainsFocus)
|
||||||
|
{
|
||||||
|
if (ExisteTeclaMovimentoPressionada() ||
|
||||||
|
ExisteTeclaCameraPressionada() ||
|
||||||
|
GeneralJoystick.UltimaDirecao != Direcao.Parado ||
|
||||||
|
GeneralJoystick.CameraEmMovimento)
|
||||||
|
{
|
||||||
|
LiberarTodosOsControles("supervisor detectou perda de foco");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool mudouMotor = false;
|
||||||
|
bool mudouCamera = false;
|
||||||
|
|
||||||
|
SincronizarTeclaFisica(Keys.Up, Comando.Motor, ref mudouMotor, ref mudouCamera);
|
||||||
|
SincronizarTeclaFisica(Keys.Down, Comando.Motor, ref mudouMotor, ref mudouCamera);
|
||||||
|
SincronizarTeclaFisica(Keys.Left, Comando.Motor, ref mudouMotor, ref mudouCamera);
|
||||||
|
SincronizarTeclaFisica(Keys.Right, Comando.Motor, ref mudouMotor, ref mudouCamera);
|
||||||
|
|
||||||
|
SincronizarTeclaFisica(Keys.W, Comando.Camera, ref mudouMotor, ref mudouCamera);
|
||||||
|
SincronizarTeclaFisica(Keys.S, Comando.Camera, ref mudouMotor, ref mudouCamera);
|
||||||
|
SincronizarTeclaFisica(Keys.A, Comando.Camera, ref mudouMotor, ref mudouCamera);
|
||||||
|
SincronizarTeclaFisica(Keys.D, Comando.Camera, ref mudouMotor, ref mudouCamera);
|
||||||
|
|
||||||
|
if (mudouMotor)
|
||||||
|
AtualizarIntencaoMotores();
|
||||||
|
|
||||||
|
if (mudouCamera)
|
||||||
|
AtualizarIntencaoCamera();
|
||||||
|
|
||||||
|
if (ExisteTeclaMovimentoPressionada())
|
||||||
|
GeneralJoystick.RenovarHeartbeatTecladoMovimento();
|
||||||
|
|
||||||
|
if (ExisteTeclaCameraPressionada())
|
||||||
|
GeneralJoystick.RenovarHeartbeatTecladoCamera();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SincronizarTeclaFisica(
|
||||||
|
Keys tecla,
|
||||||
|
Comando comando,
|
||||||
|
ref bool mudouMotor,
|
||||||
|
ref bool mudouCamera)
|
||||||
|
{
|
||||||
|
bool fisicamentePressionada = TeclaFisicamentePressionada(tecla);
|
||||||
|
bool registrada = _teclasPressionadas.Contains(tecla);
|
||||||
|
|
||||||
|
if (fisicamentePressionada == registrada)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (fisicamentePressionada)
|
||||||
|
_teclasPressionadas.Add(tecla);
|
||||||
|
else
|
||||||
|
_teclasPressionadas.Remove(tecla);
|
||||||
|
|
||||||
|
if (comando == Comando.Motor)
|
||||||
|
mudouMotor = true;
|
||||||
|
else if (comando == Comando.Camera)
|
||||||
|
mudouCamera = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ExisteTeclaMovimentoPressionada()
|
||||||
|
{
|
||||||
|
return _teclasPressionadas.Contains(Keys.Up) ||
|
||||||
|
_teclasPressionadas.Contains(Keys.Down) ||
|
||||||
|
_teclasPressionadas.Contains(Keys.Left) ||
|
||||||
|
_teclasPressionadas.Contains(Keys.Right);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ExisteTeclaCameraPressionada()
|
||||||
|
{
|
||||||
|
foreach (Keys tecla in _teclasPressionadas)
|
||||||
|
{
|
||||||
|
if (GeneralJoystick.TipoControle(tecla) ==
|
||||||
|
Comando.Camera)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessarMedidorEspessura(Keys tecla)
|
||||||
|
{
|
||||||
|
bool carimbar = tecla == Keys.Q;
|
||||||
|
|
||||||
|
if (!carimbar)
|
||||||
|
{
|
||||||
|
int angulo =
|
||||||
|
Variaveis.Angulo_MedidorEspessuraVertical == 0
|
||||||
|
? Variaveis.PerfilVigente.AnguloMedicaoIdeal
|
||||||
|
: 0;
|
||||||
|
|
||||||
|
Variaveis.frmPrincipal
|
||||||
|
.trkMedidorEspessura.Value = angulo;
|
||||||
|
|
||||||
|
GeneralJoystick
|
||||||
|
.AtualizaAnguloMedidorEspessura(angulo);
|
||||||
|
}
|
||||||
|
|
||||||
|
GeneralJoystick
|
||||||
|
.AlternarAnguloMedidorEspessura(carimbar);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LiberarTodosOsControles(string motivo)
|
||||||
|
{
|
||||||
|
bool haviaMovimento =
|
||||||
|
ExisteTeclaMovimentoPressionada() ||
|
||||||
|
GeneralJoystick.UltimaDirecao != Direcao.Parado;
|
||||||
|
|
||||||
|
bool haviaCamera =
|
||||||
|
ExisteTeclaCameraPressionada() ||
|
||||||
|
GeneralJoystick.CameraEmMovimento;
|
||||||
|
|
||||||
|
_teclasPressionadas.Clear();
|
||||||
|
|
||||||
|
GeneralJoystick.ListaTeclasPressionadas.Clear();
|
||||||
|
GeneralJoystick.ListaTeclasPressionadas.Add("Stop");
|
||||||
|
|
||||||
|
if (haviaMovimento)
|
||||||
|
{
|
||||||
|
GeneralJoystick.ParadaSegura(motivo);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (haviaCamera)
|
||||||
|
{
|
||||||
|
GeneralJoystick.PararCameraSegura(motivo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void frmControlecarro_Deactivate(
|
||||||
|
object sender,
|
||||||
|
EventArgs e)
|
||||||
|
{
|
||||||
|
LiberarTodosOsControles(
|
||||||
|
"tela de controle perdeu o foco");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void frmControlecarro_VisibleChanged(
|
||||||
|
object sender,
|
||||||
|
EventArgs e)
|
||||||
|
{
|
||||||
|
if (!Visible)
|
||||||
|
{
|
||||||
|
LiberarTodosOsControles(
|
||||||
|
"tela de controle ocultada");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void frmControlecarro_FormClosed(object sender, FormClosedEventArgs e)
|
||||||
|
{
|
||||||
|
_supervisorTecladoTimer?.Stop();
|
||||||
|
_supervisorTecladoTimer?.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void frmControlecarro_FormClosing(
|
||||||
|
object sender,
|
||||||
|
FormClosingEventArgs e)
|
||||||
|
{
|
||||||
|
LiberarTodosOsControles(
|
||||||
|
"fechamento da tela de controle");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Durante o encerramento da aplicação precisamos permitir
|
||||||
|
* que o formulário seja realmente destruído.
|
||||||
|
*/
|
||||||
|
if (e.CloseReason !=
|
||||||
|
CloseReason.UserClosing)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_processandoFechamento &&
|
||||||
|
!Variaveis.frmPrincipal.FechandoControle)
|
||||||
|
{
|
||||||
|
_processandoFechamento = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Variaveis.frmPrincipal.FechandoControle =
|
||||||
|
true;
|
||||||
|
|
||||||
|
Variaveis.frmPrincipal
|
||||||
|
.FecharControleAnalogico();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_processandoFechamento = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
e.Cancel = true;
|
||||||
|
Hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -75,19 +75,27 @@ namespace OrionTardPro
|
||||||
SerialService.Inicializar();
|
SerialService.Inicializar();
|
||||||
GeneralJoystick.Inicializar();
|
GeneralJoystick.Inicializar();
|
||||||
Variaveis.CarregarDadosEmpresa();
|
Variaveis.CarregarDadosEmpresa();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Variaveis.CarregarPerfil();
|
Variaveis.CarregarPerfil();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
Variaveis.SetVariaveisGerais(true);
|
Variaveis.SetVariaveisGerais(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Variaveis.frmControle.ConfiguraJoystick();
|
Variaveis.frmControle.ConfiguraJoystick();
|
||||||
|
|
||||||
//Variaveis.frmPrincipal = new frmPrincipal();
|
Variaveis.frmPrincipal.FormClosed += FrmPrincipal_FormClosed;
|
||||||
Variaveis.frmPrincipal.Show();
|
Variaveis.frmPrincipal.Show(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FrmPrincipal_FormClosed(object sender, FormClosedEventArgs e)
|
||||||
|
{
|
||||||
|
GeneralJoystick.ParadaSegura("encerramento da aplicação");
|
||||||
|
|
||||||
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,12 @@ namespace OrionTardPro
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void frmLicenca_Load(object sender, EventArgs e)
|
private async void frmLicenca_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//Console.WriteLine(GenerateSerialKey("425.855.768-41", "31032021"));
|
// A validação local é imediata; qualquer consulta de rede usa await
|
||||||
if (CheckLicense())
|
// e nunca bloqueia a message pump do WinForms.
|
||||||
this.Close();
|
if (await CheckLicenseAsync())
|
||||||
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void frmLicenca_FormClosing(object sender, FormClosingEventArgs e)
|
private void frmLicenca_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
|
|
@ -54,7 +55,7 @@ namespace OrionTardPro
|
||||||
}
|
}
|
||||||
|
|
||||||
VersionamentoService.ForcarDownloadArquivos = true;
|
VersionamentoService.ForcarDownloadArquivos = true;
|
||||||
VersionamentoService.AtualizarArquivoVersionamento(true).ConfigureAwait(false);
|
_ = VersionamentoService.AtualizarArquivoVersionamento(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -65,15 +66,29 @@ namespace OrionTardPro
|
||||||
Cancelar();
|
Cancelar();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnValidar_Click(object sender, EventArgs e)
|
private async void btnValidar_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (txtChave.Text == "")
|
if (txtChave.Text == "")
|
||||||
{
|
{
|
||||||
MessageBox.Show("Digite os dados do registro corretamente!", "Dados inválidos", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(
|
||||||
|
"Digite os dados do registro corretamente!",
|
||||||
|
"Dados inválidos",
|
||||||
|
MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Verify(true))
|
|
||||||
|
btnValidar.Enabled = false;
|
||||||
|
UseWaitCursor = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await VerifyAsync(true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
btnValidar.Enabled = true;
|
btnValidar.Enabled = true;
|
||||||
|
UseWaitCursor = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -90,88 +105,74 @@ namespace OrionTardPro
|
||||||
return Sair;
|
return Sair;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CheckLicense()
|
private async Task<bool> CheckLicenseAsync()
|
||||||
{
|
{
|
||||||
bool isLicensed = false;
|
|
||||||
|
|
||||||
if (File.Exists(VariaveisGerais.CaminhoArquivoData))
|
if (File.Exists(VariaveisGerais.CaminhoArquivoData))
|
||||||
{
|
{
|
||||||
string[] DateConfig = File.ReadAllLines(VariaveisGerais.CaminhoArquivoData, Encoding.UTF8);
|
string[] dateConfig = File.ReadAllLines(
|
||||||
DataInstalacao = DateConfig[1].Split(';')[1];
|
VariaveisGerais.CaminhoArquivoData,
|
||||||
|
Encoding.UTF8);
|
||||||
|
|
||||||
|
if (dateConfig.Length > 1 && dateConfig[1].Contains(";"))
|
||||||
|
DataInstalacao = dateConfig[1].Split(';')[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (!File.Exists("C:\\Windows\\config_key.cnf"))
|
if (!File.Exists(VariaveisGerais.CaminhoArquivoLicenca))
|
||||||
{
|
return false;
|
||||||
NomeCliente = "Versão de avaliação";
|
|
||||||
CPFCliente = "132.658.664-33";
|
|
||||||
ValidadeChave = DateTime.Now.AddDays(30).ToString();
|
|
||||||
ValidadeChave = ValidadeChave.Substring(0, 10);
|
|
||||||
ValidadeChave = ValidadeChave[0].ToString() +
|
|
||||||
ValidadeChave[1].ToString() +
|
|
||||||
ValidadeChave[3].ToString() +
|
|
||||||
ValidadeChave[4].ToString() +
|
|
||||||
ValidadeChave[6].ToString() +
|
|
||||||
ValidadeChave[7].ToString() +
|
|
||||||
ValidadeChave[8].ToString() +
|
|
||||||
ValidadeChave[9].ToString();
|
|
||||||
SerialKey = GenerateSerialKey(CPFCliente, ValidadeChave);
|
|
||||||
ValidadeChave = ValidadeChave[0].ToString() + ValidadeChave[1].ToString() + "-" +
|
|
||||||
ValidadeChave[2].ToString() + ValidadeChave[3].ToString() + "-" +
|
|
||||||
ValidadeChave[4].ToString() + ValidadeChave[5].ToString() + ValidadeChave[6].ToString() + ValidadeChave[7].ToString();
|
|
||||||
WriteConfigFile();
|
|
||||||
MessageBox.Show("Licença gratuita por 30 dias", "Licensa gratuita", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
|
||||||
Licensed = true;
|
|
||||||
this.Close();
|
|
||||||
isLicensed = true;
|
|
||||||
SetVariables();
|
|
||||||
return isLicensed;
|
|
||||||
}*/
|
|
||||||
if (File.Exists(VariaveisGerais.CaminhoArquivoLicenca))
|
|
||||||
{
|
|
||||||
FileExists = true;
|
|
||||||
string[] Config = File.ReadAllLines(VariaveisGerais.CaminhoArquivoLicenca, Encoding.UTF8);
|
|
||||||
txtLicenciadopara.Text = Config[1].Split(';')[1];
|
|
||||||
txtCNPJ.Text = Config[2].Split(';')[1];
|
|
||||||
txtChave.Text = Config[3].Split(';')[1];
|
|
||||||
txtExpira.Text = Config[4].Split(';')[1];
|
|
||||||
Verify(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return isLicensed;
|
FileExists = true;
|
||||||
|
string[] config = File.ReadAllLines(
|
||||||
|
VariaveisGerais.CaminhoArquivoLicenca,
|
||||||
|
Encoding.UTF8);
|
||||||
|
|
||||||
|
if (config.Length < 5)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
txtLicenciadopara.Text = config[1].Split(';')[1];
|
||||||
|
txtCNPJ.Text = config[2].Split(';')[1];
|
||||||
|
txtChave.Text = config[3].Split(';')[1];
|
||||||
|
txtExpira.Text = config[4].Split(';')[1];
|
||||||
|
|
||||||
|
return await VerifyAsync(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool Verify(bool MakeRequest)
|
private async Task<bool> VerifyAsync(bool MakeRequest)
|
||||||
{
|
{
|
||||||
bool LicenseIsOk = false;
|
bool LicenseIsOk = false;
|
||||||
|
|
||||||
string ChaveAcesso = txtChave.Text;
|
string ChaveAcesso = txtChave.Text;
|
||||||
string CPF = txtCNPJ.Text;
|
string CPF = txtCNPJ.Text;
|
||||||
string Validade = txtExpira.Text;
|
|
||||||
|
|
||||||
if (MakeRequest && HttpService.ServerUp)
|
if (MakeRequest && await HttpService.ServerUpAsync())
|
||||||
{
|
{
|
||||||
var Response = httpService.ValidaLicenca(ChaveAcesso);
|
HttpService.LicencaResponse response =
|
||||||
|
await httpService.ValidaLicencaAsync(ChaveAcesso);
|
||||||
|
|
||||||
if (Response == null || !Response.response.Any())
|
if (response == null ||
|
||||||
|
response.response == null ||
|
||||||
|
!response.response.Any())
|
||||||
{
|
{
|
||||||
MessageBox.Show("Chave de acesso não encontrada ou já ativada em outra máquina!", "Inválido", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
MessageBox.Show(
|
||||||
|
"Chave de acesso não encontrada ou já ativada em outra máquina!",
|
||||||
|
"Inválido",
|
||||||
|
MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Warning);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Variaveis.licencaModel.Nome = Response.response.FirstOrDefault().Nome;
|
LicencaModel licenca = response.response.First();
|
||||||
txtLicenciadopara.Text = Variaveis.licencaModel.Nome;
|
Variaveis.licencaModel.Nome = licenca.Nome;
|
||||||
Variaveis.licencaModel.CPF = Response.response.FirstOrDefault().CPF;
|
txtLicenciadopara.Text = licenca.Nome;
|
||||||
Variaveis.licencaModel.Usada = Response.response.FirstOrDefault().Usada;
|
Variaveis.licencaModel.CPF = licenca.CPF;
|
||||||
Variaveis.licencaModel.IDSistema = Response.response.FirstOrDefault().IDSistema;
|
Variaveis.licencaModel.Usada = licenca.Usada;
|
||||||
|
Variaveis.licencaModel.IDSistema = licenca.IDSistema;
|
||||||
}
|
}
|
||||||
|
|
||||||
string CPFChave = GetCPFofKey(ChaveAcesso);
|
string CPFChave = DecryptText(GetCPFofKey(ChaveAcesso));
|
||||||
CPFChave = DecryptText(CPFChave);
|
string DataChave = DecryptText(GetDataofKey(ChaveAcesso));
|
||||||
string DataChave = GetDataofKey(ChaveAcesso);
|
DateTime DataValidade = Convert.ToDateTime(DataChave);
|
||||||
DataChave = DecryptText(DataChave);
|
DateTime DataInstalacaoVerify;
|
||||||
DateTime DataValidade = new DateTime();
|
|
||||||
DataValidade = Convert.ToDateTime(DataChave);
|
|
||||||
DateTime DataInstalacaoVerify = new DateTime();
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DataInstalacaoVerify = Convert.ToDateTime(DataInstalacao);
|
DataInstalacaoVerify = Convert.ToDateTime(DataInstalacao);
|
||||||
|
|
@ -181,48 +182,54 @@ namespace OrionTardPro
|
||||||
DataInstalacaoVerify = DateTime.Now.Date;
|
DataInstalacaoVerify = DateTime.Now.Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FixedCPF(CPFChave) == FixedCPF(CPF) && DataValidade >= DateTime.Now)
|
if (FixedCPF(CPFChave) == FixedCPF(CPF) &&
|
||||||
|
DataValidade >= DateTime.Now)
|
||||||
{
|
{
|
||||||
if (MakeRequest)
|
if (MakeRequest)
|
||||||
{
|
{
|
||||||
if (Variaveis.licencaModel.Usada == true && MessageBox.Show("Sua chave de licença já está ativada em outra máquina! Deseja remover o acesso antigo para ativar esse computador?", "Ativação", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
|
if (Variaveis.licencaModel.Usada &&
|
||||||
|
MessageBox.Show(
|
||||||
|
"Sua chave de licença já está ativada em outra máquina! Deseja remover o acesso antigo para ativar esse computador?",
|
||||||
|
"Ativação",
|
||||||
|
MessageBoxButtons.YesNo,
|
||||||
|
MessageBoxIcon.Warning) == DialogResult.No)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!Variaveis.licencaModel.Usada && HttpService.ServerUp)
|
|
||||||
httpService.SetChaveUsada(ChaveAcesso);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!Variaveis.licencaModel.Usada &&
|
||||||
|
await HttpService.ServerUpAsync())
|
||||||
|
{
|
||||||
|
await httpService.SetChaveUsadaAsync(ChaveAcesso);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (File.Exists(VariaveisGerais.CaminhoArquivoLicenca))
|
if (File.Exists(VariaveisGerais.CaminhoArquivoLicenca) &&
|
||||||
|
DateTime.Now < DataInstalacaoVerify)
|
||||||
{
|
{
|
||||||
if (DateTime.Now < DataInstalacaoVerify)
|
if (MessageBox.Show(
|
||||||
|
"Sua chave de licença expirou! Deseja renovar sua licença agora?",
|
||||||
|
"Expirado",
|
||||||
|
MessageBoxButtons.YesNo,
|
||||||
|
MessageBoxIcon.Warning) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
if (MessageBox.Show("Sua chave de licença expirou! Deseja renovar sua licença agora?", "Expirado", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
|
Process.Start(VariaveisGerais.LinkSite + "/login");
|
||||||
{
|
|
||||||
Process.Start(VariaveisGerais.LinkSite + "/login");
|
|
||||||
}
|
|
||||||
return LicenseIsOk;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LicenseIsOk = true;
|
LicenseIsOk = true;
|
||||||
SerialKey = txtChave.Text;
|
SerialKey = txtChave.Text;
|
||||||
NomeCliente = (MakeRequest) ? Variaveis.licencaModel.Nome : txtLicenciadopara.Text;
|
NomeCliente = MakeRequest
|
||||||
|
? Variaveis.licencaModel.Nome
|
||||||
|
: txtLicenciadopara.Text;
|
||||||
ValidadeChave = DataChave;
|
ValidadeChave = DataChave;
|
||||||
CPFCliente = CPF;
|
CPFCliente = CPF;
|
||||||
txtExpira.Text = DataChave;
|
txtExpira.Text = DataChave;
|
||||||
|
|
||||||
Variaveis.ValidadeLicenca = ValidadeChave;
|
Variaveis.ValidadeLicenca = ValidadeChave;
|
||||||
if (NomeCliente == "Versão de avaliação")
|
Variaveis.Licenciado = NomeCliente != "Versão de avaliação";
|
||||||
Variaveis.Licenciado = false;
|
|
||||||
else
|
|
||||||
Variaveis.Licenciado = true;
|
|
||||||
|
|
||||||
WriteConfigFile();
|
|
||||||
|
|
||||||
Variaveis.licencaModel.Nome = txtLicenciadopara.Text;
|
Variaveis.licencaModel.Nome = txtLicenciadopara.Text;
|
||||||
Variaveis.licencaModel.CPF = txtCNPJ.Text;
|
Variaveis.licencaModel.CPF = txtCNPJ.Text;
|
||||||
|
|
@ -231,22 +238,50 @@ namespace OrionTardPro
|
||||||
|
|
||||||
if (!FileExists)
|
if (!FileExists)
|
||||||
{
|
{
|
||||||
MessageBox.Show(VariaveisGerais.NomeProjeto + " licenciado com sucesso até a data " + ValidadeChave.Replace("-", "/"), "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
MessageBox.Show(
|
||||||
|
VariaveisGerais.NomeProjeto +
|
||||||
|
" licenciado com sucesso até a data " +
|
||||||
|
ValidadeChave.Replace("-", "/"),
|
||||||
|
"Sucesso",
|
||||||
|
MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Asterisk);
|
||||||
}
|
}
|
||||||
else
|
else if (DataValidade < DateTime.Now.AddDays(7))
|
||||||
{
|
{
|
||||||
if (DataValidade < DateTime.Now.AddDays(7))
|
MessageBox.Show(
|
||||||
MessageBox.Show("Sua licença expira em " + (DataValidade.DayOfYear - DateTime.Now.DayOfYear).ToString() + " dias", "Validade", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
"Sua licença expira em " +
|
||||||
|
(DataValidade.DayOfYear - DateTime.Now.DayOfYear) +
|
||||||
|
" dias",
|
||||||
|
"Validade",
|
||||||
|
MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Asterisk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Escreve e fecha apenas depois de terminar de atualizar o estado
|
||||||
|
// e a interface. Evita acessar controles após Close().
|
||||||
|
WriteConfigFile();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (FixedCPF(CPFChave) != FixedCPF(CPF))
|
if (FixedCPF(CPFChave) != FixedCPF(CPF))
|
||||||
MessageBox.Show("Chave de licença inválida!", "Inválido", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
{
|
||||||
if (DataValidade < DateTime.Now && (MessageBox.Show("Sua chave de licença expirou! Deseja renovar sua licença agora?", "Expirado", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes))
|
MessageBox.Show(
|
||||||
Process.Start(VariaveisGerais.LinkSite + "/login");
|
"Chave de licença inválida!",
|
||||||
}
|
"Inválido",
|
||||||
|
MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DataValidade < DateTime.Now &&
|
||||||
|
MessageBox.Show(
|
||||||
|
"Sua chave de licença expirou! Deseja renovar sua licença agora?",
|
||||||
|
"Expirado",
|
||||||
|
MessageBoxButtons.YesNo,
|
||||||
|
MessageBoxIcon.Warning) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
Process.Start(VariaveisGerais.LinkSite + "/login");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return LicenseIsOk;
|
return LicenseIsOk;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,30 +38,32 @@
|
||||||
this.txtCorrentebateria = new System.Windows.Forms.TextBox();
|
this.txtCorrentebateria = new System.Windows.Forms.TextBox();
|
||||||
this.lblCorrentebateria = new System.Windows.Forms.Label();
|
this.lblCorrentebateria = new System.Windows.Forms.Label();
|
||||||
this.lblRPM = new System.Windows.Forms.Label();
|
this.lblRPM = new System.Windows.Forms.Label();
|
||||||
this.txtOffsetvelocidade = new System.Windows.Forms.TextBox();
|
|
||||||
this.lblPings = new System.Windows.Forms.Label();
|
this.lblPings = new System.Windows.Forms.Label();
|
||||||
this.txtPings = new System.Windows.Forms.NumericUpDown();
|
this.txtPings = new System.Windows.Forms.NumericUpDown();
|
||||||
this.txtResolucao = new System.Windows.Forms.NumericUpDown();
|
this.txtResolucao = new System.Windows.Forms.NumericUpDown();
|
||||||
this.lblResolucao = new System.Windows.Forms.Label();
|
this.lblResolucao = new System.Windows.Forms.Label();
|
||||||
this.gpbParametros = new System.Windows.Forms.GroupBox();
|
this.gpbParametros = new System.Windows.Forms.GroupBox();
|
||||||
this.pnlParametros = new System.Windows.Forms.Panel();
|
this.pnlParametros = new System.Windows.Forms.Panel();
|
||||||
|
this.nudAnguloMedicaoMargemLimite = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.lblAnguloMedicaoMargemLimite = new System.Windows.Forms.Label();
|
||||||
|
this.nudAnguloCarimboVertical = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.lblAnguloCarimboVertical = new System.Windows.Forms.Label();
|
||||||
|
this.nudAnguloMedicaoIdeal = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.lblAnguloMedicaoIdeal = new System.Windows.Forms.Label();
|
||||||
|
this.nudAnguloCarimboHorizontal = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.lblAnguloCarimboHorizontal = new System.Windows.Forms.Label();
|
||||||
this.nudCanalReleGeral = new System.Windows.Forms.NumericUpDown();
|
this.nudCanalReleGeral = new System.Windows.Forms.NumericUpDown();
|
||||||
this.lblCanalReleGeral = new System.Windows.Forms.Label();
|
this.lblCanalReleGeral = new System.Windows.Forms.Label();
|
||||||
this.nudEnderecoReleGeral = new System.Windows.Forms.NumericUpDown();
|
this.nudEnderecoReleGeral = new System.Windows.Forms.NumericUpDown();
|
||||||
this.lblEnderecoReleGeral = new System.Windows.Forms.Label();
|
this.lblEnderecoReleGeral = new System.Windows.Forms.Label();
|
||||||
this.txtMultiplicadorCorrente = new System.Windows.Forms.TextBox();
|
|
||||||
this.lblOdometroInspecaoHrs = new System.Windows.Forms.Label();
|
this.lblOdometroInspecaoHrs = new System.Windows.Forms.Label();
|
||||||
this.nudOdometroInspecao = new System.Windows.Forms.NumericUpDown();
|
this.nudOdometroInspecao = new System.Windows.Forms.NumericUpDown();
|
||||||
this.lblOdometroInspecao = new System.Windows.Forms.Label();
|
this.lblOdometroInspecao = new System.Windows.Forms.Label();
|
||||||
this.lblRampaUnidade = new System.Windows.Forms.Label();
|
this.lblRampaUnidade = new System.Windows.Forms.Label();
|
||||||
this.lblPotenciaUnidade = new System.Windows.Forms.Label();
|
this.lblPotenciaUnidade = new System.Windows.Forms.Label();
|
||||||
this.lblVelocidadeMax = new System.Windows.Forms.Label();
|
this.lblVelocidadeMax = new System.Windows.Forms.Label();
|
||||||
this.txtCoefB = new System.Windows.Forms.TextBox();
|
|
||||||
this.lblCoefB = new System.Windows.Forms.Label();
|
|
||||||
this.nudDiametroRoda = new System.Windows.Forms.NumericUpDown();
|
this.nudDiametroRoda = new System.Windows.Forms.NumericUpDown();
|
||||||
this.txtCoefA = new System.Windows.Forms.TextBox();
|
|
||||||
this.lblDiametroRoda = new System.Windows.Forms.Label();
|
this.lblDiametroRoda = new System.Windows.Forms.Label();
|
||||||
this.lblCoefA = new System.Windows.Forms.Label();
|
|
||||||
this.txtPrecisaominima = new System.Windows.Forms.NumericUpDown();
|
this.txtPrecisaominima = new System.Windows.Forms.NumericUpDown();
|
||||||
this.nudRPM = new System.Windows.Forms.NumericUpDown();
|
this.nudRPM = new System.Windows.Forms.NumericUpDown();
|
||||||
this.lblPrecisaominima = new System.Windows.Forms.Label();
|
this.lblPrecisaominima = new System.Windows.Forms.Label();
|
||||||
|
|
@ -100,6 +102,8 @@
|
||||||
this.btnZerar = new System.Windows.Forms.Button();
|
this.btnZerar = new System.Windows.Forms.Button();
|
||||||
this.gpbSensores = new System.Windows.Forms.GroupBox();
|
this.gpbSensores = new System.Windows.Forms.GroupBox();
|
||||||
this.pnlSensores = new System.Windows.Forms.Panel();
|
this.pnlSensores = new System.Windows.Forms.Panel();
|
||||||
|
this.chbInfDebug = new System.Windows.Forms.CheckBox();
|
||||||
|
this.chbInf = new System.Windows.Forms.CheckBox();
|
||||||
this.chbUmiDebug = new System.Windows.Forms.CheckBox();
|
this.chbUmiDebug = new System.Windows.Forms.CheckBox();
|
||||||
this.chbWatchdogDebug = new System.Windows.Forms.CheckBox();
|
this.chbWatchdogDebug = new System.Windows.Forms.CheckBox();
|
||||||
this.chbCorDebug = new System.Windows.Forms.CheckBox();
|
this.chbCorDebug = new System.Windows.Forms.CheckBox();
|
||||||
|
|
@ -174,21 +178,20 @@
|
||||||
this.lblDesenrolar = new System.Windows.Forms.Label();
|
this.lblDesenrolar = new System.Windows.Forms.Label();
|
||||||
this.cmbEnrolar = new System.Windows.Forms.ComboBox();
|
this.cmbEnrolar = new System.Windows.Forms.ComboBox();
|
||||||
this.lblEnrolar = new System.Windows.Forms.Label();
|
this.lblEnrolar = new System.Windows.Forms.Label();
|
||||||
this.gpbTipoPerfil = new System.Windows.Forms.GroupBox();
|
this.gpbVersaoProtocolo = new System.Windows.Forms.GroupBox();
|
||||||
this.rdbF4 = new System.Windows.Forms.RadioButton();
|
this.cmbProtocoloVersao = new System.Windows.Forms.ComboBox();
|
||||||
this.rdbF3 = new System.Windows.Forms.RadioButton();
|
this.lblOffsetVelocidade = new System.Windows.Forms.Label();
|
||||||
this.nudAnguloCarimboHorizontal = new System.Windows.Forms.NumericUpDown();
|
this.lblMultiplicadorCorrente = new System.Windows.Forms.Label();
|
||||||
this.lblAnguloCarimboHorizontal = new System.Windows.Forms.Label();
|
this.txtOffsetvelocidade = new System.Windows.Forms.TextBox();
|
||||||
this.nudAnguloMedicaoIdeal = new System.Windows.Forms.NumericUpDown();
|
this.txtMultiplicadorCorrente = new System.Windows.Forms.TextBox();
|
||||||
this.lblAnguloMedicaoIdeal = new System.Windows.Forms.Label();
|
|
||||||
this.nudAnguloCarimboVertical = new System.Windows.Forms.NumericUpDown();
|
|
||||||
this.lblAnguloCarimboVertical = new System.Windows.Forms.Label();
|
|
||||||
this.nudAnguloMedicaoMargemLimite = new System.Windows.Forms.NumericUpDown();
|
|
||||||
this.lblAnguloMedicaoMargemLimite = new System.Windows.Forms.Label();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.txtPings)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.txtPings)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.txtResolucao)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.txtResolucao)).BeginInit();
|
||||||
this.gpbParametros.SuspendLayout();
|
this.gpbParametros.SuspendLayout();
|
||||||
this.pnlParametros.SuspendLayout();
|
this.pnlParametros.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.nudAnguloMedicaoMargemLimite)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.nudAnguloCarimboVertical)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.nudAnguloMedicaoIdeal)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.nudAnguloCarimboHorizontal)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudCanalReleGeral)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.nudCanalReleGeral)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudEnderecoReleGeral)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.nudEnderecoReleGeral)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudOdometroInspecao)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.nudOdometroInspecao)).BeginInit();
|
||||||
|
|
@ -222,11 +225,7 @@
|
||||||
this.gpbRaqueMotor.SuspendLayout();
|
this.gpbRaqueMotor.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudOffsetDesenrolar)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.nudOffsetDesenrolar)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudOffsetEnrolar)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.nudOffsetEnrolar)).BeginInit();
|
||||||
this.gpbTipoPerfil.SuspendLayout();
|
this.gpbVersaoProtocolo.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudAnguloCarimboHorizontal)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudAnguloMedicaoIdeal)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudAnguloCarimboVertical)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudAnguloMedicaoMargemLimite)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// lblDescricao
|
// lblDescricao
|
||||||
|
|
@ -299,9 +298,9 @@
|
||||||
this.lblCorrentebateria.AutoSize = true;
|
this.lblCorrentebateria.AutoSize = true;
|
||||||
this.lblCorrentebateria.Location = new System.Drawing.Point(20, 109);
|
this.lblCorrentebateria.Location = new System.Drawing.Point(20, 109);
|
||||||
this.lblCorrentebateria.Name = "lblCorrentebateria";
|
this.lblCorrentebateria.Name = "lblCorrentebateria";
|
||||||
this.lblCorrentebateria.Size = new System.Drawing.Size(117, 16);
|
this.lblCorrentebateria.Size = new System.Drawing.Size(137, 16);
|
||||||
this.lblCorrentebateria.TabIndex = 9;
|
this.lblCorrentebateria.TabIndex = 9;
|
||||||
this.lblCorrentebateria.Text = "Corrente da bateria";
|
this.lblCorrentebateria.Text = "Capacidade da bateria";
|
||||||
//
|
//
|
||||||
// lblRPM
|
// lblRPM
|
||||||
//
|
//
|
||||||
|
|
@ -312,20 +311,10 @@
|
||||||
this.lblRPM.TabIndex = 11;
|
this.lblRPM.TabIndex = 11;
|
||||||
this.lblRPM.Text = "RPM";
|
this.lblRPM.Text = "RPM";
|
||||||
//
|
//
|
||||||
// txtOffsetvelocidade
|
|
||||||
//
|
|
||||||
this.txtOffsetvelocidade.Location = new System.Drawing.Point(305, 173);
|
|
||||||
this.txtOffsetvelocidade.Name = "txtOffsetvelocidade";
|
|
||||||
this.txtOffsetvelocidade.Size = new System.Drawing.Size(28, 23);
|
|
||||||
this.txtOffsetvelocidade.TabIndex = 10;
|
|
||||||
this.txtOffsetvelocidade.Text = "0";
|
|
||||||
this.txtOffsetvelocidade.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
|
||||||
this.txtOffsetvelocidade.Visible = false;
|
|
||||||
//
|
|
||||||
// lblPings
|
// lblPings
|
||||||
//
|
//
|
||||||
this.lblPings.AutoSize = true;
|
this.lblPings.AutoSize = true;
|
||||||
this.lblPings.Location = new System.Drawing.Point(20, 209);
|
this.lblPings.Location = new System.Drawing.Point(20, 139);
|
||||||
this.lblPings.Name = "lblPings";
|
this.lblPings.Name = "lblPings";
|
||||||
this.lblPings.Size = new System.Drawing.Size(158, 16);
|
this.lblPings.Size = new System.Drawing.Size(158, 16);
|
||||||
this.lblPings.TabIndex = 13;
|
this.lblPings.TabIndex = 13;
|
||||||
|
|
@ -333,7 +322,7 @@
|
||||||
//
|
//
|
||||||
// txtPings
|
// txtPings
|
||||||
//
|
//
|
||||||
this.txtPings.Location = new System.Drawing.Point(235, 207);
|
this.txtPings.Location = new System.Drawing.Point(235, 137);
|
||||||
this.txtPings.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.txtPings.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.txtPings.Maximum = new decimal(new int[] {
|
this.txtPings.Maximum = new decimal(new int[] {
|
||||||
9999,
|
9999,
|
||||||
|
|
@ -352,7 +341,7 @@
|
||||||
//
|
//
|
||||||
// txtResolucao
|
// txtResolucao
|
||||||
//
|
//
|
||||||
this.txtResolucao.Location = new System.Drawing.Point(235, 242);
|
this.txtResolucao.Location = new System.Drawing.Point(235, 172);
|
||||||
this.txtResolucao.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.txtResolucao.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.txtResolucao.Maximum = new decimal(new int[] {
|
this.txtResolucao.Maximum = new decimal(new int[] {
|
||||||
12,
|
12,
|
||||||
|
|
@ -377,7 +366,7 @@
|
||||||
// lblResolucao
|
// lblResolucao
|
||||||
//
|
//
|
||||||
this.lblResolucao.AutoSize = true;
|
this.lblResolucao.AutoSize = true;
|
||||||
this.lblResolucao.Location = new System.Drawing.Point(20, 243);
|
this.lblResolucao.Location = new System.Drawing.Point(20, 173);
|
||||||
this.lblResolucao.Name = "lblResolucao";
|
this.lblResolucao.Name = "lblResolucao";
|
||||||
this.lblResolucao.Size = new System.Drawing.Size(107, 16);
|
this.lblResolucao.Size = new System.Drawing.Size(107, 16);
|
||||||
this.lblResolucao.TabIndex = 15;
|
this.lblResolucao.TabIndex = 15;
|
||||||
|
|
@ -396,6 +385,10 @@
|
||||||
// pnlParametros
|
// pnlParametros
|
||||||
//
|
//
|
||||||
this.pnlParametros.AutoScroll = true;
|
this.pnlParametros.AutoScroll = true;
|
||||||
|
this.pnlParametros.Controls.Add(this.txtMultiplicadorCorrente);
|
||||||
|
this.pnlParametros.Controls.Add(this.txtOffsetvelocidade);
|
||||||
|
this.pnlParametros.Controls.Add(this.lblMultiplicadorCorrente);
|
||||||
|
this.pnlParametros.Controls.Add(this.lblOffsetVelocidade);
|
||||||
this.pnlParametros.Controls.Add(this.nudAnguloMedicaoMargemLimite);
|
this.pnlParametros.Controls.Add(this.nudAnguloMedicaoMargemLimite);
|
||||||
this.pnlParametros.Controls.Add(this.lblAnguloMedicaoMargemLimite);
|
this.pnlParametros.Controls.Add(this.lblAnguloMedicaoMargemLimite);
|
||||||
this.pnlParametros.Controls.Add(this.nudAnguloCarimboVertical);
|
this.pnlParametros.Controls.Add(this.nudAnguloCarimboVertical);
|
||||||
|
|
@ -408,19 +401,14 @@
|
||||||
this.pnlParametros.Controls.Add(this.lblCanalReleGeral);
|
this.pnlParametros.Controls.Add(this.lblCanalReleGeral);
|
||||||
this.pnlParametros.Controls.Add(this.nudEnderecoReleGeral);
|
this.pnlParametros.Controls.Add(this.nudEnderecoReleGeral);
|
||||||
this.pnlParametros.Controls.Add(this.lblEnderecoReleGeral);
|
this.pnlParametros.Controls.Add(this.lblEnderecoReleGeral);
|
||||||
this.pnlParametros.Controls.Add(this.txtMultiplicadorCorrente);
|
|
||||||
this.pnlParametros.Controls.Add(this.lblOdometroInspecaoHrs);
|
this.pnlParametros.Controls.Add(this.lblOdometroInspecaoHrs);
|
||||||
this.pnlParametros.Controls.Add(this.nudOdometroInspecao);
|
this.pnlParametros.Controls.Add(this.nudOdometroInspecao);
|
||||||
this.pnlParametros.Controls.Add(this.lblOdometroInspecao);
|
this.pnlParametros.Controls.Add(this.lblOdometroInspecao);
|
||||||
this.pnlParametros.Controls.Add(this.lblRampaUnidade);
|
this.pnlParametros.Controls.Add(this.lblRampaUnidade);
|
||||||
this.pnlParametros.Controls.Add(this.lblPotenciaUnidade);
|
this.pnlParametros.Controls.Add(this.lblPotenciaUnidade);
|
||||||
this.pnlParametros.Controls.Add(this.lblVelocidadeMax);
|
this.pnlParametros.Controls.Add(this.lblVelocidadeMax);
|
||||||
this.pnlParametros.Controls.Add(this.txtCoefB);
|
|
||||||
this.pnlParametros.Controls.Add(this.lblCoefB);
|
|
||||||
this.pnlParametros.Controls.Add(this.nudDiametroRoda);
|
this.pnlParametros.Controls.Add(this.nudDiametroRoda);
|
||||||
this.pnlParametros.Controls.Add(this.txtCoefA);
|
|
||||||
this.pnlParametros.Controls.Add(this.lblDiametroRoda);
|
this.pnlParametros.Controls.Add(this.lblDiametroRoda);
|
||||||
this.pnlParametros.Controls.Add(this.lblCoefA);
|
|
||||||
this.pnlParametros.Controls.Add(this.txtPrecisaominima);
|
this.pnlParametros.Controls.Add(this.txtPrecisaominima);
|
||||||
this.pnlParametros.Controls.Add(this.nudRPM);
|
this.pnlParametros.Controls.Add(this.nudRPM);
|
||||||
this.pnlParametros.Controls.Add(this.lblPrecisaominima);
|
this.pnlParametros.Controls.Add(this.lblPrecisaominima);
|
||||||
|
|
@ -438,7 +426,6 @@
|
||||||
this.pnlParametros.Controls.Add(this.txtRampamaxima);
|
this.pnlParametros.Controls.Add(this.txtRampamaxima);
|
||||||
this.pnlParametros.Controls.Add(this.lbltensaomaxima);
|
this.pnlParametros.Controls.Add(this.lbltensaomaxima);
|
||||||
this.pnlParametros.Controls.Add(this.lblRampamaxima);
|
this.pnlParametros.Controls.Add(this.lblRampamaxima);
|
||||||
this.pnlParametros.Controls.Add(this.txtOffsetvelocidade);
|
|
||||||
this.pnlParametros.Controls.Add(this.txtTensaominima);
|
this.pnlParametros.Controls.Add(this.txtTensaominima);
|
||||||
this.pnlParametros.Controls.Add(this.txtPotenciaminima);
|
this.pnlParametros.Controls.Add(this.txtPotenciaminima);
|
||||||
this.pnlParametros.Controls.Add(this.lblPotenciaminima);
|
this.pnlParametros.Controls.Add(this.lblPotenciaminima);
|
||||||
|
|
@ -461,9 +448,121 @@
|
||||||
this.pnlParametros.Size = new System.Drawing.Size(367, 378);
|
this.pnlParametros.Size = new System.Drawing.Size(367, 378);
|
||||||
this.pnlParametros.TabIndex = 36;
|
this.pnlParametros.TabIndex = 36;
|
||||||
//
|
//
|
||||||
|
// nudAnguloMedicaoMargemLimite
|
||||||
|
//
|
||||||
|
this.nudAnguloMedicaoMargemLimite.Location = new System.Drawing.Point(235, 533);
|
||||||
|
this.nudAnguloMedicaoMargemLimite.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.nudAnguloMedicaoMargemLimite.Maximum = new decimal(new int[] {
|
||||||
|
180,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.nudAnguloMedicaoMargemLimite.Name = "nudAnguloMedicaoMargemLimite";
|
||||||
|
this.nudAnguloMedicaoMargemLimite.Size = new System.Drawing.Size(60, 23);
|
||||||
|
this.nudAnguloMedicaoMargemLimite.TabIndex = 64;
|
||||||
|
this.nudAnguloMedicaoMargemLimite.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||||
|
this.nudAnguloMedicaoMargemLimite.Value = new decimal(new int[] {
|
||||||
|
20,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
//
|
||||||
|
// lblAnguloMedicaoMargemLimite
|
||||||
|
//
|
||||||
|
this.lblAnguloMedicaoMargemLimite.AutoSize = true;
|
||||||
|
this.lblAnguloMedicaoMargemLimite.Location = new System.Drawing.Point(20, 535);
|
||||||
|
this.lblAnguloMedicaoMargemLimite.Name = "lblAnguloMedicaoMargemLimite";
|
||||||
|
this.lblAnguloMedicaoMargemLimite.Size = new System.Drawing.Size(199, 16);
|
||||||
|
this.lblAnguloMedicaoMargemLimite.TabIndex = 63;
|
||||||
|
this.lblAnguloMedicaoMargemLimite.Text = "Margem Medição Margem Limite";
|
||||||
|
//
|
||||||
|
// nudAnguloCarimboVertical
|
||||||
|
//
|
||||||
|
this.nudAnguloCarimboVertical.Location = new System.Drawing.Point(235, 471);
|
||||||
|
this.nudAnguloCarimboVertical.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.nudAnguloCarimboVertical.Maximum = new decimal(new int[] {
|
||||||
|
180,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.nudAnguloCarimboVertical.Name = "nudAnguloCarimboVertical";
|
||||||
|
this.nudAnguloCarimboVertical.Size = new System.Drawing.Size(60, 23);
|
||||||
|
this.nudAnguloCarimboVertical.TabIndex = 62;
|
||||||
|
this.nudAnguloCarimboVertical.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||||
|
this.nudAnguloCarimboVertical.Value = new decimal(new int[] {
|
||||||
|
63,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
//
|
||||||
|
// lblAnguloCarimboVertical
|
||||||
|
//
|
||||||
|
this.lblAnguloCarimboVertical.AutoSize = true;
|
||||||
|
this.lblAnguloCarimboVertical.Location = new System.Drawing.Point(20, 473);
|
||||||
|
this.lblAnguloCarimboVertical.Name = "lblAnguloCarimboVertical";
|
||||||
|
this.lblAnguloCarimboVertical.Size = new System.Drawing.Size(145, 16);
|
||||||
|
this.lblAnguloCarimboVertical.TabIndex = 61;
|
||||||
|
this.lblAnguloCarimboVertical.Text = "Angulo Carimbo Vertical";
|
||||||
|
//
|
||||||
|
// nudAnguloMedicaoIdeal
|
||||||
|
//
|
||||||
|
this.nudAnguloMedicaoIdeal.Location = new System.Drawing.Point(235, 502);
|
||||||
|
this.nudAnguloMedicaoIdeal.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.nudAnguloMedicaoIdeal.Maximum = new decimal(new int[] {
|
||||||
|
180,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.nudAnguloMedicaoIdeal.Name = "nudAnguloMedicaoIdeal";
|
||||||
|
this.nudAnguloMedicaoIdeal.Size = new System.Drawing.Size(60, 23);
|
||||||
|
this.nudAnguloMedicaoIdeal.TabIndex = 60;
|
||||||
|
this.nudAnguloMedicaoIdeal.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||||
|
this.nudAnguloMedicaoIdeal.Value = new decimal(new int[] {
|
||||||
|
132,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
//
|
||||||
|
// lblAnguloMedicaoIdeal
|
||||||
|
//
|
||||||
|
this.lblAnguloMedicaoIdeal.AutoSize = true;
|
||||||
|
this.lblAnguloMedicaoIdeal.Location = new System.Drawing.Point(20, 504);
|
||||||
|
this.lblAnguloMedicaoIdeal.Name = "lblAnguloMedicaoIdeal";
|
||||||
|
this.lblAnguloMedicaoIdeal.Size = new System.Drawing.Size(133, 16);
|
||||||
|
this.lblAnguloMedicaoIdeal.TabIndex = 59;
|
||||||
|
this.lblAnguloMedicaoIdeal.Text = "Angulo Medição Ideal";
|
||||||
|
//
|
||||||
|
// nudAnguloCarimboHorizontal
|
||||||
|
//
|
||||||
|
this.nudAnguloCarimboHorizontal.Location = new System.Drawing.Point(235, 440);
|
||||||
|
this.nudAnguloCarimboHorizontal.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.nudAnguloCarimboHorizontal.Maximum = new decimal(new int[] {
|
||||||
|
180,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.nudAnguloCarimboHorizontal.Name = "nudAnguloCarimboHorizontal";
|
||||||
|
this.nudAnguloCarimboHorizontal.Size = new System.Drawing.Size(60, 23);
|
||||||
|
this.nudAnguloCarimboHorizontal.TabIndex = 58;
|
||||||
|
this.nudAnguloCarimboHorizontal.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||||
|
this.nudAnguloCarimboHorizontal.Value = new decimal(new int[] {
|
||||||
|
67,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
//
|
||||||
|
// lblAnguloCarimboHorizontal
|
||||||
|
//
|
||||||
|
this.lblAnguloCarimboHorizontal.AutoSize = true;
|
||||||
|
this.lblAnguloCarimboHorizontal.Location = new System.Drawing.Point(20, 442);
|
||||||
|
this.lblAnguloCarimboHorizontal.Name = "lblAnguloCarimboHorizontal";
|
||||||
|
this.lblAnguloCarimboHorizontal.Size = new System.Drawing.Size(162, 16);
|
||||||
|
this.lblAnguloCarimboHorizontal.TabIndex = 57;
|
||||||
|
this.lblAnguloCarimboHorizontal.Text = "Angulo Carimbo Horizontal";
|
||||||
|
//
|
||||||
// nudCanalReleGeral
|
// nudCanalReleGeral
|
||||||
//
|
//
|
||||||
this.nudCanalReleGeral.Location = new System.Drawing.Point(235, 479);
|
this.nudCanalReleGeral.Location = new System.Drawing.Point(235, 409);
|
||||||
this.nudCanalReleGeral.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.nudCanalReleGeral.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.nudCanalReleGeral.Maximum = new decimal(new int[] {
|
this.nudCanalReleGeral.Maximum = new decimal(new int[] {
|
||||||
2,
|
2,
|
||||||
|
|
@ -488,7 +587,7 @@
|
||||||
// lblCanalReleGeral
|
// lblCanalReleGeral
|
||||||
//
|
//
|
||||||
this.lblCanalReleGeral.AutoSize = true;
|
this.lblCanalReleGeral.AutoSize = true;
|
||||||
this.lblCanalReleGeral.Location = new System.Drawing.Point(20, 481);
|
this.lblCanalReleGeral.Location = new System.Drawing.Point(20, 411);
|
||||||
this.lblCanalReleGeral.Name = "lblCanalReleGeral";
|
this.lblCanalReleGeral.Name = "lblCanalReleGeral";
|
||||||
this.lblCanalReleGeral.Size = new System.Drawing.Size(100, 16);
|
this.lblCanalReleGeral.Size = new System.Drawing.Size(100, 16);
|
||||||
this.lblCanalReleGeral.TabIndex = 55;
|
this.lblCanalReleGeral.TabIndex = 55;
|
||||||
|
|
@ -496,7 +595,7 @@
|
||||||
//
|
//
|
||||||
// nudEnderecoReleGeral
|
// nudEnderecoReleGeral
|
||||||
//
|
//
|
||||||
this.nudEnderecoReleGeral.Location = new System.Drawing.Point(235, 448);
|
this.nudEnderecoReleGeral.Location = new System.Drawing.Point(235, 378);
|
||||||
this.nudEnderecoReleGeral.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.nudEnderecoReleGeral.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.nudEnderecoReleGeral.Maximum = new decimal(new int[] {
|
this.nudEnderecoReleGeral.Maximum = new decimal(new int[] {
|
||||||
255,
|
255,
|
||||||
|
|
@ -511,25 +610,16 @@
|
||||||
// lblEnderecoReleGeral
|
// lblEnderecoReleGeral
|
||||||
//
|
//
|
||||||
this.lblEnderecoReleGeral.AutoSize = true;
|
this.lblEnderecoReleGeral.AutoSize = true;
|
||||||
this.lblEnderecoReleGeral.Location = new System.Drawing.Point(20, 450);
|
this.lblEnderecoReleGeral.Location = new System.Drawing.Point(20, 380);
|
||||||
this.lblEnderecoReleGeral.Name = "lblEnderecoReleGeral";
|
this.lblEnderecoReleGeral.Name = "lblEnderecoReleGeral";
|
||||||
this.lblEnderecoReleGeral.Size = new System.Drawing.Size(122, 16);
|
this.lblEnderecoReleGeral.Size = new System.Drawing.Size(122, 16);
|
||||||
this.lblEnderecoReleGeral.TabIndex = 53;
|
this.lblEnderecoReleGeral.TabIndex = 53;
|
||||||
this.lblEnderecoReleGeral.Text = "Endereço Relé Geral";
|
this.lblEnderecoReleGeral.Text = "Endereço Relé Geral";
|
||||||
//
|
//
|
||||||
// txtMultiplicadorCorrente
|
|
||||||
//
|
|
||||||
this.txtMultiplicadorCorrente.Location = new System.Drawing.Point(305, 140);
|
|
||||||
this.txtMultiplicadorCorrente.Name = "txtMultiplicadorCorrente";
|
|
||||||
this.txtMultiplicadorCorrente.Size = new System.Drawing.Size(28, 23);
|
|
||||||
this.txtMultiplicadorCorrente.TabIndex = 52;
|
|
||||||
this.txtMultiplicadorCorrente.Text = "1";
|
|
||||||
this.txtMultiplicadorCorrente.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
|
||||||
//
|
|
||||||
// lblOdometroInspecaoHrs
|
// lblOdometroInspecaoHrs
|
||||||
//
|
//
|
||||||
this.lblOdometroInspecaoHrs.AutoSize = true;
|
this.lblOdometroInspecaoHrs.AutoSize = true;
|
||||||
this.lblOdometroInspecaoHrs.Location = new System.Drawing.Point(298, 419);
|
this.lblOdometroInspecaoHrs.Location = new System.Drawing.Point(298, 349);
|
||||||
this.lblOdometroInspecaoHrs.Name = "lblOdometroInspecaoHrs";
|
this.lblOdometroInspecaoHrs.Name = "lblOdometroInspecaoHrs";
|
||||||
this.lblOdometroInspecaoHrs.Size = new System.Drawing.Size(23, 16);
|
this.lblOdometroInspecaoHrs.Size = new System.Drawing.Size(23, 16);
|
||||||
this.lblOdometroInspecaoHrs.TabIndex = 51;
|
this.lblOdometroInspecaoHrs.TabIndex = 51;
|
||||||
|
|
@ -537,7 +627,7 @@
|
||||||
//
|
//
|
||||||
// nudOdometroInspecao
|
// nudOdometroInspecao
|
||||||
//
|
//
|
||||||
this.nudOdometroInspecao.Location = new System.Drawing.Point(235, 417);
|
this.nudOdometroInspecao.Location = new System.Drawing.Point(235, 347);
|
||||||
this.nudOdometroInspecao.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.nudOdometroInspecao.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.nudOdometroInspecao.Maximum = new decimal(new int[] {
|
this.nudOdometroInspecao.Maximum = new decimal(new int[] {
|
||||||
99999,
|
99999,
|
||||||
|
|
@ -562,7 +652,7 @@
|
||||||
// lblOdometroInspecao
|
// lblOdometroInspecao
|
||||||
//
|
//
|
||||||
this.lblOdometroInspecao.AutoSize = true;
|
this.lblOdometroInspecao.AutoSize = true;
|
||||||
this.lblOdometroInspecao.Location = new System.Drawing.Point(20, 419);
|
this.lblOdometroInspecao.Location = new System.Drawing.Point(20, 349);
|
||||||
this.lblOdometroInspecao.Name = "lblOdometroInspecao";
|
this.lblOdometroInspecao.Name = "lblOdometroInspecao";
|
||||||
this.lblOdometroInspecao.Size = new System.Drawing.Size(150, 16);
|
this.lblOdometroInspecao.Size = new System.Drawing.Size(150, 16);
|
||||||
this.lblOdometroInspecao.TabIndex = 49;
|
this.lblOdometroInspecao.TabIndex = 49;
|
||||||
|
|
@ -571,7 +661,7 @@
|
||||||
// lblRampaUnidade
|
// lblRampaUnidade
|
||||||
//
|
//
|
||||||
this.lblRampaUnidade.AutoSize = true;
|
this.lblRampaUnidade.AutoSize = true;
|
||||||
this.lblRampaUnidade.Location = new System.Drawing.Point(301, 349);
|
this.lblRampaUnidade.Location = new System.Drawing.Point(301, 279);
|
||||||
this.lblRampaUnidade.Name = "lblRampaUnidade";
|
this.lblRampaUnidade.Name = "lblRampaUnidade";
|
||||||
this.lblRampaUnidade.Size = new System.Drawing.Size(23, 16);
|
this.lblRampaUnidade.Size = new System.Drawing.Size(23, 16);
|
||||||
this.lblRampaUnidade.TabIndex = 48;
|
this.lblRampaUnidade.TabIndex = 48;
|
||||||
|
|
@ -581,7 +671,7 @@
|
||||||
//
|
//
|
||||||
this.lblPotenciaUnidade.AutoSize = true;
|
this.lblPotenciaUnidade.AutoSize = true;
|
||||||
this.lblPotenciaUnidade.Font = new System.Drawing.Font("Microsoft JhengHei", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.lblPotenciaUnidade.Font = new System.Drawing.Font("Microsoft JhengHei", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.lblPotenciaUnidade.Location = new System.Drawing.Point(299, 317);
|
this.lblPotenciaUnidade.Location = new System.Drawing.Point(299, 247);
|
||||||
this.lblPotenciaUnidade.Name = "lblPotenciaUnidade";
|
this.lblPotenciaUnidade.Name = "lblPotenciaUnidade";
|
||||||
this.lblPotenciaUnidade.Size = new System.Drawing.Size(34, 15);
|
this.lblPotenciaUnidade.Size = new System.Drawing.Size(34, 15);
|
||||||
this.lblPotenciaUnidade.TabIndex = 47;
|
this.lblPotenciaUnidade.TabIndex = 47;
|
||||||
|
|
@ -596,24 +686,6 @@
|
||||||
this.lblVelocidadeMax.TabIndex = 24;
|
this.lblVelocidadeMax.TabIndex = 24;
|
||||||
this.lblVelocidadeMax.Text = "0,2 m/s";
|
this.lblVelocidadeMax.Text = "0,2 m/s";
|
||||||
//
|
//
|
||||||
// txtCoefB
|
|
||||||
//
|
|
||||||
this.txtCoefB.Location = new System.Drawing.Point(235, 173);
|
|
||||||
this.txtCoefB.Name = "txtCoefB";
|
|
||||||
this.txtCoefB.Size = new System.Drawing.Size(60, 23);
|
|
||||||
this.txtCoefB.TabIndex = 6;
|
|
||||||
this.txtCoefB.Text = "-0,17";
|
|
||||||
this.txtCoefB.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
|
||||||
//
|
|
||||||
// lblCoefB
|
|
||||||
//
|
|
||||||
this.lblCoefB.AutoSize = true;
|
|
||||||
this.lblCoefB.Location = new System.Drawing.Point(20, 176);
|
|
||||||
this.lblCoefB.Name = "lblCoefB";
|
|
||||||
this.lblCoefB.Size = new System.Drawing.Size(133, 16);
|
|
||||||
this.lblCoefB.TabIndex = 45;
|
|
||||||
this.lblCoefB.Text = "Coeficiente B Corrente";
|
|
||||||
//
|
|
||||||
// nudDiametroRoda
|
// nudDiametroRoda
|
||||||
//
|
//
|
||||||
this.nudDiametroRoda.Location = new System.Drawing.Point(198, 8);
|
this.nudDiametroRoda.Location = new System.Drawing.Point(198, 8);
|
||||||
|
|
@ -633,15 +705,6 @@
|
||||||
0});
|
0});
|
||||||
this.nudDiametroRoda.Leave += new System.EventHandler(this.nudDiametroRoda_Leave);
|
this.nudDiametroRoda.Leave += new System.EventHandler(this.nudDiametroRoda_Leave);
|
||||||
//
|
//
|
||||||
// txtCoefA
|
|
||||||
//
|
|
||||||
this.txtCoefA.Location = new System.Drawing.Point(235, 140);
|
|
||||||
this.txtCoefA.Name = "txtCoefA";
|
|
||||||
this.txtCoefA.Size = new System.Drawing.Size(60, 23);
|
|
||||||
this.txtCoefA.TabIndex = 5;
|
|
||||||
this.txtCoefA.Text = "0,097";
|
|
||||||
this.txtCoefA.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
|
||||||
//
|
|
||||||
// lblDiametroRoda
|
// lblDiametroRoda
|
||||||
//
|
//
|
||||||
this.lblDiametroRoda.AutoSize = true;
|
this.lblDiametroRoda.AutoSize = true;
|
||||||
|
|
@ -651,18 +714,9 @@
|
||||||
this.lblDiametroRoda.TabIndex = 46;
|
this.lblDiametroRoda.TabIndex = 46;
|
||||||
this.lblDiametroRoda.Text = "Φ roda";
|
this.lblDiametroRoda.Text = "Φ roda";
|
||||||
//
|
//
|
||||||
// lblCoefA
|
|
||||||
//
|
|
||||||
this.lblCoefA.AutoSize = true;
|
|
||||||
this.lblCoefA.Location = new System.Drawing.Point(20, 143);
|
|
||||||
this.lblCoefA.Name = "lblCoefA";
|
|
||||||
this.lblCoefA.Size = new System.Drawing.Size(134, 16);
|
|
||||||
this.lblCoefA.TabIndex = 42;
|
|
||||||
this.lblCoefA.Text = "Coeficiente A Corrente";
|
|
||||||
//
|
|
||||||
// txtPrecisaominima
|
// txtPrecisaominima
|
||||||
//
|
//
|
||||||
this.txtPrecisaominima.Location = new System.Drawing.Point(92, 382);
|
this.txtPrecisaominima.Location = new System.Drawing.Point(92, 312);
|
||||||
this.txtPrecisaominima.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.txtPrecisaominima.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.txtPrecisaominima.Maximum = new decimal(new int[] {
|
this.txtPrecisaominima.Maximum = new decimal(new int[] {
|
||||||
10,
|
10,
|
||||||
|
|
@ -706,7 +760,7 @@
|
||||||
// lblPrecisaominima
|
// lblPrecisaominima
|
||||||
//
|
//
|
||||||
this.lblPrecisaominima.AutoSize = true;
|
this.lblPrecisaominima.AutoSize = true;
|
||||||
this.lblPrecisaominima.Location = new System.Drawing.Point(20, 384);
|
this.lblPrecisaominima.Location = new System.Drawing.Point(20, 314);
|
||||||
this.lblPrecisaominima.Name = "lblPrecisaominima";
|
this.lblPrecisaominima.Name = "lblPrecisaominima";
|
||||||
this.lblPrecisaominima.Size = new System.Drawing.Size(49, 16);
|
this.lblPrecisaominima.Size = new System.Drawing.Size(49, 16);
|
||||||
this.lblPrecisaominima.TabIndex = 39;
|
this.lblPrecisaominima.TabIndex = 39;
|
||||||
|
|
@ -714,7 +768,7 @@
|
||||||
//
|
//
|
||||||
// txtPrecisaomaxima
|
// txtPrecisaomaxima
|
||||||
//
|
//
|
||||||
this.txtPrecisaomaxima.Location = new System.Drawing.Point(235, 382);
|
this.txtPrecisaomaxima.Location = new System.Drawing.Point(235, 312);
|
||||||
this.txtPrecisaomaxima.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.txtPrecisaomaxima.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.txtPrecisaomaxima.Maximum = new decimal(new int[] {
|
this.txtPrecisaomaxima.Maximum = new decimal(new int[] {
|
||||||
85,
|
85,
|
||||||
|
|
@ -739,7 +793,7 @@
|
||||||
// lblPrecisaomaxima
|
// lblPrecisaomaxima
|
||||||
//
|
//
|
||||||
this.lblPrecisaomaxima.AutoSize = true;
|
this.lblPrecisaomaxima.AutoSize = true;
|
||||||
this.lblPrecisaomaxima.Location = new System.Drawing.Point(164, 384);
|
this.lblPrecisaomaxima.Location = new System.Drawing.Point(164, 314);
|
||||||
this.lblPrecisaomaxima.Name = "lblPrecisaomaxima";
|
this.lblPrecisaomaxima.Name = "lblPrecisaomaxima";
|
||||||
this.lblPrecisaomaxima.Size = new System.Drawing.Size(52, 16);
|
this.lblPrecisaomaxima.Size = new System.Drawing.Size(52, 16);
|
||||||
this.lblPrecisaomaxima.TabIndex = 36;
|
this.lblPrecisaomaxima.TabIndex = 36;
|
||||||
|
|
@ -747,7 +801,7 @@
|
||||||
//
|
//
|
||||||
// txtRampaminima
|
// txtRampaminima
|
||||||
//
|
//
|
||||||
this.txtRampaminima.Location = new System.Drawing.Point(92, 347);
|
this.txtRampaminima.Location = new System.Drawing.Point(92, 277);
|
||||||
this.txtRampaminima.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.txtRampaminima.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.txtRampaminima.Maximum = new decimal(new int[] {
|
this.txtRampaminima.Maximum = new decimal(new int[] {
|
||||||
10,
|
10,
|
||||||
|
|
@ -772,7 +826,7 @@
|
||||||
// lblRampaminima
|
// lblRampaminima
|
||||||
//
|
//
|
||||||
this.lblRampaminima.AutoSize = true;
|
this.lblRampaminima.AutoSize = true;
|
||||||
this.lblRampaminima.Location = new System.Drawing.Point(20, 349);
|
this.lblRampaminima.Location = new System.Drawing.Point(20, 279);
|
||||||
this.lblRampaminima.Name = "lblRampaminima";
|
this.lblRampaminima.Name = "lblRampaminima";
|
||||||
this.lblRampaminima.Size = new System.Drawing.Size(58, 16);
|
this.lblRampaminima.Size = new System.Drawing.Size(58, 16);
|
||||||
this.lblRampaminima.TabIndex = 33;
|
this.lblRampaminima.TabIndex = 33;
|
||||||
|
|
@ -780,7 +834,7 @@
|
||||||
//
|
//
|
||||||
// txtRampamaxima
|
// txtRampamaxima
|
||||||
//
|
//
|
||||||
this.txtRampamaxima.Location = new System.Drawing.Point(235, 347);
|
this.txtRampamaxima.Location = new System.Drawing.Point(235, 277);
|
||||||
this.txtRampamaxima.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.txtRampamaxima.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.txtRampamaxima.Maximum = new decimal(new int[] {
|
this.txtRampamaxima.Maximum = new decimal(new int[] {
|
||||||
10,
|
10,
|
||||||
|
|
@ -805,7 +859,7 @@
|
||||||
// lblRampamaxima
|
// lblRampamaxima
|
||||||
//
|
//
|
||||||
this.lblRampamaxima.AutoSize = true;
|
this.lblRampamaxima.AutoSize = true;
|
||||||
this.lblRampamaxima.Location = new System.Drawing.Point(158, 349);
|
this.lblRampamaxima.Location = new System.Drawing.Point(158, 279);
|
||||||
this.lblRampamaxima.Name = "lblRampamaxima";
|
this.lblRampamaxima.Name = "lblRampamaxima";
|
||||||
this.lblRampamaxima.Size = new System.Drawing.Size(61, 16);
|
this.lblRampamaxima.Size = new System.Drawing.Size(61, 16);
|
||||||
this.lblRampamaxima.TabIndex = 30;
|
this.lblRampamaxima.TabIndex = 30;
|
||||||
|
|
@ -813,7 +867,7 @@
|
||||||
//
|
//
|
||||||
// txtPotenciaminima
|
// txtPotenciaminima
|
||||||
//
|
//
|
||||||
this.txtPotenciaminima.Location = new System.Drawing.Point(92, 312);
|
this.txtPotenciaminima.Location = new System.Drawing.Point(92, 242);
|
||||||
this.txtPotenciaminima.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.txtPotenciaminima.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.txtPotenciaminima.Maximum = new decimal(new int[] {
|
this.txtPotenciaminima.Maximum = new decimal(new int[] {
|
||||||
10,
|
10,
|
||||||
|
|
@ -838,7 +892,7 @@
|
||||||
// lblPotenciaminima
|
// lblPotenciaminima
|
||||||
//
|
//
|
||||||
this.lblPotenciaminima.AutoSize = true;
|
this.lblPotenciaminima.AutoSize = true;
|
||||||
this.lblPotenciaminima.Location = new System.Drawing.Point(20, 314);
|
this.lblPotenciaminima.Location = new System.Drawing.Point(20, 244);
|
||||||
this.lblPotenciaminima.Name = "lblPotenciaminima";
|
this.lblPotenciaminima.Name = "lblPotenciaminima";
|
||||||
this.lblPotenciaminima.Size = new System.Drawing.Size(53, 16);
|
this.lblPotenciaminima.Size = new System.Drawing.Size(53, 16);
|
||||||
this.lblPotenciaminima.TabIndex = 27;
|
this.lblPotenciaminima.TabIndex = 27;
|
||||||
|
|
@ -846,7 +900,7 @@
|
||||||
//
|
//
|
||||||
// txtPotenciamaxima
|
// txtPotenciamaxima
|
||||||
//
|
//
|
||||||
this.txtPotenciamaxima.Location = new System.Drawing.Point(235, 312);
|
this.txtPotenciamaxima.Location = new System.Drawing.Point(235, 242);
|
||||||
this.txtPotenciamaxima.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.txtPotenciamaxima.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.txtPotenciamaxima.Maximum = new decimal(new int[] {
|
this.txtPotenciamaxima.Maximum = new decimal(new int[] {
|
||||||
10,
|
10,
|
||||||
|
|
@ -871,7 +925,7 @@
|
||||||
// lblPotenciamaxima
|
// lblPotenciamaxima
|
||||||
//
|
//
|
||||||
this.lblPotenciamaxima.AutoSize = true;
|
this.lblPotenciamaxima.AutoSize = true;
|
||||||
this.lblPotenciamaxima.Location = new System.Drawing.Point(158, 314);
|
this.lblPotenciamaxima.Location = new System.Drawing.Point(158, 244);
|
||||||
this.lblPotenciamaxima.Name = "lblPotenciamaxima";
|
this.lblPotenciamaxima.Name = "lblPotenciamaxima";
|
||||||
this.lblPotenciamaxima.Size = new System.Drawing.Size(56, 16);
|
this.lblPotenciamaxima.Size = new System.Drawing.Size(56, 16);
|
||||||
this.lblPotenciamaxima.TabIndex = 24;
|
this.lblPotenciamaxima.TabIndex = 24;
|
||||||
|
|
@ -880,7 +934,7 @@
|
||||||
// lblUcabo
|
// lblUcabo
|
||||||
//
|
//
|
||||||
this.lblUcabo.AutoSize = true;
|
this.lblUcabo.AutoSize = true;
|
||||||
this.lblUcabo.Location = new System.Drawing.Point(301, 279);
|
this.lblUcabo.Location = new System.Drawing.Point(301, 209);
|
||||||
this.lblUcabo.Name = "lblUcabo";
|
this.lblUcabo.Name = "lblUcabo";
|
||||||
this.lblUcabo.Size = new System.Drawing.Size(18, 16);
|
this.lblUcabo.Size = new System.Drawing.Size(18, 16);
|
||||||
this.lblUcabo.TabIndex = 23;
|
this.lblUcabo.TabIndex = 23;
|
||||||
|
|
@ -897,7 +951,7 @@
|
||||||
//
|
//
|
||||||
// txtComprimentocabo
|
// txtComprimentocabo
|
||||||
//
|
//
|
||||||
this.txtComprimentocabo.Location = new System.Drawing.Point(235, 277);
|
this.txtComprimentocabo.Location = new System.Drawing.Point(235, 207);
|
||||||
this.txtComprimentocabo.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.txtComprimentocabo.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.txtComprimentocabo.Maximum = new decimal(new int[] {
|
this.txtComprimentocabo.Maximum = new decimal(new int[] {
|
||||||
9999,
|
9999,
|
||||||
|
|
@ -926,7 +980,7 @@
|
||||||
// lblComprimentocabo
|
// lblComprimentocabo
|
||||||
//
|
//
|
||||||
this.lblComprimentocabo.AutoSize = true;
|
this.lblComprimentocabo.AutoSize = true;
|
||||||
this.lblComprimentocabo.Location = new System.Drawing.Point(20, 279);
|
this.lblComprimentocabo.Location = new System.Drawing.Point(20, 209);
|
||||||
this.lblComprimentocabo.Name = "lblComprimentocabo";
|
this.lblComprimentocabo.Name = "lblComprimentocabo";
|
||||||
this.lblComprimentocabo.Size = new System.Drawing.Size(137, 16);
|
this.lblComprimentocabo.Size = new System.Drawing.Size(137, 16);
|
||||||
this.lblComprimentocabo.TabIndex = 21;
|
this.lblComprimentocabo.TabIndex = 21;
|
||||||
|
|
@ -944,7 +998,7 @@
|
||||||
// lblUbits
|
// lblUbits
|
||||||
//
|
//
|
||||||
this.lblUbits.AutoSize = true;
|
this.lblUbits.AutoSize = true;
|
||||||
this.lblUbits.Location = new System.Drawing.Point(301, 243);
|
this.lblUbits.Location = new System.Drawing.Point(301, 173);
|
||||||
this.lblUbits.Name = "lblUbits";
|
this.lblUbits.Name = "lblUbits";
|
||||||
this.lblUbits.Size = new System.Drawing.Size(27, 16);
|
this.lblUbits.Size = new System.Drawing.Size(27, 16);
|
||||||
this.lblUbits.TabIndex = 20;
|
this.lblUbits.TabIndex = 20;
|
||||||
|
|
@ -1130,6 +1184,8 @@
|
||||||
// pnlSensores
|
// pnlSensores
|
||||||
//
|
//
|
||||||
this.pnlSensores.AutoScroll = true;
|
this.pnlSensores.AutoScroll = true;
|
||||||
|
this.pnlSensores.Controls.Add(this.chbInfDebug);
|
||||||
|
this.pnlSensores.Controls.Add(this.chbInf);
|
||||||
this.pnlSensores.Controls.Add(this.chbUmiDebug);
|
this.pnlSensores.Controls.Add(this.chbUmiDebug);
|
||||||
this.pnlSensores.Controls.Add(this.chbWatchdogDebug);
|
this.pnlSensores.Controls.Add(this.chbWatchdogDebug);
|
||||||
this.pnlSensores.Controls.Add(this.chbCorDebug);
|
this.pnlSensores.Controls.Add(this.chbCorDebug);
|
||||||
|
|
@ -1154,6 +1210,26 @@
|
||||||
this.pnlSensores.Size = new System.Drawing.Size(155, 256);
|
this.pnlSensores.Size = new System.Drawing.Size(155, 256);
|
||||||
this.pnlSensores.TabIndex = 13;
|
this.pnlSensores.TabIndex = 13;
|
||||||
//
|
//
|
||||||
|
// chbInfDebug
|
||||||
|
//
|
||||||
|
this.chbInfDebug.AutoSize = true;
|
||||||
|
this.chbInfDebug.Location = new System.Drawing.Point(4, 249);
|
||||||
|
this.chbInfDebug.Name = "chbInfDebug";
|
||||||
|
this.chbInfDebug.Size = new System.Drawing.Size(15, 14);
|
||||||
|
this.chbInfDebug.TabIndex = 18;
|
||||||
|
this.chbInfDebug.UseVisualStyleBackColor = true;
|
||||||
|
this.chbInfDebug.Visible = false;
|
||||||
|
//
|
||||||
|
// chbInf
|
||||||
|
//
|
||||||
|
this.chbInf.AutoSize = true;
|
||||||
|
this.chbInf.Location = new System.Drawing.Point(25, 246);
|
||||||
|
this.chbInf.Name = "chbInf";
|
||||||
|
this.chbInf.Size = new System.Drawing.Size(82, 20);
|
||||||
|
this.chbInf.TabIndex = 17;
|
||||||
|
this.chbInf.Text = "Infiltração";
|
||||||
|
this.chbInf.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// chbUmiDebug
|
// chbUmiDebug
|
||||||
//
|
//
|
||||||
this.chbUmiDebug.AutoSize = true;
|
this.chbUmiDebug.AutoSize = true;
|
||||||
|
|
@ -1935,157 +2011,67 @@
|
||||||
this.lblEnrolar.TabIndex = 0;
|
this.lblEnrolar.TabIndex = 0;
|
||||||
this.lblEnrolar.Text = "Enrolar";
|
this.lblEnrolar.Text = "Enrolar";
|
||||||
//
|
//
|
||||||
// gpbTipoPerfil
|
// gpbVersaoProtocolo
|
||||||
//
|
//
|
||||||
this.gpbTipoPerfil.Controls.Add(this.rdbF4);
|
this.gpbVersaoProtocolo.Controls.Add(this.cmbProtocoloVersao);
|
||||||
this.gpbTipoPerfil.Controls.Add(this.rdbF3);
|
this.gpbVersaoProtocolo.Location = new System.Drawing.Point(191, 418);
|
||||||
this.gpbTipoPerfil.Location = new System.Drawing.Point(191, 418);
|
this.gpbVersaoProtocolo.Name = "gpbVersaoProtocolo";
|
||||||
this.gpbTipoPerfil.Name = "gpbTipoPerfil";
|
this.gpbVersaoProtocolo.Size = new System.Drawing.Size(194, 65);
|
||||||
this.gpbTipoPerfil.Size = new System.Drawing.Size(194, 65);
|
this.gpbVersaoProtocolo.TabIndex = 7;
|
||||||
this.gpbTipoPerfil.TabIndex = 7;
|
this.gpbVersaoProtocolo.TabStop = false;
|
||||||
this.gpbTipoPerfil.TabStop = false;
|
this.gpbVersaoProtocolo.Text = "Versão Protocolo";
|
||||||
this.gpbTipoPerfil.Text = "Tipo de Perfil";
|
|
||||||
//
|
//
|
||||||
// rdbF4
|
// cmbProtocoloVersao
|
||||||
//
|
//
|
||||||
this.rdbF4.AutoSize = true;
|
this.cmbProtocoloVersao.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
this.rdbF4.Location = new System.Drawing.Point(109, 30);
|
this.cmbProtocoloVersao.FormattingEnabled = true;
|
||||||
this.rdbF4.Name = "rdbF4";
|
this.cmbProtocoloVersao.Location = new System.Drawing.Point(6, 24);
|
||||||
this.rdbF4.Size = new System.Drawing.Size(59, 20);
|
this.cmbProtocoloVersao.Name = "cmbProtocoloVersao";
|
||||||
this.rdbF4.TabIndex = 1;
|
this.cmbProtocoloVersao.Size = new System.Drawing.Size(182, 24);
|
||||||
this.rdbF4.Text = ">= F4";
|
this.cmbProtocoloVersao.TabIndex = 0;
|
||||||
this.rdbF4.UseVisualStyleBackColor = true;
|
|
||||||
//
|
//
|
||||||
// rdbF3
|
// lblOffsetVelocidade
|
||||||
//
|
//
|
||||||
this.rdbF3.AutoSize = true;
|
this.lblOffsetVelocidade.AutoSize = true;
|
||||||
this.rdbF3.Checked = true;
|
this.lblOffsetVelocidade.Location = new System.Drawing.Point(20, 566);
|
||||||
this.rdbF3.Location = new System.Drawing.Point(17, 30);
|
this.lblOffsetVelocidade.Name = "lblOffsetVelocidade";
|
||||||
this.rdbF3.Name = "rdbF3";
|
this.lblOffsetVelocidade.Size = new System.Drawing.Size(109, 16);
|
||||||
this.rdbF3.Size = new System.Drawing.Size(59, 20);
|
this.lblOffsetVelocidade.TabIndex = 67;
|
||||||
this.rdbF3.TabIndex = 0;
|
this.lblOffsetVelocidade.Text = "Offset Velocidade";
|
||||||
this.rdbF3.TabStop = true;
|
|
||||||
this.rdbF3.Text = "<= F3";
|
|
||||||
this.rdbF3.UseVisualStyleBackColor = true;
|
|
||||||
//
|
//
|
||||||
// nudAnguloCarimboHorizontal
|
// lblMultiplicadorCorrente
|
||||||
//
|
//
|
||||||
this.nudAnguloCarimboHorizontal.Location = new System.Drawing.Point(235, 510);
|
this.lblMultiplicadorCorrente.AutoSize = true;
|
||||||
this.nudAnguloCarimboHorizontal.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.lblMultiplicadorCorrente.Location = new System.Drawing.Point(20, 595);
|
||||||
this.nudAnguloCarimboHorizontal.Maximum = new decimal(new int[] {
|
this.lblMultiplicadorCorrente.Name = "lblMultiplicadorCorrente";
|
||||||
180,
|
this.lblMultiplicadorCorrente.Size = new System.Drawing.Size(135, 16);
|
||||||
0,
|
this.lblMultiplicadorCorrente.TabIndex = 68;
|
||||||
0,
|
this.lblMultiplicadorCorrente.Text = "Multiplicador Corrente";
|
||||||
0});
|
|
||||||
this.nudAnguloCarimboHorizontal.Name = "nudAnguloCarimboHorizontal";
|
|
||||||
this.nudAnguloCarimboHorizontal.Size = new System.Drawing.Size(60, 23);
|
|
||||||
this.nudAnguloCarimboHorizontal.TabIndex = 58;
|
|
||||||
this.nudAnguloCarimboHorizontal.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
|
||||||
this.nudAnguloCarimboHorizontal.Value = new decimal(new int[] {
|
|
||||||
67,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
//
|
//
|
||||||
// lblAnguloCarimboHorizontal
|
// txtOffsetvelocidade
|
||||||
//
|
//
|
||||||
this.lblAnguloCarimboHorizontal.AutoSize = true;
|
this.txtOffsetvelocidade.Location = new System.Drawing.Point(235, 563);
|
||||||
this.lblAnguloCarimboHorizontal.Location = new System.Drawing.Point(20, 512);
|
this.txtOffsetvelocidade.Name = "txtOffsetvelocidade";
|
||||||
this.lblAnguloCarimboHorizontal.Name = "lblAnguloCarimboHorizontal";
|
this.txtOffsetvelocidade.Size = new System.Drawing.Size(60, 23);
|
||||||
this.lblAnguloCarimboHorizontal.Size = new System.Drawing.Size(162, 16);
|
this.txtOffsetvelocidade.TabIndex = 69;
|
||||||
this.lblAnguloCarimboHorizontal.TabIndex = 57;
|
this.txtOffsetvelocidade.Text = "0";
|
||||||
this.lblAnguloCarimboHorizontal.Text = "Angulo Carimbo Horizontal";
|
this.txtOffsetvelocidade.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||||
//
|
//
|
||||||
// nudAnguloMedicaoIdeal
|
// txtMultiplicadorCorrente
|
||||||
//
|
//
|
||||||
this.nudAnguloMedicaoIdeal.Location = new System.Drawing.Point(235, 572);
|
this.txtMultiplicadorCorrente.Location = new System.Drawing.Point(235, 592);
|
||||||
this.nudAnguloMedicaoIdeal.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.txtMultiplicadorCorrente.Name = "txtMultiplicadorCorrente";
|
||||||
this.nudAnguloMedicaoIdeal.Maximum = new decimal(new int[] {
|
this.txtMultiplicadorCorrente.Size = new System.Drawing.Size(60, 23);
|
||||||
180,
|
this.txtMultiplicadorCorrente.TabIndex = 70;
|
||||||
0,
|
this.txtMultiplicadorCorrente.Text = "1";
|
||||||
0,
|
this.txtMultiplicadorCorrente.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||||
0});
|
|
||||||
this.nudAnguloMedicaoIdeal.Name = "nudAnguloMedicaoIdeal";
|
|
||||||
this.nudAnguloMedicaoIdeal.Size = new System.Drawing.Size(60, 23);
|
|
||||||
this.nudAnguloMedicaoIdeal.TabIndex = 60;
|
|
||||||
this.nudAnguloMedicaoIdeal.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
|
||||||
this.nudAnguloMedicaoIdeal.Value = new decimal(new int[] {
|
|
||||||
132,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
//
|
|
||||||
// lblAnguloMedicaoIdeal
|
|
||||||
//
|
|
||||||
this.lblAnguloMedicaoIdeal.AutoSize = true;
|
|
||||||
this.lblAnguloMedicaoIdeal.Location = new System.Drawing.Point(20, 574);
|
|
||||||
this.lblAnguloMedicaoIdeal.Name = "lblAnguloMedicaoIdeal";
|
|
||||||
this.lblAnguloMedicaoIdeal.Size = new System.Drawing.Size(133, 16);
|
|
||||||
this.lblAnguloMedicaoIdeal.TabIndex = 59;
|
|
||||||
this.lblAnguloMedicaoIdeal.Text = "Angulo Medição Ideal";
|
|
||||||
//
|
|
||||||
// nudAnguloCarimboVertical
|
|
||||||
//
|
|
||||||
this.nudAnguloCarimboVertical.Location = new System.Drawing.Point(235, 541);
|
|
||||||
this.nudAnguloCarimboVertical.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
|
||||||
this.nudAnguloCarimboVertical.Maximum = new decimal(new int[] {
|
|
||||||
180,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.nudAnguloCarimboVertical.Name = "nudAnguloCarimboVertical";
|
|
||||||
this.nudAnguloCarimboVertical.Size = new System.Drawing.Size(60, 23);
|
|
||||||
this.nudAnguloCarimboVertical.TabIndex = 62;
|
|
||||||
this.nudAnguloCarimboVertical.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
|
||||||
this.nudAnguloCarimboVertical.Value = new decimal(new int[] {
|
|
||||||
63,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
//
|
|
||||||
// lblAnguloCarimboVertical
|
|
||||||
//
|
|
||||||
this.lblAnguloCarimboVertical.AutoSize = true;
|
|
||||||
this.lblAnguloCarimboVertical.Location = new System.Drawing.Point(20, 543);
|
|
||||||
this.lblAnguloCarimboVertical.Name = "lblAnguloCarimboVertical";
|
|
||||||
this.lblAnguloCarimboVertical.Size = new System.Drawing.Size(145, 16);
|
|
||||||
this.lblAnguloCarimboVertical.TabIndex = 61;
|
|
||||||
this.lblAnguloCarimboVertical.Text = "Angulo Carimbo Vertical";
|
|
||||||
//
|
|
||||||
// nudAnguloMedicaoMargemLimite
|
|
||||||
//
|
|
||||||
this.nudAnguloMedicaoMargemLimite.Location = new System.Drawing.Point(235, 603);
|
|
||||||
this.nudAnguloMedicaoMargemLimite.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
|
||||||
this.nudAnguloMedicaoMargemLimite.Maximum = new decimal(new int[] {
|
|
||||||
180,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.nudAnguloMedicaoMargemLimite.Name = "nudAnguloMedicaoMargemLimite";
|
|
||||||
this.nudAnguloMedicaoMargemLimite.Size = new System.Drawing.Size(60, 23);
|
|
||||||
this.nudAnguloMedicaoMargemLimite.TabIndex = 64;
|
|
||||||
this.nudAnguloMedicaoMargemLimite.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
|
||||||
this.nudAnguloMedicaoMargemLimite.Value = new decimal(new int[] {
|
|
||||||
20,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
//
|
|
||||||
// lblAnguloMedicaoMargemLimite
|
|
||||||
//
|
|
||||||
this.lblAnguloMedicaoMargemLimite.AutoSize = true;
|
|
||||||
this.lblAnguloMedicaoMargemLimite.Location = new System.Drawing.Point(20, 605);
|
|
||||||
this.lblAnguloMedicaoMargemLimite.Name = "lblAnguloMedicaoMargemLimite";
|
|
||||||
this.lblAnguloMedicaoMargemLimite.Size = new System.Drawing.Size(199, 16);
|
|
||||||
this.lblAnguloMedicaoMargemLimite.TabIndex = 63;
|
|
||||||
this.lblAnguloMedicaoMargemLimite.Text = "Margem Medição Margem Limite";
|
|
||||||
//
|
//
|
||||||
// frmParametros
|
// frmParametros
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(1130, 490);
|
this.ClientSize = new System.Drawing.Size(1130, 490);
|
||||||
this.Controls.Add(this.gpbTipoPerfil);
|
this.Controls.Add(this.gpbVersaoProtocolo);
|
||||||
this.Controls.Add(this.btnSalvarMotores);
|
this.Controls.Add(this.btnSalvarMotores);
|
||||||
this.Controls.Add(this.btnDeFabrica);
|
this.Controls.Add(this.btnDeFabrica);
|
||||||
this.Controls.Add(this.gpbRaque);
|
this.Controls.Add(this.gpbRaque);
|
||||||
|
|
@ -2110,6 +2096,10 @@
|
||||||
this.gpbParametros.ResumeLayout(false);
|
this.gpbParametros.ResumeLayout(false);
|
||||||
this.pnlParametros.ResumeLayout(false);
|
this.pnlParametros.ResumeLayout(false);
|
||||||
this.pnlParametros.PerformLayout();
|
this.pnlParametros.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.nudAnguloMedicaoMargemLimite)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.nudAnguloCarimboVertical)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.nudAnguloMedicaoIdeal)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.nudAnguloCarimboHorizontal)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudCanalReleGeral)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.nudCanalReleGeral)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudEnderecoReleGeral)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.nudEnderecoReleGeral)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudOdometroInspecao)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.nudOdometroInspecao)).EndInit();
|
||||||
|
|
@ -2153,12 +2143,7 @@
|
||||||
this.gpbRaqueMotor.PerformLayout();
|
this.gpbRaqueMotor.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudOffsetDesenrolar)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.nudOffsetDesenrolar)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudOffsetEnrolar)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.nudOffsetEnrolar)).EndInit();
|
||||||
this.gpbTipoPerfil.ResumeLayout(false);
|
this.gpbVersaoProtocolo.ResumeLayout(false);
|
||||||
this.gpbTipoPerfil.PerformLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudAnguloCarimboHorizontal)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudAnguloMedicaoIdeal)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudAnguloCarimboVertical)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudAnguloMedicaoMargemLimite)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -2229,7 +2214,6 @@
|
||||||
public System.Windows.Forms.TextBox txtTensaominima;
|
public System.Windows.Forms.TextBox txtTensaominima;
|
||||||
public System.Windows.Forms.TextBox txtTensaomaxima;
|
public System.Windows.Forms.TextBox txtTensaomaxima;
|
||||||
public System.Windows.Forms.TextBox txtCorrentebateria;
|
public System.Windows.Forms.TextBox txtCorrentebateria;
|
||||||
public System.Windows.Forms.TextBox txtOffsetvelocidade;
|
|
||||||
public System.Windows.Forms.NumericUpDown txtPings;
|
public System.Windows.Forms.NumericUpDown txtPings;
|
||||||
public System.Windows.Forms.NumericUpDown txtResolucao;
|
public System.Windows.Forms.NumericUpDown txtResolucao;
|
||||||
public System.Windows.Forms.NumericUpDown txtComprimentocabo;
|
public System.Windows.Forms.NumericUpDown txtComprimentocabo;
|
||||||
|
|
@ -2255,10 +2239,6 @@
|
||||||
public System.Windows.Forms.NumericUpDown nudDT1Offset;
|
public System.Windows.Forms.NumericUpDown nudDT1Offset;
|
||||||
public System.Windows.Forms.NumericUpDown nudDF2Offset;
|
public System.Windows.Forms.NumericUpDown nudDF2Offset;
|
||||||
public System.Windows.Forms.NumericUpDown nudDF1Offset;
|
public System.Windows.Forms.NumericUpDown nudDF1Offset;
|
||||||
public System.Windows.Forms.TextBox txtCoefB;
|
|
||||||
private System.Windows.Forms.Label lblCoefB;
|
|
||||||
public System.Windows.Forms.TextBox txtCoefA;
|
|
||||||
private System.Windows.Forms.Label lblCoefA;
|
|
||||||
private System.Windows.Forms.Panel pnlAtuadores;
|
private System.Windows.Forms.Panel pnlAtuadores;
|
||||||
public System.Windows.Forms.CheckBox chbRaque;
|
public System.Windows.Forms.CheckBox chbRaque;
|
||||||
private System.Windows.Forms.GroupBox gpbRaque;
|
private System.Windows.Forms.GroupBox gpbRaque;
|
||||||
|
|
@ -2301,10 +2281,7 @@
|
||||||
public System.Windows.Forms.NumericUpDown nudOdometroInspecao;
|
public System.Windows.Forms.NumericUpDown nudOdometroInspecao;
|
||||||
private System.Windows.Forms.Label lblOdometroInspecao;
|
private System.Windows.Forms.Label lblOdometroInspecao;
|
||||||
private System.Windows.Forms.Label lblOdometroInspecaoHrs;
|
private System.Windows.Forms.Label lblOdometroInspecaoHrs;
|
||||||
public System.Windows.Forms.TextBox txtMultiplicadorCorrente;
|
private System.Windows.Forms.GroupBox gpbVersaoProtocolo;
|
||||||
private System.Windows.Forms.GroupBox gpbTipoPerfil;
|
|
||||||
public System.Windows.Forms.RadioButton rdbF4;
|
|
||||||
public System.Windows.Forms.RadioButton rdbF3;
|
|
||||||
public System.Windows.Forms.NumericUpDown nudCanalReleGeral;
|
public System.Windows.Forms.NumericUpDown nudCanalReleGeral;
|
||||||
private System.Windows.Forms.Label lblCanalReleGeral;
|
private System.Windows.Forms.Label lblCanalReleGeral;
|
||||||
public System.Windows.Forms.NumericUpDown nudEnderecoReleGeral;
|
public System.Windows.Forms.NumericUpDown nudEnderecoReleGeral;
|
||||||
|
|
@ -2320,5 +2297,12 @@
|
||||||
private System.Windows.Forms.Label lblAnguloMedicaoIdeal;
|
private System.Windows.Forms.Label lblAnguloMedicaoIdeal;
|
||||||
public System.Windows.Forms.NumericUpDown nudAnguloCarimboHorizontal;
|
public System.Windows.Forms.NumericUpDown nudAnguloCarimboHorizontal;
|
||||||
private System.Windows.Forms.Label lblAnguloCarimboHorizontal;
|
private System.Windows.Forms.Label lblAnguloCarimboHorizontal;
|
||||||
|
public System.Windows.Forms.ComboBox cmbProtocoloVersao;
|
||||||
|
public System.Windows.Forms.CheckBox chbInfDebug;
|
||||||
|
public System.Windows.Forms.CheckBox chbInf;
|
||||||
|
private System.Windows.Forms.Label lblMultiplicadorCorrente;
|
||||||
|
private System.Windows.Forms.Label lblOffsetVelocidade;
|
||||||
|
public System.Windows.Forms.TextBox txtMultiplicadorCorrente;
|
||||||
|
public System.Windows.Forms.TextBox txtOffsetvelocidade;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7,6 +7,8 @@ namespace OrionTardPro
|
||||||
{
|
{
|
||||||
public partial class frmParametros : Form
|
public partial class frmParametros : Form
|
||||||
{
|
{
|
||||||
|
private bool isAdm => Variaveis.licencaModel.CPF == "425.855.768-41";
|
||||||
|
|
||||||
public frmParametros()
|
public frmParametros()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
@ -14,6 +16,10 @@ namespace OrionTardPro
|
||||||
|
|
||||||
private void frmParametros_Load(object sender, EventArgs e)
|
private void frmParametros_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
cmbProtocoloVersao.Items.Clear();
|
||||||
|
cmbProtocoloVersao.Items.AddRange(Enum.GetNames(typeof(VersaoProtocolo)));
|
||||||
|
cmbProtocoloVersao.SelectedItem = Variaveis.PerfilVigente.VersaoProtocolo.ToString();
|
||||||
|
|
||||||
nudOdometroInspecao.Value = Variaveis.PerfilVigente.OdometroInspecao;
|
nudOdometroInspecao.Value = Variaveis.PerfilVigente.OdometroInspecao;
|
||||||
txtPings.Value = Variaveis.PerfilVigente.NumeroPingsMaximo;
|
txtPings.Value = Variaveis.PerfilVigente.NumeroPingsMaximo;
|
||||||
nudRPM.Value = Convert.ToInt32(Variaveis.PerfilVigente.RPM);
|
nudRPM.Value = Convert.ToInt32(Variaveis.PerfilVigente.RPM);
|
||||||
|
|
@ -24,8 +30,6 @@ namespace OrionTardPro
|
||||||
txtTensaominima.Text = Variaveis.PerfilVigente.TensaoMinimaBateria.ToString();
|
txtTensaominima.Text = Variaveis.PerfilVigente.TensaoMinimaBateria.ToString();
|
||||||
txtResolucao.Value = Variaveis.PerfilVigente.ResolucaoLeitura;
|
txtResolucao.Value = Variaveis.PerfilVigente.ResolucaoLeitura;
|
||||||
txtCorrentebateria.Text = Variaveis.PerfilVigente.CorrenteMaximaBateria.ToString();
|
txtCorrentebateria.Text = Variaveis.PerfilVigente.CorrenteMaximaBateria.ToString();
|
||||||
txtCoefA.Text = Variaveis.PerfilVigente.COR_coeficienteA.ToString();
|
|
||||||
txtCoefB.Text = Variaveis.PerfilVigente.COR_coeficienteB.ToString();
|
|
||||||
txtMultiplicadorCorrente.Text = Variaveis.PerfilVigente.COR_multiplicador.ToString();
|
txtMultiplicadorCorrente.Text = Variaveis.PerfilVigente.COR_multiplicador.ToString();
|
||||||
txtComprimentocabo.Value = Convert.ToInt32(Variaveis.PerfilVigente.ComprimentoCabo);
|
txtComprimentocabo.Value = Convert.ToInt32(Variaveis.PerfilVigente.ComprimentoCabo);
|
||||||
txtPotenciamaxima.Text = Variaveis.PerfilVigente.PotenciaMaxima.ToString();
|
txtPotenciamaxima.Text = Variaveis.PerfilVigente.PotenciaMaxima.ToString();
|
||||||
|
|
@ -40,8 +44,6 @@ namespace OrionTardPro
|
||||||
nudDT2Offset.Value = Variaveis.PerfilVigente.Offsett_Driver2_Tras;
|
nudDT2Offset.Value = Variaveis.PerfilVigente.Offsett_Driver2_Tras;
|
||||||
nudOffsetEnrolar.Value = Variaveis.PerfilVigente.Offsett_Raque_Enrolar;
|
nudOffsetEnrolar.Value = Variaveis.PerfilVigente.Offsett_Raque_Enrolar;
|
||||||
nudOffsetDesenrolar.Value = Variaveis.PerfilVigente.Offsett_Raque_Desenrolar;
|
nudOffsetDesenrolar.Value = Variaveis.PerfilVigente.Offsett_Raque_Desenrolar;
|
||||||
rdbF3.Checked = !Variaveis.PerfilVigente.FirmwareF4;
|
|
||||||
rdbF4.Checked = Variaveis.PerfilVigente.FirmwareF4;
|
|
||||||
nudEnderecoReleGeral.Value = Variaveis.PerfilVigente.EnderecoReleGeral;
|
nudEnderecoReleGeral.Value = Variaveis.PerfilVigente.EnderecoReleGeral;
|
||||||
nudCanalReleGeral.Value = Variaveis.PerfilVigente.CanalReleGeral;
|
nudCanalReleGeral.Value = Variaveis.PerfilVigente.CanalReleGeral;
|
||||||
nudAnguloCarimboHorizontal.Value = Variaveis.PerfilVigente.AnguloCarimboHorizontal;
|
nudAnguloCarimboHorizontal.Value = Variaveis.PerfilVigente.AnguloCarimboHorizontal;
|
||||||
|
|
@ -68,7 +70,6 @@ namespace OrionTardPro
|
||||||
chbBrc.Checked = Variaveis.PerfilVigente.Atuador_Ativado_BRC == Estado.Ligado;
|
chbBrc.Checked = Variaveis.PerfilVigente.Atuador_Ativado_BRC == Estado.Ligado;
|
||||||
chbMep.Checked = Variaveis.PerfilVigente.Atuador_Ativado_MEP == Estado.Ligado;
|
chbMep.Checked = Variaveis.PerfilVigente.Atuador_Ativado_MEP == Estado.Ligado;
|
||||||
|
|
||||||
bool isAdm = Variaveis.licencaModel.CPF == "425.855.768-41";
|
|
||||||
btnZerar.Enabled = isAdm;
|
btnZerar.Enabled = isAdm;
|
||||||
btnDefinir.Enabled = isAdm;
|
btnDefinir.Enabled = isAdm;
|
||||||
|
|
||||||
|
|
@ -141,8 +142,6 @@ namespace OrionTardPro
|
||||||
Variaveis.PerfilVigente.ResolucaoLeitura = Convert.ToInt32(txtResolucao.Value);
|
Variaveis.PerfilVigente.ResolucaoLeitura = Convert.ToInt32(txtResolucao.Value);
|
||||||
Variaveis.PerfilVigente.ValorMaximoAnalogico = Convert.ToInt32(Math.Pow(2, Variaveis.PerfilVigente.ResolucaoLeitura));
|
Variaveis.PerfilVigente.ValorMaximoAnalogico = Convert.ToInt32(Math.Pow(2, Variaveis.PerfilVigente.ResolucaoLeitura));
|
||||||
Variaveis.PerfilVigente.CorrenteMaximaBateria = Convert.ToDouble(txtCorrentebateria.Text);
|
Variaveis.PerfilVigente.CorrenteMaximaBateria = Convert.ToDouble(txtCorrentebateria.Text);
|
||||||
Variaveis.PerfilVigente.COR_coeficienteA = Convert.ToDouble(txtCoefA.Text);
|
|
||||||
Variaveis.PerfilVigente.COR_coeficienteB = Convert.ToDouble(txtCoefB.Text);
|
|
||||||
Variaveis.PerfilVigente.COR_multiplicador = Convert.ToDouble(txtMultiplicadorCorrente.Text);
|
Variaveis.PerfilVigente.COR_multiplicador = Convert.ToDouble(txtMultiplicadorCorrente.Text);
|
||||||
Variaveis.PerfilVigente.ComprimentoCabo = Convert.ToInt32(txtComprimentocabo.Value);
|
Variaveis.PerfilVigente.ComprimentoCabo = Convert.ToInt32(txtComprimentocabo.Value);
|
||||||
Variaveis.PerfilVigente.PotenciaMaxima = Convert.ToInt32(txtPotenciamaxima.Value);
|
Variaveis.PerfilVigente.PotenciaMaxima = Convert.ToInt32(txtPotenciamaxima.Value);
|
||||||
|
|
@ -163,7 +162,11 @@ namespace OrionTardPro
|
||||||
Variaveis.PerfilVigente.InverterRotacaoEsquerda = chbInvEsquerda.Checked;
|
Variaveis.PerfilVigente.InverterRotacaoEsquerda = chbInvEsquerda.Checked;
|
||||||
Variaveis.PerfilVigente.OdometroInspecao = Convert.ToInt32(nudOdometroInspecao.Value);
|
Variaveis.PerfilVigente.OdometroInspecao = Convert.ToInt32(nudOdometroInspecao.Value);
|
||||||
|
|
||||||
Variaveis.PerfilVigente.FirmwareF4 = rdbF4.Checked;
|
Variaveis.PerfilVigente.VersaoProtocolo =
|
||||||
|
(VersaoProtocolo)Enum.Parse(
|
||||||
|
typeof(VersaoProtocolo),
|
||||||
|
cmbProtocoloVersao.SelectedItem.ToString()
|
||||||
|
);
|
||||||
Variaveis.PerfilVigente.EnderecoReleGeral = Convert.ToByte(nudEnderecoReleGeral.Value);
|
Variaveis.PerfilVigente.EnderecoReleGeral = Convert.ToByte(nudEnderecoReleGeral.Value);
|
||||||
Variaveis.PerfilVigente.CanalReleGeral = Convert.ToInt32(nudCanalReleGeral.Value);
|
Variaveis.PerfilVigente.CanalReleGeral = Convert.ToInt32(nudCanalReleGeral.Value);
|
||||||
|
|
||||||
|
|
@ -178,6 +181,7 @@ namespace OrionTardPro
|
||||||
|
|
||||||
private void btnZerar_Click(object sender, EventArgs e)
|
private void btnZerar_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (!isAdm) return;
|
||||||
if (MessageBox.Show("Tem certeza que deseja resetar todos os odômetros?", "Confirmação", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
|
if (MessageBox.Show("Tem certeza que deseja resetar todos os odômetros?", "Confirmação", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
Variaveis.FuncaoOdometro = Estado.Reset;
|
Variaveis.FuncaoOdometro = Estado.Reset;
|
||||||
|
|
@ -253,6 +257,7 @@ namespace OrionTardPro
|
||||||
|
|
||||||
private void btnDefinir_Click(object sender, EventArgs e)
|
private void btnDefinir_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (!isAdm) return;
|
||||||
if (MessageBox.Show("Tem certeza que deseja redefinir o valor atual do odometro " + cmbTipoodometro.Text + " para " + nudOdoValor.Value.ToString() + "?", "Redefinir valor do odometro", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
if (MessageBox.Show("Tem certeza que deseja redefinir o valor atual do odometro " + cmbTipoodometro.Text + " para " + nudOdoValor.Value.ToString() + "?", "Redefinir valor do odometro", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
Variaveis.FuncaoOdometro = Estado.Desligado;
|
Variaveis.FuncaoOdometro = Estado.Desligado;
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,9 @@
|
||||||
this.pnlEsquerdo = new System.Windows.Forms.Panel();
|
this.pnlEsquerdo = new System.Windows.Forms.Panel();
|
||||||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||||
this.tabSensores = new System.Windows.Forms.TabPage();
|
this.tabSensores = new System.Windows.Forms.TabPage();
|
||||||
|
this.gpbInfiltracao = new System.Windows.Forms.GroupBox();
|
||||||
|
this.lblInfiltracaoEstado = new System.Windows.Forms.Label();
|
||||||
|
this.lblInfiltracaoPercentual = new System.Windows.Forms.Label();
|
||||||
this.gpbOdometro = new System.Windows.Forms.GroupBox();
|
this.gpbOdometro = new System.Windows.Forms.GroupBox();
|
||||||
this.lblOdometroTempo = new System.Windows.Forms.Label();
|
this.lblOdometroTempo = new System.Windows.Forms.Label();
|
||||||
this.imgOdometro = new System.Windows.Forms.PictureBox();
|
this.imgOdometro = new System.Windows.Forms.PictureBox();
|
||||||
|
|
@ -92,6 +95,7 @@
|
||||||
this.imgLampGasVerm = new System.Windows.Forms.PictureBox();
|
this.imgLampGasVerm = new System.Windows.Forms.PictureBox();
|
||||||
this.tabControle = new System.Windows.Forms.TabPage();
|
this.tabControle = new System.Windows.Forms.TabPage();
|
||||||
this.gpbMedidorEspessura = new System.Windows.Forms.GroupBox();
|
this.gpbMedidorEspessura = new System.Windows.Forms.GroupBox();
|
||||||
|
this.btnMedir = new System.Windows.Forms.Button();
|
||||||
this.lblMepStatus = new System.Windows.Forms.Label();
|
this.lblMepStatus = new System.Windows.Forms.Label();
|
||||||
this.imgMepContato = new System.Windows.Forms.PictureBox();
|
this.imgMepContato = new System.Windows.Forms.PictureBox();
|
||||||
this.btnCarimbar = new System.Windows.Forms.Button();
|
this.btnCarimbar = new System.Windows.Forms.Button();
|
||||||
|
|
@ -154,7 +158,6 @@
|
||||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
this.tmrTempoAtivo = new System.Windows.Forms.Timer(this.components);
|
this.tmrTempoAtivo = new System.Windows.Forms.Timer(this.components);
|
||||||
this.tmrVelocidade = new System.Windows.Forms.Timer(this.components);
|
this.tmrVelocidade = new System.Windows.Forms.Timer(this.components);
|
||||||
this.btnMedir = new System.Windows.Forms.Button();
|
|
||||||
this.lblCarroconexao = new System.Windows.Forms.ToolStripStatusLabel();
|
this.lblCarroconexao = new System.Windows.Forms.ToolStripStatusLabel();
|
||||||
this.lblJoystickconexao = new System.Windows.Forms.ToolStripStatusLabel();
|
this.lblJoystickconexao = new System.Windows.Forms.ToolStripStatusLabel();
|
||||||
this.lblCameraconexao = new System.Windows.Forms.ToolStripStatusLabel();
|
this.lblCameraconexao = new System.Windows.Forms.ToolStripStatusLabel();
|
||||||
|
|
@ -173,6 +176,7 @@
|
||||||
this.pnlEsquerdo.SuspendLayout();
|
this.pnlEsquerdo.SuspendLayout();
|
||||||
this.tabControl1.SuspendLayout();
|
this.tabControl1.SuspendLayout();
|
||||||
this.tabSensores.SuspendLayout();
|
this.tabSensores.SuspendLayout();
|
||||||
|
this.gpbInfiltracao.SuspendLayout();
|
||||||
this.gpbOdometro.SuspendLayout();
|
this.gpbOdometro.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.imgOdometro)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.imgOdometro)).BeginInit();
|
||||||
this.gpbAltitude.SuspendLayout();
|
this.gpbAltitude.SuspendLayout();
|
||||||
|
|
@ -246,7 +250,7 @@
|
||||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.menuStrip1.Name = "menuStrip1";
|
this.menuStrip1.Name = "menuStrip1";
|
||||||
this.menuStrip1.Padding = new System.Windows.Forms.Padding(4, 2, 0, 2);
|
this.menuStrip1.Padding = new System.Windows.Forms.Padding(4, 2, 0, 2);
|
||||||
this.menuStrip1.Size = new System.Drawing.Size(1294, 24);
|
this.menuStrip1.Size = new System.Drawing.Size(1358, 24);
|
||||||
this.menuStrip1.TabIndex = 0;
|
this.menuStrip1.TabIndex = 0;
|
||||||
this.menuStrip1.Text = "menuStrip1";
|
this.menuStrip1.Text = "menuStrip1";
|
||||||
//
|
//
|
||||||
|
|
@ -488,6 +492,7 @@
|
||||||
// tabSensores
|
// tabSensores
|
||||||
//
|
//
|
||||||
this.tabSensores.AutoScroll = true;
|
this.tabSensores.AutoScroll = true;
|
||||||
|
this.tabSensores.Controls.Add(this.gpbInfiltracao);
|
||||||
this.tabSensores.Controls.Add(this.gpbOdometro);
|
this.tabSensores.Controls.Add(this.gpbOdometro);
|
||||||
this.tabSensores.Controls.Add(this.gpbAltitude);
|
this.tabSensores.Controls.Add(this.gpbAltitude);
|
||||||
this.tabSensores.Controls.Add(this.gpbInclinacao);
|
this.tabSensores.Controls.Add(this.gpbInclinacao);
|
||||||
|
|
@ -503,12 +508,43 @@
|
||||||
this.tabSensores.Text = "Monitoramento";
|
this.tabSensores.Text = "Monitoramento";
|
||||||
this.tabSensores.UseVisualStyleBackColor = true;
|
this.tabSensores.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
// gpbInfiltracao
|
||||||
|
//
|
||||||
|
this.gpbInfiltracao.Controls.Add(this.lblInfiltracaoEstado);
|
||||||
|
this.gpbInfiltracao.Controls.Add(this.lblInfiltracaoPercentual);
|
||||||
|
this.gpbInfiltracao.Location = new System.Drawing.Point(4, 576);
|
||||||
|
this.gpbInfiltracao.Name = "gpbInfiltracao";
|
||||||
|
this.gpbInfiltracao.Size = new System.Drawing.Size(178, 80);
|
||||||
|
this.gpbInfiltracao.TabIndex = 4;
|
||||||
|
this.gpbInfiltracao.TabStop = false;
|
||||||
|
this.gpbInfiltracao.Text = "Infiltração";
|
||||||
|
//
|
||||||
|
// lblInfiltracaoEstado
|
||||||
|
//
|
||||||
|
this.lblInfiltracaoEstado.AutoSize = true;
|
||||||
|
this.lblInfiltracaoEstado.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.lblInfiltracaoEstado.Location = new System.Drawing.Point(9, 45);
|
||||||
|
this.lblInfiltracaoEstado.Name = "lblInfiltracaoEstado";
|
||||||
|
this.lblInfiltracaoEstado.Size = new System.Drawing.Size(105, 20);
|
||||||
|
this.lblInfiltracaoEstado.TabIndex = 30;
|
||||||
|
this.lblInfiltracaoEstado.Text = "Estado: Seco";
|
||||||
|
//
|
||||||
|
// lblInfiltracaoPercentual
|
||||||
|
//
|
||||||
|
this.lblInfiltracaoPercentual.AutoSize = true;
|
||||||
|
this.lblInfiltracaoPercentual.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.lblInfiltracaoPercentual.Location = new System.Drawing.Point(9, 21);
|
||||||
|
this.lblInfiltracaoPercentual.Name = "lblInfiltracaoPercentual";
|
||||||
|
this.lblInfiltracaoPercentual.Size = new System.Drawing.Size(102, 20);
|
||||||
|
this.lblInfiltracaoPercentual.TabIndex = 29;
|
||||||
|
this.lblInfiltracaoPercentual.Text = "Risco: 0,00%";
|
||||||
|
//
|
||||||
// gpbOdometro
|
// gpbOdometro
|
||||||
//
|
//
|
||||||
this.gpbOdometro.Controls.Add(this.lblOdometroTempo);
|
this.gpbOdometro.Controls.Add(this.lblOdometroTempo);
|
||||||
this.gpbOdometro.Controls.Add(this.imgOdometro);
|
this.gpbOdometro.Controls.Add(this.imgOdometro);
|
||||||
this.gpbOdometro.Controls.Add(this.lblOdometroMetros);
|
this.gpbOdometro.Controls.Add(this.lblOdometroMetros);
|
||||||
this.gpbOdometro.Location = new System.Drawing.Point(4, 576);
|
this.gpbOdometro.Location = new System.Drawing.Point(4, 662);
|
||||||
this.gpbOdometro.Name = "gpbOdometro";
|
this.gpbOdometro.Name = "gpbOdometro";
|
||||||
this.gpbOdometro.Size = new System.Drawing.Size(178, 90);
|
this.gpbOdometro.Size = new System.Drawing.Size(178, 90);
|
||||||
this.gpbOdometro.TabIndex = 29;
|
this.gpbOdometro.TabIndex = 29;
|
||||||
|
|
@ -631,6 +667,7 @@
|
||||||
this.lblInclinacaox.Size = new System.Drawing.Size(50, 13);
|
this.lblInclinacaox.Size = new System.Drawing.Size(50, 13);
|
||||||
this.lblInclinacaox.TabIndex = 0;
|
this.lblInclinacaox.TabIndex = 0;
|
||||||
this.lblInclinacaox.Text = "L: 0.000°";
|
this.lblInclinacaox.Text = "L: 0.000°";
|
||||||
|
this.lblInclinacaox.DoubleClick += new System.EventHandler(this.pnlInclinacaoX_DoubleClick);
|
||||||
//
|
//
|
||||||
// lblInclinacaoy
|
// lblInclinacaoy
|
||||||
//
|
//
|
||||||
|
|
@ -640,6 +677,7 @@
|
||||||
this.lblInclinacaoy.Size = new System.Drawing.Size(50, 13);
|
this.lblInclinacaoy.Size = new System.Drawing.Size(50, 13);
|
||||||
this.lblInclinacaoy.TabIndex = 1;
|
this.lblInclinacaoy.TabIndex = 1;
|
||||||
this.lblInclinacaoy.Text = "F: 0.000°";
|
this.lblInclinacaoy.Text = "F: 0.000°";
|
||||||
|
this.lblInclinacaoy.DoubleClick += new System.EventHandler(this.pnlInclinacaoY_DoubleClick);
|
||||||
//
|
//
|
||||||
// gpbNivelbateria
|
// gpbNivelbateria
|
||||||
//
|
//
|
||||||
|
|
@ -879,6 +917,16 @@
|
||||||
this.gpbMedidorEspessura.TabStop = false;
|
this.gpbMedidorEspessura.TabStop = false;
|
||||||
this.gpbMedidorEspessura.Text = "Medidor de Espessura";
|
this.gpbMedidorEspessura.Text = "Medidor de Espessura";
|
||||||
//
|
//
|
||||||
|
// btnMedir
|
||||||
|
//
|
||||||
|
this.btnMedir.Location = new System.Drawing.Point(6, 49);
|
||||||
|
this.btnMedir.Name = "btnMedir";
|
||||||
|
this.btnMedir.Size = new System.Drawing.Size(69, 23);
|
||||||
|
this.btnMedir.TabIndex = 33;
|
||||||
|
this.btnMedir.Text = "Medir";
|
||||||
|
this.btnMedir.UseVisualStyleBackColor = true;
|
||||||
|
this.btnMedir.Click += new System.EventHandler(this.btnMedir_Click);
|
||||||
|
//
|
||||||
// lblMepStatus
|
// lblMepStatus
|
||||||
//
|
//
|
||||||
this.lblMepStatus.AutoSize = true;
|
this.lblMepStatus.AutoSize = true;
|
||||||
|
|
@ -1243,7 +1291,7 @@
|
||||||
this.pnlDireito.Controls.Add(this.lblDeslocamentovalor);
|
this.pnlDireito.Controls.Add(this.lblDeslocamentovalor);
|
||||||
this.pnlDireito.Controls.Add(this.lblInicio);
|
this.pnlDireito.Controls.Add(this.lblInicio);
|
||||||
this.pnlDireito.Dock = System.Windows.Forms.DockStyle.Right;
|
this.pnlDireito.Dock = System.Windows.Forms.DockStyle.Right;
|
||||||
this.pnlDireito.Location = new System.Drawing.Point(1086, 24);
|
this.pnlDireito.Location = new System.Drawing.Point(1150, 24);
|
||||||
this.pnlDireito.Name = "pnlDireito";
|
this.pnlDireito.Name = "pnlDireito";
|
||||||
this.pnlDireito.Size = new System.Drawing.Size(208, 621);
|
this.pnlDireito.Size = new System.Drawing.Size(208, 621);
|
||||||
this.pnlDireito.TabIndex = 2;
|
this.pnlDireito.TabIndex = 2;
|
||||||
|
|
@ -1299,7 +1347,7 @@
|
||||||
this.pnlCentro.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.pnlCentro.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.pnlCentro.Location = new System.Drawing.Point(208, 24);
|
this.pnlCentro.Location = new System.Drawing.Point(208, 24);
|
||||||
this.pnlCentro.Name = "pnlCentro";
|
this.pnlCentro.Name = "pnlCentro";
|
||||||
this.pnlCentro.Size = new System.Drawing.Size(878, 530);
|
this.pnlCentro.Size = new System.Drawing.Size(942, 530);
|
||||||
this.pnlCentro.TabIndex = 3;
|
this.pnlCentro.TabIndex = 3;
|
||||||
//
|
//
|
||||||
// lblMensagemaviso
|
// lblMensagemaviso
|
||||||
|
|
@ -1338,7 +1386,7 @@
|
||||||
this.imgCamera.Location = new System.Drawing.Point(0, 0);
|
this.imgCamera.Location = new System.Drawing.Point(0, 0);
|
||||||
this.imgCamera.Margin = new System.Windows.Forms.Padding(20);
|
this.imgCamera.Margin = new System.Windows.Forms.Padding(20);
|
||||||
this.imgCamera.Name = "imgCamera";
|
this.imgCamera.Name = "imgCamera";
|
||||||
this.imgCamera.Size = new System.Drawing.Size(878, 530);
|
this.imgCamera.Size = new System.Drawing.Size(942, 530);
|
||||||
this.imgCamera.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
this.imgCamera.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||||
this.imgCamera.TabIndex = 0;
|
this.imgCamera.TabIndex = 0;
|
||||||
this.imgCamera.TabStop = false;
|
this.imgCamera.TabStop = false;
|
||||||
|
|
@ -1355,7 +1403,7 @@
|
||||||
this.pnlCameraBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
|
this.pnlCameraBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
this.pnlCameraBottom.Location = new System.Drawing.Point(208, 554);
|
this.pnlCameraBottom.Location = new System.Drawing.Point(208, 554);
|
||||||
this.pnlCameraBottom.Name = "pnlCameraBottom";
|
this.pnlCameraBottom.Name = "pnlCameraBottom";
|
||||||
this.pnlCameraBottom.Size = new System.Drawing.Size(878, 91);
|
this.pnlCameraBottom.Size = new System.Drawing.Size(942, 91);
|
||||||
this.pnlCameraBottom.TabIndex = 1;
|
this.pnlCameraBottom.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// gpbGravacao
|
// gpbGravacao
|
||||||
|
|
@ -1594,16 +1642,6 @@
|
||||||
this.tmrVelocidade.Interval = 10;
|
this.tmrVelocidade.Interval = 10;
|
||||||
this.tmrVelocidade.Tick += new System.EventHandler(this.tmrVelocidade_Tick);
|
this.tmrVelocidade.Tick += new System.EventHandler(this.tmrVelocidade_Tick);
|
||||||
//
|
//
|
||||||
// btnMedir
|
|
||||||
//
|
|
||||||
this.btnMedir.Location = new System.Drawing.Point(6, 49);
|
|
||||||
this.btnMedir.Name = "btnMedir";
|
|
||||||
this.btnMedir.Size = new System.Drawing.Size(69, 23);
|
|
||||||
this.btnMedir.TabIndex = 33;
|
|
||||||
this.btnMedir.Text = "Medir";
|
|
||||||
this.btnMedir.UseVisualStyleBackColor = true;
|
|
||||||
this.btnMedir.Click += new System.EventHandler(this.btnMedir_Click);
|
|
||||||
//
|
|
||||||
// lblCarroconexao
|
// lblCarroconexao
|
||||||
//
|
//
|
||||||
this.lblCarroconexao.Name = "lblCarroconexao";
|
this.lblCarroconexao.Name = "lblCarroconexao";
|
||||||
|
|
@ -1703,7 +1741,7 @@
|
||||||
this.lblTempo});
|
this.lblTempo});
|
||||||
this.statusStrip1.Location = new System.Drawing.Point(0, 645);
|
this.statusStrip1.Location = new System.Drawing.Point(0, 645);
|
||||||
this.statusStrip1.Name = "statusStrip1";
|
this.statusStrip1.Name = "statusStrip1";
|
||||||
this.statusStrip1.Size = new System.Drawing.Size(1294, 22);
|
this.statusStrip1.Size = new System.Drawing.Size(1358, 22);
|
||||||
this.statusStrip1.TabIndex = 1;
|
this.statusStrip1.TabIndex = 1;
|
||||||
this.statusStrip1.Text = "statusStrip1";
|
this.statusStrip1.Text = "statusStrip1";
|
||||||
//
|
//
|
||||||
|
|
@ -1711,7 +1749,7 @@
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(1294, 667);
|
this.ClientSize = new System.Drawing.Size(1358, 667);
|
||||||
this.Controls.Add(this.pnlCentro);
|
this.Controls.Add(this.pnlCentro);
|
||||||
this.Controls.Add(this.pnlCameraBottom);
|
this.Controls.Add(this.pnlCameraBottom);
|
||||||
this.Controls.Add(this.pnlDireito);
|
this.Controls.Add(this.pnlDireito);
|
||||||
|
|
@ -1732,6 +1770,8 @@
|
||||||
this.pnlEsquerdo.ResumeLayout(false);
|
this.pnlEsquerdo.ResumeLayout(false);
|
||||||
this.tabControl1.ResumeLayout(false);
|
this.tabControl1.ResumeLayout(false);
|
||||||
this.tabSensores.ResumeLayout(false);
|
this.tabSensores.ResumeLayout(false);
|
||||||
|
this.gpbInfiltracao.ResumeLayout(false);
|
||||||
|
this.gpbInfiltracao.PerformLayout();
|
||||||
this.gpbOdometro.ResumeLayout(false);
|
this.gpbOdometro.ResumeLayout(false);
|
||||||
this.gpbOdometro.PerformLayout();
|
this.gpbOdometro.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.imgOdometro)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.imgOdometro)).EndInit();
|
||||||
|
|
@ -1951,6 +1991,9 @@
|
||||||
private System.Windows.Forms.ToolStripStatusLabel lblDivisor4;
|
private System.Windows.Forms.ToolStripStatusLabel lblDivisor4;
|
||||||
private System.Windows.Forms.ToolStripStatusLabel lblTempo;
|
private System.Windows.Forms.ToolStripStatusLabel lblTempo;
|
||||||
private System.Windows.Forms.StatusStrip statusStrip1;
|
private System.Windows.Forms.StatusStrip statusStrip1;
|
||||||
|
private System.Windows.Forms.GroupBox gpbInfiltracao;
|
||||||
|
public System.Windows.Forms.Label lblInfiltracaoEstado;
|
||||||
|
public System.Windows.Forms.Label lblInfiltracaoPercentual;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
using OrionTardPro.Services;
|
using OrionTardPro.Services;
|
||||||
using System;
|
using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
@ -23,6 +24,14 @@ namespace OrionTardPro
|
||||||
public System.Drawing.Point P1Odometro;
|
public System.Drawing.Point P1Odometro;
|
||||||
public System.Drawing.Point P2Odometro;
|
public System.Drawing.Point P2Odometro;
|
||||||
Timer tmrAtualizacao;
|
Timer tmrAtualizacao;
|
||||||
|
private bool _estadoConexaoAnterior;
|
||||||
|
private bool _alarmeInfiltracaoAnterior;
|
||||||
|
private byte? _mascaraSaudeAnterior;
|
||||||
|
private bool _encerramentoConfirmado;
|
||||||
|
private readonly Stopwatch _relogioTempoAtivo = Stopwatch.StartNew();
|
||||||
|
private readonly Stopwatch _relogioTempoConectado = new Stopwatch();
|
||||||
|
private DateTime _ultimaAtualizacaoPainelDeslocamentoUtc = DateTime.MinValue;
|
||||||
|
private const int IntervaloPainelDeslocamentoMs = 50;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
@ -41,8 +50,12 @@ namespace OrionTardPro
|
||||||
pnlDireito.GetType().GetMethod("SetStyle", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).Invoke(pnlDireito, new object[] { ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true });
|
pnlDireito.GetType().GetMethod("SetStyle", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).Invoke(pnlDireito, new object[] { ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void frmPrincipal_Load(object sender, EventArgs e)
|
private async void frmPrincipal_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
// Monitor leve de campo: mede stalls da UI, filas, memória/GDI e
|
||||||
|
// operações lentas sem bloquear a interface para gravar diagnóstico.
|
||||||
|
PerformanceMonitorService.Inicializar(this);
|
||||||
|
|
||||||
AtualizaDadosProjeto();
|
AtualizaDadosProjeto();
|
||||||
imgEspelharY.BackgroundImage.RotateFlip(RotateFlipType.Rotate90FlipY);
|
imgEspelharY.BackgroundImage.RotateFlip(RotateFlipType.Rotate90FlipY);
|
||||||
|
|
||||||
|
|
@ -67,14 +80,22 @@ namespace OrionTardPro
|
||||||
Dicas.SetToolTip(imgPausarGravacao, "Pausa a gravação do vídeo");
|
Dicas.SetToolTip(imgPausarGravacao, "Pausa a gravação do vídeo");
|
||||||
Dicas.SetToolTip(imgPararGravacao, "Finaliza a gravação do vídeo");
|
Dicas.SetToolTip(imgPararGravacao, "Finaliza a gravação do vídeo");
|
||||||
|
|
||||||
GeneralJoystick.InstanciaJoystick();
|
// Descobertas de hardware podem demorar em drivers problemáticos.
|
||||||
|
// Elas agora rodam fora da UI thread, mantendo o formulário responsivo.
|
||||||
Variaveis.frmCamera.AtualizaListaCameras();
|
await GeneralJoystick.InstanciaJoystickAsync();
|
||||||
|
await Variaveis.frmCamera.AtualizaListaCamerasAsync();
|
||||||
|
|
||||||
tmrAtualizacao = new Timer();
|
tmrAtualizacao = new Timer();
|
||||||
tmrAtualizacao.Interval = 500;
|
tmrAtualizacao.Interval = 500;
|
||||||
tmrAtualizacao.Tick += tmrAtualizacao_Tick;
|
tmrAtualizacao.Tick += tmrAtualizacao_Tick;
|
||||||
tmrAtualizacao.Start();
|
tmrAtualizacao.Start();
|
||||||
|
|
||||||
|
_estadoConexaoAnterior = SerialService.Conectado;
|
||||||
|
if (_estadoConexaoAnterior)
|
||||||
|
_relogioTempoConectado.Start();
|
||||||
|
_alarmeInfiltracaoAnterior = SerialService.AlarmeInfiltracaoV6;
|
||||||
|
LogsFuncoes.IniciarGeoWatcher();
|
||||||
|
_ = LogsFuncoes.TentarEnviarPendentesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tmrAtualizacao_Tick(object sender, EventArgs e)
|
private void tmrAtualizacao_Tick(object sender, EventArgs e)
|
||||||
|
|
@ -85,24 +106,40 @@ namespace OrionTardPro
|
||||||
"Parado";
|
"Parado";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void frmPrincipal_FormClosed(object sender, FormClosedEventArgs e)
|
|
||||||
{
|
|
||||||
Environment.Exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void frmPrincipal_FormClosing(object sender, FormClosingEventArgs e)
|
private void frmPrincipal_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
|
|
||||||
{
|
{
|
||||||
LogsFuncoes.RegistrarLog();
|
if (_encerramentoConfirmado)
|
||||||
|
return;
|
||||||
|
|
||||||
if (MessageBox.Show("Tem certeza que deseja sair?", "Sair", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
if (MessageBox.Show("Tem certeza que deseja sair?", "Sair", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||||
{
|
{
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
GeneralJoystick.ParadaSegura("encerramento da aplicação");
|
||||||
|
|
||||||
|
// Finaliza captura/gravação com espera limitada apenas no encerramento.
|
||||||
|
VideoService.Encerrar();
|
||||||
|
|
||||||
|
// Garante que odômetro/configurações operacionais pendentes
|
||||||
|
// sejam persistidos antes de encerrar o processo.
|
||||||
|
Variaveis.FlushPersistenciaPendente();
|
||||||
|
|
||||||
|
_encerramentoConfirmado = true;
|
||||||
|
if (LogsFuncoes.TemAtividadeNoPeriodo || SerialService.TempoConectado > 0)
|
||||||
{
|
{
|
||||||
try { Environment.Exit(0); } catch { }
|
LogsFuncoes.RegistrarLog(
|
||||||
|
TipoEventoLog.Encerramento,
|
||||||
|
"Aplicação encerrada pelo usuário.",
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
|
LogsFuncoes.EncerrarGeoWatcher();
|
||||||
|
|
||||||
|
// Mantém o monitor ativo durante toda a sequência de encerramento
|
||||||
|
// para registrar qualquer operação lenta antes de finalizar.
|
||||||
|
PerformanceMonitorService.Encerrar();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -127,9 +164,9 @@ namespace OrionTardPro
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void desconectarToolStripMenuItem_Click(object sender, EventArgs e)
|
private async void desconectarToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
SerialService.Desconectar().ConfigureAwait(false);
|
await SerialService.Desconectar();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnConfcamera_Click(object sender, EventArgs e)
|
private void btnConfcamera_Click(object sender, EventArgs e)
|
||||||
|
|
@ -368,19 +405,37 @@ namespace OrionTardPro
|
||||||
|
|
||||||
private void pnlInclinacaoX_DoubleClick(object sender, EventArgs e)
|
private void pnlInclinacaoX_DoubleClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (SerialService.Conectado && Variaveis.PerfilVigente.Sensor_Ativado_MPU == Estado.Ligado)
|
if (SerialService.Conectado &&
|
||||||
|
Variaveis.PerfilVigente.Sensor_Ativado_MPU == Estado.Ligado)
|
||||||
{
|
{
|
||||||
Variaveis.Sensoriamento.Sensor_InclinacaoLateral_Offset = Variaveis.Sensoriamento.InclinacaoLateral;
|
// Zera exatamente a grandeza exibida neste lado da tela.
|
||||||
Variaveis.Sensoriamento.Sensor_InclinacaoLateral_Offset = Variaveis.Sensoriamento.Sensor_InclinacaoLateral_Offset * -1;
|
// O método cuida internamente da diferença histórica V1/V2.
|
||||||
|
Variaveis.Sensoriamento.ZerarInclinacaoLateralAtual();
|
||||||
|
|
||||||
|
lblInclinacaox.Text =
|
||||||
|
"F: " +
|
||||||
|
Variaveis.Sensoriamento.InclinacaoLateral.ToString("0.00") +
|
||||||
|
"°";
|
||||||
|
|
||||||
|
lblDebugcontrole.Text =
|
||||||
|
"Zero de inclinação frontal definido e salvo.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pnlInclinacaoY_DoubleClick(object sender, EventArgs e)
|
private void pnlInclinacaoY_DoubleClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (SerialService.Conectado && Variaveis.PerfilVigente.Sensor_Ativado_MPU == Estado.Ligado)
|
if (SerialService.Conectado &&
|
||||||
|
Variaveis.PerfilVigente.Sensor_Ativado_MPU == Estado.Ligado)
|
||||||
{
|
{
|
||||||
Variaveis.Sensoriamento.Sensor_InclinacaoFrontal_Offset = Variaveis.Sensoriamento.InclinacaoFrontal;
|
Variaveis.Sensoriamento.ZerarInclinacaoFrontalAtual();
|
||||||
Variaveis.Sensoriamento.Sensor_InclinacaoFrontal_Offset = Variaveis.Sensoriamento.Sensor_InclinacaoFrontal_Offset * -1;
|
|
||||||
|
lblInclinacaoy.Text =
|
||||||
|
"L: " +
|
||||||
|
Variaveis.Sensoriamento.InclinacaoFrontal.ToString("0.00") +
|
||||||
|
"°";
|
||||||
|
|
||||||
|
lblDebugcontrole.Text =
|
||||||
|
"Zero de inclinação lateral definido e salvo.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -402,16 +457,13 @@ namespace OrionTardPro
|
||||||
|
|
||||||
public void AtualizaDadosIniciais(bool CarregaPerfil)
|
public void AtualizaDadosIniciais(bool CarregaPerfil)
|
||||||
{
|
{
|
||||||
trkVelocidade.Maximum = Variaveis.PerfilVigente.PotenciaMaxima;
|
Variaveis.ConfigurarTrackBarsVelocidade();
|
||||||
trkVelocidade.Minimum = Variaveis.PerfilVigente.PotenciaMinima;
|
|
||||||
trkMedidorEspessura.Maximum = Variaveis.PerfilVigente.AnguloMedicaoIdeal + Variaveis.PerfilVigente.AnguloMedicaoMargemLimite;
|
trkMedidorEspessura.Maximum = Variaveis.PerfilVigente.AnguloMedicaoIdeal + Variaveis.PerfilVigente.AnguloMedicaoMargemLimite;
|
||||||
Variaveis.frmControle.trkRampaaceleracao.Maximum = Variaveis.PerfilVigente.RampaMaxima;
|
Variaveis.frmControle.trkRampaaceleracao.Maximum = Variaveis.PerfilVigente.RampaMaxima;
|
||||||
Variaveis.frmControle.trkRampaaceleracao.Minimum = Variaveis.PerfilVigente.RampaMinima;
|
Variaveis.frmControle.trkRampaaceleracao.Minimum = Variaveis.PerfilVigente.RampaMinima;
|
||||||
Variaveis.frmControle.trkPrecisaorampa.Maximum = Variaveis.PerfilVigente.PrecisaoMaxima;
|
Variaveis.frmControle.trkPrecisaorampa.Maximum = Variaveis.PerfilVigente.PrecisaoMaxima;
|
||||||
Variaveis.frmControle.trkPrecisaorampa.Minimum = Variaveis.PerfilVigente.PrecisaoMinima;
|
Variaveis.frmControle.trkPrecisaorampa.Minimum = Variaveis.PerfilVigente.PrecisaoMinima;
|
||||||
Variaveis.frmControle.trkVelocidade.Maximum = Variaveis.PerfilVigente.PotenciaMaxima;
|
GeneralJoystick.AtualizaPotenciaAtual(trkVelocidade.Value);
|
||||||
Variaveis.frmControle.trkVelocidade.Minimum = Variaveis.PerfilVigente.PotenciaMinima;
|
|
||||||
GeneralJoystick.AtualizaPotenciaAtual(trkVelocidade.Value * 10);
|
|
||||||
GeneralJoystick.AtualizaRampaAtual(Variaveis.frmControle.trkRampaaceleracao.Value);
|
GeneralJoystick.AtualizaRampaAtual(Variaveis.frmControle.trkRampaaceleracao.Value);
|
||||||
Variaveis.PerfilVigente.PrecisaoAtual = Variaveis.frmControle.trkPrecisaorampa.Value;
|
Variaveis.PerfilVigente.PrecisaoAtual = Variaveis.frmControle.trkPrecisaorampa.Value;
|
||||||
|
|
||||||
|
|
@ -470,7 +522,7 @@ namespace OrionTardPro
|
||||||
this.Text = VariaveisGerais.NomeProjeto + " v" + VariaveisGerais.Versao;
|
this.Text = VariaveisGerais.NomeProjeto + " v" + VariaveisGerais.Versao;
|
||||||
if (Variaveis.Cliente != null)
|
if (Variaveis.Cliente != null)
|
||||||
{
|
{
|
||||||
this.Text += " - " + Variaveis.Cliente.Servico + " (" + Variaveis.Cliente.Nome + ")";
|
this.Text += " - " + Variaveis.Cliente.Servico + " (" + Variaveis.Cliente.Nome + ")";
|
||||||
|
|
||||||
DirectoryInfo Path = new DirectoryInfo(Variaveis.Cliente.Path);
|
DirectoryInfo Path = new DirectoryInfo(Variaveis.Cliente.Path);
|
||||||
Variaveis.IndexFotosIndentificacao = Path.GetFiles().Count(x => x.Extension == Variaveis.ExtIdentificacao);
|
Variaveis.IndexFotosIndentificacao = Path.GetFiles().Count(x => x.Extension == Variaveis.ExtIdentificacao);
|
||||||
|
|
@ -495,14 +547,28 @@ namespace OrionTardPro
|
||||||
return ValorPreenchido;
|
return ValorPreenchido;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private double CalcularPosicaoVerticalTubo(double deslocamentoMetros)
|
||||||
|
{
|
||||||
|
double comprimentoCabo =
|
||||||
|
Math.Max(0.001, Variaveis.PerfilVigente.ComprimentoCabo);
|
||||||
|
|
||||||
|
return AlturaCano -
|
||||||
|
((AlturaCano * deslocamentoMetros) / comprimentoCabo);
|
||||||
|
}
|
||||||
|
|
||||||
public void AdicionarMarcadorTubo(Label Marcador)
|
public void AdicionarMarcadorTubo(Label Marcador)
|
||||||
{
|
{
|
||||||
Label label = new Label();
|
Label label = Marcador;
|
||||||
label = Marcador;
|
|
||||||
label.Parent = pnlDireito;
|
label.Parent = pnlDireito;
|
||||||
pnlDireito.Controls.Add(label);
|
pnlDireito.Controls.Add(label);
|
||||||
int Percorrido = Convert.ToInt32(AlturaCano - Convert.ToDouble(decimal.Divide(Convert.ToDecimal(AlturaCano * Variaveis.Sensoriamento.DeslocamentoCarro), Convert.ToDecimal(Variaveis.PerfilVigente.ComprimentoCabo))));
|
|
||||||
label.Location = new System.Drawing.Point((pnlDireito.Width / 2) + 17, (Percorrido - 4));
|
int percorrido = Convert.ToInt32(
|
||||||
|
CalcularPosicaoVerticalTubo(
|
||||||
|
Variaveis.Sensoriamento.DeslocamentoCarro));
|
||||||
|
|
||||||
|
label.Location = new System.Drawing.Point(
|
||||||
|
(pnlDireito.Width / 2) + 17,
|
||||||
|
percorrido - 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ZerarEncoder()
|
public void ZerarEncoder()
|
||||||
|
|
@ -523,31 +589,56 @@ namespace OrionTardPro
|
||||||
|
|
||||||
private void pnlDireito_Paint(object sender, PaintEventArgs e)
|
private void pnlDireito_Paint(object sender, PaintEventArgs e)
|
||||||
{
|
{
|
||||||
//int MedidaCarroX = 30;
|
double percorrido =
|
||||||
//int MedidaCarroY = 30;
|
CalcularPosicaoVerticalTubo(
|
||||||
double Percorrido = AlturaCano - Convert.ToDouble(decimal.Divide(Convert.ToDecimal(AlturaCano * Variaveis.Sensoriamento.DeslocamentoCarro), Convert.ToDecimal(Variaveis.PerfilVigente.ComprimentoCabo)));
|
Variaveis.Sensoriamento.DeslocamentoCarro);
|
||||||
|
|
||||||
int MedidaCarroX = picRoboSuperior.Width;
|
int medidaCarroX = picRoboSuperior.Width;
|
||||||
int MedidaCarroY = picRoboSuperior.Height;
|
int medidaCarroY = picRoboSuperior.Height;
|
||||||
int xCarro = (pnlDireito.Width / 2) - (MedidaCarroX / 2);
|
int xCarro =
|
||||||
int yCarro = Convert.ToInt32(Percorrido) + OffSetCano - (MedidaCarroX / 2);
|
(pnlDireito.Width / 2) - (medidaCarroX / 2);
|
||||||
picRoboSuperior.Location = new System.Drawing.Point(xCarro, yCarro);
|
int yCarro =
|
||||||
|
Convert.ToInt32(percorrido) +
|
||||||
|
OffSetCano -
|
||||||
|
(medidaCarroY / 2);
|
||||||
|
|
||||||
lblDeslocamentovalor.Location = new System.Drawing.Point((pnlDireito.Width / 2) - 69, Convert.ToInt32(Percorrido) + (MedidaCarroX / 4));
|
picRoboSuperior.Location =
|
||||||
|
new System.Drawing.Point(xCarro, yCarro);
|
||||||
|
|
||||||
//Rectangle Carro = new Rectangle((pnlDireito.Width / 2) - (MedidaCarroX / 2) - 1, Convert.ToInt32(Percorrido) + OffSetCano - (MedidaCarroX / 2), MedidaCarroX, MedidaCarroY);
|
lblDeslocamentovalor.Location =
|
||||||
//Graphics g = pnlDireito.CreateGraphics();
|
new System.Drawing.Point(
|
||||||
//g.DrawEllipse(new Pen(Color.Red, 2), Carro);
|
(pnlDireito.Width / 2) - 69,
|
||||||
|
Convert.ToInt32(percorrido) +
|
||||||
|
(medidaCarroY / 4));
|
||||||
|
|
||||||
Rectangle Cano = new Rectangle((pnlDireito.Width / 2) - LarguraCano, OffSetCano, LarguraCano * 2, AlturaCano);
|
Rectangle cano = new Rectangle(
|
||||||
e.Graphics.DrawRectangle(new Pen(Color.Black, 2), Cano);
|
(pnlDireito.Width / 2) - LarguraCano,
|
||||||
|
OffSetCano,
|
||||||
|
LarguraCano * 2,
|
||||||
|
AlturaCano);
|
||||||
|
|
||||||
|
using (Pen canoPen = new Pen(Color.Black, 2))
|
||||||
|
e.Graphics.DrawRectangle(canoPen, cano);
|
||||||
|
|
||||||
if (Variaveis.Sensoriamento.OdometroParcialIniciado)
|
if (Variaveis.Sensoriamento.OdometroParcialIniciado)
|
||||||
{
|
{
|
||||||
P2Odometro = new System.Drawing.Point(lblDeslocamentovalor.Location.X - 20, lblDeslocamentovalor.Location.Y);
|
P2Odometro = new System.Drawing.Point(
|
||||||
e.Graphics.DrawLine(new Pen(Color.Blue, 2), P1Odometro, P2Odometro);
|
lblDeslocamentovalor.Location.X - 20,
|
||||||
lblOdometroparcial.Text = Variaveis.OdometroParcial + " m";
|
lblDeslocamentovalor.Location.Y);
|
||||||
lblOdometroparcial.Location = new System.Drawing.Point(P2Odometro.X - 13, P2Odometro.Y - 13);
|
|
||||||
|
using (Pen parcialPen = new Pen(Color.Blue, 2))
|
||||||
|
e.Graphics.DrawLine(
|
||||||
|
parcialPen,
|
||||||
|
P1Odometro,
|
||||||
|
P2Odometro);
|
||||||
|
|
||||||
|
lblOdometroparcial.Text =
|
||||||
|
Variaveis.OdometroParcial.ToString("0.00") + " m";
|
||||||
|
|
||||||
|
lblOdometroparcial.Location =
|
||||||
|
new System.Drawing.Point(
|
||||||
|
P2Odometro.X - 13,
|
||||||
|
P2Odometro.Y - 13);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -556,7 +647,7 @@ namespace OrionTardPro
|
||||||
private void trkVelocidade_Scroll(object sender, EventArgs e)
|
private void trkVelocidade_Scroll(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Variaveis.frmControle.trkVelocidade.Value = trkVelocidade.Value;
|
Variaveis.frmControle.trkVelocidade.Value = trkVelocidade.Value;
|
||||||
GeneralJoystick.AtualizaPotenciaAtual(trkVelocidade.Value * 10);
|
GeneralJoystick.AtualizaPotenciaAtual(trkVelocidade.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tkbBraco_Scroll(object sender, EventArgs e)
|
private void tkbBraco_Scroll(object sender, EventArgs e)
|
||||||
|
|
@ -618,14 +709,23 @@ namespace OrionTardPro
|
||||||
string Pontos = "";
|
string Pontos = "";
|
||||||
private void tmrTempoAtivo_Tick(object sender, EventArgs e)
|
private void tmrTempoAtivo_Tick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
SerialService.TempoAtivo++;
|
if (SerialService.Conectado && !_relogioTempoConectado.IsRunning)
|
||||||
LogsFuncoes.TimerLog += 1000;
|
_relogioTempoConectado.Start();
|
||||||
if (SerialService.Conectado)
|
else if (!SerialService.Conectado && _relogioTempoConectado.IsRunning)
|
||||||
SerialService.TempoConectado++;
|
_relogioTempoConectado.Stop();
|
||||||
|
|
||||||
|
SerialService.TempoAtivo = (int)_relogioTempoAtivo.Elapsed.TotalSeconds;
|
||||||
|
SerialService.TempoConectado = (int)_relogioTempoConectado.Elapsed.TotalSeconds;
|
||||||
|
LogsFuncoes.TimerLog += 1000; // mantido apenas para compatibilidade visual/legada
|
||||||
|
|
||||||
lblTempo.Text = "Tempo Ativo: " + TimeSpan.FromSeconds(SerialService.TempoAtivo).ToString(@"hh\:mm\:ss") + " - Tempo Conectado: " + TimeSpan.FromSeconds(SerialService.TempoConectado).ToString(@"hh\:mm\:ss");
|
lblTempo.Text = "Tempo Ativo: " + TimeSpan.FromSeconds(SerialService.TempoAtivo).ToString(@"hh\:mm\:ss") + " - Tempo Conectado: " + TimeSpan.FromSeconds(SerialService.TempoConectado).ToString(@"hh\:mm\:ss");
|
||||||
|
|
||||||
if (VideoService.GravacaoIniciada)
|
if (VideoService.GravacaoFinalizando)
|
||||||
|
{
|
||||||
|
lblStatusCamera.Text = "Finalizando...";
|
||||||
|
lblStatusCamera.ForeColor = Color.DarkOrange;
|
||||||
|
}
|
||||||
|
else if (VideoService.GravacaoIniciada)
|
||||||
{
|
{
|
||||||
if (VideoService.GravacaoPausada)
|
if (VideoService.GravacaoPausada)
|
||||||
{
|
{
|
||||||
|
|
@ -653,34 +753,181 @@ namespace OrionTardPro
|
||||||
lblStatusCamera.ForeColor = Color.Black;
|
lblStatusCamera.ForeColor = Color.Black;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LogsFuncoes.TimerLog > LogsFuncoes.TempoLog)
|
// Estado dos botões acompanha também a fase assíncrona de finalização.
|
||||||
|
imgIniciarGravacao.Enabled =
|
||||||
|
Variaveis.VideoIsRuning &&
|
||||||
|
!VideoService.GravacaoIniciada &&
|
||||||
|
!VideoService.GravacaoFinalizando;
|
||||||
|
imgPausarGravacao.Enabled = VideoService.GravacaoIniciada;
|
||||||
|
imgPararGravacao.Enabled = VideoService.GravacaoIniciada;
|
||||||
|
|
||||||
|
RegistrarEventosOperacionais();
|
||||||
|
|
||||||
|
if (LogsFuncoes.DeveRegistrarLogPeriodico())
|
||||||
{
|
{
|
||||||
LogsFuncoes.TimerLog = 0;
|
LogsFuncoes.RegistrarLog(
|
||||||
LogsFuncoes.RegistrarLog();
|
TipoEventoLog.Periodico,
|
||||||
|
"Snapshot periódico da operação.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RegistrarEventosOperacionais()
|
||||||
|
{
|
||||||
|
bool conectadoAgora = SerialService.Conectado;
|
||||||
|
|
||||||
|
if (conectadoAgora != _estadoConexaoAnterior)
|
||||||
|
{
|
||||||
|
LogsFuncoes.RegistrarLog(
|
||||||
|
conectadoAgora
|
||||||
|
? TipoEventoLog.Conectado
|
||||||
|
: TipoEventoLog.Desconectado,
|
||||||
|
conectadoAgora
|
||||||
|
? "Sessão serial estabelecida e validada."
|
||||||
|
: "Sessão serial encerrada ou perdida.");
|
||||||
|
|
||||||
|
_estadoConexaoAnterior = conectadoAgora;
|
||||||
|
_mascaraSaudeAnterior = null;
|
||||||
|
_alarmeInfiltracaoAnterior = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!conectadoAgora ||
|
||||||
|
Variaveis.PerfilVigente.VersaoProtocolo != VersaoProtocolo.v2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool infiltracaoAgora = SerialService.AlarmeInfiltracaoV6;
|
||||||
|
if (infiltracaoAgora && !_alarmeInfiltracaoAnterior)
|
||||||
|
{
|
||||||
|
LogsFuncoes.RegistrarLog(
|
||||||
|
TipoEventoLog.Infiltracao,
|
||||||
|
"Alarme de infiltração ativado.");
|
||||||
|
}
|
||||||
|
_alarmeInfiltracaoAnterior = infiltracaoAgora;
|
||||||
|
|
||||||
|
// Só avalia saúde depois que pelo menos um frame válido chegou.
|
||||||
|
if (SerialService.ProtocoloEntrada.Momento == DateTime.MinValue)
|
||||||
|
return;
|
||||||
|
|
||||||
|
byte saudeAgora = SerialService.MascaraSaudeV6;
|
||||||
|
if (!_mascaraSaudeAnterior.HasValue)
|
||||||
|
{
|
||||||
|
_mascaraSaudeAnterior = saudeAgora;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_mascaraSaudeAnterior.Value != saudeAgora)
|
||||||
|
{
|
||||||
|
LogsFuncoes.RegistrarLog(
|
||||||
|
TipoEventoLog.SaudeSensores,
|
||||||
|
$"Saúde dos sensores alterada de 0x{_mascaraSaudeAnterior.Value:X2} para 0x{saudeAgora:X2}.");
|
||||||
|
_mascaraSaudeAnterior = saudeAgora;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double indVelocidade = 0.0;
|
double indVelocidade = 0.0;
|
||||||
private void tmrVelocidade_Tick(object sender, EventArgs e)
|
private void tmrVelocidade_Tick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
tmrVelocidade.Interval = Variaveis.PerfilVigente.RampaAtual * 10;
|
tmrVelocidade.Interval =
|
||||||
|
Math.Max(
|
||||||
|
10,
|
||||||
|
Variaveis.PerfilVigente.RampaAtual * 10);
|
||||||
|
|
||||||
if (GeneralJoystick.UltimaDirecao != Direcao.Parado && indVelocidade < Variaveis.PerfilVigente.PrecisaoAtual)
|
// Atualiza a velocidade-alvo instantânea usando a potência atual
|
||||||
{
|
// de cada lado. A integração do deslocamento usa, logo abaixo,
|
||||||
indVelocidade += 1.0;
|
// exatamente a mesma VelocidadeAtual mostrada no velocímetro.
|
||||||
}
|
Variaveis.Sensoriamento.AtualizaVelocidadeMedia();
|
||||||
else if (GeneralJoystick.UltimaDirecao == Direcao.Parado && indVelocidade > 0)
|
|
||||||
{
|
|
||||||
indVelocidade -= 1.0;
|
|
||||||
}
|
|
||||||
double Porcentagem = indVelocidade / Variaveis.PerfilVigente.PrecisaoAtual;
|
|
||||||
Variaveis.Sensoriamento.VelocidadeAtual = Variaveis.Sensoriamento.VelocidadeMedia * Porcentagem;
|
|
||||||
lblVelocimetro.Text = Variaveis.Sensoriamento.VelocidadeAtual.ToString("0.00") + " m/s";
|
|
||||||
|
|
||||||
if (GeneralJoystick.UltimaDirecao == Direcao.Parado && indVelocidade == 0)
|
int precisaoRampa =
|
||||||
|
Math.Max(
|
||||||
|
1,
|
||||||
|
Variaveis.PerfilVigente.PrecisaoAtual);
|
||||||
|
|
||||||
|
if (SerialService.ProtocoloV2Ativo)
|
||||||
{
|
{
|
||||||
|
// A V6 já informa na telemetria o PWM realmente aplicado pela
|
||||||
|
// rampa da firmware. Portanto não aplicamos uma segunda rampa
|
||||||
|
// no C#.
|
||||||
|
if (GeneralJoystick.UltimaDirecao == Direcao.Parado)
|
||||||
|
{
|
||||||
|
indVelocidade = 0;
|
||||||
|
Variaveis.Sensoriamento.VelocidadeAtual = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
indVelocidade = precisaoRampa;
|
||||||
|
Variaveis.Sensoriamento.VelocidadeAtual =
|
||||||
|
Variaveis.Sensoriamento.VelocidadeMedia;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Legado: mantém a rampa visual/estimada original do Orion,
|
||||||
|
// mas sobre uma velocidade-alvo instantânea, sem média
|
||||||
|
// acumulada de comandos anteriores.
|
||||||
|
if (GeneralJoystick.UltimaDirecao != Direcao.Parado &&
|
||||||
|
indVelocidade < precisaoRampa)
|
||||||
|
{
|
||||||
|
indVelocidade += 1.0;
|
||||||
|
}
|
||||||
|
else if (GeneralJoystick.UltimaDirecao == Direcao.Parado &&
|
||||||
|
indVelocidade > 0)
|
||||||
|
{
|
||||||
|
indVelocidade -= 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
indVelocidade =
|
||||||
|
Math.Max(
|
||||||
|
0,
|
||||||
|
Math.Min(precisaoRampa, indVelocidade));
|
||||||
|
|
||||||
|
double porcentagemRampa =
|
||||||
|
indVelocidade / precisaoRampa;
|
||||||
|
|
||||||
|
Variaveis.Sensoriamento.VelocidadeAtual =
|
||||||
|
Variaveis.Sensoriamento.VelocidadeMedia *
|
||||||
|
porcentagemRampa;
|
||||||
|
}
|
||||||
|
|
||||||
|
Variaveis.Sensoriamento.AtualizaDeslocamentoTubo();
|
||||||
|
|
||||||
|
lblVelocimetro.Text =
|
||||||
|
Variaveis.Sensoriamento.VelocidadeAtual
|
||||||
|
.ToString("0.00") +
|
||||||
|
" m/s";
|
||||||
|
|
||||||
|
lblDeslocamentovalor.Text =
|
||||||
|
Variaveis.Sensoriamento.DeslocamentoCarro
|
||||||
|
.ToString("0.00") +
|
||||||
|
" m";
|
||||||
|
|
||||||
|
DateTime agoraUtc = DateTime.UtcNow;
|
||||||
|
bool atualizarPainel =
|
||||||
|
_ultimaAtualizacaoPainelDeslocamentoUtc ==
|
||||||
|
DateTime.MinValue ||
|
||||||
|
(agoraUtc -
|
||||||
|
_ultimaAtualizacaoPainelDeslocamentoUtc)
|
||||||
|
.TotalMilliseconds >=
|
||||||
|
IntervaloPainelDeslocamentoMs;
|
||||||
|
|
||||||
|
if (atualizarPainel)
|
||||||
|
{
|
||||||
|
_ultimaAtualizacaoPainelDeslocamentoUtc =
|
||||||
|
agoraUtc;
|
||||||
|
|
||||||
|
Variaveis.Sensoriamento
|
||||||
|
.AtualizarOdometroGeral();
|
||||||
|
|
||||||
|
pnlDireito.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GeneralJoystick.UltimaDirecao == Direcao.Parado &&
|
||||||
|
indVelocidade == 0)
|
||||||
|
{
|
||||||
|
// Força a posição final antes de dormir o timer.
|
||||||
|
Variaveis.Sensoriamento
|
||||||
|
.AtualizarOdometroGeral();
|
||||||
|
pnlDireito.Invalidate();
|
||||||
|
|
||||||
tmrVelocidade.Enabled = false;
|
tmrVelocidade.Enabled = false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,14 @@ namespace OrionTardPro
|
||||||
{
|
{
|
||||||
public partial class frmSensoriamento : Form
|
public partial class frmSensoriamento : Form
|
||||||
{
|
{
|
||||||
|
private const int MaximoLinhasConsole = 500;
|
||||||
|
private const int IntervaloAtualizacaoTelaMs = 200;
|
||||||
|
private readonly Queue<string> _linhasConsole =
|
||||||
|
new Queue<string>();
|
||||||
|
private int _linhasDesdeCompactacao;
|
||||||
|
private DateTime _ultimaAtualizacaoTelaUtc =
|
||||||
|
DateTime.MinValue;
|
||||||
|
|
||||||
public frmSensoriamento()
|
public frmSensoriamento()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
@ -54,72 +62,295 @@ namespace OrionTardPro
|
||||||
dtSensores.Rows.Add("BMP Altitude", Variaveis.Sensoriamento.Altitude.ToString("0.00"), "m");
|
dtSensores.Rows.Add("BMP Altitude", Variaveis.Sensoriamento.Altitude.ToString("0.00"), "m");
|
||||||
dtSensores.Rows.Add("Tensão", Variaveis.Sensoriamento.Tensao.ToString("0.00"), "");
|
dtSensores.Rows.Add("Tensão", Variaveis.Sensoriamento.Tensao.ToString("0.00"), "");
|
||||||
dtSensores.Rows.Add("Corrente", Variaveis.Sensoriamento.Corrente.ToString("0.00"), "");
|
dtSensores.Rows.Add("Corrente", Variaveis.Sensoriamento.Corrente.ToString("0.00"), "");
|
||||||
|
dtSensores.Rows.Add("Infiltração - leitura bruta", Variaveis.Sensoriamento.InfiltracaoRaw, "ADC");
|
||||||
|
dtSensores.Rows.Add("Infiltração - nível de risco", Variaveis.Sensoriamento.NivelRiscoInfiltracao.ToString("0.0"), "%");
|
||||||
|
dtSensores.Rows.Add("Infiltração - estado", Variaveis.Sensoriamento.EstadoInfiltracao, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AtualizaDados()
|
public void AtualizaDados()
|
||||||
{
|
{
|
||||||
string MensagemConsole = "";
|
if (IsDisposed || !Visible)
|
||||||
|
return;
|
||||||
|
|
||||||
|
DateTime agoraUtc = DateTime.UtcNow;
|
||||||
|
if ((agoraUtc - _ultimaAtualizacaoTelaUtc)
|
||||||
|
.TotalMilliseconds <
|
||||||
|
IntervaloAtualizacaoTelaMs)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_ultimaAtualizacaoTelaUtc = agoraUtc;
|
||||||
|
|
||||||
|
string mensagemConsole = "";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(SerialService.ProtocoloEntrada.Dados))
|
string frame = SerialService.ProtocoloEntrada.Dados;
|
||||||
{
|
|
||||||
|
if (string.IsNullOrWhiteSpace(frame))
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
string[] ProtocoloRecebido = SerialService.ProtocoloEntrada.Dados.Split(Convert.ToChar(SerialService.InicioSensores));
|
bool firmwareV6 =
|
||||||
string[] ParametrosSensor = ProtocoloRecebido[ProtocoloRecebido.Length - 1].Split(';');
|
Variaveis.PerfilVigente != null &&
|
||||||
TipoSensor Tipo = (TipoSensor)Convert.ToInt32(ParametrosSensor[0]);
|
Variaveis.PerfilVigente.VersaoProtocolo == VersaoProtocolo.v2;
|
||||||
if (
|
|
||||||
Tipo == TipoSensor.Tod ||
|
if (firmwareV6)
|
||||||
(Tipo == TipoSensor.Cor && Variaveis.frmParametros.chbCorDebug.Checked) ||
|
|
||||||
(Tipo == TipoSensor.Gas && Variaveis.frmParametros.chbGasDebug.Checked) ||
|
|
||||||
(Tipo == TipoSensor.Mpu && Variaveis.frmParametros.chbMpuDebug.Checked) ||
|
|
||||||
(Tipo == TipoSensor.Ten && Variaveis.frmParametros.chbTenDebug.Checked) ||
|
|
||||||
(Tipo == TipoSensor.Tmp && Variaveis.frmParametros.chbTmpDebug.Checked) ||
|
|
||||||
(Tipo == TipoSensor.Ult && Variaveis.frmParametros.chbUltDebug.Checked) ||
|
|
||||||
(Tipo == TipoSensor.Umi && Variaveis.frmParametros.chbUmiDebug.Checked) ||
|
|
||||||
(Tipo == TipoSensor.Vel && Variaveis.frmParametros.chbVelDebug.Checked)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
MensagemConsole = SerialService.ProtocoloEntrada.Dados;
|
// Na V6 o SerialService já verificou CRC, sequência,
|
||||||
|
// tipo do frame e atualizou as variáveis.
|
||||||
|
if (frame.StartsWith("!V6;", StringComparison.Ordinal))
|
||||||
|
mensagemConsole = frame.TrimEnd('\r', '\n');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Parser visual legado.
|
||||||
|
string[] protocoloRecebido =
|
||||||
|
frame.Split(Convert.ToChar(SerialService.InicioSensores));
|
||||||
|
|
||||||
|
if (protocoloRecebido.Length > 0)
|
||||||
|
{
|
||||||
|
string[] parametrosSensor =
|
||||||
|
protocoloRecebido[protocoloRecebido.Length - 1].Split(';');
|
||||||
|
|
||||||
|
int tipoNumerico;
|
||||||
|
|
||||||
|
if (parametrosSensor.Length > 0 &&
|
||||||
|
int.TryParse(parametrosSensor[0], out tipoNumerico))
|
||||||
|
{
|
||||||
|
TipoSensor tipo = (TipoSensor)tipoNumerico;
|
||||||
|
|
||||||
|
if (
|
||||||
|
tipo == TipoSensor.Tod ||
|
||||||
|
(tipo == TipoSensor.Cor && Variaveis.frmParametros.chbCorDebug.Checked) ||
|
||||||
|
(tipo == TipoSensor.Gas && Variaveis.frmParametros.chbGasDebug.Checked) ||
|
||||||
|
(tipo == TipoSensor.Mpu && Variaveis.frmParametros.chbMpuDebug.Checked) ||
|
||||||
|
(tipo == TipoSensor.Ten && Variaveis.frmParametros.chbTenDebug.Checked) ||
|
||||||
|
(tipo == TipoSensor.Tmp && Variaveis.frmParametros.chbTmpDebug.Checked) ||
|
||||||
|
(tipo == TipoSensor.Ult && Variaveis.frmParametros.chbUltDebug.Checked) ||
|
||||||
|
(tipo == TipoSensor.Umi && Variaveis.frmParametros.chbUmiDebug.Checked) ||
|
||||||
|
(tipo == TipoSensor.Vel && Variaveis.frmParametros.chbVelDebug.Checked)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
mensagemConsole = frame;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine(
|
||||||
|
"[SENSORIAMENTO] Erro preparando console: " + ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
txtConsole.Text += MensagemConsole + "\r\n";
|
if (!string.IsNullOrWhiteSpace(mensagemConsole))
|
||||||
txtConsole.SelectionStart = txtConsole.Text.Length;
|
{
|
||||||
txtConsole.ScrollToCaret();
|
_linhasConsole.Enqueue(mensagemConsole);
|
||||||
|
|
||||||
|
while (_linhasConsole.Count > MaximoLinhasConsole)
|
||||||
|
_linhasConsole.Dequeue();
|
||||||
|
|
||||||
|
txtConsole.AppendText(
|
||||||
|
mensagemConsole +
|
||||||
|
Environment.NewLine);
|
||||||
|
|
||||||
|
_linhasDesdeCompactacao++;
|
||||||
|
|
||||||
|
// Reescreve o TextBox apenas em blocos. Assim o controle
|
||||||
|
// nunca cresce indefinidamente e também não reconstruímos
|
||||||
|
// 500 linhas a cada frame.
|
||||||
|
if (_linhasDesdeCompactacao >= 100 &&
|
||||||
|
txtConsole.Lines.Length >
|
||||||
|
MaximoLinhasConsole)
|
||||||
|
{
|
||||||
|
txtConsole.Lines =
|
||||||
|
_linhasConsole.ToArray();
|
||||||
|
|
||||||
|
_linhasDesdeCompactacao = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
txtConsole.SelectionStart =
|
||||||
|
txtConsole.Text.Length;
|
||||||
|
|
||||||
|
txtConsole.ScrollToCaret();
|
||||||
|
}
|
||||||
|
|
||||||
|
AtualizaTabelaSensores();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine(
|
||||||
|
"[SENSORIAMENTO] Erro atualizando tela: " + ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AtualizaTabelaSensores()
|
||||||
|
{
|
||||||
|
if (dtSensores.Rows.Count < 17)
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool firmwareV6 =
|
||||||
|
Variaveis.PerfilVigente != null &&
|
||||||
|
Variaveis.PerfilVigente.VersaoProtocolo == VersaoProtocolo.v2;
|
||||||
|
|
||||||
|
if (firmwareV6)
|
||||||
|
{
|
||||||
|
dtSensores.Rows[0].SetValues(
|
||||||
|
"SHT31 Temperatura",
|
||||||
|
Variaveis.Sensoriamento.ShtTmp.ToString("0.00"),
|
||||||
|
"°C");
|
||||||
|
|
||||||
|
dtSensores.Rows[1].SetValues(
|
||||||
|
"SHT31 Umidade",
|
||||||
|
Variaveis.Sensoriamento.ShtUmd.ToString("0.00"),
|
||||||
|
"%");
|
||||||
|
|
||||||
|
dtSensores.Rows[2].SetValues(
|
||||||
|
"Inclinação Roll",
|
||||||
|
SerialService.RollDeg_V6.ToString("0.00"),
|
||||||
|
"°");
|
||||||
|
|
||||||
|
dtSensores.Rows[3].SetValues(
|
||||||
|
"ACE X",
|
||||||
|
Variaveis.Sensoriamento.AceX.ToString("0.000"),
|
||||||
|
"m/s²");
|
||||||
|
|
||||||
|
dtSensores.Rows[4].SetValues(
|
||||||
|
"ACE Y",
|
||||||
|
Variaveis.Sensoriamento.AceY.ToString("0.000"),
|
||||||
|
"m/s²");
|
||||||
|
|
||||||
|
dtSensores.Rows[5].SetValues(
|
||||||
|
"ACE Z",
|
||||||
|
Variaveis.Sensoriamento.AceZ.ToString("0.000"),
|
||||||
|
"m/s²");
|
||||||
|
|
||||||
|
dtSensores.Rows[6].SetValues(
|
||||||
|
"GYR X",
|
||||||
|
Variaveis.Sensoriamento.GyrX.ToString("0.000"),
|
||||||
|
"°/s");
|
||||||
|
|
||||||
|
dtSensores.Rows[7].SetValues(
|
||||||
|
"GYR Y",
|
||||||
|
Variaveis.Sensoriamento.GyrY.ToString("0.000"),
|
||||||
|
"°/s");
|
||||||
|
|
||||||
|
dtSensores.Rows[8].SetValues(
|
||||||
|
"GYR Z",
|
||||||
|
Variaveis.Sensoriamento.GyrZ.ToString("0.000"),
|
||||||
|
"°/s");
|
||||||
|
|
||||||
|
dtSensores.Rows[9].SetValues(
|
||||||
|
"Inclinação Pitch",
|
||||||
|
SerialService.PitchDeg_V6.ToString("0.00"),
|
||||||
|
"°");
|
||||||
|
|
||||||
|
dtSensores.Rows[10].SetValues(
|
||||||
|
"Infiltração",
|
||||||
|
SerialService.InfiltracaoRawV6,
|
||||||
|
"ADC");
|
||||||
|
|
||||||
|
dtSensores.Rows[11].SetValues(
|
||||||
|
"Alarme de infiltração",
|
||||||
|
SerialService.AlarmeInfiltracaoV6 ? "ATIVO" : "Normal",
|
||||||
|
"");
|
||||||
|
|
||||||
|
dtSensores.Rows[12].SetValues(
|
||||||
|
"Saúde I²C",
|
||||||
|
"0x" + SerialService.MascaraSaudeV6.ToString("X2"),
|
||||||
|
"");
|
||||||
|
|
||||||
|
dtSensores.Rows[13].SetValues(
|
||||||
|
"INA228",
|
||||||
|
Variaveis.Sensoriamento.INA_Iniciado ? "OK" : "Falha",
|
||||||
|
"");
|
||||||
|
|
||||||
|
dtSensores.Rows[14].SetValues(
|
||||||
|
"BMI270",
|
||||||
|
Variaveis.Sensoriamento.MPU_Iniciado ? "OK" : "Falha",
|
||||||
|
"");
|
||||||
|
|
||||||
|
dtSensores.Rows[15].SetValues(
|
||||||
|
"Tensão",
|
||||||
|
Variaveis.Sensoriamento.InaTen.ToString("0.000"),
|
||||||
|
"V");
|
||||||
|
|
||||||
|
dtSensores.Rows[16].SetValues(
|
||||||
|
"Corrente",
|
||||||
|
Variaveis.Sensoriamento.InaCor.ToString("0.0"),
|
||||||
|
"mA");
|
||||||
|
|
||||||
|
dtSensores.Rows[17].SetValues(
|
||||||
|
"Infiltração - leitura bruta",
|
||||||
|
Variaveis.Sensoriamento.InfiltracaoRaw,
|
||||||
|
"ADC");
|
||||||
|
|
||||||
|
dtSensores.Rows[18].SetValues(
|
||||||
|
"Infiltração - nível de risco",
|
||||||
|
Variaveis.Sensoriamento.NivelRiscoInfiltracao.ToString("0.0"),
|
||||||
|
"%");
|
||||||
|
|
||||||
|
dtSensores.Rows[19].SetValues(
|
||||||
|
"Infiltração - estado",
|
||||||
|
Variaveis.Sensoriamento.EstadoInfiltracao,
|
||||||
|
"");
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dtSensores.Rows[0].Cells[0].Value = "Gás e Fumaça"; dtSensores.Rows[0].Cells[1].Value = Variaveis.Sensoriamento.NivelGas.ToString("0.00"); dtSensores.Rows[0].Cells[2].Value = "";
|
// Tabela antiga: permanece exatamente como já funcionava.
|
||||||
dtSensores.Rows[1].Cells[0].Value = "DHT Temperatura"; dtSensores.Rows[1].Cells[1].Value = Variaveis.Sensoriamento.Temperatura.ToString("0.00"); dtSensores.Rows[1].Cells[2].Value = "°C";
|
dtSensores.Rows[0].SetValues(
|
||||||
dtSensores.Rows[2].Cells[0].Value = "DHT Umidade"; dtSensores.Rows[2].Cells[1].Value = Variaveis.Sensoriamento.Umidade.ToString("0.00"); dtSensores.Rows[2].Cells[2].Value = "%";
|
"Gás e Fumaça",
|
||||||
//dtSensores.Rows[3].Cells[0].Value = "DHT Índice de calor"; dtSensores.Rows[3].Cells[1].Value = Variaveis.Sensor_DHT_IndiceCalor; dtSensores.Rows[3].Cells[2].Value = "%";
|
Variaveis.Sensoriamento.NivelGas.ToString("0.00"),
|
||||||
//dtSensores.Rows[4].Cells[0].Value = "DHT Ponto condensação da água"; dtSensores.Rows[4].Cells[1].Value = Variaveis.Sensor_DHT_Condensacao; dtSensores.Rows[4].Cells[2].Value = "%";
|
"%");
|
||||||
//dtSensores.Rows[5].Cells[0].Value = "DHT Status"; dtSensores.Rows[5].Cells[1].Value = Variaveis.Sensor_DHT_Status; dtSensores.Rows[5].Cells[2].Value = "";
|
|
||||||
dtSensores.Rows[3].Cells[0].Value = "ACE X"; dtSensores.Rows[3].Cells[1].Value = Variaveis.Sensoriamento.AceX; dtSensores.Rows[3].Cells[2].Value = "°";
|
dtSensores.Rows[1].SetValues(
|
||||||
dtSensores.Rows[4].Cells[0].Value = "ACE Y"; dtSensores.Rows[4].Cells[1].Value = Variaveis.Sensoriamento.AceY; dtSensores.Rows[4].Cells[2].Value = "°";
|
"DHT Temperatura",
|
||||||
dtSensores.Rows[5].Cells[0].Value = "ACE Z"; dtSensores.Rows[5].Cells[1].Value = Variaveis.Sensoriamento.AceZ; dtSensores.Rows[5].Cells[2].Value = "°";
|
Variaveis.Sensoriamento.Temperatura.ToString("0.00"),
|
||||||
dtSensores.Rows[6].Cells[0].Value = "GYR X"; dtSensores.Rows[6].Cells[1].Value = Variaveis.Sensoriamento.GyrX; dtSensores.Rows[6].Cells[2].Value = "°";
|
"°C");
|
||||||
dtSensores.Rows[7].Cells[0].Value = "GYR Y"; dtSensores.Rows[7].Cells[1].Value = Variaveis.Sensoriamento.GyrY; dtSensores.Rows[7].Cells[2].Value = "°";
|
|
||||||
dtSensores.Rows[8].Cells[0].Value = "GYR Z"; dtSensores.Rows[8].Cells[1].Value = Variaveis.Sensoriamento.GyrZ; dtSensores.Rows[8].Cells[2].Value = "°";
|
dtSensores.Rows[2].SetValues(
|
||||||
dtSensores.Rows[9].Cells[0].Value = "MAG X"; dtSensores.Rows[9].Cells[1].Value = Variaveis.Sensoriamento.MagX; dtSensores.Rows[9].Cells[2].Value = "°";
|
"DHT Umidade",
|
||||||
dtSensores.Rows[10].Cells[0].Value = "MAG Y"; dtSensores.Rows[10].Cells[1].Value = Variaveis.Sensoriamento.MagY; dtSensores.Rows[10].Cells[2].Value = "°";
|
Variaveis.Sensoriamento.Umidade.ToString("0.00"),
|
||||||
dtSensores.Rows[11].Cells[0].Value = "MAG Z"; dtSensores.Rows[11].Cells[1].Value = Variaveis.Sensoriamento.MagZ; dtSensores.Rows[11].Cells[2].Value = "°";
|
"%");
|
||||||
dtSensores.Rows[12].Cells[0].Value = "BMP Temperatura"; dtSensores.Rows[12].Cells[1].Value = Variaveis.Sensoriamento.BmpTmp.ToString("0.00"); dtSensores.Rows[12].Cells[2].Value = "°C";
|
|
||||||
dtSensores.Rows[13].Cells[0].Value = "BMP Pressão"; dtSensores.Rows[13].Cells[1].Value = Variaveis.Sensoriamento.Pressao.ToString("0.00"); dtSensores.Rows[13].Cells[2].Value = "Kpa";
|
dtSensores.Rows[3].SetValues("ACE X", Variaveis.Sensoriamento.AceX, "°");
|
||||||
dtSensores.Rows[14].Cells[0].Value = "BMP Altitude"; dtSensores.Rows[14].Cells[1].Value = Variaveis.Sensoriamento.Altitude.ToString("0.00"); dtSensores.Rows[14].Cells[2].Value = "m";
|
dtSensores.Rows[4].SetValues("ACE Y", Variaveis.Sensoriamento.AceY, "°");
|
||||||
dtSensores.Rows[15].Cells[0].Value = "Leitura Tensão"; dtSensores.Rows[15].Cells[1].Value = Variaveis.Sensoriamento.Tensao.ToString("0.00"); dtSensores.Rows[15].Cells[2].Value = "";
|
dtSensores.Rows[5].SetValues("ACE Z", Variaveis.Sensoriamento.AceZ, "°");
|
||||||
dtSensores.Rows[16].Cells[0].Value = "Leitura Corrente"; dtSensores.Rows[16].Cells[1].Value = Variaveis.Sensoriamento.Corrente.ToString("0.00"); dtSensores.Rows[16].Cells[2].Value = "";
|
dtSensores.Rows[6].SetValues("GYR X", Variaveis.Sensoriamento.GyrX, "°");
|
||||||
|
dtSensores.Rows[7].SetValues("GYR Y", Variaveis.Sensoriamento.GyrY, "°");
|
||||||
|
dtSensores.Rows[8].SetValues("GYR Z", Variaveis.Sensoriamento.GyrZ, "°");
|
||||||
|
dtSensores.Rows[9].SetValues("MAG X", Variaveis.Sensoriamento.MagX, "°");
|
||||||
|
dtSensores.Rows[10].SetValues("MAG Y", Variaveis.Sensoriamento.MagY, "°");
|
||||||
|
dtSensores.Rows[11].SetValues("MAG Z", Variaveis.Sensoriamento.MagZ, "°");
|
||||||
|
|
||||||
|
dtSensores.Rows[12].SetValues(
|
||||||
|
"BMP Temperatura",
|
||||||
|
Variaveis.Sensoriamento.BmpTmp.ToString("0.00"),
|
||||||
|
"°C");
|
||||||
|
|
||||||
|
dtSensores.Rows[13].SetValues(
|
||||||
|
"BMP Pressão",
|
||||||
|
Variaveis.Sensoriamento.Pressao.ToString("0.00"),
|
||||||
|
"kPa");
|
||||||
|
|
||||||
|
dtSensores.Rows[14].SetValues(
|
||||||
|
"BMP Altitude",
|
||||||
|
Variaveis.Sensoriamento.Altitude.ToString("0.00"),
|
||||||
|
"m");
|
||||||
|
|
||||||
|
dtSensores.Rows[15].SetValues(
|
||||||
|
"Leitura Tensão",
|
||||||
|
Variaveis.Sensoriamento.Tensao.ToString("0.00"),
|
||||||
|
"");
|
||||||
|
|
||||||
|
dtSensores.Rows[16].SetValues(
|
||||||
|
"Leitura Corrente",
|
||||||
|
Variaveis.Sensoriamento.Corrente.ToString("0.00"),
|
||||||
|
"");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void frmSensoriamento_FormClosing(object sender, FormClosingEventArgs e)
|
private void frmSensoriamento_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
|
|
|
||||||
|
|
@ -20,49 +20,69 @@ namespace OrionTardPro
|
||||||
{
|
{
|
||||||
public static void EnviarEmail()
|
public static void EnviarEmail()
|
||||||
{
|
{
|
||||||
if (HttpService.ServerUp)
|
// Fire-and-forget deliberado: envio de e-mail nunca deve segurar a UI
|
||||||
{
|
// durante a inicialização. A rotina interna já trata timeout e exceções.
|
||||||
string Config = File.ReadAllText(VariaveisGerais.CaminhoArquivoLicenca, Encoding.UTF8);
|
_ = EnviarEmailAsync();
|
||||||
Config = Config.Replace("\r\n", "<br>").Replace(";", ": ");
|
|
||||||
var values = new NameValueCollection();
|
|
||||||
values["Para"] = VariaveisGerais.EmailFabricante;
|
|
||||||
values["Assunto"] = "OrionTard Pro";
|
|
||||||
values["Conteudo"] = "O Software OrionTard Pro acaba se ser iniciado<br><br>" + Config + "<br>Odômetro Geral: " + Variaveis.PerfilVigente.Odometro;
|
|
||||||
EnviaRequisisaoPost("/email/enviarEmail", values);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void EnviaRequisisaoPost(string endpoint, NameValueCollection body, int timeoutInSeconds = 5)
|
public static async Task EnviarEmailAsync()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var client = new WebClient())
|
if (!await HttpService.ServerUpAsync().ConfigureAwait(false))
|
||||||
using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(timeoutInSeconds)))
|
return;
|
||||||
|
|
||||||
|
string config = await Task.Run(() =>
|
||||||
|
File.ReadAllText(
|
||||||
|
VariaveisGerais.CaminhoArquivoLicenca,
|
||||||
|
Encoding.UTF8)).ConfigureAwait(false);
|
||||||
|
|
||||||
|
config = config.Replace("\r\n", "<br>").Replace(";", ": ");
|
||||||
|
|
||||||
|
var values = new NameValueCollection
|
||||||
{
|
{
|
||||||
// Adicionando headers para a requisição
|
["Para"] = VariaveisGerais.EmailFabricante,
|
||||||
client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
|
["Assunto"] = "OrionTard Pro",
|
||||||
|
["Conteudo"] =
|
||||||
|
"O Software OrionTard Pro acaba se ser iniciado<br><br>" +
|
||||||
|
config +
|
||||||
|
"<br>Odômetro Geral: " +
|
||||||
|
Variaveis.PerfilVigente.Odometro
|
||||||
|
};
|
||||||
|
|
||||||
// Configurando o CancellationToken
|
await EnviaRequisisaoPostAsync(
|
||||||
var task = Task.Run(() => client.UploadValues(VariaveisGerais.LinkSite + "/api/" + endpoint, body), cts.Token);
|
"/email/enviarEmail",
|
||||||
|
values).ConfigureAwait(false);
|
||||||
// Aguarda a conclusão da tarefa com timeout
|
|
||||||
if (task.Wait(TimeSpan.FromSeconds(timeoutInSeconds)))
|
|
||||||
{
|
|
||||||
var responseString = Encoding.Default.GetString(task.Result);
|
|
||||||
Console.WriteLine("Resposta da API: " + responseString);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.WriteLine("Erro: Timeout ao enviar a requisição para o endpoint " + endpoint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Erro ao enviar email: " + e.Message);
|
Console.WriteLine("Erro ao enviar email: " + ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Task<bool> EnviaRequisisaoPostAsync(
|
||||||
|
string endpoint,
|
||||||
|
NameValueCollection body,
|
||||||
|
int timeoutInSeconds = 5)
|
||||||
|
{
|
||||||
|
return HttpService.PostFormAsync(
|
||||||
|
endpoint,
|
||||||
|
body,
|
||||||
|
timeoutInSeconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compatibilidade com chamadas legadas: não bloqueia mais o chamador.
|
||||||
|
public static void EnviaRequisisaoPost(
|
||||||
|
string endpoint,
|
||||||
|
NameValueCollection body,
|
||||||
|
int timeoutInSeconds = 5)
|
||||||
|
{
|
||||||
|
_ = EnviaRequisisaoPostAsync(
|
||||||
|
endpoint,
|
||||||
|
body,
|
||||||
|
timeoutInSeconds);
|
||||||
|
}
|
||||||
|
|
||||||
public static IEnumerable<Control> GetAllControls(Control control, Type type)
|
public static IEnumerable<Control> GetAllControls(Control control, Type type)
|
||||||
{
|
{
|
||||||
var controls = control.Controls.Cast<Control>();
|
var controls = control.Controls.Cast<Control>();
|
||||||
|
|
@ -188,42 +208,50 @@ namespace OrionTardPro
|
||||||
|
|
||||||
public static double CalcularModa(List<double> lista)
|
public static double CalcularModa(List<double> lista)
|
||||||
{
|
{
|
||||||
double moda = 0;
|
if (lista == null || lista.Count == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
Dictionary<double, int> valores = new Dictionary<double, int>();
|
Dictionary<double, int> valores = new Dictionary<double, int>();
|
||||||
foreach (var valor in lista)
|
foreach (double valor in lista)
|
||||||
{
|
{
|
||||||
if (valores.Keys.Contains(valor))
|
if (double.IsNaN(valor) || double.IsInfinity(valor))
|
||||||
{
|
continue;
|
||||||
valores[valor] = valores[valor] + 1;
|
|
||||||
}
|
int quantidade;
|
||||||
else
|
valores.TryGetValue(valor, out quantidade);
|
||||||
{
|
valores[valor] = quantidade + 1;
|
||||||
valores.Add(valor, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
moda = valores.OrderByDescending(x => x.Value).First().Key;
|
if (valores.Count == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
return moda;
|
return valores
|
||||||
|
.OrderByDescending(x => x.Value)
|
||||||
|
.ThenBy(x => x.Key)
|
||||||
|
.First()
|
||||||
|
.Key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double CalcularMediana(List<double> lista)
|
public static double CalcularMediana(List<double> lista)
|
||||||
{
|
{
|
||||||
double mediana = 0;
|
if (lista == null || lista.Count == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (lista.Count() % 2 == 0)
|
// A implementação antiga pegava os elementos centrais sem ordenar.
|
||||||
{
|
// A mediana estatística exige ordenação.
|
||||||
double val1 = lista.Skip((lista.Count() / 2) - 1).First();
|
List<double> ordenada = lista
|
||||||
double val2 = lista.Skip((lista.Count() / 2)).First();
|
.Where(x => !double.IsNaN(x) && !double.IsInfinity(x))
|
||||||
mediana = (val1 + val2) / 2;
|
.OrderBy(x => x)
|
||||||
}
|
.ToList();
|
||||||
else
|
|
||||||
{
|
|
||||||
int meio = Convert.ToInt32(lista.Count() / 2);
|
|
||||||
mediana = lista.Skip(meio).First();
|
|
||||||
}
|
|
||||||
|
|
||||||
return mediana;
|
if (ordenada.Count == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int meio = ordenada.Count / 2;
|
||||||
|
if ((ordenada.Count % 2) == 0)
|
||||||
|
return (ordenada[meio - 1] + ordenada[meio]) / 2.0;
|
||||||
|
|
||||||
|
return ordenada[meio];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using static OrionTardPro.Enuns;
|
using static OrionTardPro.Enuns;
|
||||||
|
|
@ -18,7 +19,7 @@ namespace OrionTardPro.Models
|
||||||
{
|
{
|
||||||
case TipoSensor.Ten: return Variaveis.Sensoriamento.PercentualTensaoBateria;
|
case TipoSensor.Ten: return Variaveis.Sensoriamento.PercentualTensaoBateria;
|
||||||
case TipoSensor.Gas: return Variaveis.Sensoriamento.NivelGas;
|
case TipoSensor.Gas: return Variaveis.Sensoriamento.NivelGas;
|
||||||
case TipoSensor.Ods: return Variaveis.Sensoriamento.OdometroValorConectado;
|
case TipoSensor.Ods: return (Variaveis.Sensoriamento.OdometroValorMotorLigadoParcial / 60.0 / 60.0); // horas
|
||||||
case TipoSensor.Umi: return Variaveis.Sensoriamento.Umidade;
|
case TipoSensor.Umi: return Variaveis.Sensoriamento.Umidade;
|
||||||
case TipoSensor.Tmp: return Variaveis.Sensoriamento.Temperatura;
|
case TipoSensor.Tmp: return Variaveis.Sensoriamento.Temperatura;
|
||||||
case TipoSensor.Cor: return Variaveis.Sensoriamento.Corrente;
|
case TipoSensor.Cor: return Variaveis.Sensoriamento.Corrente;
|
||||||
|
|
@ -29,6 +30,7 @@ namespace OrionTardPro.Models
|
||||||
public double LimiteMinimo { get; set; }
|
public double LimiteMinimo { get; set; }
|
||||||
public double LimiteMaximo { get; set; }
|
public double LimiteMaximo { get; set; }
|
||||||
public bool AlertaSonoro { get; set; }
|
public bool AlertaSonoro { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
public Control LabelSensor { get; set; }
|
public Control LabelSensor { get; set; }
|
||||||
public string LabelSensorNome { get; set; }
|
public string LabelSensorNome { get; set; }
|
||||||
public bool ComparacaoMaxima { get; set; }
|
public bool ComparacaoMaxima { get; set; }
|
||||||
|
|
@ -48,7 +50,8 @@ namespace OrionTardPro.Models
|
||||||
public TipoSensor TipoSensor { get; set; }
|
public TipoSensor TipoSensor { get; set; }
|
||||||
public Estado SensorAtivado { get; set; }
|
public Estado SensorAtivado { get; set; }
|
||||||
public string Variavel { get; set; }
|
public string Variavel { get; set; }
|
||||||
public Control LabelSensor { get; set; }
|
[JsonIgnore]
|
||||||
|
public Control LabelSensor { get; set; }
|
||||||
public double ValorSensor
|
public double ValorSensor
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ namespace OrionTardPro
|
||||||
private IntPtr hWnd;
|
private IntPtr hWnd;
|
||||||
public bool[] buttons;
|
public bool[] buttons;
|
||||||
private string systemJoysticks;
|
private string systemJoysticks;
|
||||||
|
private readonly object _deviceLock = new object();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
@ -67,19 +68,6 @@ namespace OrionTardPro
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (systemJoysticks != null)
|
|
||||||
{
|
|
||||||
GeneralJoystick.JoystickExist = true;
|
|
||||||
//if (Variaveis.frmPrincipal != null)
|
|
||||||
// Variaveis.frmPrincipal.lblJoystickconexao.Text = "Joystick: Conectado";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GeneralJoystick.JoystickExist = false;
|
|
||||||
if (Variaveis.frmPrincipal != null)
|
|
||||||
Variaveis.frmPrincipal.lblJoystickconexao.Text = "Joystick: Desconectado";
|
|
||||||
}
|
|
||||||
|
|
||||||
string Selecionado = null;
|
string Selecionado = null;
|
||||||
if (GeneralJoystick.ListaDeJoysticksNomes.Count > 0)
|
if (GeneralJoystick.ListaDeJoysticksNomes.Count > 0)
|
||||||
Selecionado = GeneralJoystick.ListaDeJoysticksNomes[0];
|
Selecionado = GeneralJoystick.ListaDeJoysticksNomes[0];
|
||||||
|
|
@ -126,35 +114,46 @@ namespace OrionTardPro
|
||||||
|
|
||||||
public void ReleaseJoystick()
|
public void ReleaseJoystick()
|
||||||
{
|
{
|
||||||
joystickDevice.Unacquire();
|
lock (_deviceLock)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
joystickDevice?.Unacquire();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// O dispositivo pode já ter sido removido fisicamente.
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateStatus()
|
public void UpdateStatus()
|
||||||
{
|
{
|
||||||
Poll();
|
lock (_deviceLock)
|
||||||
|
|
||||||
int[] extraAxis = state.GetSlider();
|
|
||||||
|
|
||||||
LXaxis = state.X;
|
|
||||||
LYaxis = state.Y;
|
|
||||||
|
|
||||||
RXaxis = state.Z;
|
|
||||||
RYaxis = state.Rz;
|
|
||||||
|
|
||||||
byte[] jsButtons = state.GetButtons();
|
|
||||||
|
|
||||||
if (jsButtons == null)
|
|
||||||
{
|
{
|
||||||
return;
|
Poll();
|
||||||
}
|
|
||||||
|
|
||||||
buttons = new bool[jsButtons.Length];
|
int[] extraAxis = state.GetSlider();
|
||||||
|
|
||||||
int i = 0;
|
LXaxis = state.X;
|
||||||
foreach (byte button in jsButtons)
|
LYaxis = state.Y;
|
||||||
{
|
|
||||||
buttons[i] = button >= 128;
|
RXaxis = state.Z;
|
||||||
i++;
|
RYaxis = state.Rz;
|
||||||
|
|
||||||
|
byte[] jsButtons = state.GetButtons();
|
||||||
|
|
||||||
|
if (jsButtons == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
buttons = new bool[jsButtons.Length];
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
foreach (byte button in jsButtons)
|
||||||
|
{
|
||||||
|
buttons[i] = button >= 128;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -173,7 +172,7 @@ namespace OrionTardPro
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
throw (null);
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,27 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.Device.Location;
|
using System.Device.Location;
|
||||||
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using static OrionTardPro.Enuns;
|
using static OrionTardPro.Enuns;
|
||||||
|
|
||||||
namespace OrionTardPro.Models
|
namespace OrionTardPro.Models
|
||||||
{
|
{
|
||||||
|
public enum TipoEventoLog
|
||||||
|
{
|
||||||
|
Periodico = 0,
|
||||||
|
Conectado = 1,
|
||||||
|
Desconectado = 2,
|
||||||
|
Infiltracao = 3,
|
||||||
|
SaudeSensores = 4,
|
||||||
|
TrocaPerfil = 5,
|
||||||
|
Encerramento = 6,
|
||||||
|
Manual = 7
|
||||||
|
}
|
||||||
|
|
||||||
public class LogRequestModel
|
public class LogRequestModel
|
||||||
{
|
{
|
||||||
public string cpf { get; set; }
|
public string cpf { get; set; }
|
||||||
|
|
@ -21,8 +36,27 @@ namespace OrionTardPro.Models
|
||||||
|
|
||||||
public class LogModel
|
public class LogModel
|
||||||
{
|
{
|
||||||
|
// Campos novos. Os campos antigos foram mantidos para preservar os relatórios.
|
||||||
|
public int schemaVersao { get; set; } = 2;
|
||||||
|
public string logId { get; set; }
|
||||||
|
public string tipoEvento { get; set; }
|
||||||
|
public string mensagemEvento { get; set; }
|
||||||
|
public DateTime periodoInicio { get; set; }
|
||||||
|
public DateTime periodoFim { get; set; }
|
||||||
|
public int protocoloVersao { get; set; }
|
||||||
|
public string revisaoHardware { get; set; }
|
||||||
|
public string capacidades { get; set; }
|
||||||
|
public byte mascaraSaude { get; set; }
|
||||||
|
public bool alarmeInfiltracao { get; set; }
|
||||||
|
public int infiltracaoRaw { get; set; }
|
||||||
|
public double potenciaW { get; set; }
|
||||||
|
public double rollDeg { get; set; }
|
||||||
|
public double pitchDeg { get; set; }
|
||||||
|
|
||||||
public DateTime data { get; set; }
|
public DateTime data { get; set; }
|
||||||
public int firmwareVersao { get; set; }
|
public int firmwareVersao { get; set; }
|
||||||
|
public string firmwareVersaoStr { get; set; }
|
||||||
|
public long idCliente { get; set; }
|
||||||
public int robotNs { get; set; }
|
public int robotNs { get; set; }
|
||||||
public string modelo { get; set; }
|
public string modelo { get; set; }
|
||||||
public string versao { get; set; }
|
public string versao { get; set; }
|
||||||
|
|
@ -56,43 +90,321 @@ namespace OrionTardPro.Models
|
||||||
public double media { get; set; }
|
public double media { get; set; }
|
||||||
public double moda { get; set; }
|
public double moda { get; set; }
|
||||||
public double mediana { get; set; }
|
public double mediana { get; set; }
|
||||||
public List<double> lista { get; set; }
|
public double ultimo { get; set; }
|
||||||
|
public int quantidadeAmostras { get; set; }
|
||||||
|
|
||||||
|
// Acumulador de runtime para média O(1). Não faz parte do arquivo de log.
|
||||||
|
[JsonIgnore]
|
||||||
|
public double somaAmostrasInterna { get; set; }
|
||||||
|
|
||||||
|
public List<double> lista { get; set; } = new List<double>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class LogsFuncoes
|
public static class LogsFuncoes
|
||||||
{
|
{
|
||||||
public static int TempoLog { get; set; } = 1000 * 60 * 5; // 5 minutos
|
public static int TempoLog { get; set; } = 1000 * 60 * 5;
|
||||||
public static int TimerLog { get; set; } = 0;
|
public static int TimerLog { get; set; } = 0; // compatibilidade com código legado
|
||||||
public static string CaminhoArquivoLogs = Variaveis.CaminhoProjeto + "\\Logs" + Variaveis.ExtLog;
|
public static string CaminhoArquivoLogs =
|
||||||
|
Variaveis.CaminhoProjeto + "\\Logs" + Variaveis.ExtLog;
|
||||||
|
|
||||||
|
private static readonly object _arquivoLock = new object();
|
||||||
|
private static readonly SemaphoreSlim _envioLock = new SemaphoreSlim(1, 1);
|
||||||
|
|
||||||
|
private sealed class LogPendentePersistencia
|
||||||
|
{
|
||||||
|
public LogModel Log { get; set; }
|
||||||
|
public bool TentarEnviar { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly object _filaPersistenciaLock = new object();
|
||||||
|
private static readonly Queue<LogPendentePersistencia> _filaPersistencia =
|
||||||
|
new Queue<LogPendentePersistencia>();
|
||||||
|
private static int _persistenciaLogsEmAndamento;
|
||||||
|
|
||||||
|
public static int FilaPersistenciaPendentePerformance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
lock (_filaPersistenciaLock)
|
||||||
|
return _filaPersistencia.Count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool PersistenciaLogsEmAndamentoPerformance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Interlocked.CompareExchange(
|
||||||
|
ref _persistenciaLogsEmAndamento,
|
||||||
|
0,
|
||||||
|
0) != 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static DateTime _periodoInicio = DateTime.Now;
|
||||||
|
private static DateTime _ultimoLogPeriodico = DateTime.Now;
|
||||||
|
private static GeoCoordinateWatcher _geoWatcher;
|
||||||
|
|
||||||
|
public static bool TemAtividadeNoPeriodo
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return SerialService.Conectado ||
|
||||||
|
Variaveis.LogsSensoresDinamicos.Any(
|
||||||
|
x => x.lista != null && x.lista.Count > 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool DeveRegistrarLogPeriodico()
|
||||||
|
{
|
||||||
|
return TemAtividadeNoPeriodo &&
|
||||||
|
(DateTime.Now - _ultimoLogPeriodico).TotalMilliseconds >= TempoLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mantém compatibilidade com as chamadas existentes.
|
||||||
public static void RegistrarLog()
|
public static void RegistrarLog()
|
||||||
{
|
{
|
||||||
Variaveis.LogsSensoresDinamicos.ForEach(x => x.lista.Clear());
|
RegistrarLog(TipoEventoLog.Manual, null, true);
|
||||||
|
}
|
||||||
|
|
||||||
int baud = 0;
|
public static void RegistrarLog(
|
||||||
int.TryParse(Variaveis.frmConexao.cmbBaud.Text, out baud);
|
TipoEventoLog tipoEvento,
|
||||||
if (baud == 0)
|
string mensagem = null,
|
||||||
|
bool tentarEnviar = true)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
baud = 38400;
|
long inicioSnapshotPerf =
|
||||||
|
PerformanceMonitorService.MarcarInicio();
|
||||||
|
|
||||||
|
// O snapshot é montado no chamador (normalmente UI), pois
|
||||||
|
// algumas informações ainda vêm dos Forms. A parte cara
|
||||||
|
// de serialização + disco acontece em background.
|
||||||
|
LogModel log =
|
||||||
|
CriarSnapshot(
|
||||||
|
tipoEvento,
|
||||||
|
mensagem);
|
||||||
|
|
||||||
|
PerformanceMonitorService.ReportarSeLento(
|
||||||
|
"LogsFuncoes.CriarSnapshot",
|
||||||
|
inicioSnapshotPerf,
|
||||||
|
120,
|
||||||
|
tipoEvento.ToString());
|
||||||
|
|
||||||
|
ReiniciarJanelaSensores();
|
||||||
|
_periodoInicio = log.periodoFim;
|
||||||
|
_ultimoLogPeriodico = log.periodoFim;
|
||||||
|
TimerLog = 0;
|
||||||
|
|
||||||
|
if (tipoEvento == TipoEventoLog.Encerramento)
|
||||||
|
{
|
||||||
|
// No encerramento não podemos depender de uma Task que
|
||||||
|
// pode ser abortada pelo fim do processo.
|
||||||
|
string json =
|
||||||
|
JsonConvert.SerializeObject(log);
|
||||||
|
|
||||||
|
lock (_arquivoLock)
|
||||||
|
{
|
||||||
|
GarantirDiretorio();
|
||||||
|
File.AppendAllText(
|
||||||
|
CaminhoArquivoLogs,
|
||||||
|
json + Environment.NewLine,
|
||||||
|
System.Text.Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EnfileirarPersistenciaLog(
|
||||||
|
log,
|
||||||
|
tentarEnviar);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(
|
||||||
|
"[LOG] Falha ao preparar snapshot: " +
|
||||||
|
ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void EnfileirarPersistenciaLog(
|
||||||
|
LogModel log,
|
||||||
|
bool tentarEnviar)
|
||||||
|
{
|
||||||
|
lock (_filaPersistenciaLock)
|
||||||
|
{
|
||||||
|
_filaPersistencia.Enqueue(
|
||||||
|
new LogPendentePersistencia
|
||||||
|
{
|
||||||
|
Log = log,
|
||||||
|
TentarEnviar = tentarEnviar
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
LogModel Log = new LogModel()
|
IniciarWorkerPersistenciaLogs();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void IniciarWorkerPersistenciaLogs()
|
||||||
|
{
|
||||||
|
if (Interlocked.Exchange(
|
||||||
|
ref _persistenciaLogsEmAndamento,
|
||||||
|
1) == 1)
|
||||||
{
|
{
|
||||||
data = DateTime.Now,
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Task.Run(
|
||||||
|
(Action)ProcessarFilaPersistenciaLogs);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessarFilaPersistenciaLogs()
|
||||||
|
{
|
||||||
|
bool deveTentarEnviar = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
LogPendentePersistencia item;
|
||||||
|
|
||||||
|
lock (_filaPersistenciaLock)
|
||||||
|
{
|
||||||
|
if (_filaPersistencia.Count == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
item =
|
||||||
|
_filaPersistencia.Dequeue();
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
long inicioPerf =
|
||||||
|
PerformanceMonitorService.MarcarInicio();
|
||||||
|
|
||||||
|
string json =
|
||||||
|
JsonConvert.SerializeObject(
|
||||||
|
item.Log);
|
||||||
|
|
||||||
|
lock (_arquivoLock)
|
||||||
|
{
|
||||||
|
GarantirDiretorio();
|
||||||
|
|
||||||
|
File.AppendAllText(
|
||||||
|
CaminhoArquivoLogs,
|
||||||
|
json + Environment.NewLine,
|
||||||
|
System.Text.Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
PerformanceMonitorService.ReportarSeLento(
|
||||||
|
"PersistenciaLogBackground",
|
||||||
|
inicioPerf,
|
||||||
|
200);
|
||||||
|
|
||||||
|
deveTentarEnviar |=
|
||||||
|
item.TentarEnviar;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(
|
||||||
|
"[LOG] Falha ao persistir em background: " +
|
||||||
|
ex.Message);
|
||||||
|
|
||||||
|
// Não perde o snapshot em memória. Recoloca no fim
|
||||||
|
// da fila e encerra esta rodada para evitar loop quente.
|
||||||
|
lock (_filaPersistenciaLock)
|
||||||
|
{
|
||||||
|
_filaPersistencia.Enqueue(
|
||||||
|
item);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Interlocked.Exchange(
|
||||||
|
ref _persistenciaLogsEmAndamento,
|
||||||
|
0);
|
||||||
|
|
||||||
|
bool aindaHaPendentes;
|
||||||
|
lock (_filaPersistenciaLock)
|
||||||
|
{
|
||||||
|
aindaHaPendentes =
|
||||||
|
_filaPersistencia.Count > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aindaHaPendentes)
|
||||||
|
{
|
||||||
|
// Pequena folga evita retry agressivo se o disco
|
||||||
|
// estiver temporariamente indisponível.
|
||||||
|
Task.Delay(1000)
|
||||||
|
.ContinueWith(
|
||||||
|
_ => IniciarWorkerPersistenciaLogs());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (deveTentarEnviar)
|
||||||
|
_ = TentarEnviarPendentesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static LogModel CriarSnapshot(
|
||||||
|
TipoEventoLog tipoEvento,
|
||||||
|
string mensagem)
|
||||||
|
{
|
||||||
|
DateTime agora = DateTime.Now;
|
||||||
|
bool v2 = Variaveis.PerfilVigente != null &&
|
||||||
|
Variaveis.PerfilVigente.VersaoProtocolo == VersaoProtocolo.v2;
|
||||||
|
|
||||||
|
int baud = v2 ? 9600 :
|
||||||
|
(Variaveis.PerfilVigente != null
|
||||||
|
? Variaveis.PerfilVigente.BaudRate
|
||||||
|
: 38400);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (SerialService._PortaRS485 != null && SerialService._PortaRS485.IsOpen)
|
||||||
|
baud = SerialService._PortaRS485.BaudRate;
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
return new LogModel
|
||||||
|
{
|
||||||
|
logId = Guid.NewGuid().ToString("N"),
|
||||||
|
tipoEvento = tipoEvento.ToString(),
|
||||||
|
mensagemEvento = mensagem,
|
||||||
|
periodoInicio = _periodoInicio,
|
||||||
|
periodoFim = agora,
|
||||||
|
data = agora,
|
||||||
|
protocoloVersao = Variaveis.PerfilVigente == null
|
||||||
|
? (int)VersaoProtocolo.v1
|
||||||
|
: (int)Variaveis.PerfilVigente.VersaoProtocolo,
|
||||||
firmwareVersao = Variaveis._FirmwareVersion,
|
firmwareVersao = Variaveis._FirmwareVersion,
|
||||||
|
firmwareVersaoStr = v2 && !string.IsNullOrWhiteSpace(SerialService.FirmwareVersionTextoV6)
|
||||||
|
? SerialService.FirmwareVersionTextoV6
|
||||||
|
: Variaveis._FirmwareVersion.ToString(CultureInfo.InvariantCulture),
|
||||||
|
idCliente = v2 ? SerialService.ClienteIdV6 : 0,
|
||||||
robotNs = Variaveis._RobotNS,
|
robotNs = Variaveis._RobotNS,
|
||||||
modelo = Variaveis._Model.ToString(),
|
modelo = Variaveis._Model.ToString(),
|
||||||
|
revisaoHardware = v2 ? SerialService.RevisaoHardwareV6 : null,
|
||||||
|
capacidades = v2 ? SerialService.CapacidadesV6 : null,
|
||||||
|
mascaraSaude = v2 ? SerialService.MascaraSaudeV6 : (byte)0,
|
||||||
|
alarmeInfiltracao = v2 && SerialService.AlarmeInfiltracaoV6,
|
||||||
|
infiltracaoRaw = v2 ? SerialService.InfiltracaoRawV6 : 0,
|
||||||
|
potenciaW = v2 ? SerialService.PotenciaW_V6 : 0,
|
||||||
|
rollDeg = v2 ? SerialService.RollDeg_V6 : 0,
|
||||||
|
pitchDeg = v2 ? SerialService.PitchDeg_V6 : 0,
|
||||||
versao = VariaveisGerais.Versao,
|
versao = VariaveisGerais.Versao,
|
||||||
servico = Variaveis.Cliente,
|
servico = Variaveis.Cliente,
|
||||||
camera = Variaveis.frmPrincipal.lblCameraconexao.Text,
|
camera = Variaveis.frmPrincipal?.lblCameraconexao?.Text,
|
||||||
altitude = Variaveis.Altitude,
|
altitude = Variaveis.Altitude,
|
||||||
latitude = Variaveis.Latitude,
|
latitude = Variaveis.Latitude,
|
||||||
longitude = Variaveis.Longitude,
|
longitude = Variaveis.Longitude,
|
||||||
baudRate = baud,
|
baudRate = baud,
|
||||||
cpf = Variaveis.frmLicenca.txtCNPJ.Text,
|
cpf = Variaveis.frmLicenca?.txtCNPJ?.Text,
|
||||||
usuario = Variaveis.frmLicenca.txtLicenciadopara.Text,
|
usuario = Variaveis.frmLicenca?.txtLicenciadopara?.Text,
|
||||||
perfil = Variaveis.PerfilSelecionado,
|
perfil = Variaveis.PerfilSelecionado,
|
||||||
portaCOM = Variaveis.frmConexao.cmbPorta.Text,
|
portaCOM = SerialService.PortaCom,
|
||||||
tempoTotal = SerialService.TempoAtivo,
|
tempoTotal = SerialService.TempoAtivo,
|
||||||
tempoConectado = SerialService.TempoConectado,
|
tempoConectado = SerialService.TempoConectado,
|
||||||
odometroTotal = Variaveis.Sensoriamento.OdometroValorTotal,
|
odometroTotal = Variaveis.Sensoriamento.OdometroValorTotal,
|
||||||
|
|
@ -100,72 +412,221 @@ namespace OrionTardPro.Models
|
||||||
odometroMotores = Variaveis.Sensoriamento.OdometroValorMotorLigado,
|
odometroMotores = Variaveis.Sensoriamento.OdometroValorMotorLigado,
|
||||||
odometroMotoresParcial = Variaveis.Sensoriamento.OdometroValorMotorLigadoParcial,
|
odometroMotoresParcial = Variaveis.Sensoriamento.OdometroValorMotorLigadoParcial,
|
||||||
conectado = SerialService.Conectado,
|
conectado = SerialService.Conectado,
|
||||||
sensores = Variaveis.LogsSensoresDinamicos,
|
sensores = CriarSnapshotSensores(),
|
||||||
distancia = Variaveis.Sensoriamento.DeslocamentoCarro,
|
distancia = Variaveis.Sensoriamento.DeslocamentoCarro
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
List<string> Logs = new List<string>();
|
private static List<LogSensorModel> CriarSnapshotSensores()
|
||||||
if (File.Exists(CaminhoArquivoLogs))
|
{
|
||||||
Logs = File.ReadAllLines(CaminhoArquivoLogs).ToList();
|
return Variaveis.LogsSensoresDinamicos.Select(sensor =>
|
||||||
|
|
||||||
string LogStr = JsonConvert.SerializeObject(Log);
|
|
||||||
Logs.Add(LogStr);
|
|
||||||
File.WriteAllLines(CaminhoArquivoLogs, Logs);
|
|
||||||
|
|
||||||
if (HttpService.ServerUp)
|
|
||||||
{
|
{
|
||||||
foreach (var LogItem in Logs)
|
List<double> valores = sensor.lista == null
|
||||||
|
? new List<double>()
|
||||||
|
: sensor.lista.Where(NumeroValido).ToList();
|
||||||
|
|
||||||
|
return new LogSensorModel
|
||||||
{
|
{
|
||||||
LogRequestModel LogRequest = new LogRequestModel()
|
sensor = sensor.sensor,
|
||||||
{
|
descricao = sensor.descricao,
|
||||||
cpf = Log.cpf,
|
quantidadeAmostras = valores.Count,
|
||||||
perfil = Log.perfil,
|
ultimo = valores.Count == 0 ? 0 : valores[valores.Count - 1],
|
||||||
latitude = Log.latitude,
|
minimo = valores.Count == 0 ? 0 : valores.Min(),
|
||||||
longitude = Log.longitude,
|
maximo = valores.Count == 0 ? 0 : valores.Max(),
|
||||||
log = LogItem
|
media = valores.Count == 0 ? 0 : valores.Average(),
|
||||||
};
|
moda = valores.Count == 0 ? 0 : FuncoesGlobais.CalcularModa(valores),
|
||||||
EnviarLog(LogRequest);
|
mediana = valores.Count == 0 ? 0 : FuncoesGlobais.CalcularMediana(valores),
|
||||||
}
|
lista = valores
|
||||||
Logs.Clear();
|
};
|
||||||
File.WriteAllLines(CaminhoArquivoLogs, Logs);
|
}).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool NumeroValido(double valor)
|
||||||
|
{
|
||||||
|
return !double.IsNaN(valor) && !double.IsInfinity(valor);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ReiniciarJanelaSensores()
|
||||||
|
{
|
||||||
|
foreach (LogSensorModel sensor in Variaveis.LogsSensoresDinamicos)
|
||||||
|
{
|
||||||
|
sensor.lista?.Clear();
|
||||||
|
sensor.minimo = 0;
|
||||||
|
sensor.maximo = 0;
|
||||||
|
sensor.media = 0;
|
||||||
|
sensor.moda = 0;
|
||||||
|
sensor.mediana = 0;
|
||||||
|
sensor.ultimo = 0;
|
||||||
|
sensor.quantidadeAmostras = 0;
|
||||||
|
sensor.somaAmostrasInterna = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void EnviarLog(LogRequestModel Log)
|
public static async Task TentarEnviarPendentesAsync()
|
||||||
{
|
{
|
||||||
if (HttpService.ServerUp)
|
// Garante que o envio legado síncrono nunca bloqueie a thread da interface.
|
||||||
{
|
await Task.Delay(1).ConfigureAwait(false);
|
||||||
var body = new NameValueCollection();
|
|
||||||
body["cpf"] = Log.cpf;
|
|
||||||
body["perfil"] = Log.perfil;
|
|
||||||
body["latitude"] = Log.latitude.ToString();
|
|
||||||
body["longitude"] = Log.longitude.ToString();
|
|
||||||
body["log"] = Log.log;
|
|
||||||
|
|
||||||
FuncoesGlobais.EnviaRequisisaoPost("/otp/insertLog", body);
|
if (!File.Exists(CaminhoArquivoLogs))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!await HttpService.ServerUpAsync().ConfigureAwait(false))
|
||||||
|
return;
|
||||||
|
if (!await _envioLock.WaitAsync(0).ConfigureAwait(false))
|
||||||
|
return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<string> pendentes;
|
||||||
|
lock (_arquivoLock)
|
||||||
|
{
|
||||||
|
pendentes = File.ReadAllLines(CaminhoArquivoLogs)
|
||||||
|
.Where(x => !string.IsNullOrWhiteSpace(x))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
int enviados = 0;
|
||||||
|
foreach (string item in pendentes)
|
||||||
|
{
|
||||||
|
if (!await EnviarLogComConfirmacaoAsync(item).ConfigureAwait(false))
|
||||||
|
break;
|
||||||
|
enviados++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enviados > 0)
|
||||||
|
{
|
||||||
|
lock (_arquivoLock)
|
||||||
|
{
|
||||||
|
// Releitura preserva registros anexados enquanto o lote era enviado.
|
||||||
|
List<string> atuais = File.ReadAllLines(CaminhoArquivoLogs)
|
||||||
|
.Where(x => !string.IsNullOrWhiteSpace(x))
|
||||||
|
.ToList();
|
||||||
|
int remover = Math.Min(enviados, atuais.Count);
|
||||||
|
GravarArquivoAtomicamente(atuais.Skip(remover));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("[LOG] Falha ao enviar pendências: " + ex.Message);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_envioLock.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async Task<bool> EnviarLogComConfirmacaoAsync(
|
||||||
|
string logJson)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LogModel log =
|
||||||
|
JsonConvert.DeserializeObject<LogModel>(logJson);
|
||||||
|
|
||||||
|
if (log == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var body = new NameValueCollection
|
||||||
|
{
|
||||||
|
["cpf"] = log.cpf ?? "",
|
||||||
|
["perfil"] = log.perfil ?? "",
|
||||||
|
["latitude"] = log.latitude.ToString(CultureInfo.InvariantCulture),
|
||||||
|
["longitude"] = log.longitude.ToString(CultureInfo.InvariantCulture),
|
||||||
|
["log"] = logJson,
|
||||||
|
["logId"] = log.logId ?? ""
|
||||||
|
};
|
||||||
|
|
||||||
|
// Confirmação real por status HTTP 2xx. A rede nunca bloqueia
|
||||||
|
// a thread da interface e possui timeout no HttpService.
|
||||||
|
return await FuncoesGlobais
|
||||||
|
.EnviaRequisisaoPostAsync("/otp/insertLog", body)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(
|
||||||
|
"[LOG] Envio não confirmado: " + ex.Message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void GravarArquivoAtomicamente(IEnumerable<string> linhas)
|
||||||
|
{
|
||||||
|
GarantirDiretorio();
|
||||||
|
string temporario = CaminhoArquivoLogs + ".tmp";
|
||||||
|
File.WriteAllLines(temporario, linhas, System.Text.Encoding.UTF8);
|
||||||
|
|
||||||
|
if (File.Exists(CaminhoArquivoLogs))
|
||||||
|
{
|
||||||
|
string backup = CaminhoArquivoLogs + ".bak";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.Replace(temporario, CaminhoArquivoLogs, backup, true);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
if (File.Exists(backup)) File.Delete(backup);
|
||||||
|
File.Copy(temporario, CaminhoArquivoLogs, true);
|
||||||
|
File.Delete(temporario);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try { if (File.Exists(backup)) File.Delete(backup); } catch { }
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
File.Copy(temporario, CaminhoArquivoLogs, true);
|
||||||
|
File.Delete(temporario);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void GarantirDiretorio()
|
||||||
|
{
|
||||||
|
string diretorio = Path.GetDirectoryName(CaminhoArquivoLogs);
|
||||||
|
if (!string.IsNullOrWhiteSpace(diretorio))
|
||||||
|
Directory.CreateDirectory(diretorio);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void IniciarGeoWatcher()
|
public static void IniciarGeoWatcher()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GeoCoordinateWatcher GeoWatcher = new GeoCoordinateWatcher();
|
if (_geoWatcher != null)
|
||||||
GeoWatcher.PositionChanged += GeoWatcher_PositionChanged; ;
|
return;
|
||||||
GeoWatcher.Start();
|
|
||||||
|
_geoWatcher = new GeoCoordinateWatcher();
|
||||||
|
_geoWatcher.PositionChanged += GeoWatcher_PositionChanged;
|
||||||
|
_geoWatcher.Start();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("[LOG] Falha ao iniciar localização: " + ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void GeoWatcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
|
public static void EncerrarGeoWatcher()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_geoWatcher == null) return;
|
||||||
|
_geoWatcher.PositionChanged -= GeoWatcher_PositionChanged;
|
||||||
|
_geoWatcher.Stop();
|
||||||
|
_geoWatcher.Dispose();
|
||||||
|
_geoWatcher = null;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("[LOG] Falha ao encerrar localização: " + ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void GeoWatcher_PositionChanged(
|
||||||
|
object sender,
|
||||||
|
GeoPositionChangedEventArgs<GeoCoordinate> e)
|
||||||
{
|
{
|
||||||
Variaveis.Latitude = e.Position.Location.Latitude;
|
Variaveis.Latitude = e.Position.Location.Latitude;
|
||||||
Variaveis.Longitude = e.Position.Location.Longitude;
|
Variaveis.Longitude = e.Position.Location.Longitude;
|
||||||
Variaveis.Altitude = e.Position.Location.Altitude;
|
Variaveis.Altitude = e.Position.Location.Altitude;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,10 @@ namespace OrionTardPro.Models
|
||||||
public double RPM { get; set; } = 30;
|
public double RPM { get; set; } = 30;
|
||||||
public double DiametroRoda { get; set; } = 130;
|
public double DiametroRoda { get; set; } = 130;
|
||||||
public double OffsetOdometro { get; set; } = 0.01;
|
public double OffsetOdometro { get; set; } = 0.01;
|
||||||
|
// Calibração persistente do inclinômetro.
|
||||||
|
// Esses offsets pertencem ao perfil/instalação e são restaurados ao abrir o Orion.
|
||||||
|
public double Sensor_InclinacaoLateral_Offset { get; set; } = 0;
|
||||||
|
public double Sensor_InclinacaoFrontal_Offset { get; set; } = 0;
|
||||||
public bool InverterRotacaoEsquerda { get; set; } = false;
|
public bool InverterRotacaoEsquerda { get; set; } = false;
|
||||||
public bool InverterRotacaoDireita { get; set; } = false;
|
public bool InverterRotacaoDireita { get; set; } = false;
|
||||||
public int Offsett_Driver1_Frente { get; set; } = 0;
|
public int Offsett_Driver1_Frente { get; set; } = 0;
|
||||||
|
|
@ -38,9 +42,8 @@ namespace OrionTardPro.Models
|
||||||
public int TempoEntrePings { get; set; } = 5;
|
public int TempoEntrePings { get; set; } = 5;
|
||||||
public int QuantidadeEnvios { get; set; } = 2;
|
public int QuantidadeEnvios { get; set; } = 2;
|
||||||
public bool ControleIndividualCamera { get; set; } = false;
|
public bool ControleIndividualCamera { get; set; } = false;
|
||||||
|
public bool EnviarPingCamera { get; set; } = false;
|
||||||
public bool ReceberProtocoloCompleto { get; set; } = true;
|
public bool ReceberProtocoloCompleto { get; set; } = true;
|
||||||
public double COR_coeficienteA { get; set; } = 0.097;
|
|
||||||
public double COR_coeficienteB { get; set; } = -0.170;
|
|
||||||
public double COR_multiplicador { get; set; } = 1;
|
public double COR_multiplicador { get; set; } = 1;
|
||||||
// DADOS DO PERFIL
|
// DADOS DO PERFIL
|
||||||
public string PerfilSelecionado { get; set; } = "Perfis\\default" + Variaveis.ExtPerfil;
|
public string PerfilSelecionado { get; set; } = "Perfis\\default" + Variaveis.ExtPerfil;
|
||||||
|
|
@ -56,6 +59,7 @@ namespace OrionTardPro.Models
|
||||||
public Estado Sensor_Ativado_COR { get; set; } = Estado.Desligado;
|
public Estado Sensor_Ativado_COR { get; set; } = Estado.Desligado;
|
||||||
public Estado Sensor_Ativado_VEL { get; set; } = Estado.Desligado;
|
public Estado Sensor_Ativado_VEL { get; set; } = Estado.Desligado;
|
||||||
public Estado Sensor_Ativado_TMP { get; set; } = Estado.Desligado;
|
public Estado Sensor_Ativado_TMP { get; set; } = Estado.Desligado;
|
||||||
|
public Estado Sensor_Ativado_INF { get; set; } = Estado.Desligado;
|
||||||
public Estado Sensor_Ativado_Watchdog { get; set; } = Estado.Desligado;
|
public Estado Sensor_Ativado_Watchdog { get; set; } = Estado.Desligado;
|
||||||
public Estado Atuador_Ativado_MOT { get; set; } = Estado.Ligado;
|
public Estado Atuador_Ativado_MOT { get; set; } = Estado.Ligado;
|
||||||
public Estado Atuador_Ativado_ILU { get; set; } = Estado.Desligado;
|
public Estado Atuador_Ativado_ILU { get; set; } = Estado.Desligado;
|
||||||
|
|
@ -78,7 +82,8 @@ namespace OrionTardPro.Models
|
||||||
public Sentido Raque_Desenrolar { get; set; } = Sentido.Antihorario;
|
public Sentido Raque_Desenrolar { get; set; } = Sentido.Antihorario;
|
||||||
public int BaudRate { get; set; } = 38400;
|
public int BaudRate { get; set; } = 38400;
|
||||||
public bool RequisitarDados { get; set; } = false;
|
public bool RequisitarDados { get; set; } = false;
|
||||||
public bool FirmwareF4 { get; set; } = false;
|
//public bool FirmwareF4 { get; set; } = false;
|
||||||
|
public VersaoProtocolo VersaoProtocolo { get; set; } = VersaoProtocolo.v1;
|
||||||
public byte EnderecoReleGeral { get; set; } = 0x00;
|
public byte EnderecoReleGeral { get; set; } = 0x00;
|
||||||
public int CanalReleGeral { get; set; } = 1;
|
public int CanalReleGeral { get; set; } = 1;
|
||||||
public int AnguloCarimboHorizontal { get; set; } = 67;
|
public int AnguloCarimboHorizontal { get; set; } = 67;
|
||||||
|
|
@ -141,7 +146,9 @@ namespace OrionTardPro.Models
|
||||||
|
|
||||||
public double GetVelocidadeMaxima()
|
public double GetVelocidadeMaxima()
|
||||||
{
|
{
|
||||||
return Math.Round((Convert.ToDouble(RPM * (DiametroRoda / 1000)) * Math.PI) / 60, 2);
|
// Mantém a precisão do cálculo físico durante a integração.
|
||||||
|
// O arredondamento fica apenas para exibição na interface.
|
||||||
|
return (RPM * (DiametroRoda / 1000.0) * Math.PI) / 60.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||||
// É possível especificar todos os valores ou usar como padrão os Números de Build e da Revisão
|
// É possível especificar todos os valores ou usar como padrão os Números de Build e da Revisão
|
||||||
// utilizando o "*" como mostrado abaixo:
|
// utilizando o "*" como mostrado abaixo:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.1.8")]
|
[assembly: AssemblyVersion("1.1.0.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.1.8")]
|
[assembly: AssemblyFileVersion("1.1.0.0")]
|
||||||
|
|
|
||||||
|
|
@ -2,63 +2,168 @@
|
||||||
using OrionTardPro.Models;
|
using OrionTardPro.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Specialized;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OrionTardPro.Services
|
namespace OrionTardPro.Services
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Camada HTTP não bloqueante.
|
||||||
|
///
|
||||||
|
/// Regras de campo:
|
||||||
|
/// - nenhuma operação de rede deve bloquear a thread do WinForms;
|
||||||
|
/// - todos os acessos possuem timeout/cancelamento;
|
||||||
|
/// - HttpClient é reutilizado para evitar exaustão de sockets;
|
||||||
|
/// - probes de servidor são cacheados por poucos segundos para não fazer
|
||||||
|
/// uma conexão nova a cada log/consulta.
|
||||||
|
/// </summary>
|
||||||
class HttpService
|
class HttpService
|
||||||
{
|
{
|
||||||
private static string UrlDownloadArquivos { get; set; } = $"https://zendioninc.com.br/sistemas/{VariaveisGerais.IDSistema}/downloads";
|
private static readonly string UrlDownloadArquivos =
|
||||||
|
$"https://zendioninc.com.br/sistemas/{VariaveisGerais.IDSistema}/downloads";
|
||||||
|
|
||||||
public static bool HasInternet
|
private static readonly HttpClient _httpClient;
|
||||||
|
private static readonly SemaphoreSlim _probeServidorLock = new SemaphoreSlim(1, 1);
|
||||||
|
private static readonly object _cacheServidorLock = new object();
|
||||||
|
|
||||||
|
private static DateTime _ultimoProbeServidorUtc = DateTime.MinValue;
|
||||||
|
private static bool _ultimoEstadoServidor;
|
||||||
|
private static readonly TimeSpan _validadeCacheServidor = TimeSpan.FromSeconds(5);
|
||||||
|
|
||||||
|
static HttpService()
|
||||||
{
|
{
|
||||||
get
|
ServicePointManager.SecurityProtocol =
|
||||||
|
SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
|
||||||
|
|
||||||
|
_httpClient = new HttpClient
|
||||||
{
|
{
|
||||||
try
|
// O timeout real de cada operação é controlado por CTS.
|
||||||
{
|
Timeout = Timeout.InfiniteTimeSpan
|
||||||
using (var client = new WebClient())
|
};
|
||||||
{
|
|
||||||
using (client.OpenRead("http://google.com"))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Último estado conhecido do servidor. Esta propriedade NÃO faz rede.
|
||||||
|
/// Para uma verificação real use ServerUpAsync().
|
||||||
|
/// </summary>
|
||||||
public static bool ServerUp
|
public static bool ServerUp
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
lock (_cacheServidorLock)
|
||||||
|
return _ultimoEstadoServidor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<bool> HasInternetAsync(int timeoutMs = 2500)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var cts = new CancellationTokenSource(Math.Max(500, timeoutMs)))
|
||||||
|
using (var request = new HttpRequestMessage(HttpMethod.Head, "https://www.google.com/generate_204"))
|
||||||
|
using (HttpResponseMessage response = await _httpClient
|
||||||
|
.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cts.Token)
|
||||||
|
.ConfigureAwait(false))
|
||||||
|
{
|
||||||
|
return response.IsSuccessStatusCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<bool> ServerUpAsync(
|
||||||
|
int timeoutMs = 3000,
|
||||||
|
bool forceRefresh = false)
|
||||||
|
{
|
||||||
|
DateTime agoraUtc = DateTime.UtcNow;
|
||||||
|
|
||||||
|
lock (_cacheServidorLock)
|
||||||
|
{
|
||||||
|
if (!forceRefresh &&
|
||||||
|
agoraUtc - _ultimoProbeServidorUtc < _validadeCacheServidor)
|
||||||
|
{
|
||||||
|
return _ultimoEstadoServidor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await _probeServidorLock.WaitAsync().ConfigureAwait(false);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
agoraUtc = DateTime.UtcNow;
|
||||||
|
lock (_cacheServidorLock)
|
||||||
|
{
|
||||||
|
if (!forceRefresh &&
|
||||||
|
agoraUtc - _ultimoProbeServidorUtc < _validadeCacheServidor)
|
||||||
|
{
|
||||||
|
return _ultimoEstadoServidor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
long inicioPerf =
|
||||||
|
PerformanceMonitorService.MarcarInicio();
|
||||||
|
|
||||||
|
bool disponivel = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var client = new WebClient())
|
using (var cts = new CancellationTokenSource(Math.Max(500, timeoutMs)))
|
||||||
|
using (var request = new HttpRequestMessage(HttpMethod.Head, VariaveisGerais.LinkSite))
|
||||||
|
using (HttpResponseMessage response = await _httpClient
|
||||||
|
.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cts.Token)
|
||||||
|
.ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
using (client.OpenRead(VariaveisGerais.LinkSite))
|
// Alguns servidores não aceitam HEAD. Se responder 405,
|
||||||
|
// fazemos um GET mínimo apenas para confirmar conectividade.
|
||||||
|
if (response.StatusCode == HttpStatusCode.MethodNotAllowed)
|
||||||
{
|
{
|
||||||
return true;
|
using (var get = new HttpRequestMessage(HttpMethod.Get, VariaveisGerais.LinkSite))
|
||||||
|
using (HttpResponseMessage getResponse = await _httpClient
|
||||||
|
.SendAsync(get, HttpCompletionOption.ResponseHeadersRead, cts.Token)
|
||||||
|
.ConfigureAwait(false))
|
||||||
|
{
|
||||||
|
disponivel = (int)getResponse.StatusCode < 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
disponivel = (int)response.StatusCode < 500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
return false;
|
disponivel = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lock (_cacheServidorLock)
|
||||||
|
{
|
||||||
|
_ultimoEstadoServidor = disponivel;
|
||||||
|
_ultimoProbeServidorUtc = DateTime.UtcNow;
|
||||||
|
}
|
||||||
|
|
||||||
|
PerformanceMonitorService.ReportarSeLento(
|
||||||
|
"HttpService.ServerUpAsync",
|
||||||
|
inicioPerf,
|
||||||
|
2000,
|
||||||
|
disponivel ? "online" : "offline/timeout");
|
||||||
|
|
||||||
|
return disponivel;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_probeServidorLock.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region MODELS
|
#region MODELS
|
||||||
|
|
||||||
public class LicencaRequestModel
|
public class LicencaRequestModel
|
||||||
|
|
@ -79,143 +184,215 @@ namespace OrionTardPro.Services
|
||||||
public string error { get; set; }
|
public string error { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public LicencaResponse ValidaLicenca(string Chave)
|
public async Task<LicencaResponse> ValidaLicencaAsync(
|
||||||
|
string chave,
|
||||||
|
CancellationToken cancellationToken = default(CancellationToken))
|
||||||
{
|
{
|
||||||
LicencaResponse Retorno = new LicencaResponse();
|
var request = new LicencaRequestModel { Chave = chave };
|
||||||
|
|
||||||
LicencaRequestModel request = new LicencaRequestModel() { Chave = Chave };
|
using (HttpResponseMessage response = await HttpRequestAsync(
|
||||||
|
new HttpRequestData
|
||||||
var response = HttpRequest(new HttpRequestData()
|
|
||||||
{
|
|
||||||
FullAddress = new Uri(VariaveisGerais.LinkSite + "/api/users/validaLicencaByChave/" + VariaveisGerais.IDSistema.ToString()),
|
|
||||||
MediaType = "application/json",
|
|
||||||
InputJson = request,
|
|
||||||
}, HttpMethod.Post);
|
|
||||||
|
|
||||||
string json = response.Content.ReadAsStringAsync().Result;
|
|
||||||
|
|
||||||
if (!response.IsSuccessStatusCode)
|
|
||||||
{
|
|
||||||
var error = response.Content.ReadAsStringAsync();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Retorno = JsonConvert.DeserializeObject<LicencaResponse>(json);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Retorno;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SetUsadaResponse SetChaveUsada(string Chave)
|
|
||||||
{
|
|
||||||
SetUsadaResponse Retorno = new SetUsadaResponse();
|
|
||||||
|
|
||||||
LicencaRequestModel request = new LicencaRequestModel() { Chave = Chave };
|
|
||||||
|
|
||||||
var response = HttpRequest(new HttpRequestData()
|
|
||||||
{
|
|
||||||
FullAddress = new Uri(VariaveisGerais.LinkSite + "/api/users/setUsada"),
|
|
||||||
MediaType = "application/json",
|
|
||||||
InputJson = request,
|
|
||||||
}, HttpMethod.Post);
|
|
||||||
|
|
||||||
string json = response.Content.ReadAsStringAsync().Result;
|
|
||||||
|
|
||||||
if (!response.IsSuccessStatusCode)
|
|
||||||
{
|
|
||||||
var error = response.Content.ReadAsStringAsync();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Retorno = JsonConvert.DeserializeObject<SetUsadaResponse>(json);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Retorno;
|
|
||||||
}
|
|
||||||
|
|
||||||
private HttpResponseMessage HttpRequest(HttpRequestData dataRequest, HttpMethod Metodo)
|
|
||||||
{
|
|
||||||
using (var httpClient = new HttpClient())
|
|
||||||
{
|
|
||||||
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
|
|
||||||
|
|
||||||
httpClient.BaseAddress = new Uri(VariaveisGerais.LinkSite);
|
|
||||||
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(dataRequest.MediaType));
|
|
||||||
|
|
||||||
//httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes($"{AdminUser}:{AdminPassword}")));
|
|
||||||
|
|
||||||
if (Metodo == HttpMethod.Post)
|
|
||||||
{
|
{
|
||||||
var json = JsonConvert.SerializeObject(dataRequest.InputJson);
|
FullAddress = new Uri(
|
||||||
var content = new StringContent(json, Encoding.UTF8, dataRequest.MediaType);
|
VariaveisGerais.LinkSite +
|
||||||
if (!string.IsNullOrEmpty(dataRequest.Body)) content = new StringContent(dataRequest.Body, Encoding.UTF8, dataRequest.MediaType);
|
"/api/users/validaLicencaByChave/" +
|
||||||
|
VariaveisGerais.IDSistema),
|
||||||
|
MediaType = "application/json",
|
||||||
|
InputJson = request,
|
||||||
|
},
|
||||||
|
HttpMethod.Post,
|
||||||
|
cancellationToken).ConfigureAwait(false))
|
||||||
|
{
|
||||||
|
string json = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
return httpClient.PostAsync(dataRequest.FullAddress, content).ConfigureAwait(true).GetAwaiter().GetResult();
|
if (!response.IsSuccessStatusCode || string.IsNullOrWhiteSpace(json))
|
||||||
}
|
return new LicencaResponse();
|
||||||
else if (Metodo == HttpMethod.Put)
|
|
||||||
{
|
|
||||||
var json = JsonConvert.SerializeObject(dataRequest.InputJson);
|
|
||||||
var content = new StringContent(json, Encoding.UTF8, dataRequest.MediaType);
|
|
||||||
if (!string.IsNullOrEmpty(dataRequest.Body)) content = new StringContent(dataRequest.Body, Encoding.UTF8, dataRequest.MediaType);
|
|
||||||
|
|
||||||
return httpClient.PutAsync(dataRequest.FullAddress, content).ConfigureAwait(true).GetAwaiter().GetResult();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return httpClient.GetAsync(dataRequest.FullAddress).ConfigureAwait(true).GetAwaiter().GetResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return JsonConvert.DeserializeObject<LicencaResponse>(json)
|
||||||
|
?? new LicencaResponse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Método para baixar arquivos
|
public async Task<SetUsadaResponse> SetChaveUsadaAsync(
|
||||||
public static async Task<bool> DownloadFileAsync(string fileName, string savePath, Action<double> reportProgress = null)
|
string chave,
|
||||||
|
CancellationToken cancellationToken = default(CancellationToken))
|
||||||
{
|
{
|
||||||
using (var client = new HttpClient())
|
var request = new LicencaRequestModel { Chave = chave };
|
||||||
{
|
|
||||||
client.BaseAddress = new Uri(VariaveisGerais.LinkSite);
|
|
||||||
string url = $"{UrlDownloadArquivos}/{fileName}";
|
|
||||||
|
|
||||||
HttpResponseMessage response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead);
|
using (HttpResponseMessage response = await HttpRequestAsync(
|
||||||
if (response.IsSuccessStatusCode)
|
new HttpRequestData
|
||||||
{
|
{
|
||||||
var totalBytes = response.Content.Headers.ContentLength ?? -1L;
|
FullAddress = new Uri(VariaveisGerais.LinkSite + "/api/users/setUsada"),
|
||||||
var downloadedBytes = 0L;
|
MediaType = "application/json",
|
||||||
|
InputJson = request,
|
||||||
|
},
|
||||||
|
HttpMethod.Post,
|
||||||
|
cancellationToken).ConfigureAwait(false))
|
||||||
|
{
|
||||||
|
string json = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
using (var fileStream = new FileStream(savePath, FileMode.Create, FileAccess.Write, FileShare.None))
|
if (!response.IsSuccessStatusCode || string.IsNullOrWhiteSpace(json))
|
||||||
using (var contentStream = await response.Content.ReadAsStreamAsync())
|
return new SetUsadaResponse();
|
||||||
|
|
||||||
|
return JsonConvert.DeserializeObject<SetUsadaResponse>(json)
|
||||||
|
?? new SetUsadaResponse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async Task<HttpResponseMessage> HttpRequestAsync(
|
||||||
|
HttpRequestData dataRequest,
|
||||||
|
HttpMethod metodo,
|
||||||
|
CancellationToken cancellationToken = default(CancellationToken),
|
||||||
|
int timeoutMs = 6000)
|
||||||
|
{
|
||||||
|
if (dataRequest == null || dataRequest.FullAddress == null)
|
||||||
|
throw new ArgumentException("Requisição HTTP inválida.");
|
||||||
|
|
||||||
|
using (var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken))
|
||||||
|
using (var request = new HttpRequestMessage(metodo, dataRequest.FullAddress))
|
||||||
|
{
|
||||||
|
timeoutCts.CancelAfter(Math.Max(500, timeoutMs));
|
||||||
|
|
||||||
|
request.Headers.Accept.Add(
|
||||||
|
new MediaTypeWithQualityHeaderValue(
|
||||||
|
string.IsNullOrWhiteSpace(dataRequest.MediaType)
|
||||||
|
? "application/json"
|
||||||
|
: dataRequest.MediaType));
|
||||||
|
|
||||||
|
if (metodo == HttpMethod.Post || metodo == HttpMethod.Put)
|
||||||
|
{
|
||||||
|
string json = !string.IsNullOrEmpty(dataRequest.Body)
|
||||||
|
? dataRequest.Body
|
||||||
|
: JsonConvert.SerializeObject(dataRequest.InputJson);
|
||||||
|
|
||||||
|
request.Content = new StringContent(
|
||||||
|
json ?? string.Empty,
|
||||||
|
Encoding.UTF8,
|
||||||
|
string.IsNullOrWhiteSpace(dataRequest.MediaType)
|
||||||
|
? "application/json"
|
||||||
|
: dataRequest.MediaType);
|
||||||
|
}
|
||||||
|
|
||||||
|
long inicioPerf =
|
||||||
|
PerformanceMonitorService.MarcarInicio();
|
||||||
|
|
||||||
|
HttpResponseMessage response = await _httpClient
|
||||||
|
.SendAsync(request, HttpCompletionOption.ResponseContentRead, timeoutCts.Token)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
PerformanceMonitorService.ReportarSeLento(
|
||||||
|
"HttpService.HttpRequestAsync",
|
||||||
|
inicioPerf,
|
||||||
|
2000,
|
||||||
|
metodo + " " + dataRequest.FullAddress.Host);
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<bool> PostFormAsync(
|
||||||
|
string endpoint,
|
||||||
|
NameValueCollection body,
|
||||||
|
int timeoutInSeconds = 5,
|
||||||
|
CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var pares = new List<KeyValuePair<string, string>>();
|
||||||
|
if (body != null)
|
||||||
|
{
|
||||||
|
foreach (string chave in body.AllKeys.Where(x => x != null))
|
||||||
|
pares.Add(new KeyValuePair<string, string>(chave, body[chave] ?? string.Empty));
|
||||||
|
}
|
||||||
|
|
||||||
|
string endereco = endpoint != null && endpoint.StartsWith("http", StringComparison.OrdinalIgnoreCase)
|
||||||
|
? endpoint
|
||||||
|
: VariaveisGerais.LinkSite.TrimEnd('/') + "/api/" + (endpoint ?? string.Empty).TrimStart('/');
|
||||||
|
|
||||||
|
using (var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken))
|
||||||
|
using (var conteudo = new FormUrlEncodedContent(pares))
|
||||||
|
{
|
||||||
|
timeoutCts.CancelAfter(TimeSpan.FromSeconds(Math.Max(1, timeoutInSeconds)));
|
||||||
|
|
||||||
|
using (HttpResponseMessage response = await _httpClient
|
||||||
|
.PostAsync(endereco, conteudo, timeoutCts.Token)
|
||||||
|
.ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
var buffer = new byte[81920]; // 80 KB buffer
|
return response.IsSuccessStatusCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("[HTTP] Falha no POST: " + ex.Message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<bool> DownloadFileAsync(
|
||||||
|
string fileName,
|
||||||
|
string savePath,
|
||||||
|
Action<double> reportProgress = null,
|
||||||
|
CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
{
|
||||||
|
string url = $"{UrlDownloadArquivos}/{fileName}";
|
||||||
|
|
||||||
|
using (var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken))
|
||||||
|
{
|
||||||
|
// Download pode ser grande, então damos uma janela generosa sem
|
||||||
|
// deixar a operação presa para sempre.
|
||||||
|
timeoutCts.CancelAfter(TimeSpan.FromMinutes(5));
|
||||||
|
|
||||||
|
using (HttpResponseMessage response = await _httpClient
|
||||||
|
.GetAsync(url, HttpCompletionOption.ResponseHeadersRead, timeoutCts.Token)
|
||||||
|
.ConfigureAwait(false))
|
||||||
|
{
|
||||||
|
if (!response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
throw new Exception(
|
||||||
|
$"Erro ao baixar o arquivo: {response.StatusCode} - {response.ReasonPhrase}");
|
||||||
|
}
|
||||||
|
|
||||||
|
long totalBytes = response.Content.Headers.ContentLength ?? -1L;
|
||||||
|
long downloadedBytes = 0L;
|
||||||
|
|
||||||
|
using (var fileStream = new FileStream(
|
||||||
|
savePath,
|
||||||
|
FileMode.Create,
|
||||||
|
FileAccess.Write,
|
||||||
|
FileShare.None,
|
||||||
|
81920,
|
||||||
|
true))
|
||||||
|
using (var contentStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false))
|
||||||
|
{
|
||||||
|
var buffer = new byte[81920];
|
||||||
int bytesRead;
|
int bytesRead;
|
||||||
|
|
||||||
while ((bytesRead = await contentStream.ReadAsync(buffer, 0, buffer.Length)) > 0)
|
while ((bytesRead = await contentStream
|
||||||
|
.ReadAsync(buffer, 0, buffer.Length, timeoutCts.Token)
|
||||||
|
.ConfigureAwait(false)) > 0)
|
||||||
{
|
{
|
||||||
fileStream.Write(buffer, 0, bytesRead);
|
await fileStream
|
||||||
|
.WriteAsync(buffer, 0, bytesRead, timeoutCts.Token)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
downloadedBytes += bytesRead;
|
downloadedBytes += bytesRead;
|
||||||
|
|
||||||
// Reporta o progresso
|
|
||||||
if (reportProgress != null && totalBytes > 0)
|
if (reportProgress != null && totalBytes > 0)
|
||||||
{
|
{
|
||||||
double progress = (double)downloadedBytes / totalBytes * 100;
|
double progress = (double)downloadedBytes / totalBytes * 100.0;
|
||||||
reportProgress?.Invoke(progress);
|
reportProgress(progress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new Exception($"Erro ao baixar o arquivo: {response.StatusCode} - {response.ReasonPhrase}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class HttpRequestData
|
public class HttpRequestData
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -4,6 +4,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using static OrionTardPro.Enuns;
|
using static OrionTardPro.Enuns;
|
||||||
|
|
||||||
|
|
@ -12,6 +13,7 @@ namespace OrionTardPro.Services
|
||||||
public class VersionamentoService
|
public class VersionamentoService
|
||||||
{
|
{
|
||||||
private static readonly object _ArquivoLock = new object();
|
private static readonly object _ArquivoLock = new object();
|
||||||
|
private static readonly SemaphoreSlim _atualizacaoLock = new SemaphoreSlim(1, 1);
|
||||||
private static string _ArquivoVersionamento { get; set; } = "version_files.vsf";
|
private static string _ArquivoVersionamento { get; set; } = "version_files.vsf";
|
||||||
public static bool AtualizandoArquivos { get; set; } = false;
|
public static bool AtualizandoArquivos { get; set; } = false;
|
||||||
public static double ProgressoAtualizacao { get; set; } = 0.0;
|
public static double ProgressoAtualizacao { get; set; } = 0.0;
|
||||||
|
|
@ -97,68 +99,81 @@ namespace OrionTardPro.Services
|
||||||
|
|
||||||
public static async Task AtualizarArquivoVersionamento(bool BaixarArquivo)
|
public static async Task AtualizarArquivoVersionamento(bool BaixarArquivo)
|
||||||
{
|
{
|
||||||
// Nao executa caso ja esteja em andamento
|
// Evita duas verificações/downloads simultâneos vindos de timers,
|
||||||
if (AtualizandoArquivos)
|
// fechamento da licença ou ação manual do usuário.
|
||||||
{
|
if (!await _atualizacaoLock.WaitAsync(0).ConfigureAwait(false))
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// Nao executa caso seja verificacao periodica, e nao tenha dado erro anteriormente
|
try
|
||||||
if (!BaixarArquivo && !ResultadoAtualizacao.Contains("Erro"))
|
|
||||||
{
|
{
|
||||||
return;
|
// Não executa caso seja verificação periódica e a última
|
||||||
}
|
// verificação já tenha terminado sem erro.
|
||||||
|
if (!BaixarArquivo && !ResultadoAtualizacao.Contains("Erro"))
|
||||||
|
return;
|
||||||
|
|
||||||
AtualizandoArquivos = true;
|
AtualizandoArquivos = true;
|
||||||
ProgressoAtualizacao = 0.0;
|
ProgressoAtualizacao = 0.0;
|
||||||
ResultadoAtualizacao = "Verificando atualizações...";
|
ResultadoAtualizacao = "Verificando atualizações...";
|
||||||
string caminhoArquivo = _ArquivoVersionamento;
|
string caminhoArquivo = _ArquivoVersionamento;
|
||||||
|
|
||||||
if (!File.Exists(caminhoArquivo))
|
if (!File.Exists(caminhoArquivo))
|
||||||
{
|
|
||||||
List<VersaoArquivoModel> arquivos = new List<VersaoArquivoModel>();
|
|
||||||
lock (_ArquivoLock)
|
|
||||||
{
|
{
|
||||||
arquivos = new List<VersaoArquivoModel>(_ArquivosVersionados);
|
List<VersaoArquivoModel> arquivos;
|
||||||
|
lock (_ArquivoLock)
|
||||||
|
{
|
||||||
|
arquivos = new List<VersaoArquivoModel>(_ArquivosVersionados);
|
||||||
|
}
|
||||||
|
|
||||||
|
await SalvarArquivoVersionamento(arquivos).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
await SalvarArquivoVersionamento(arquivos);
|
|
||||||
}
|
|
||||||
|
|
||||||
await CarregarArquivoVersionamento(caminhoArquivo);
|
await CarregarArquivoVersionamento(caminhoArquivo).ConfigureAwait(false);
|
||||||
ResultadoAtualizacao = "Arquivos carregados!";
|
ResultadoAtualizacao = "Arquivos carregados!";
|
||||||
|
|
||||||
|
if (!await HttpService.ServerUpAsync().ConfigureAwait(false))
|
||||||
|
{
|
||||||
|
ResultadoAtualizacao = "Equipamento desconectado!";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (HttpService.ServerUp)
|
|
||||||
{
|
|
||||||
File.Copy(caminhoArquivo, caminhoArquivo + "_old", true);
|
File.Copy(caminhoArquivo, caminhoArquivo + "_old", true);
|
||||||
|
|
||||||
bool baixado = !BaixarArquivo;
|
bool baixado = !BaixarArquivo;
|
||||||
if (!baixado)
|
if (!baixado)
|
||||||
{
|
{
|
||||||
baixado = await HttpService.DownloadFileAsync(_ArquivoVersionamento, caminhoArquivo);
|
baixado = await HttpService
|
||||||
|
.DownloadFileAsync(_ArquivoVersionamento, caminhoArquivo)
|
||||||
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
if (baixado)
|
|
||||||
|
if (!baixado)
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool carregado = await CarregarArquivoVersionamento(caminhoArquivo)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (!carregado)
|
||||||
{
|
{
|
||||||
bool carregado = await CarregarArquivoVersionamento(caminhoArquivo);
|
File.Copy(caminhoArquivo + "_old", caminhoArquivo, true);
|
||||||
|
ResultadoAtualizacao = "Erro ao atualizar arquivos!";
|
||||||
if (!carregado)
|
}
|
||||||
{
|
else
|
||||||
File.Copy(caminhoArquivo + "_old", caminhoArquivo, true);
|
{
|
||||||
ResultadoAtualizacao = "Erro ao atualizar arquivos!";
|
LimparArquivosAntigos();
|
||||||
}
|
ResultadoAtualizacao = "Arquivos atualizados!";
|
||||||
else
|
|
||||||
{
|
|
||||||
LimparArquivosAntigos();
|
|
||||||
ResultadoAtualizacao = "Arquivos atualizados!";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
ResultadoAtualizacao = "Equipamento desconectado!";
|
ResultadoAtualizacao = "Erro ao atualizar arquivos: " + ex.Message;
|
||||||
|
Console.WriteLine("[VERSAO] " + ResultadoAtualizacao);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ForcarDownloadArquivos = false;
|
||||||
|
AtualizandoArquivos = false;
|
||||||
|
_atualizacaoLock.Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
ForcarDownloadArquivos = false;
|
|
||||||
AtualizandoArquivos = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<bool> SalvarArquivoVersionamento(List<VersaoArquivoModel> arquivos)
|
private static async Task<bool> SalvarArquivoVersionamento(List<VersaoArquivoModel> arquivos)
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -141,7 +141,6 @@ namespace OrionTardPro
|
||||||
|
|
||||||
// Protocolo de entrada
|
// Protocolo de entrada
|
||||||
|
|
||||||
|
|
||||||
public static string[] TiposOdometro = new string[] { "Total", "Conectado", "Movimento", "Parcial" };
|
public static string[] TiposOdometro = new string[] { "Total", "Conectado", "Movimento", "Parcial" };
|
||||||
public static int OdometroEnderecoTotal { get; set; } = 110;
|
public static int OdometroEnderecoTotal { get; set; } = 110;
|
||||||
public static int OdometroEnderecoConectado { get; set; } = 130;
|
public static int OdometroEnderecoConectado { get; set; } = 130;
|
||||||
|
|
@ -174,6 +173,8 @@ namespace OrionTardPro
|
||||||
new LogSensorModel() { sensor = TipoSensor.Vel, descricao = "Porcentagem", lista = new List<double>() },
|
new LogSensorModel() { sensor = TipoSensor.Vel, descricao = "Porcentagem", lista = new List<double>() },
|
||||||
new LogSensorModel() { sensor = TipoSensor.Vel, descricao = "Velocidade MPU", lista = new List<double>() },
|
new LogSensorModel() { sensor = TipoSensor.Vel, descricao = "Velocidade MPU", lista = new List<double>() },
|
||||||
new LogSensorModel() { sensor = TipoSensor.Ods, descricao = "Distância", lista = new List<double>() },
|
new LogSensorModel() { sensor = TipoSensor.Ods, descricao = "Distância", lista = new List<double>() },
|
||||||
|
new LogSensorModel() { sensor = TipoSensor.Inf, descricao = "Infiltração - nível de risco", lista = new List<double>() },
|
||||||
|
new LogSensorModel() { sensor = TipoSensor.Inf, descricao = "Infiltração - leitura bruta", lista = new List<double>() }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -184,11 +185,327 @@ namespace OrionTardPro
|
||||||
|
|
||||||
public static int EncoderVoltasPorMetro { get; set; } = 15;
|
public static int EncoderVoltasPorMetro { get; set; } = 15;
|
||||||
|
|
||||||
|
// Persistência operacional desacoplada da UI.
|
||||||
|
// Durante movimento apenas marcamos o perfil como "sujo".
|
||||||
|
// Um timer de background grava no máximo uma vez a cada 5 s.
|
||||||
|
private const int IntervaloPersistenciaOperacionalMs = 5000;
|
||||||
|
private static readonly object _persistenciaPerfilLock = new object();
|
||||||
|
private static readonly object _escritaPerfilLock = new object();
|
||||||
|
private static System.Threading.Timer _persistenciaPerfilTimer;
|
||||||
|
private static int _persistenciaPerfilPendente;
|
||||||
|
private static int _persistenciaPerfilEmAndamento;
|
||||||
|
|
||||||
|
public static bool PersistenciaPendentePerformance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return System.Threading.Interlocked.CompareExchange(
|
||||||
|
ref _persistenciaPerfilPendente,
|
||||||
|
0,
|
||||||
|
0) != 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool PersistenciaEmAndamentoPerformance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return System.Threading.Interlocked.CompareExchange(
|
||||||
|
ref _persistenciaPerfilEmAndamento,
|
||||||
|
0,
|
||||||
|
0) != 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SolicitarPersistenciaOperacional()
|
||||||
|
{
|
||||||
|
System.Threading.Interlocked.Exchange(
|
||||||
|
ref _persistenciaPerfilPendente,
|
||||||
|
1);
|
||||||
|
|
||||||
public static void SetVariaveisGerais(bool DeFabrica, bool Odometro = false)
|
lock (_persistenciaPerfilLock)
|
||||||
|
{
|
||||||
|
if (_persistenciaPerfilTimer == null)
|
||||||
|
{
|
||||||
|
_persistenciaPerfilTimer =
|
||||||
|
new System.Threading.Timer(
|
||||||
|
PersistenciaPerfilTimerCallback,
|
||||||
|
null,
|
||||||
|
IntervaloPersistenciaOperacionalMs,
|
||||||
|
IntervaloPersistenciaOperacionalMs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void PersistenciaPerfilTimerCallback(object state)
|
||||||
|
{
|
||||||
|
if (System.Threading.Interlocked.Exchange(
|
||||||
|
ref _persistenciaPerfilPendente,
|
||||||
|
0) == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (System.Threading.Interlocked.Exchange(
|
||||||
|
ref _persistenciaPerfilEmAndamento,
|
||||||
|
1) == 1)
|
||||||
|
{
|
||||||
|
// Já há uma gravação em curso. Mantém a solicitação viva
|
||||||
|
// para o próximo ciclo sem empilhar Tasks.
|
||||||
|
System.Threading.Interlocked.Exchange(
|
||||||
|
ref _persistenciaPerfilPendente,
|
||||||
|
1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PersistirPerfilEmDisco();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(
|
||||||
|
"[PERSISTENCIA] Falha ao salvar perfil operacional: " +
|
||||||
|
ex.Message);
|
||||||
|
|
||||||
|
// Tenta novamente no próximo ciclo.
|
||||||
|
System.Threading.Interlocked.Exchange(
|
||||||
|
ref _persistenciaPerfilPendente,
|
||||||
|
1);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
System.Threading.Interlocked.Exchange(
|
||||||
|
ref _persistenciaPerfilEmAndamento,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void FlushPersistenciaPendente()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
System.Threading.Interlocked.Exchange(
|
||||||
|
ref _persistenciaPerfilPendente,
|
||||||
|
0);
|
||||||
|
|
||||||
|
PersistirPerfilEmDisco();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(
|
||||||
|
"[PERSISTENCIA] Falha no flush final do perfil: " +
|
||||||
|
ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void PersistirPerfilEmDisco()
|
||||||
|
{
|
||||||
|
long inicioPerf = PerformanceMonitorService.MarcarInicio();
|
||||||
|
|
||||||
|
lock (_escritaPerfilLock)
|
||||||
|
{
|
||||||
|
if (PerfilVigente == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
string jsonPerfil =
|
||||||
|
JsonConvert.SerializeObject(PerfilVigente);
|
||||||
|
|
||||||
|
GravarTextoAtomicamente(
|
||||||
|
"install" + ExtInstall,
|
||||||
|
jsonPerfil);
|
||||||
|
}
|
||||||
|
|
||||||
|
PerformanceMonitorService.ReportarSeLento(
|
||||||
|
"PersistirPerfilEmDisco",
|
||||||
|
inicioPerf,
|
||||||
|
150);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void GravarTextoAtomicamente(
|
||||||
|
string caminhoDestino,
|
||||||
|
string conteudo)
|
||||||
|
{
|
||||||
|
string caminhoTemporario =
|
||||||
|
caminhoDestino + ".tmp";
|
||||||
|
|
||||||
|
File.WriteAllText(
|
||||||
|
caminhoTemporario,
|
||||||
|
conteudo,
|
||||||
|
Encoding.UTF8);
|
||||||
|
|
||||||
|
if (!File.Exists(caminhoDestino))
|
||||||
|
{
|
||||||
|
File.Move(
|
||||||
|
caminhoTemporario,
|
||||||
|
caminhoDestino);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string caminhoBackup =
|
||||||
|
caminhoDestino + ".bak";
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.Replace(
|
||||||
|
caminhoTemporario,
|
||||||
|
caminhoDestino,
|
||||||
|
caminhoBackup,
|
||||||
|
true);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (File.Exists(caminhoBackup))
|
||||||
|
File.Delete(caminhoBackup);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// Fallback para sistemas/volumes onde File.Replace
|
||||||
|
// não estiver disponível.
|
||||||
|
File.Copy(
|
||||||
|
caminhoTemporario,
|
||||||
|
caminhoDestino,
|
||||||
|
true);
|
||||||
|
|
||||||
|
File.Delete(caminhoTemporario);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Persiste a calibração de inclinação no install e no perfil
|
||||||
|
/// selecionado. A operação é rara (duplo clique de calibração), então
|
||||||
|
/// usamos gravação atômica imediata para que o zero sobreviva inclusive
|
||||||
|
/// a uma reinicialização logo após a calibração.
|
||||||
|
/// </summary>
|
||||||
|
public static void PersistirCalibracaoInclinacao(
|
||||||
|
double offsetLateral,
|
||||||
|
double offsetFrontal)
|
||||||
|
{
|
||||||
|
if (PerfilVigente == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
long inicioPerf = PerformanceMonitorService.MarcarInicio();
|
||||||
|
|
||||||
|
lock (_escritaPerfilLock)
|
||||||
|
{
|
||||||
|
PerfilVigente.Sensor_InclinacaoLateral_Offset = offsetLateral;
|
||||||
|
PerfilVigente.Sensor_InclinacaoFrontal_Offset = offsetFrontal;
|
||||||
|
|
||||||
|
// O install guarda o estado operacional atual.
|
||||||
|
string jsonInstall = JsonConvert.SerializeObject(PerfilVigente);
|
||||||
|
GravarTextoAtomicamente(
|
||||||
|
"install" + ExtInstall,
|
||||||
|
jsonInstall);
|
||||||
|
|
||||||
|
// Mantém também o perfil selecionado coerente. Atualizamos
|
||||||
|
// somente os campos de calibração para não transportar
|
||||||
|
// odômetros/estado operacional para o arquivo de perfil.
|
||||||
|
string caminhoPerfil = PerfilVigente.PerfilSelecionado;
|
||||||
|
if (!string.IsNullOrWhiteSpace(caminhoPerfil) &&
|
||||||
|
File.Exists(caminhoPerfil))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string jsonPerfil = File.ReadAllText(caminhoPerfil);
|
||||||
|
PerfilModel perfilSalvo =
|
||||||
|
JsonConvert.DeserializeObject<PerfilModel>(jsonPerfil);
|
||||||
|
|
||||||
|
if (perfilSalvo != null)
|
||||||
|
{
|
||||||
|
perfilSalvo.Sensor_InclinacaoLateral_Offset = offsetLateral;
|
||||||
|
perfilSalvo.Sensor_InclinacaoFrontal_Offset = offsetFrontal;
|
||||||
|
|
||||||
|
GravarTextoAtomicamente(
|
||||||
|
caminhoPerfil,
|
||||||
|
JsonConvert.SerializeObject(perfilSalvo));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(
|
||||||
|
"[CALIBRACAO] Falha ao atualizar offsets no perfil: " +
|
||||||
|
ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.Threading.Interlocked.Exchange(
|
||||||
|
ref _persistenciaPerfilPendente,
|
||||||
|
0);
|
||||||
|
|
||||||
|
PerformanceMonitorService.ReportarSeLento(
|
||||||
|
"PersistirCalibracaoInclinacao",
|
||||||
|
inicioPerf,
|
||||||
|
150);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int ObterPotenciaMinimaPercentual()
|
||||||
|
{
|
||||||
|
if (PerfilVigente == null)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return Math.Max(0, Math.Min(100, PerfilVigente.PotenciaMinima * 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int ObterPotenciaMaximaPercentual()
|
||||||
|
{
|
||||||
|
if (PerfilVigente == null)
|
||||||
|
return 100;
|
||||||
|
|
||||||
|
int minimo = ObterPotenciaMinimaPercentual();
|
||||||
|
int maximo = Math.Max(0, Math.Min(100, PerfilVigente.PotenciaMaxima * 10));
|
||||||
|
return Math.Max(minimo, maximo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int NormalizarPotenciaAtualPercentual(int valor)
|
||||||
|
{
|
||||||
|
// Compatibilidade com os perfis legados: historicamente o TrackBar
|
||||||
|
// trabalhava em unidades de dezenas (6 = 60%). A partir daqui
|
||||||
|
// PotenciaAtual passa a representar diretamente o percentual.
|
||||||
|
if (valor >= 0 && valor <= 10)
|
||||||
|
valor *= 10;
|
||||||
|
|
||||||
|
int minimo = ObterPotenciaMinimaPercentual();
|
||||||
|
int maximo = ObterPotenciaMaximaPercentual();
|
||||||
|
return Math.Max(minimo, Math.Min(maximo, valor));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ConfigurarTrackBarsVelocidade()
|
||||||
|
{
|
||||||
|
if (PerfilVigente == null || frmPrincipal == null || frmControle == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int minimo = ObterPotenciaMinimaPercentual();
|
||||||
|
int maximo = ObterPotenciaMaximaPercentual();
|
||||||
|
int atual = NormalizarPotenciaAtualPercentual(PerfilVigente.PotenciaAtual);
|
||||||
|
|
||||||
|
PerfilVigente.PotenciaAtual = atual;
|
||||||
|
|
||||||
|
TrackBar[] controles =
|
||||||
|
{
|
||||||
|
frmPrincipal.trkVelocidade,
|
||||||
|
frmControle.trkVelocidade
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (TrackBar controle in controles)
|
||||||
|
{
|
||||||
|
controle.Maximum = maximo;
|
||||||
|
controle.Minimum = minimo;
|
||||||
|
controle.SmallChange = 1;
|
||||||
|
controle.LargeChange = 5;
|
||||||
|
controle.TickFrequency = 1;
|
||||||
|
controle.Value = atual;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetVariaveisGerais(
|
||||||
|
bool DeFabrica,
|
||||||
|
bool Odometro = false)
|
||||||
{
|
{
|
||||||
if (DeFabrica)
|
if (DeFabrica)
|
||||||
{
|
{
|
||||||
|
|
@ -197,24 +514,19 @@ namespace OrionTardPro
|
||||||
|
|
||||||
if (!Odometro)
|
if (!Odometro)
|
||||||
{
|
{
|
||||||
PerfilVigente.PotenciaAtual = Convert.ToInt32(frmPrincipal.trkVelocidade.Value);
|
PerfilVigente.PotenciaAtual =
|
||||||
|
Convert.ToInt32(
|
||||||
|
frmPrincipal.trkVelocidade.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
PerfilVigente.ListaAlertas.ForEach(alerta =>
|
// LabelSensor é runtime-only e agora possui [JsonIgnore].
|
||||||
{
|
// Portanto não precisamos mais desmontar/reconstruir
|
||||||
alerta.LabelSensor = null;
|
// referências de Controls ao salvar o perfil.
|
||||||
//alerta.ValorComparar = null;
|
PersistirPerfilEmDisco();
|
||||||
});
|
|
||||||
|
|
||||||
string JsonPerfil = JsonConvert.SerializeObject(PerfilVigente);
|
|
||||||
File.WriteAllText("install" + ExtInstall, JsonPerfil);
|
|
||||||
|
|
||||||
PerfilVigente.ListaAlertas.ForEach(alerta =>
|
|
||||||
{
|
|
||||||
alerta.LabelSensor = frmPrincipal.Controls.Find(alerta.LabelSensorNome, true).First();
|
|
||||||
//alerta.ValorComparar = ListaMetodosSensores.First(x => x.Method.Name == alerta.ValorCompararNome);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
System.Threading.Interlocked.Exchange(
|
||||||
|
ref _persistenciaPerfilPendente,
|
||||||
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SalvarPerfil(string Diretorio)
|
public static void SalvarPerfil(string Diretorio)
|
||||||
|
|
@ -239,6 +551,8 @@ namespace OrionTardPro
|
||||||
RPM = Convert.ToDouble(frmParametros.nudRPM.Value),
|
RPM = Convert.ToDouble(frmParametros.nudRPM.Value),
|
||||||
DiametroRoda = Convert.ToDouble(frmParametros.nudDiametroRoda.Value),
|
DiametroRoda = Convert.ToDouble(frmParametros.nudDiametroRoda.Value),
|
||||||
OffsetOdometro = double.Parse(string.IsNullOrEmpty(frmParametros.txtOffsetvelocidade.Text) ? "0" : frmParametros.txtOffsetvelocidade.Text),
|
OffsetOdometro = double.Parse(string.IsNullOrEmpty(frmParametros.txtOffsetvelocidade.Text) ? "0" : frmParametros.txtOffsetvelocidade.Text),
|
||||||
|
Sensor_InclinacaoLateral_Offset = Sensoriamento.Sensor_InclinacaoLateral_Offset,
|
||||||
|
Sensor_InclinacaoFrontal_Offset = Sensoriamento.Sensor_InclinacaoFrontal_Offset,
|
||||||
Offsett_Driver1_Frente = Convert.ToInt32(frmParametros.nudDF1Offset.Value),
|
Offsett_Driver1_Frente = Convert.ToInt32(frmParametros.nudDF1Offset.Value),
|
||||||
Offsett_Driver2_Frente = Convert.ToInt32(frmParametros.nudDF2Offset.Value),
|
Offsett_Driver2_Frente = Convert.ToInt32(frmParametros.nudDF2Offset.Value),
|
||||||
Offsett_Driver1_Tras = Convert.ToInt32(frmParametros.nudDT1Offset.Value),
|
Offsett_Driver1_Tras = Convert.ToInt32(frmParametros.nudDT1Offset.Value),
|
||||||
|
|
@ -257,6 +571,7 @@ namespace OrionTardPro
|
||||||
TempoEntrePings = Convert.ToInt32(frmConexao.txtTempoPings.Value),
|
TempoEntrePings = Convert.ToInt32(frmConexao.txtTempoPings.Value),
|
||||||
QuantidadeEnvios = Convert.ToInt32(frmConexao.txtEnvios.Value),
|
QuantidadeEnvios = Convert.ToInt32(frmConexao.txtEnvios.Value),
|
||||||
ControleIndividualCamera = frmConexao.chbCamera.Checked,
|
ControleIndividualCamera = frmConexao.chbCamera.Checked,
|
||||||
|
EnviarPingCamera = frmConexao.chbPingCamera.Checked,
|
||||||
ReceberProtocoloCompleto = frmConexao.chbProtocolocompleto.Checked,
|
ReceberProtocoloCompleto = frmConexao.chbProtocolocompleto.Checked,
|
||||||
PerfilSelecionado = PerfilSelecionado,
|
PerfilSelecionado = PerfilSelecionado,
|
||||||
RampaAtual = Convert.ToInt32(frmControle.trkRampaaceleracao.Value),
|
RampaAtual = Convert.ToInt32(frmControle.trkRampaaceleracao.Value),
|
||||||
|
|
@ -270,6 +585,7 @@ namespace OrionTardPro
|
||||||
Sensor_Ativado_COR = frmParametros.chbCor.Checked ? Estado.Ligado : Estado.Desligado,
|
Sensor_Ativado_COR = frmParametros.chbCor.Checked ? Estado.Ligado : Estado.Desligado,
|
||||||
Sensor_Ativado_VEL = frmParametros.chbVel.Checked ? Estado.Ligado : Estado.Desligado,
|
Sensor_Ativado_VEL = frmParametros.chbVel.Checked ? Estado.Ligado : Estado.Desligado,
|
||||||
Sensor_Ativado_TMP = frmParametros.chbTmp.Checked ? Estado.Ligado : Estado.Desligado,
|
Sensor_Ativado_TMP = frmParametros.chbTmp.Checked ? Estado.Ligado : Estado.Desligado,
|
||||||
|
Sensor_Ativado_INF = frmParametros.chbInf.Checked ? Estado.Ligado : Estado.Desligado,
|
||||||
Sensor_Ativado_Watchdog = frmParametros.chbWatchdog.Checked ? Estado.Ligado : Estado.Desligado,
|
Sensor_Ativado_Watchdog = frmParametros.chbWatchdog.Checked ? Estado.Ligado : Estado.Desligado,
|
||||||
Atuador_Ativado_MOT = frmParametros.chbMot.Checked ? Estado.Ligado : Estado.Desligado,
|
Atuador_Ativado_MOT = frmParametros.chbMot.Checked ? Estado.Ligado : Estado.Desligado,
|
||||||
Atuador_Ativado_ILU = frmParametros.chbIlu.Checked ? Estado.Ligado : Estado.Desligado,
|
Atuador_Ativado_ILU = frmParametros.chbIlu.Checked ? Estado.Ligado : Estado.Desligado,
|
||||||
|
|
@ -294,12 +610,13 @@ namespace OrionTardPro
|
||||||
ValorMaximoAnalogico = Convert.ToInt32(Math.Pow(2, PerfilVigente.ResolucaoLeitura)),
|
ValorMaximoAnalogico = Convert.ToInt32(Math.Pow(2, PerfilVigente.ResolucaoLeitura)),
|
||||||
PerfilJoystick = PerfilVigente.PerfilJoystick,
|
PerfilJoystick = PerfilVigente.PerfilJoystick,
|
||||||
ListaAlertas = PerfilVigente.ListaAlertas,
|
ListaAlertas = PerfilVigente.ListaAlertas,
|
||||||
COR_coeficienteA = Double.Parse(frmParametros.txtCoefA.Text),
|
|
||||||
COR_coeficienteB = Double.Parse(frmParametros.txtCoefB.Text),
|
|
||||||
COR_multiplicador = Double.Parse(frmParametros.txtMultiplicadorCorrente.Text),
|
COR_multiplicador = Double.Parse(frmParametros.txtMultiplicadorCorrente.Text),
|
||||||
InverterRotacaoDireita = frmParametros.chbInvDireita.Checked,
|
InverterRotacaoDireita = frmParametros.chbInvDireita.Checked,
|
||||||
InverterRotacaoEsquerda = frmParametros.chbInvEsquerda.Checked,
|
InverterRotacaoEsquerda = frmParametros.chbInvEsquerda.Checked,
|
||||||
FirmwareF4 = frmParametros.rdbF4.Checked,
|
//FirmwareF4 = true, // frmParametros.rdbF4.Checked,
|
||||||
|
VersaoProtocolo = (VersaoProtocolo)Enum.Parse(
|
||||||
|
typeof(VersaoProtocolo),
|
||||||
|
frmParametros.cmbProtocoloVersao.SelectedItem.ToString()),
|
||||||
RequisitarDados = frmConexao.chbRequisitarDados.Checked,
|
RequisitarDados = frmConexao.chbRequisitarDados.Checked,
|
||||||
EnderecoReleGeral = Convert.ToByte(frmParametros.nudEnderecoReleGeral.Value),
|
EnderecoReleGeral = Convert.ToByte(frmParametros.nudEnderecoReleGeral.Value),
|
||||||
CanalReleGeral = Convert.ToInt32(frmParametros.nudCanalReleGeral.Value),
|
CanalReleGeral = Convert.ToInt32(frmParametros.nudCanalReleGeral.Value),
|
||||||
|
|
@ -309,7 +626,7 @@ namespace OrionTardPro
|
||||||
AnguloMedicaoMargemLimite = Convert.ToInt32(frmParametros.nudAnguloMedicaoMargemLimite.Value),
|
AnguloMedicaoMargemLimite = Convert.ToInt32(frmParametros.nudAnguloMedicaoMargemLimite.Value),
|
||||||
};
|
};
|
||||||
string PerfilJson = JsonConvert.SerializeObject(PerfilVigente);
|
string PerfilJson = JsonConvert.SerializeObject(PerfilVigente);
|
||||||
File.WriteAllText(Diretorio, PerfilJson);
|
GravarTextoAtomicamente(Diretorio, PerfilJson);
|
||||||
|
|
||||||
//File.WriteAllLines(Diretorio, DadosPerfil);
|
//File.WriteAllLines(Diretorio, DadosPerfil);
|
||||||
|
|
||||||
|
|
@ -318,6 +635,13 @@ namespace OrionTardPro
|
||||||
|
|
||||||
public static void CarregarPerfil(string Diretorio = null)
|
public static void CarregarPerfil(string Diretorio = null)
|
||||||
{
|
{
|
||||||
|
if (Diretorio != null && LogsFuncoes.TemAtividadeNoPeriodo)
|
||||||
|
{
|
||||||
|
LogsFuncoes.RegistrarLog(
|
||||||
|
TipoEventoLog.TrocaPerfil,
|
||||||
|
"Encerramento da janela antes da troca de perfil.");
|
||||||
|
}
|
||||||
|
|
||||||
string pathLeitura = "install" + ExtInstall;
|
string pathLeitura = "install" + ExtInstall;
|
||||||
if (Diretorio != null)
|
if (Diretorio != null)
|
||||||
pathLeitura = Diretorio;
|
pathLeitura = Diretorio;
|
||||||
|
|
@ -325,6 +649,19 @@ namespace OrionTardPro
|
||||||
string JsonPerfil = File.ReadAllText(pathLeitura);
|
string JsonPerfil = File.ReadAllText(pathLeitura);
|
||||||
PerfilVigente = JsonConvert.DeserializeObject<PerfilModel>(JsonPerfil);
|
PerfilVigente = JsonConvert.DeserializeObject<PerfilModel>(JsonPerfil);
|
||||||
|
|
||||||
|
if (PerfilVigente == null)
|
||||||
|
throw new InvalidDataException("O arquivo de perfil não contém um perfil válido.");
|
||||||
|
|
||||||
|
// Sincroniza imediatamente a calibração persistida com o modelo
|
||||||
|
// runtime. Assim conexão/reconexão não apaga o zero do usuário.
|
||||||
|
if (Sensoriamento != null)
|
||||||
|
Sensoriamento.CarregarOffsetsDoPerfil();
|
||||||
|
|
||||||
|
if (!Enum.IsDefined(typeof(VersaoProtocolo), PerfilVigente.VersaoProtocolo))
|
||||||
|
PerfilVigente.VersaoProtocolo = VersaoProtocolo.v1;
|
||||||
|
if (PerfilVigente.ListaAlertas == null)
|
||||||
|
PerfilVigente.ListaAlertas = new List<Alertas>();
|
||||||
|
|
||||||
if (pathLeitura.Contains("install"))
|
if (pathLeitura.Contains("install"))
|
||||||
{
|
{
|
||||||
OdometroAtual = PerfilVigente.Odometro;
|
OdometroAtual = PerfilVigente.Odometro;
|
||||||
|
|
@ -366,16 +703,11 @@ namespace OrionTardPro
|
||||||
});
|
});
|
||||||
|
|
||||||
PerfilVigente.ValorMaximoAnalogico = Convert.ToInt32(Math.Pow(2, PerfilVigente.ResolucaoLeitura));
|
PerfilVigente.ValorMaximoAnalogico = Convert.ToInt32(Math.Pow(2, PerfilVigente.ResolucaoLeitura));
|
||||||
frmControle.trkVelocidade.Maximum = PerfilVigente.PotenciaMaxima;
|
ConfigurarTrackBarsVelocidade();
|
||||||
frmPrincipal.trkVelocidade.Maximum = PerfilVigente.PotenciaMaxima;
|
|
||||||
frmControle.trkVelocidade.Minimum = PerfilVigente.PotenciaMinima;
|
|
||||||
frmPrincipal.trkVelocidade.Minimum = PerfilVigente.PotenciaMinima;
|
|
||||||
frmControle.trkRampaaceleracao.Maximum = PerfilVigente.RampaMaxima;
|
frmControle.trkRampaaceleracao.Maximum = PerfilVigente.RampaMaxima;
|
||||||
frmControle.trkRampaaceleracao.Minimum = PerfilVigente.RampaMinima;
|
frmControle.trkRampaaceleracao.Minimum = PerfilVigente.RampaMinima;
|
||||||
frmControle.trkPrecisaorampa.Maximum = PerfilVigente.PrecisaoMaxima;
|
frmControle.trkPrecisaorampa.Maximum = PerfilVigente.PrecisaoMaxima;
|
||||||
frmControle.trkPrecisaorampa.Minimum = PerfilVigente.PrecisaoMinima;
|
frmControle.trkPrecisaorampa.Minimum = PerfilVigente.PrecisaoMinima;
|
||||||
frmPrincipal.trkVelocidade.Value = PerfilVigente.PotenciaAtual;
|
|
||||||
frmControle.trkVelocidade.Value = PerfilVigente.PotenciaAtual;
|
|
||||||
frmParametros.chbGas.Checked = (PerfilVigente.Sensor_Ativado_GAS == Estado.Ligado);
|
frmParametros.chbGas.Checked = (PerfilVigente.Sensor_Ativado_GAS == Estado.Ligado);
|
||||||
frmParametros.chbTmp.Checked = (PerfilVigente.Sensor_Ativado_TMP == Estado.Ligado);
|
frmParametros.chbTmp.Checked = (PerfilVigente.Sensor_Ativado_TMP == Estado.Ligado);
|
||||||
frmParametros.chbMpu.Checked = (PerfilVigente.Sensor_Ativado_MPU == Estado.Ligado);
|
frmParametros.chbMpu.Checked = (PerfilVigente.Sensor_Ativado_MPU == Estado.Ligado);
|
||||||
|
|
@ -384,6 +716,7 @@ namespace OrionTardPro
|
||||||
frmParametros.chbVel.Checked = (PerfilVigente.Sensor_Ativado_VEL == Estado.Ligado);
|
frmParametros.chbVel.Checked = (PerfilVigente.Sensor_Ativado_VEL == Estado.Ligado);
|
||||||
frmParametros.chbCor.Checked = (PerfilVigente.Sensor_Ativado_COR == Estado.Ligado);
|
frmParametros.chbCor.Checked = (PerfilVigente.Sensor_Ativado_COR == Estado.Ligado);
|
||||||
frmParametros.chbUmi.Checked = (PerfilVigente.Sensor_Ativado_UMI == Estado.Ligado);
|
frmParametros.chbUmi.Checked = (PerfilVigente.Sensor_Ativado_UMI == Estado.Ligado);
|
||||||
|
frmParametros.chbInf.Checked = (PerfilVigente.Sensor_Ativado_INF == Estado.Ligado);
|
||||||
frmParametros.chbMot.Checked = (PerfilVigente.Atuador_Ativado_MOT == Estado.Ligado);
|
frmParametros.chbMot.Checked = (PerfilVigente.Atuador_Ativado_MOT == Estado.Ligado);
|
||||||
frmParametros.chbIlu.Checked = (PerfilVigente.Atuador_Ativado_ILU == Estado.Ligado);
|
frmParametros.chbIlu.Checked = (PerfilVigente.Atuador_Ativado_ILU == Estado.Ligado);
|
||||||
frmParametros.chbLas.Checked = (PerfilVigente.Atuador_Ativado_LAS == Estado.Ligado);
|
frmParametros.chbLas.Checked = (PerfilVigente.Atuador_Ativado_LAS == Estado.Ligado);
|
||||||
|
|
@ -411,12 +744,14 @@ namespace OrionTardPro
|
||||||
frmConexao.txtTempoPings.Value = PerfilVigente.TempoEntrePings;
|
frmConexao.txtTempoPings.Value = PerfilVigente.TempoEntrePings;
|
||||||
frmConexao.txtEnvios.Value = PerfilVigente.QuantidadeEnvios;
|
frmConexao.txtEnvios.Value = PerfilVigente.QuantidadeEnvios;
|
||||||
frmConexao.chbCamera.Checked = PerfilVigente.ControleIndividualCamera;
|
frmConexao.chbCamera.Checked = PerfilVigente.ControleIndividualCamera;
|
||||||
|
frmConexao.chbPingCamera.Checked = PerfilVigente.EnviarPingCamera;
|
||||||
frmConexao.chbProtocolocompleto.Checked = PerfilVigente.ReceberProtocoloCompleto;
|
frmConexao.chbProtocolocompleto.Checked = PerfilVigente.ReceberProtocoloCompleto;
|
||||||
frmConexao.chbRequisitarDados.Checked = PerfilVigente.RequisitarDados;
|
frmConexao.chbRequisitarDados.Checked = PerfilVigente.RequisitarDados;
|
||||||
frmParametros.chbInvDireita.Checked = PerfilVigente.InverterRotacaoDireita;
|
frmParametros.chbInvDireita.Checked = PerfilVigente.InverterRotacaoDireita;
|
||||||
frmParametros.chbInvEsquerda.Checked = PerfilVigente.InverterRotacaoEsquerda;
|
frmParametros.chbInvEsquerda.Checked = PerfilVigente.InverterRotacaoEsquerda;
|
||||||
frmParametros.rdbF3.Checked = !PerfilVigente.FirmwareF4;
|
//frmParametros.rdbF3.Checked = !PerfilVigente.FirmwareF4;
|
||||||
frmParametros.rdbF4.Checked = PerfilVigente.FirmwareF4;
|
//frmParametros.rdbF4.Checked = PerfilVigente.FirmwareF4;
|
||||||
|
frmParametros.cmbProtocoloVersao.SelectedItem = PerfilVigente.VersaoProtocolo.ToString();
|
||||||
frmParametros.nudEnderecoReleGeral.Value = PerfilVigente.EnderecoReleGeral;
|
frmParametros.nudEnderecoReleGeral.Value = PerfilVigente.EnderecoReleGeral;
|
||||||
frmParametros.nudCanalReleGeral.Value = PerfilVigente.CanalReleGeral;
|
frmParametros.nudCanalReleGeral.Value = PerfilVigente.CanalReleGeral;
|
||||||
frmPrincipal.tkbBraco.Value = 0;
|
frmPrincipal.tkbBraco.Value = 0;
|
||||||
|
|
@ -432,7 +767,6 @@ namespace OrionTardPro
|
||||||
|
|
||||||
frmPrincipal.lblPerfil.Text = "Perfil: " + NomePerfil;
|
frmPrincipal.lblPerfil.Text = "Perfil: " + NomePerfil;
|
||||||
|
|
||||||
LogsFuncoes.RegistrarLog();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AtualizarDadosServico()
|
public static void AtualizarDadosServico()
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"PerfilNome":"PS2","Layout":"Layouts\\PS2.jpg","DataCriacao":"2024-08-26T14:17:17.6131205-03:00","Botoes":[{"Indice":0,"Descricao":"Triangulo","Posicao":"378, 149","Botao":0,"Comando":11,"Definido":true},{"Indice":1,"Descricao":"Bolinha","Posicao":"412, 181","Botao":1,"Comando":10,"Definido":true},{"Indice":2,"Descricao":"Xis","Posicao":"377, 214","Botao":2,"Comando":9,"Definido":true},{"Indice":3,"Descricao":"Quadrado","Posicao":"347, 181","Botao":3,"Comando":0,"Definido":true},{"Indice":4,"Descricao":"L1","Posicao":"122, 101","Botao":4,"Comando":6,"Definido":true},{"Indice":5,"Descricao":"R1","Posicao":"376, 103","Botao":5,"Comando":5,"Definido":true},{"Indice":6,"Descricao":"L2","Posicao":"123, 84","Botao":6,"Comando":13,"Definido":true},{"Indice":7,"Descricao":"R2","Posicao":"375, 83","Botao":7,"Comando":12,"Definido":true},{"Indice":8,"Descricao":"Select","Posicao":"210, 182","Botao":8,"Comando":0,"Definido":true},{"Indice":9,"Descricao":"Start","Posicao":"285, 182","Botao":9,"Comando":0,"Definido":true},{"Indice":10,"Descricao":"L3","Posicao":"183, 245","Botao":10,"Comando":8,"Definido":true},{"Indice":11,"Descricao":"R3","Posicao":"313, 246","Botao":11,"Comando":0,"Definido":true}],"QuantidadeBotoes":12,"AnalogicoZeroX":32767,"AnalogicoZeroY":32767,"InverteAnalogicoLX":false,"InverteAnalogicoLY":false,"InverteAnalogicoRX":true,"InverteAnalogicoRY":true}
|
{"PerfilNome":"PS2","Layout":"Layouts\\PS2.jpg","DataCriacao":"2026-05-12T13:04:20.8474749-03:00","Botoes":[{"Indice":0,"Descricao":"Triangulo","Posicao":"378, 149","Botao":0,"Comando":11,"Definido":true},{"Indice":1,"Descricao":"Bolinha","Posicao":"412, 181","Botao":1,"Comando":10,"Definido":true},{"Indice":2,"Descricao":"Xis","Posicao":"377, 214","Botao":2,"Comando":9,"Definido":true},{"Indice":3,"Descricao":"Quadrado","Posicao":"347, 181","Botao":3,"Comando":0,"Definido":true},{"Indice":4,"Descricao":"L1","Posicao":"122, 101","Botao":4,"Comando":6,"Definido":true},{"Indice":5,"Descricao":"R1","Posicao":"376, 103","Botao":5,"Comando":5,"Definido":true},{"Indice":6,"Descricao":"L2","Posicao":"123, 84","Botao":6,"Comando":13,"Definido":true},{"Indice":7,"Descricao":"R2","Posicao":"375, 83","Botao":7,"Comando":12,"Definido":true},{"Indice":8,"Descricao":"Select","Posicao":"210, 182","Botao":8,"Comando":0,"Definido":true},{"Indice":9,"Descricao":"Start","Posicao":"285, 182","Botao":9,"Comando":0,"Definido":true},{"Indice":10,"Descricao":"L3","Posicao":"183, 245","Botao":10,"Comando":8,"Definido":true},{"Indice":11,"Descricao":"R3","Posicao":"313, 246","Botao":11,"Comando":0,"Definido":true}],"QuantidadeBotoes":12,"AnalogicoZeroX":32767,"AnalogicoZeroY":32767,"InverteAnalogicoLX":false,"InverteAnalogicoLY":false,"InverteAnalogicoRX":true,"InverteAnalogicoRY":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"Odometro":0.0,"OdometroInspecao":10,"TensaoMinimaBateria":12.0,"TensaoMaximaBateria":16.8,"CorrenteMaximaBateria":8.0,"ComprimentoCabo":150,"RPM":66.0,"DiametroRoda":120.0,"OffsetOdometro":0.01030125,"InverterRotacaoEsquerda":false,"InverterRotacaoDireita":false,"Offsett_Driver1_Frente":0,"Offsett_Driver2_Frente":0,"Offsett_Driver1_Tras":0,"Offsett_Driver2_Tras":0,"Offsett_Raque_Enrolar":0,"Offsett_Raque_Desenrolar":0,"NumeroPingsMaximo":10,"ResolucaoLeitura":10,"ValorMaximoAnalogico":1024,"PotenciaMaxima":10,"PotenciaMinima":5,"RampaMaxima":5,"RampaMinima":1,"PrecisaoMaxima":10,"PrecisaoMinima":1,"TempoRecepcaoSensores":1000,"TempoEntrePings":10,"QuantidadeEnvios":2,"ControleIndividualCamera":true,"ReceberProtocoloCompleto":true,"COR_coeficienteA":0.097,"COR_coeficienteB":-0.17,"COR_multiplicador":1.0,"PerfilSelecionado":"Perfis\\Factor2.otpp","PerfilJoystick":"Layouts\\default.joy","RampaAtual":2,"PotenciaAtual":6,"PrecisaoAtual":10,"Sensor_Ativado_GAS":1,"Sensor_Ativado_UMI":1,"Sensor_Ativado_MPU":1,"Sensor_Ativado_ULT":0,"Sensor_Ativado_TEN":1,"Sensor_Ativado_COR":1,"Sensor_Ativado_VEL":0,"Sensor_Ativado_TMP":1,"Sensor_Ativado_Watchdog":0,"Atuador_Ativado_MOT":1,"Atuador_Ativado_ILU":0,"Atuador_Ativado_LAS":0,"Atuador_Ativado_CAM":1,"Atuador_Ativado_EMB":0,"Atuador_Ativado_Transmissor":1,"Atuador_Ativado_Raque":0,"Atuador_Ativado_BRC":0,"Atuador_Ativado_MEP":0,"Driver1_Frente":2,"Driver2_Frente":1,"Driver1_Tras":1,"Driver2_Tras":2,"Driver1_Esquerda":2,"Driver2_Esquerda":2,"Driver1_Direita":1,"Driver2_Direita":1,"Raque_Enrolar":0,"Raque_Desenrolar":0,"BaudRate":38400,"RequisitarDados":true,"FirmwareF4":true,"EnderecoReleGeral":0,"CanalReleGeral":1,"ListaAlertas":[{"TipoSensor":9,"Titulo":"Manutenção preventiva necessária","Mensagem":"O tempo de trabalho já atingiu o limite recomendado para manutenção preventiva. Planeje essa ação!","ValorComparar":675.0,"LimiteMinimo":0.0,"LimiteMaximo":36000.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblOdometroTempo","ComparacaoMaxima":true,"ComparacaoMinima":false,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":0,"Editando":false},{"TipoSensor":5,"Titulo":"Bateria baixa","Mensagem":"Risco de parada!","ValorComparar":91.0,"LimiteMinimo":20.0,"LimiteMaximo":0.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"gpbNivelbateria","ComparacaoMaxima":false,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":2,"Editando":false},{"TipoSensor":8,"Titulo":"Temperatura excedida","Mensagem":"Risco de parada","ValorComparar":23.06,"LimiteMinimo":-5.0,"LimiteMaximo":85.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblTemperaturavalor","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":6,"Editando":false},{"TipoSensor":2,"Titulo":"Umidade alta","Mensagem":"Risco de infiltração","ValorComparar":47.23,"LimiteMinimo":0.0,"LimiteMaximo":40.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblStatusUmidade","ComparacaoMaxima":true,"ComparacaoMinima":false,"AlarmeAcionado":true,"PararCarro":false,"AlarmeAtivado":1,"Variavel":7,"Editando":false},{"TipoSensor":3,"Titulo":"Inclinação lateral","Mensagem":"Risco de queda!","ValorComparar":0.0,"LimiteMinimo":-45.0,"LimiteMaximo":45.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblInclinacaoy","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":10,"Editando":false},{"TipoSensor":3,"Titulo":"Inclinação frontal","Mensagem":"Risco de queda!\n","ValorComparar":0.0,"LimiteMinimo":-45.0,"LimiteMaximo":45.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblAltitude","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":11,"Editando":false}]}
|
{"Odometro":0.0,"OdometroInspecao":36000,"TensaoMinimaBateria":12.0,"TensaoMaximaBateria":16.8,"CorrenteMaximaBateria":8.0,"ComprimentoCabo":150,"RPM":66.0,"DiametroRoda":120.0,"OffsetOdometro":0.01030125,"InverterRotacaoEsquerda":false,"InverterRotacaoDireita":false,"Offsett_Driver1_Frente":0,"Offsett_Driver2_Frente":0,"Offsett_Driver1_Tras":0,"Offsett_Driver2_Tras":0,"Offsett_Raque_Enrolar":0,"Offsett_Raque_Desenrolar":0,"NumeroPingsMaximo":10,"ResolucaoLeitura":10,"ValorMaximoAnalogico":1024,"PotenciaMaxima":10,"PotenciaMinima":3,"RampaMaxima":5,"RampaMinima":1,"PrecisaoMaxima":10,"PrecisaoMinima":1,"TempoRecepcaoSensores":5000,"TempoEntrePings":10,"QuantidadeEnvios":2,"ControleIndividualCamera":true,"ReceberProtocoloCompleto":true,"COR_coeficienteA":0.097,"COR_coeficienteB":-0.17,"COR_multiplicador":1.0,"PerfilSelecionado":"Perfis\\Factor2.otpp","PerfilJoystick":"Layouts\\default.joy","RampaAtual":2,"PotenciaAtual":6,"PrecisaoAtual":10,"Sensor_Ativado_GAS":1,"Sensor_Ativado_UMI":1,"Sensor_Ativado_MPU":1,"Sensor_Ativado_ULT":0,"Sensor_Ativado_TEN":1,"Sensor_Ativado_COR":1,"Sensor_Ativado_VEL":0,"Sensor_Ativado_TMP":1,"Sensor_Ativado_Watchdog":0,"Atuador_Ativado_MOT":1,"Atuador_Ativado_ILU":0,"Atuador_Ativado_LAS":0,"Atuador_Ativado_CAM":1,"Atuador_Ativado_EMB":0,"Atuador_Ativado_Transmissor":1,"Atuador_Ativado_Raque":0,"Atuador_Ativado_BRC":0,"Atuador_Ativado_MEP":0,"Driver1_Frente":2,"Driver2_Frente":1,"Driver1_Tras":1,"Driver2_Tras":2,"Driver1_Esquerda":2,"Driver2_Esquerda":2,"Driver1_Direita":1,"Driver2_Direita":1,"Raque_Enrolar":0,"Raque_Desenrolar":0,"BaudRate":38400,"RequisitarDados":true,"FirmwareF4":true,"EnderecoReleGeral":0,"CanalReleGeral":1,"ListaAlertas":[{"TipoSensor":9,"Titulo":"Manutenção preventiva necessária","Mensagem":"O tempo de trabalho já atingiu o limite recomendado para manutenção preventiva. Planeje essa ação!","ValorComparar":675.0,"LimiteMinimo":0.0,"LimiteMaximo":36000.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblOdometroTempo","ComparacaoMaxima":true,"ComparacaoMinima":false,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":0,"Editando":false},{"TipoSensor":5,"Titulo":"Bateria baixa","Mensagem":"Risco de parada!","ValorComparar":91.0,"LimiteMinimo":20.0,"LimiteMaximo":0.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"gpbNivelbateria","ComparacaoMaxima":false,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":2,"Editando":false},{"TipoSensor":8,"Titulo":"Temperatura excedida","Mensagem":"Risco de parada","ValorComparar":23.06,"LimiteMinimo":-5.0,"LimiteMaximo":85.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblTemperaturavalor","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":6,"Editando":false},{"TipoSensor":2,"Titulo":"Umidade alta","Mensagem":"Risco de infiltração","ValorComparar":47.23,"LimiteMinimo":0.0,"LimiteMaximo":40.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblStatusUmidade","ComparacaoMaxima":true,"ComparacaoMinima":false,"AlarmeAcionado":true,"PararCarro":false,"AlarmeAtivado":1,"Variavel":7,"Editando":false},{"TipoSensor":3,"Titulo":"Inclinação lateral","Mensagem":"Risco de queda!","ValorComparar":0.0,"LimiteMinimo":-45.0,"LimiteMaximo":45.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblInclinacaoy","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":10,"Editando":false},{"TipoSensor":3,"Titulo":"Inclinação frontal","Mensagem":"Risco de queda!\n","ValorComparar":0.0,"LimiteMinimo":-45.0,"LimiteMaximo":45.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblAltitude","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":11,"Editando":false}]}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"Odometro":0.0,"OdometroInspecao":36000,"TensaoMinimaBateria":12.0,"TensaoMaximaBateria":16.8,"CorrenteMaximaBateria":8.0,"ComprimentoCabo":150,"RPM":66.0,"DiametroRoda":120.0,"OffsetOdometro":0.01030125,"InverterRotacaoEsquerda":false,"InverterRotacaoDireita":false,"Offsett_Driver1_Frente":0,"Offsett_Driver2_Frente":0,"Offsett_Driver1_Tras":0,"Offsett_Driver2_Tras":0,"Offsett_Raque_Enrolar":0,"Offsett_Raque_Desenrolar":0,"NumeroPingsMaximo":10,"ResolucaoLeitura":10,"ValorMaximoAnalogico":1024,"PotenciaMaxima":10,"PotenciaMinima":3,"RampaMaxima":5,"RampaMinima":1,"PrecisaoMaxima":10,"PrecisaoMinima":1,"TempoRecepcaoSensores":5000,"TempoEntrePings":10,"QuantidadeEnvios":1,"ControleIndividualCamera":true,"ReceberProtocoloCompleto":true,"COR_coeficienteA":0.097,"COR_coeficienteB":-0.17,"COR_multiplicador":1.0,"PerfilSelecionado":"Perfis\\Factor2_MedidorEspessura.otpp","PerfilJoystick":"Layouts\\default.joy","RampaAtual":2,"PotenciaAtual":6,"PrecisaoAtual":10,"Sensor_Ativado_GAS":1,"Sensor_Ativado_UMI":1,"Sensor_Ativado_MPU":1,"Sensor_Ativado_ULT":0,"Sensor_Ativado_TEN":1,"Sensor_Ativado_COR":1,"Sensor_Ativado_VEL":0,"Sensor_Ativado_TMP":1,"Sensor_Ativado_Watchdog":0,"Atuador_Ativado_MOT":1,"Atuador_Ativado_ILU":0,"Atuador_Ativado_LAS":0,"Atuador_Ativado_CAM":1,"Atuador_Ativado_EMB":0,"Atuador_Ativado_Transmissor":1,"Atuador_Ativado_Raque":0,"Atuador_Ativado_BRC":0,"Atuador_Ativado_MEP":1,"Driver1_Frente":2,"Driver2_Frente":1,"Driver1_Tras":1,"Driver2_Tras":2,"Driver1_Esquerda":2,"Driver2_Esquerda":2,"Driver1_Direita":1,"Driver2_Direita":1,"Raque_Enrolar":0,"Raque_Desenrolar":0,"BaudRate":38400,"RequisitarDados":true,"FirmwareF4":true,"EnderecoReleGeral":0,"CanalReleGeral":1,"AnguloCarimboHorizontal":63,"AnguloCarimboVertical":63,"AnguloMedicaoIdeal":132,"AnguloMedicaoMargemLimite":20,"ListaAlertas":[{"TipoSensor":9,"Titulo":"Manutenção preventiva necessária","Mensagem":"O tempo de trabalho já atingiu o limite recomendado para manutenção preventiva. Planeje essa ação!","ValorComparar":16583.0,"LimiteMinimo":0.0,"LimiteMaximo":36000.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblOdometroTempo","ComparacaoMaxima":true,"ComparacaoMinima":false,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":0,"Editando":false},{"TipoSensor":5,"Titulo":"Bateria baixa","Mensagem":"Risco de parada!","ValorComparar":94.0,"LimiteMinimo":20.0,"LimiteMaximo":0.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"gpbNivelbateria","ComparacaoMaxima":false,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":2,"Editando":false},{"TipoSensor":8,"Titulo":"Temperatura excedida","Mensagem":"Risco de parada","ValorComparar":30.06,"LimiteMinimo":-5.0,"LimiteMaximo":85.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblTemperaturavalor","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":6,"Editando":false},{"TipoSensor":2,"Titulo":"Umidade alta","Mensagem":"Risco de infiltração","ValorComparar":36.53,"LimiteMinimo":0.0,"LimiteMaximo":40.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblStatusUmidade","ComparacaoMaxima":true,"ComparacaoMinima":false,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":7,"Editando":false},{"TipoSensor":3,"Titulo":"Inclinação lateral","Mensagem":"Risco de queda!","ValorComparar":0.0,"LimiteMinimo":-45.0,"LimiteMaximo":45.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblInclinacaoy","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":10,"Editando":false},{"TipoSensor":3,"Titulo":"Inclinação frontal","Mensagem":"Risco de queda!\n","ValorComparar":0.0,"LimiteMinimo":-45.0,"LimiteMaximo":45.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblAltitude","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":11,"Editando":false}]}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"Odometro":0.0,"OdometroInspecao":10,"TensaoMinimaBateria":12.0,"TensaoMaximaBateria":16.8,"CorrenteMaximaBateria":8.0,"ComprimentoCabo":150,"RPM":54.0,"DiametroRoda":170.0,"OffsetOdometro":0.01206,"InverterRotacaoEsquerda":false,"InverterRotacaoDireita":false,"Offsett_Driver1_Frente":0,"Offsett_Driver2_Frente":0,"Offsett_Driver1_Tras":0,"Offsett_Driver2_Tras":0,"Offsett_Raque_Enrolar":0,"Offsett_Raque_Desenrolar":0,"NumeroPingsMaximo":10,"ResolucaoLeitura":10,"ValorMaximoAnalogico":1024,"PotenciaMaxima":10,"PotenciaMinima":5,"RampaMaxima":5,"RampaMinima":1,"PrecisaoMaxima":10,"PrecisaoMinima":1,"TempoRecepcaoSensores":1000,"TempoEntrePings":10,"QuantidadeEnvios":2,"ControleIndividualCamera":true,"ReceberProtocoloCompleto":true,"COR_coeficienteA":0.097,"COR_coeficienteB":-0.17,"COR_multiplicador":1.0,"PerfilSelecionado":"Perfis\\Factor3.1.otpp","PerfilJoystick":"Layouts\\default.joy","RampaAtual":2,"PotenciaAtual":6,"PrecisaoAtual":10,"Sensor_Ativado_GAS":1,"Sensor_Ativado_UMI":1,"Sensor_Ativado_MPU":1,"Sensor_Ativado_ULT":0,"Sensor_Ativado_TEN":1,"Sensor_Ativado_COR":1,"Sensor_Ativado_VEL":0,"Sensor_Ativado_TMP":1,"Sensor_Ativado_Watchdog":0,"Atuador_Ativado_MOT":1,"Atuador_Ativado_ILU":0,"Atuador_Ativado_LAS":0,"Atuador_Ativado_CAM":1,"Atuador_Ativado_EMB":0,"Atuador_Ativado_Transmissor":1,"Atuador_Ativado_Raque":0,"Atuador_Ativado_BRC":0,"Atuador_Ativado_MEP":0,"Driver1_Frente":2,"Driver2_Frente":1,"Driver1_Tras":1,"Driver2_Tras":2,"Driver1_Esquerda":2,"Driver2_Esquerda":2,"Driver1_Direita":1,"Driver2_Direita":1,"Raque_Enrolar":0,"Raque_Desenrolar":0,"BaudRate":38400,"RequisitarDados":true,"FirmwareF4":true,"EnderecoReleGeral":0,"CanalReleGeral":1,"ListaAlertas":[{"TipoSensor":9,"Titulo":"Manutenção preventiva necessária","Mensagem":"O tempo de trabalho já atingiu o limite recomendado para manutenção preventiva. Planeje essa ação!","ValorComparar":190.0,"LimiteMinimo":0.0,"LimiteMaximo":10.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblOdometroTempo","ComparacaoMaxima":true,"ComparacaoMinima":false,"AlarmeAcionado":true,"PararCarro":false,"AlarmeAtivado":1,"Variavel":0,"Editando":false},{"TipoSensor":5,"Titulo":"Bateria baixa","Mensagem":"Risco de parada!","ValorComparar":0.0,"LimiteMinimo":20.0,"LimiteMaximo":0.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"gpbNivelbateria","ComparacaoMaxima":false,"ComparacaoMinima":true,"AlarmeAcionado":true,"PararCarro":false,"AlarmeAtivado":1,"Variavel":2,"Editando":false},{"TipoSensor":8,"Titulo":"Temperatura excedida","Mensagem":"Risco de parada","ValorComparar":0.0,"LimiteMinimo":-5.0,"LimiteMaximo":85.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblTemperaturavalor","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":6,"Editando":false},{"TipoSensor":2,"Titulo":"Umidade alta","Mensagem":"Risco de infiltração","ValorComparar":0.0,"LimiteMinimo":0.0,"LimiteMaximo":40.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblStatusUmidade","ComparacaoMaxima":true,"ComparacaoMinima":false,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":7,"Editando":false},{"TipoSensor":3,"Titulo":"Inclinação lateral","Mensagem":"Risco de queda!","ValorComparar":0.0,"LimiteMinimo":-45.0,"LimiteMaximo":45.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblInclinacaoy","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":10,"Editando":false},{"TipoSensor":3,"Titulo":"Inclinação frontal","Mensagem":"Risco de queda!\n","ValorComparar":0.0,"LimiteMinimo":-45.0,"LimiteMaximo":45.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblAltitude","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":11,"Editando":false}]}
|
{"Odometro":0.0,"OdometroInspecao":36000,"TensaoMinimaBateria":12.0,"TensaoMaximaBateria":16.8,"CorrenteMaximaBateria":8.0,"ComprimentoCabo":150,"RPM":54.0,"DiametroRoda":170.0,"OffsetOdometro":0.01206,"InverterRotacaoEsquerda":false,"InverterRotacaoDireita":false,"Offsett_Driver1_Frente":0,"Offsett_Driver2_Frente":0,"Offsett_Driver1_Tras":0,"Offsett_Driver2_Tras":0,"Offsett_Raque_Enrolar":0,"Offsett_Raque_Desenrolar":0,"NumeroPingsMaximo":10,"ResolucaoLeitura":10,"ValorMaximoAnalogico":1024,"PotenciaMaxima":10,"PotenciaMinima":3,"RampaMaxima":5,"RampaMinima":1,"PrecisaoMaxima":10,"PrecisaoMinima":1,"TempoRecepcaoSensores":5000,"TempoEntrePings":10,"QuantidadeEnvios":2,"ControleIndividualCamera":true,"ReceberProtocoloCompleto":true,"COR_coeficienteA":0.097,"COR_coeficienteB":-0.17,"COR_multiplicador":1.0,"PerfilSelecionado":"Perfis\\Factor3.1.otpp","PerfilJoystick":"Layouts\\default.joy","RampaAtual":2,"PotenciaAtual":6,"PrecisaoAtual":10,"Sensor_Ativado_GAS":1,"Sensor_Ativado_UMI":1,"Sensor_Ativado_MPU":1,"Sensor_Ativado_ULT":0,"Sensor_Ativado_TEN":1,"Sensor_Ativado_COR":1,"Sensor_Ativado_VEL":0,"Sensor_Ativado_TMP":1,"Sensor_Ativado_Watchdog":0,"Atuador_Ativado_MOT":1,"Atuador_Ativado_ILU":0,"Atuador_Ativado_LAS":0,"Atuador_Ativado_CAM":1,"Atuador_Ativado_EMB":0,"Atuador_Ativado_Transmissor":1,"Atuador_Ativado_Raque":0,"Atuador_Ativado_BRC":0,"Atuador_Ativado_MEP":0,"Driver1_Frente":2,"Driver2_Frente":1,"Driver1_Tras":1,"Driver2_Tras":2,"Driver1_Esquerda":2,"Driver2_Esquerda":2,"Driver1_Direita":1,"Driver2_Direita":1,"Raque_Enrolar":0,"Raque_Desenrolar":0,"BaudRate":9600,"RequisitarDados":true,"FirmwareF4":true,"EnderecoReleGeral":0,"CanalReleGeral":1,"ListaAlertas":[{"TipoSensor":9,"Titulo":"Manutenção preventiva necessária","Mensagem":"O tempo de trabalho já atingiu o limite recomendado para manutenção preventiva. Planeje essa ação!","ValorComparar":190.0,"LimiteMinimo":0.0,"LimiteMaximo":10.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblOdometroTempo","ComparacaoMaxima":true,"ComparacaoMinima":false,"AlarmeAcionado":true,"PararCarro":false,"AlarmeAtivado":1,"Variavel":0,"Editando":false},{"TipoSensor":5,"Titulo":"Bateria baixa","Mensagem":"Risco de parada!","ValorComparar":0.0,"LimiteMinimo":20.0,"LimiteMaximo":0.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"gpbNivelbateria","ComparacaoMaxima":false,"ComparacaoMinima":true,"AlarmeAcionado":true,"PararCarro":false,"AlarmeAtivado":1,"Variavel":2,"Editando":false},{"TipoSensor":8,"Titulo":"Temperatura excedida","Mensagem":"Risco de parada","ValorComparar":0.0,"LimiteMinimo":-5.0,"LimiteMaximo":85.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblTemperaturavalor","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":6,"Editando":false},{"TipoSensor":2,"Titulo":"Umidade alta","Mensagem":"Risco de infiltração","ValorComparar":0.0,"LimiteMinimo":0.0,"LimiteMaximo":40.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblStatusUmidade","ComparacaoMaxima":true,"ComparacaoMinima":false,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":7,"Editando":false},{"TipoSensor":3,"Titulo":"Inclinação lateral","Mensagem":"Risco de queda!","ValorComparar":0.0,"LimiteMinimo":-45.0,"LimiteMaximo":45.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblInclinacaoy","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":10,"Editando":false},{"TipoSensor":3,"Titulo":"Inclinação frontal","Mensagem":"Risco de queda!\n","ValorComparar":0.0,"LimiteMinimo":-45.0,"LimiteMaximo":45.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblAltitude","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":11,"Editando":false}]}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"Odometro":0.0,"OdometroInspecao":10,"TensaoMinimaBateria":12.0,"TensaoMaximaBateria":14.4,"CorrenteMaximaBateria":15.0,"ComprimentoCabo":150,"RPM":54.0,"DiametroRoda":170.0,"OffsetOdometro":0.01206,"InverterRotacaoEsquerda":false,"InverterRotacaoDireita":false,"Offsett_Driver1_Frente":0,"Offsett_Driver2_Frente":0,"Offsett_Driver1_Tras":0,"Offsett_Driver2_Tras":0,"Offsett_Raque_Enrolar":0,"Offsett_Raque_Desenrolar":0,"NumeroPingsMaximo":10,"ResolucaoLeitura":10,"ValorMaximoAnalogico":1024,"PotenciaMaxima":10,"PotenciaMinima":5,"RampaMaxima":5,"RampaMinima":1,"PrecisaoMaxima":10,"PrecisaoMinima":1,"TempoRecepcaoSensores":1000,"TempoEntrePings":10,"QuantidadeEnvios":2,"ControleIndividualCamera":true,"ReceberProtocoloCompleto":true,"COR_coeficienteA":0.097,"COR_coeficienteB":-0.17,"COR_multiplicador":1.0,"PerfilSelecionado":"Perfis\\Factor4.otpp","PerfilJoystick":"Layouts\\default.joy","RampaAtual":2,"PotenciaAtual":6,"PrecisaoAtual":10,"Sensor_Ativado_GAS":1,"Sensor_Ativado_UMI":1,"Sensor_Ativado_MPU":1,"Sensor_Ativado_ULT":0,"Sensor_Ativado_TEN":1,"Sensor_Ativado_COR":1,"Sensor_Ativado_VEL":0,"Sensor_Ativado_TMP":1,"Sensor_Ativado_Watchdog":0,"Atuador_Ativado_MOT":1,"Atuador_Ativado_ILU":0,"Atuador_Ativado_LAS":0,"Atuador_Ativado_CAM":1,"Atuador_Ativado_EMB":0,"Atuador_Ativado_Transmissor":1,"Atuador_Ativado_Raque":0,"Atuador_Ativado_BRC":0,"Driver1_Frente":2,"Driver2_Frente":1,"Driver1_Tras":1,"Driver2_Tras":2,"Driver1_Esquerda":2,"Driver2_Esquerda":2,"Driver1_Direita":1,"Driver2_Direita":1,"Raque_Enrolar":0,"Raque_Desenrolar":0,"BaudRate":38400,"RequisitarDados":true,"FirmwareF4":true,"EnderecoReleGeral":0,"CanalReleGeral":1,"ListaAlertas":[{"TipoSensor":9,"Titulo":"Manutenção preventiva necessária","Mensagem":"O tempo de trabalho já atingiu o limite recomendado para manutenção preventiva. Planeje essa ação!","ValorComparar":0.0,"LimiteMinimo":0.0,"LimiteMaximo":10.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblOdometroTempo","ComparacaoMaxima":true,"ComparacaoMinima":false,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":0,"Editando":false},{"TipoSensor":5,"Titulo":"Bateria baixa","Mensagem":"Risco de parada!","ValorComparar":0.91,"LimiteMinimo":20.0,"LimiteMaximo":0.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"gpbNivelbateria","ComparacaoMaxima":false,"ComparacaoMinima":true,"AlarmeAcionado":true,"PararCarro":false,"AlarmeAtivado":1,"Variavel":2,"Editando":false},{"TipoSensor":8,"Titulo":"Temperatura excedida","Mensagem":"Risco de parada","ValorComparar":4.0,"LimiteMinimo":-5.0,"LimiteMaximo":85.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblTemperaturavalor","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":6,"Editando":false},{"TipoSensor":2,"Titulo":"Umidade alta","Mensagem":"Risco de infiltração","ValorComparar":17.4,"LimiteMinimo":0.0,"LimiteMaximo":40.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblStatusUmidade","ComparacaoMaxima":true,"ComparacaoMinima":false,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":7,"Editando":false},{"TipoSensor":3,"Titulo":"Inclinação lateral","Mensagem":"Risco de queda!","ValorComparar":0.0,"LimiteMinimo":-45.0,"LimiteMaximo":45.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblInclinacaoy","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":10,"Editando":false},{"TipoSensor":3,"Titulo":"Inclinação frontal","Mensagem":"Risco de queda!\n","ValorComparar":0.0,"LimiteMinimo":-45.0,"LimiteMaximo":45.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblAltitude","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":11,"Editando":false}]}
|
{"Odometro":0.0,"OdometroInspecao":10,"TensaoMinimaBateria":12.0,"TensaoMaximaBateria":16.8,"CorrenteMaximaBateria":8.0,"ComprimentoCabo":150,"RPM":54.0,"DiametroRoda":170.0,"OffsetOdometro":0.01206,"InverterRotacaoEsquerda":false,"InverterRotacaoDireita":false,"Offsett_Driver1_Frente":0,"Offsett_Driver2_Frente":0,"Offsett_Driver1_Tras":0,"Offsett_Driver2_Tras":0,"Offsett_Raque_Enrolar":0,"Offsett_Raque_Desenrolar":0,"NumeroPingsMaximo":4,"ResolucaoLeitura":10,"ValorMaximoAnalogico":1024,"PotenciaMaxima":10,"PotenciaMinima":3,"RampaMaxima":5,"RampaMinima":1,"PrecisaoMaxima":10,"PrecisaoMinima":1,"TempoRecepcaoSensores":1000,"TempoEntrePings":4,"QuantidadeEnvios":2,"ControleIndividualCamera":true,"EnviarPingCamera":false,"ReceberProtocoloCompleto":true,"COR_multiplicador":1.0,"PerfilSelecionado":"Perfis\\Factor4.otpp","PerfilJoystick":"Layouts\\default.joy","RampaAtual":2,"PotenciaAtual":6,"PrecisaoAtual":10,"Sensor_Ativado_GAS":0,"Sensor_Ativado_UMI":1,"Sensor_Ativado_MPU":1,"Sensor_Ativado_ULT":0,"Sensor_Ativado_TEN":1,"Sensor_Ativado_COR":1,"Sensor_Ativado_VEL":0,"Sensor_Ativado_TMP":1,"Sensor_Ativado_INF":1,"Sensor_Ativado_Watchdog":0,"Atuador_Ativado_MOT":1,"Atuador_Ativado_ILU":0,"Atuador_Ativado_LAS":0,"Atuador_Ativado_CAM":1,"Atuador_Ativado_EMB":0,"Atuador_Ativado_Transmissor":1,"Atuador_Ativado_Raque":0,"Atuador_Ativado_BRC":0,"Atuador_Ativado_MEP":0,"Driver1_Frente":2,"Driver2_Frente":1,"Driver1_Tras":1,"Driver2_Tras":2,"Driver1_Esquerda":2,"Driver2_Esquerda":2,"Driver1_Direita":1,"Driver2_Direita":1,"Raque_Enrolar":0,"Raque_Desenrolar":0,"BaudRate":38400,"RequisitarDados":true,"VersaoProtocolo":2,"EnderecoReleGeral":0,"CanalReleGeral":1,"AnguloCarimboHorizontal":67,"AnguloCarimboVertical":63,"AnguloMedicaoIdeal":132,"AnguloMedicaoMargemLimite":20,"ListaAlertas":[{"TipoSensor":9,"Titulo":"Manutenção preventiva necessária","Mensagem":"O tempo de trabalho já atingiu o limite recomendado para manutenção preventiva. Planeje essa ação!","ValorComparar":0.0,"LimiteMinimo":0.0,"LimiteMaximo":10.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblOdometroTempo","ComparacaoMaxima":true,"ComparacaoMinima":false,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":0,"Editando":false},{"TipoSensor":5,"Titulo":"Bateria baixa","Mensagem":"Risco de parada!","ValorComparar":0.0,"LimiteMinimo":20.0,"LimiteMaximo":0.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"gpbNivelbateria","ComparacaoMaxima":false,"ComparacaoMinima":true,"AlarmeAcionado":true,"PararCarro":false,"AlarmeAtivado":1,"Variavel":2,"Editando":false},{"TipoSensor":8,"Titulo":"Temperatura excedida","Mensagem":"Risco de parada","ValorComparar":0.0,"LimiteMinimo":-5.0,"LimiteMaximo":85.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblTemperaturavalor","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":6,"Editando":false},{"TipoSensor":2,"Titulo":"Umidade alta","Mensagem":"Risco de infiltração","ValorComparar":0.0,"LimiteMinimo":0.0,"LimiteMaximo":40.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblStatusUmidade","ComparacaoMaxima":true,"ComparacaoMinima":false,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":7,"Editando":false},{"TipoSensor":3,"Titulo":"Inclinação lateral","Mensagem":"Risco de queda!","ValorComparar":0.0,"LimiteMinimo":-45.0,"LimiteMaximo":45.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblInclinacaoy","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":10,"Editando":false},{"TipoSensor":3,"Titulo":"Inclinação frontal","Mensagem":"Risco de queda!\n","ValorComparar":0.0,"LimiteMinimo":-45.0,"LimiteMaximo":45.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblAltitude","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":11,"Editando":false}]}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"Odometro":0.0,"OdometroInspecao":10,"TensaoMinimaBateria":12.0,"TensaoMaximaBateria":16.8,"CorrenteMaximaBateria":15.0,"ComprimentoCabo":150,"RPM":50.0,"DiametroRoda":205.0,"OffsetOdometro":0.0135675,"InverterRotacaoEsquerda":false,"InverterRotacaoDireita":false,"Offsett_Driver1_Frente":0,"Offsett_Driver2_Frente":0,"Offsett_Driver1_Tras":0,"Offsett_Driver2_Tras":0,"Offsett_Raque_Enrolar":0,"Offsett_Raque_Desenrolar":0,"NumeroPingsMaximo":10,"ResolucaoLeitura":10,"ValorMaximoAnalogico":1024,"PotenciaMaxima":7,"PotenciaMinima":3,"RampaMaxima":5,"RampaMinima":1,"PrecisaoMaxima":20,"PrecisaoMinima":10,"TempoRecepcaoSensores":1000,"TempoEntrePings":10,"QuantidadeEnvios":2,"ControleIndividualCamera":true,"ReceberProtocoloCompleto":true,"COR_coeficienteA":0.097,"COR_coeficienteB":-0.17,"COR_multiplicador":1.0,"PerfilSelecionado":"Perfis\\Tardigrado.otpp","PerfilJoystick":"Layouts\\PS2.joy","RampaAtual":2,"PotenciaAtual":3,"PrecisaoAtual":10,"Sensor_Ativado_GAS":1,"Sensor_Ativado_UMI":1,"Sensor_Ativado_MPU":1,"Sensor_Ativado_ULT":0,"Sensor_Ativado_TEN":1,"Sensor_Ativado_COR":1,"Sensor_Ativado_VEL":0,"Sensor_Ativado_TMP":1,"Sensor_Ativado_Watchdog":0,"Atuador_Ativado_MOT":1,"Atuador_Ativado_ILU":0,"Atuador_Ativado_LAS":0,"Atuador_Ativado_CAM":0,"Atuador_Ativado_EMB":0,"Atuador_Ativado_Transmissor":1,"Atuador_Ativado_Raque":0,"Atuador_Ativado_BRC":0,"Atuador_Ativado_MEP":0,"Driver1_Frente":1,"Driver2_Frente":2,"Driver1_Tras":2,"Driver2_Tras":1,"Driver1_Esquerda":1,"Driver2_Esquerda":1,"Driver1_Direita":2,"Driver2_Direita":2,"Raque_Enrolar":1,"Raque_Desenrolar":2,"BaudRate":38400,"RequisitarDados":true,"FirmwareF4":true,"EnderecoReleGeral":1,"CanalReleGeral":1,"ListaAlertas":[{"TipoSensor":9,"Titulo":"Manutenção preventiva necessária","Mensagem":"O tempo de trabalho já atingiu o limite recomendado para manutenção preventiva. Planeje essa ação!","ValorComparar":675.0,"LimiteMinimo":0.0,"LimiteMaximo":36000.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblOdometroTempo","ComparacaoMaxima":true,"ComparacaoMinima":false,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":0,"Editando":false},{"TipoSensor":5,"Titulo":"Bateria baixa","Mensagem":"Risco de parada!","ValorComparar":91.0,"LimiteMinimo":20.0,"LimiteMaximo":0.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"gpbNivelbateria","ComparacaoMaxima":false,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":2,"Editando":false},{"TipoSensor":8,"Titulo":"Temperatura excedida","Mensagem":"Risco de parada","ValorComparar":23.06,"LimiteMinimo":-5.0,"LimiteMaximo":85.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblTemperaturavalor","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":6,"Editando":false},{"TipoSensor":2,"Titulo":"Umidade alta","Mensagem":"Risco de infiltração","ValorComparar":47.23,"LimiteMinimo":0.0,"LimiteMaximo":40.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblStatusUmidade","ComparacaoMaxima":true,"ComparacaoMinima":false,"AlarmeAcionado":true,"PararCarro":false,"AlarmeAtivado":1,"Variavel":7,"Editando":false},{"TipoSensor":3,"Titulo":"Inclinação lateral","Mensagem":"Risco de queda!","ValorComparar":0.0,"LimiteMinimo":-45.0,"LimiteMaximo":45.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblInclinacaoy","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":10,"Editando":false},{"TipoSensor":3,"Titulo":"Inclinação frontal","Mensagem":"Risco de queda!\n","ValorComparar":0.0,"LimiteMinimo":-45.0,"LimiteMaximo":45.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblAltitude","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":11,"Editando":false}]}
|
{"Odometro":0.0,"OdometroInspecao":36000,"TensaoMinimaBateria":12.0,"TensaoMaximaBateria":16.8,"CorrenteMaximaBateria":15.0,"ComprimentoCabo":150,"RPM":50.0,"DiametroRoda":205.0,"OffsetOdometro":0.0135675,"InverterRotacaoEsquerda":false,"InverterRotacaoDireita":false,"Offsett_Driver1_Frente":0,"Offsett_Driver2_Frente":0,"Offsett_Driver1_Tras":0,"Offsett_Driver2_Tras":0,"Offsett_Raque_Enrolar":0,"Offsett_Raque_Desenrolar":0,"NumeroPingsMaximo":10,"ResolucaoLeitura":10,"ValorMaximoAnalogico":1024,"PotenciaMaxima":7,"PotenciaMinima":3,"RampaMaxima":5,"RampaMinima":1,"PrecisaoMaxima":20,"PrecisaoMinima":10,"TempoRecepcaoSensores":5000,"TempoEntrePings":10,"QuantidadeEnvios":2,"ControleIndividualCamera":true,"ReceberProtocoloCompleto":true,"COR_coeficienteA":0.097,"COR_coeficienteB":-0.17,"COR_multiplicador":1.0,"PerfilSelecionado":"Perfis\\Tardigrado.otpp","PerfilJoystick":"Layouts\\PS2.joy","RampaAtual":2,"PotenciaAtual":5,"PrecisaoAtual":10,"Sensor_Ativado_GAS":1,"Sensor_Ativado_UMI":1,"Sensor_Ativado_MPU":1,"Sensor_Ativado_ULT":0,"Sensor_Ativado_TEN":1,"Sensor_Ativado_COR":1,"Sensor_Ativado_VEL":0,"Sensor_Ativado_TMP":1,"Sensor_Ativado_Watchdog":0,"Atuador_Ativado_MOT":1,"Atuador_Ativado_ILU":0,"Atuador_Ativado_LAS":0,"Atuador_Ativado_CAM":0,"Atuador_Ativado_EMB":0,"Atuador_Ativado_Transmissor":1,"Atuador_Ativado_Raque":0,"Atuador_Ativado_BRC":0,"Atuador_Ativado_MEP":0,"Driver1_Frente":1,"Driver2_Frente":2,"Driver1_Tras":2,"Driver2_Tras":1,"Driver1_Esquerda":1,"Driver2_Esquerda":1,"Driver1_Direita":2,"Driver2_Direita":2,"Raque_Enrolar":1,"Raque_Desenrolar":2,"BaudRate":9600,"RequisitarDados":true,"FirmwareF4":true,"EnderecoReleGeral":0,"CanalReleGeral":1,"AnguloCarimboHorizontal":67,"AnguloCarimboVertical":63,"AnguloMedicaoIdeal":132,"AnguloMedicaoMargemLimite":20,"ListaAlertas":[{"TipoSensor":9,"Titulo":"Manutenção preventiva necessária","Mensagem":"O tempo de trabalho já atingiu o limite recomendado para manutenção preventiva. Planeje essa ação!","ValorComparar":15227.0,"LimiteMinimo":0.0,"LimiteMaximo":36000.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblOdometroTempo","ComparacaoMaxima":true,"ComparacaoMinima":false,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":0,"Editando":false},{"TipoSensor":5,"Titulo":"Bateria baixa","Mensagem":"Risco de parada!","ValorComparar":0.0,"LimiteMinimo":20.0,"LimiteMaximo":0.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"gpbNivelbateria","ComparacaoMaxima":false,"ComparacaoMinima":true,"AlarmeAcionado":true,"PararCarro":false,"AlarmeAtivado":1,"Variavel":2,"Editando":false},{"TipoSensor":8,"Titulo":"Temperatura excedida","Mensagem":"Risco de parada","ValorComparar":0.0,"LimiteMinimo":-5.0,"LimiteMaximo":85.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblTemperaturavalor","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":6,"Editando":false},{"TipoSensor":2,"Titulo":"Umidade alta","Mensagem":"Risco de infiltração","ValorComparar":0.0,"LimiteMinimo":0.0,"LimiteMaximo":40.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblStatusUmidade","ComparacaoMaxima":true,"ComparacaoMinima":false,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":7,"Editando":false},{"TipoSensor":3,"Titulo":"Inclinação lateral","Mensagem":"Risco de queda!","ValorComparar":0.0,"LimiteMinimo":-45.0,"LimiteMaximo":45.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblInclinacaoy","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":10,"Editando":false},{"TipoSensor":3,"Titulo":"Inclinação frontal","Mensagem":"Risco de queda!\n","ValorComparar":0.0,"LimiteMinimo":-45.0,"LimiteMaximo":45.0,"AlertaSonoro":false,"LabelSensor":null,"LabelSensorNome":"lblAltitude","ComparacaoMaxima":true,"ComparacaoMinima":true,"AlarmeAcionado":false,"PararCarro":false,"AlarmeAtivado":1,"Variavel":11,"Editando":false}]}
|
||||||
Loading…
Reference in New Issue