ajustes comunicacao lora
|
|
@ -70,9 +70,15 @@ namespace AgroBase.Forms
|
||||||
|
|
||||||
if (GPSService.Iniciado)
|
if (GPSService.Iniciado)
|
||||||
{
|
{
|
||||||
int ID = Convert.ToInt32(Variaveis.IsAgroMonitor ? Variaveis.LoraBaseParametros.address : Variaveis.LoraService.ParametrosSet.address);
|
int ID = Convert.ToInt32(Variaveis.IsAgroMonitor ? LoRaBaseService.parametrosModel.address : Variaveis.LoraService.ParametrosSet.address);
|
||||||
GPSService.EnviarCoordenadasParaMapa(Gps.Latitude, Gps.Longitude, Gps.AnguloCarroDefinido, true, ID);
|
GPSService.EnviarCoordenadasParaMapa(Gps.Latitude, Gps.Longitude, Gps.AnguloCarroDefinido, true, ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Variaveis.LoraService.Iniciado && Variaveis.LoraService._ultimoRxDados > DateTime.UtcNow.AddSeconds(-60))
|
||||||
|
{
|
||||||
|
var GpsBase = VariaveisOperacao.PosicaoBase;
|
||||||
|
GPSService.EnviarCoordenadasParaMapa(GpsBase.Latitude, GpsBase.Longitude, GpsBase.AnguloCarroDefinido, false, Variaveis.LoraBaseParametros.address);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void IniciarMapa()
|
private void IniciarMapa()
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,19 @@ namespace AgroBase.Forms
|
||||||
tmrLeitura = new AsyncTaskTimerModel("tmrLeitura", tmrLeitura_Tick, 1000, this);
|
tmrLeitura = new AsyncTaskTimerModel("tmrLeitura", tmrLeitura_Tick, 1000, this);
|
||||||
tmrLeitura.Start();
|
tmrLeitura.Start();
|
||||||
|
|
||||||
//Parametros = loraService.CarregarParametros();
|
await AtualizarParametros();
|
||||||
if (LoRaBaseService.Iniciado)
|
|
||||||
|
/*if (Variaveis.IsAgroMonitor)
|
||||||
{
|
{
|
||||||
await AtualizarParametros();
|
if (LoRaBaseService.Iniciado)
|
||||||
|
{
|
||||||
|
await AtualizarParametros();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Parametros = Variaveis.LoraService.ParametrosGet;
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task AtualizarParametros()
|
private async Task AtualizarParametros()
|
||||||
|
|
@ -78,7 +86,7 @@ namespace AgroBase.Forms
|
||||||
|
|
||||||
private async Task tmrLeitura_Tick()
|
private async Task tmrLeitura_Tick()
|
||||||
{
|
{
|
||||||
if (LoRaBaseService.Iniciado)
|
if (Variaveis.IsAgroMonitor)
|
||||||
{
|
{
|
||||||
var MensagemDisponivel = LoRaBaseService.MensagemPendente;
|
var MensagemDisponivel = LoRaBaseService.MensagemPendente;
|
||||||
if (MensagemDisponivel != null)
|
if (MensagemDisponivel != null)
|
||||||
|
|
@ -86,11 +94,21 @@ namespace AgroBase.Forms
|
||||||
AtualizarConsole(MensagemDisponivel.Remetente, MensagemDisponivel.Destinatario, MensagemDisponivel.Mensagem);
|
AtualizarConsole(MensagemDisponivel.Remetente, MensagemDisponivel.Destinatario, MensagemDisponivel.Mensagem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var MensagemDisponivel = Variaveis.LoraService.MensagensRecebidasAvulsas.FirstOrDefault(x => !x.Lido);
|
||||||
|
if (MensagemDisponivel != null)
|
||||||
|
{
|
||||||
|
MensagemDisponivel.Lido = true;
|
||||||
|
AtualizarConsole(MensagemDisponivel.Remetente, MensagemDisponivel.Destinatario, MensagemDisponivel.Mensagem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AtualizarDadosTela()
|
private void AtualizarDadosTela()
|
||||||
{
|
{
|
||||||
bool loraConectado = LoRaBaseService.Iniciado;
|
bool loraConectado = Variaveis.IsAgroMonitor ? LoRaBaseService.Iniciado : Variaveis.LoraService.Iniciado;
|
||||||
|
|
||||||
cmbPorta.Items.Clear();
|
cmbPorta.Items.Clear();
|
||||||
cmbPorta.Items.AddRange(SerialPort.GetPortNames().ToArray());
|
cmbPorta.Items.AddRange(SerialPort.GetPortNames().ToArray());
|
||||||
|
|
@ -114,27 +132,21 @@ namespace AgroBase.Forms
|
||||||
|
|
||||||
private async void btnLerParametros_Click(object sender, EventArgs e)
|
private async void btnLerParametros_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (LoRaBaseService.Iniciado)
|
await AtualizarParametros();
|
||||||
{
|
|
||||||
await AtualizarParametros();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void btnGravarParametros_Click(object sender, EventArgs e)
|
private async void btnGravarParametros_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (LoRaBaseService.Iniciado)
|
Parametros.baudRate = LoRaBaseService.CodigosBaudRates.FirstOrDefault(x => x.Key.ToString() == cmbBaudRate.Text).Value;
|
||||||
{
|
Parametros.tranMode = LoRaBaseService.CodigosTipoTransmissao.FirstOrDefault(x => x.Key.ToString() == cmbTransmissao.Text).Value;
|
||||||
Parametros.baudRate = LoRaBaseService.CodigosBaudRates.FirstOrDefault(x => x.Key.ToString() == cmbBaudRate.Text).Value;
|
Parametros.address = Convert.ToByte(txtEndereco.Text);
|
||||||
Parametros.tranMode = LoRaBaseService.CodigosTipoTransmissao.FirstOrDefault(x => x.Key.ToString() == cmbTransmissao.Text).Value;
|
Parametros.channel = Convert.ToByte(txtCanal.Text);
|
||||||
Parametros.address = Convert.ToByte(txtEndereco.Text);
|
Parametros.airRate = LoRaBaseService.CodigosAirRates.FirstOrDefault(x => x.Key.ToString() == cmbAirRate.Text).Value;
|
||||||
Parametros.channel = Convert.ToByte(txtCanal.Text);
|
Parametros.packetSize = LoRaBaseService.CodigosPacketSizes.FirstOrDefault(x => x.Key.ToString() == cmbPacketSize.Text).Value;
|
||||||
Parametros.airRate = LoRaBaseService.CodigosAirRates.FirstOrDefault(x => x.Key.ToString() == cmbAirRate.Text).Value;
|
Parametros.worCycle = LoRaBaseService.CodigosWorCycles.FirstOrDefault(x => x.Key.ToString() == cmbWorCycle.Text).Value;
|
||||||
Parametros.packetSize = LoRaBaseService.CodigosPacketSizes.FirstOrDefault(x => x.Key.ToString() == cmbPacketSize.Text).Value;
|
Parametros.power = LoRaBaseService.CodigosPowers.FirstOrDefault(x => x.Key.ToString() == cmbPower.Text).Value;
|
||||||
Parametros.worCycle = LoRaBaseService.CodigosWorCycles.FirstOrDefault(x => x.Key.ToString() == cmbWorCycle.Text).Value;
|
|
||||||
Parametros.power = LoRaBaseService.CodigosPowers.FirstOrDefault(x => x.Key.ToString() == cmbPower.Text).Value;
|
|
||||||
|
|
||||||
await ConfigurarModulo();
|
await ConfigurarModulo();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ConfigurarModulo()
|
private async Task ConfigurarModulo()
|
||||||
|
|
@ -161,55 +173,52 @@ namespace AgroBase.Forms
|
||||||
|
|
||||||
private void btnEnviar_Click(object sender, EventArgs e)
|
private void btnEnviar_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (LoRaBaseService.Iniciado)
|
bool valido = byte.TryParse(txtEnderecoDestino.Text, out byte destinatario);
|
||||||
|
if (!valido)
|
||||||
{
|
{
|
||||||
bool valido = byte.TryParse(txtEnderecoDestino.Text, out byte destinatario);
|
MessageBox.Show("Preencha o destinatario corretamente!");
|
||||||
if (!valido)
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Remove espaços extras e divide por espaço
|
||||||
|
string[] partes = txtMensagem.Text.Trim().Split(' ');
|
||||||
|
|
||||||
|
// Converte cada string para byte
|
||||||
|
List<byte> payload = new List<byte>();
|
||||||
|
payload.AddRange(LoRaSerializer.CanPrefix(LoRaEspService.DadosLoRaParse.DadosLivre));
|
||||||
|
foreach (var parte in partes)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Preencha o destinatario corretamente!");
|
if (byte.TryParse(parte, System.Globalization.NumberStyles.HexNumber, null, out byte valor))
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Remove espaços extras e divide por espaço
|
|
||||||
string[] partes = txtMensagem.Text.Trim().Split(' ');
|
|
||||||
|
|
||||||
// Converte cada string para byte
|
|
||||||
List<byte> payload = new List<byte>();
|
|
||||||
payload.AddRange(LoRaSerializer.CanPrefix(LoRaEspService.DadosLoRaParse.DadosLivre));
|
|
||||||
foreach (var parte in partes)
|
|
||||||
{
|
{
|
||||||
if (byte.TryParse(parte, System.Globalization.NumberStyles.HexNumber, null, out byte valor))
|
if (payload.Count < 8)
|
||||||
{
|
payload.Add(valor);
|
||||||
if (payload.Count < 8)
|
|
||||||
payload.Add(valor);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show($"Valor inválido: '{parte}'", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Variaveis.IsAgroMonitor)
|
|
||||||
{
|
|
||||||
LoRaBaseService.EnviarDadosLoRa(payload.ToArray(), destinatario);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Variaveis.LoraService.EnviarDadosLoRaViaCAN(payload.ToArray());
|
MessageBox.Show($"Valor inválido: '{parte}'", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageBox.Show("Dados enviados com sucesso: " + FuncoesGlobais.ConverterComandoBytesParaTexto(payload.ToArray()));
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
|
if (Variaveis.IsAgroMonitor)
|
||||||
{
|
{
|
||||||
MessageBox.Show($"Erro ao enviar: {ex.Message}", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
LoRaBaseService.EnviarDadosLoRa(payload.ToArray(), destinatario);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Variaveis.LoraService.EnviarDadosLoRaViaCAN(payload.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
AtualizarConsole(Parametros.address, destinatario, txtMensagem.Text);
|
MessageBox.Show("Dados enviados com sucesso: " + FuncoesGlobais.ConverterComandoBytesParaTexto(payload.ToArray()));
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"Erro ao enviar: {ex.Message}", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
AtualizarConsole(Parametros.address, destinatario, txtMensagem.Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void txtMensagem_KeyDown(object sender, KeyEventArgs e)
|
private void txtMensagem_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ namespace AgroBase.Models
|
||||||
public byte Destinatario { get; set; }
|
public byte Destinatario { get; set; }
|
||||||
public string Mensagem { get; set; }
|
public string Mensagem { get; set; }
|
||||||
public bool Lido { get; set; }
|
public bool Lido { get; set; }
|
||||||
|
public byte[] Data { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LoRaProtocoloModel
|
public class LoRaProtocoloModel
|
||||||
|
|
|
||||||
|
|
@ -421,14 +421,14 @@ namespace AgroBase.Models.Modules
|
||||||
bool RPMAlterado = LeituraRPM != RPM_SP;
|
bool RPMAlterado = LeituraRPM != RPM_SP;
|
||||||
bool LigadoAlterado = LeituraLigado != ComandoLigado;
|
bool LigadoAlterado = LeituraLigado != ComandoLigado;
|
||||||
bool FreioAlterado = (Leitura?.Freado ?? false) != Freado;
|
bool FreioAlterado = (Leitura?.Freado ?? false) != Freado;
|
||||||
bool EnviaComando = PrimeiraLeitura || SentidoAlterado || RPMAlterado || LigadoAlterado;
|
bool EnviaComando = PrimeiraLeitura || SentidoAlterado || RPMAlterado || LigadoAlterado || FreioAlterado;
|
||||||
|
|
||||||
OidFuncCode modoControle =
|
OidFuncCode modoControle =
|
||||||
Freado ? OidFuncCode.ComandoCorrenteFreio :
|
Freado ? OidFuncCode.ComandoCorrenteFreio :
|
||||||
ComandoLigado ? OidFuncCode.ComandoVelocidade :
|
ComandoLigado ? OidFuncCode.ComandoVelocidade :
|
||||||
OidFuncCode.ComandoCorrente;
|
OidFuncCode.ComandoCorrente;
|
||||||
|
|
||||||
if (EnviaComando && !Freado)
|
if (EnviaComando) // && !Freado
|
||||||
{
|
{
|
||||||
int mx =
|
int mx =
|
||||||
Sentido_SP == Sentido.Horario ? 1 :
|
Sentido_SP == Sentido.Horario ? 1 :
|
||||||
|
|
|
||||||
|
|
@ -1712,6 +1712,7 @@ namespace AgroBase.Models.Modules
|
||||||
loRaService.Conectado = false;
|
loRaService.Conectado = false;
|
||||||
loRaService.Configurado = false;
|
loRaService.Configurado = false;
|
||||||
loRaService.ParametrosGet.UltimaLeitura = DateTime.MinValue;
|
loRaService.ParametrosGet.UltimaLeitura = DateTime.MinValue;
|
||||||
|
loRaService.MensagensRecebidasAvulsas = new List<LoRaMensagemModel>();
|
||||||
VisualWorkerService.DadosLeitura.CameraFrames = new Dictionary<CameraFrameType, OAKCameraFrameModel>();
|
VisualWorkerService.DadosLeitura.CameraFrames = new Dictionary<CameraFrameType, OAKCameraFrameModel>();
|
||||||
WeedWorkerService.DadosLeitura.CameraFrames = new Dictionary<CameraFrameType, OAKCameraFrameModel>();
|
WeedWorkerService.DadosLeitura.CameraFrames = new Dictionary<CameraFrameType, OAKCameraFrameModel>();
|
||||||
|
|
||||||
|
|
@ -2953,6 +2954,16 @@ namespace AgroBase.Models.Modules
|
||||||
case DadosLoRaParse.DadosLivre:
|
case DadosLoRaParse.DadosLivre:
|
||||||
{
|
{
|
||||||
Console.WriteLine("[LRA] Dados livres LORA recebidos da base: " + FuncoesGlobais.ConverterComandoBytesParaTexto(data));
|
Console.WriteLine("[LRA] Dados livres LORA recebidos da base: " + FuncoesGlobais.ConverterComandoBytesParaTexto(data));
|
||||||
|
Variaveis.LoraService.MensagensRecebidasAvulsas.Add(new LoRaMensagemModel()
|
||||||
|
{
|
||||||
|
Lido = false,
|
||||||
|
Momento = DateTime.Now,
|
||||||
|
channel = Variaveis.LoraBaseParametros.channel,
|
||||||
|
Remetente = Variaveis.LoraBaseParametros.address,
|
||||||
|
Destinatario = Variaveis.LoraService.ParametrosGet.address,
|
||||||
|
Data = data,
|
||||||
|
Mensagem = string.Join("", data.Select(x => x.ToString("X")))
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DadosLoRaParse.GpsQualidade:
|
case DadosLoRaParse.GpsQualidade:
|
||||||
|
|
@ -2996,6 +3007,7 @@ namespace AgroBase.Models.Modules
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Variaveis.LoraService.UltimoRxDados = Stopwatch.GetTimestamp() / (double)Stopwatch.Frequency;
|
Variaveis.LoraService.UltimoRxDados = Stopwatch.GetTimestamp() / (double)Stopwatch.Frequency;
|
||||||
|
Variaveis.LoraService._ultimoRxDados = DateTime.UtcNow;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1088,6 +1088,7 @@ namespace AgroBase.Models
|
||||||
}
|
}
|
||||||
|
|
||||||
Variaveis.OperacaoEmAndamento.Sensoriamento.AtualizarDados();
|
Variaveis.OperacaoEmAndamento.Sensoriamento.AtualizarDados();
|
||||||
|
Variaveis.LoraService.EnviarDadosParaBase();
|
||||||
|
|
||||||
if (!Variaveis.OperacaoEmAndamento.Iniciado)
|
if (!Variaveis.OperacaoEmAndamento.Iniciado)
|
||||||
{
|
{
|
||||||
|
|
@ -1286,13 +1287,6 @@ namespace AgroBase.Models
|
||||||
}
|
}
|
||||||
|
|
||||||
Variaveis.OperacaoEmAndamento.idxLog++;
|
Variaveis.OperacaoEmAndamento.idxLog++;
|
||||||
|
|
||||||
|
|
||||||
if (Variaveis.OperacaoEmAndamento.idxLog % (Variaveis.LoraService.TempoEnvioDadosBase / 1000.0) == 0)
|
|
||||||
{
|
|
||||||
Variaveis.LoraService.EnviarDadosParaBase();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ namespace AgroBase.Models.Operadores
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
List<Direcao> _direcoesInterromperMovimento = new List<Direcao> { Direcao.Frente, Direcao.Tras };
|
List<Direcao> _direcoesInterromperMovimento = new List<Direcao> { Direcao.Frente }; //, Direcao.Tras
|
||||||
Direcao _ultimaDirecaoControle = Variaveis.OperacaoEmAndamento.Controle.TiposControle.FirstOrDefault(x => x.Tipo == T_Code.Mov)?.UltimaDirecao ?? Direcao.Parado;
|
Direcao _ultimaDirecaoControle = Variaveis.OperacaoEmAndamento.Controle.TiposControle.FirstOrDefault(x => x.Tipo == T_Code.Mov)?.UltimaDirecao ?? Direcao.Parado;
|
||||||
bool _carroEmMovimento = _direcoesInterromperMovimento.Contains(_ultimaDirecaoControle);
|
bool _carroEmMovimento = _direcoesInterromperMovimento.Contains(_ultimaDirecaoControle);
|
||||||
bool emMovimento = consideraEmMovimento ? _carroEmMovimento : true;
|
bool emMovimento = consideraEmMovimento ? _carroEmMovimento : true;
|
||||||
|
|
|
||||||
|
|
@ -116,5 +116,8 @@ namespace AgroMonitor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static readonly object _EquipamentosConectadosLogsLock = new object();
|
public static readonly object _EquipamentosConectadosLogsLock = new object();
|
||||||
|
|
||||||
|
public static bool EnviarDadosEmBroadcast { get; set; } = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -942,7 +942,7 @@ namespace AgroBase.Services
|
||||||
|
|
||||||
if (Variaveis.IsAgroMonitor)
|
if (Variaveis.IsAgroMonitor)
|
||||||
{
|
{
|
||||||
EnviarCoordenadasParaMapa(UltimaLeitura.Latitude, UltimaLeitura.Longitude, UltimaLeitura.AnguloCarroDefinido, false, LoRaBaseService.parametrosModel.address);
|
//EnviarCoordenadasParaMapa(UltimaLeitura.Latitude, UltimaLeitura.Longitude, UltimaLeitura.AnguloCarroDefinido, false, LoRaBaseService.parametrosModel.address);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -988,10 +988,10 @@ namespace AgroBase.Services
|
||||||
|
|
||||||
AtualizarTrajetoriaDinamica();
|
AtualizarTrajetoriaDinamica();
|
||||||
|
|
||||||
int EnderecoEquipamento = Convert.ToInt32(Variaveis.LoraService?.ParametrosSet?.address ?? 0x00);
|
int EnderecoEquipamento = Convert.ToInt32(Variaveis.LoraService?.ParametrosGet?.address ?? Variaveis.LoraService?.ParametrosSet?.address ?? 0x00);
|
||||||
EnviarCoordenadasParaMapa(UltimaLeitura.Latitude, UltimaLeitura.Longitude, UltimaLeitura.AnguloCarroDefinido, Variaveis.OperacaoEmAndamento.Iniciado, EnderecoEquipamento);
|
EnviarCoordenadasParaMapa(UltimaLeitura.Latitude, UltimaLeitura.Longitude, UltimaLeitura.AnguloCarroDefinido, Variaveis.OperacaoEmAndamento.Iniciado, EnderecoEquipamento);
|
||||||
|
|
||||||
if (VariaveisOperacao.PosicaoBase != null && Variaveis.LoraBaseParametros != null)
|
if (Variaveis.LoraService.Iniciado && Variaveis.LoraService._ultimoRxDados > DateTime.UtcNow.AddSeconds(-60))
|
||||||
{
|
{
|
||||||
byte EnderecoBase = Variaveis.LoraBaseParametros.address;
|
byte EnderecoBase = Variaveis.LoraBaseParametros.address;
|
||||||
EnviarCoordenadasParaMapa(VariaveisOperacao.PosicaoBase.Latitude, VariaveisOperacao.PosicaoBase.Longitude, VariaveisOperacao.PosicaoBase.OrientacaoReal, false, EnderecoBase);
|
EnviarCoordenadasParaMapa(VariaveisOperacao.PosicaoBase.Latitude, VariaveisOperacao.PosicaoBase.Longitude, VariaveisOperacao.PosicaoBase.OrientacaoReal, false, EnderecoBase);
|
||||||
|
|
|
||||||
|
|
@ -113,12 +113,12 @@ namespace AgroBase.Services
|
||||||
public static LoRaParametrosModel parametrosModel { get; set; } = new LoRaParametrosModel()
|
public static LoRaParametrosModel parametrosModel { get; set; } = new LoRaParametrosModel()
|
||||||
{
|
{
|
||||||
address = 0x01,
|
address = 0x01,
|
||||||
channel = 0x17,
|
channel = 0x41,
|
||||||
tranMode = CodigosTipoTransmissao["Fixed"],
|
tranMode = CodigosTipoTransmissao["Fixed"],
|
||||||
baudRate = CodigosBaudRates[9600],
|
baudRate = CodigosBaudRates[9600],
|
||||||
airRate = CodigosAirRates[2.4],
|
airRate = CodigosAirRates[2.4],
|
||||||
packetSize = CodigosPacketSizes[200],
|
packetSize = CodigosPacketSizes[32],
|
||||||
worCycle = CodigosWorCycles[4000],
|
worCycle = CodigosWorCycles[2000],
|
||||||
power = CodigosPowers[22],
|
power = CodigosPowers[22],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -495,6 +495,20 @@ namespace AgroBase.Services
|
||||||
case DadosLoRaParse.DadosControle:
|
case DadosLoRaParse.DadosControle:
|
||||||
{
|
{
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DadosLoRaParse.DadosLivre:
|
||||||
|
{
|
||||||
|
MensagensRecebidas.Add(new LoRaMensagemModel()
|
||||||
|
{
|
||||||
|
channel = parametrosModel.channel,
|
||||||
|
Destinatario = destinatario,
|
||||||
|
Remetente = remetente,
|
||||||
|
Data = dados,
|
||||||
|
Lido = false,
|
||||||
|
Momento = DateTime.Now,
|
||||||
|
Mensagem = string.Join("", dados.Select(x => x.ToString("X")))
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -543,7 +557,7 @@ namespace AgroBase.Services
|
||||||
{
|
{
|
||||||
List<byte[]> Partes = new List<byte[]>();
|
List<byte[]> Partes = new List<byte[]>();
|
||||||
|
|
||||||
byte addressHigh = 0x00;
|
byte addressHigh = (byte)(targetAddress == 0xFF ? 0xFF : 0x00);
|
||||||
byte channel = parametrosModel.channel;
|
byte channel = parametrosModel.channel;
|
||||||
byte remetente = parametrosModel.address;
|
byte remetente = parametrosModel.address;
|
||||||
|
|
||||||
|
|
@ -642,13 +656,20 @@ namespace AgroBase.Services
|
||||||
|
|
||||||
public static async Task tmrPing_Tick()
|
public static async Task tmrPing_Tick()
|
||||||
{
|
{
|
||||||
foreach (var Equipamento in VariaveisMonitoramento.EquipamentosConectados.Where(x => x.Key != parametrosModel.address))
|
if (VariaveisMonitoramento.EnviarDadosEmBroadcast)
|
||||||
{
|
{
|
||||||
EnviarDadosPosicao(Equipamento.Key);
|
EnviarDadosPosicao();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var Equipamento in VariaveisMonitoramento.EquipamentosConectados.Where(x => x.Key != parametrosModel.address))
|
||||||
|
{
|
||||||
|
EnviarDadosPosicao(Equipamento.Key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void EnviarDadosPosicao(byte EnderecoDestinatario)
|
private static void EnviarDadosPosicao(byte EnderecoDestinatario = 0xFF)
|
||||||
{
|
{
|
||||||
if (Iniciado)
|
if (Iniciado)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ namespace AgroBase.Services
|
||||||
return Conectado && Configurado;
|
return Conectado && Configurado;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public double FrequenciaEnvioDadosBase { get; set; } = 0.1;
|
public double FrequenciaEnvioDadosBase { get; set; } = 0.2;
|
||||||
public double TempoEnvioDadosBase
|
public double TempoEnvioDadosBase
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -32,10 +32,13 @@ namespace AgroBase.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public double UltimoRxDados { get; set; } = 0;
|
public double UltimoRxDados { get; set; } = 0;
|
||||||
|
public DateTime _ultimoRxDados { get; set; } = DateTime.MinValue;
|
||||||
public double UltimoTxDados { get; set; } = 0;
|
public double UltimoTxDados { get; set; } = 0;
|
||||||
|
public DateTime _ultimoTxDados { get; set; } = DateTime.MinValue;
|
||||||
public LoRaParametrosModel ParametrosSet { get; set; } = new LoRaParametrosModel();
|
public LoRaParametrosModel ParametrosSet { get; set; } = new LoRaParametrosModel();
|
||||||
public LoRaParametrosModel ParametrosGet { get; set; } = new LoRaParametrosModel();
|
public LoRaParametrosModel ParametrosGet { get; set; } = new LoRaParametrosModel();
|
||||||
public List<FuncoesPinout> Funcoes { get; set; }
|
public List<FuncoesPinout> Funcoes { get; set; }
|
||||||
|
public List<LoRaMensagemModel> MensagensRecebidasAvulsas { get; set; } = new List<LoRaMensagemModel>();
|
||||||
|
|
||||||
public List<(int, CanMessagePosicaoDados, byte[])> ProtocoloConfiguracao(PinoutDataModel Pinout, bool conectar)
|
public List<(int, CanMessagePosicaoDados, byte[])> ProtocoloConfiguracao(PinoutDataModel Pinout, bool conectar)
|
||||||
{
|
{
|
||||||
|
|
@ -103,37 +106,49 @@ namespace AgroBase.Services
|
||||||
|
|
||||||
Variaveis.OperacaoEmAndamento.DispSen?.AdicionarMensagemFila(idNum, posicao, posicao, payload.Skip(2).ToArray(), false);
|
Variaveis.OperacaoEmAndamento.DispSen?.AdicionarMensagemFila(idNum, posicao, posicao, payload.Skip(2).ToArray(), false);
|
||||||
UltimoTxDados = Stopwatch.GetTimestamp() / (double)Stopwatch.Frequency;
|
UltimoTxDados = Stopwatch.GetTimestamp() / (double)Stopwatch.Frequency;
|
||||||
|
_ultimoTxDados = DateTime.UtcNow;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EnviarDadosParaBase()
|
public void EnviarDadosParaBase()
|
||||||
{
|
{
|
||||||
if (Iniciado)
|
if (!Iniciado) return;
|
||||||
{
|
|
||||||
var _Sensoriamento = Variaveis.OperacaoEmAndamento.Sensoriamento;
|
|
||||||
|
|
||||||
List<byte[]> dadosGps = LoRaSerializer.SerializeGPS(_Sensoriamento.Gps);
|
var now = DateTime.UtcNow; // evite DST
|
||||||
foreach (var dado in dadosGps)
|
|
||||||
{
|
|
||||||
Variaveis.LoraService?.EnviarDadosLoRaViaCAN(dado);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<byte[]> dadosOperacao = LoRaSerializer.SerializeOperacao(_Sensoriamento);
|
// --- parâmetros (ajuste) ---
|
||||||
foreach (var dado in dadosOperacao)
|
int minIntervaloTxMs = (int)TempoEnvioDadosBase; // mínimo entre TXs do rover
|
||||||
{
|
int beaconPeriodoMs = VariaveisEquipamento.TempoEntrePingsConexao; // p.ex. 10000
|
||||||
Variaveis.LoraService?.EnviarDadosLoRaViaCAN(dado);
|
int janelaMinMs = 1000; // só responda >= 1 s após o beacon
|
||||||
}
|
int guardaProximoMs = 2000; // e não responda nos últimos 2 s antes do próximo beacon
|
||||||
|
|
||||||
List<byte[]> dadosSensores = LoRaSerializer.SerializeSensores(_Sensoriamento);
|
// --- idades ---
|
||||||
foreach (var dado in dadosSensores)
|
double ageTxMs = (now - _ultimoTxDados).TotalMilliseconds;
|
||||||
{
|
double ageRxMs = (now - _ultimoRxDados).TotalMilliseconds;
|
||||||
Variaveis.LoraService?.EnviarDadosLoRaViaCAN(dado);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// 1) respeite intervalo mínimo entre TX
|
||||||
|
if (ageTxMs < minIntervaloTxMs) return;
|
||||||
|
|
||||||
Variaveis.LoraService?.EnviarDadosLoRaViaCAN(LoRaSerializer.SerializeControleAtual(_Sensoriamento.Controle));
|
// 2) valide janela após o último beacon
|
||||||
}
|
if (ageRxMs < janelaMinMs) return; // cedo demais
|
||||||
|
if (ageRxMs > beaconPeriodoMs - guardaProximoMs) return; // já muito perto do próximo beacon
|
||||||
|
|
||||||
|
// (opcional) se o último beacon já “caducou” (perdeu pings), não envie
|
||||||
|
if (ageRxMs > beaconPeriodoMs + 2000) return;
|
||||||
|
|
||||||
|
// --- ENVIO (ideal: agregue em 1-2 frames) ---
|
||||||
|
var s = Variaveis.OperacaoEmAndamento.Sensoriamento;
|
||||||
|
|
||||||
|
foreach (var dado in LoRaSerializer.SerializeGPS(s.Gps))
|
||||||
|
Variaveis.LoraService?.EnviarDadosLoRaViaCAN(dado);
|
||||||
|
|
||||||
|
foreach (var dado in LoRaSerializer.SerializeOperacao(s))
|
||||||
|
Variaveis.LoraService?.EnviarDadosLoRaViaCAN(dado);
|
||||||
|
|
||||||
|
foreach (var dado in LoRaSerializer.SerializeSensores(s))
|
||||||
|
Variaveis.LoraService?.EnviarDadosLoRaViaCAN(dado);
|
||||||
|
|
||||||
|
Variaveis.LoraService?.EnviarDadosLoRaViaCAN(LoRaSerializer.SerializeControleAtual(s.Controle));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,12 +123,14 @@ namespace AgroBase.Services
|
||||||
{
|
{
|
||||||
short corrente_10mA = (short)(setPoint * 100);
|
short corrente_10mA = (short)(setPoint * 100);
|
||||||
setPointBytes = BitConverter.GetBytes(corrente_10mA).Reverse().ToArray();
|
setPointBytes = BitConverter.GetBytes(corrente_10mA).Reverse().ToArray();
|
||||||
|
DadosLeitura.FirstOrDefault(x => x.EnderecoTx == idTx).ModoControle = OIDModoControle.Freio;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OidFuncCode.ComandoVelocidade:
|
case OidFuncCode.ComandoVelocidade:
|
||||||
{
|
{
|
||||||
int erpm = (int)(setPoint * VariaveisEquipamento.NumeroPolosMotor);
|
int erpm = (int)(setPoint * VariaveisEquipamento.NumeroPolosMotor);
|
||||||
setPointBytes = BitConverter.GetBytes(erpm).Reverse().ToArray();
|
setPointBytes = BitConverter.GetBytes(erpm).Reverse().ToArray();
|
||||||
|
DadosLeitura.FirstOrDefault(x => x.EnderecoTx == idTx).ModoControle = OIDModoControle.Velocidade;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OidFuncCode.ComandoCicloTrabalho:
|
case OidFuncCode.ComandoCicloTrabalho:
|
||||||
|
|
|
||||||
|
|
@ -146,8 +146,7 @@ namespace AgroBase.Services.Operadores
|
||||||
),
|
),
|
||||||
("Gerais", new
|
("Gerais", new
|
||||||
{
|
{
|
||||||
//velocidade_ms = _Sensoriamento.Movimentacao?.VelocidadeMedia ?? 0,
|
velocidade_ms = Variaveis.OperacaoEmAndamento.Simulando ? FuncoesMatematicas.CalculaVelocidadeMsPercentual(Variaveis.OperacaoEmAndamento.Controle.RPM_SP) : _Sensoriamento.Movimentacao?.VelocidadeMedia ?? 0,
|
||||||
velocidade_ms = FuncoesMatematicas.CalculaVelocidadeMsPercentual(Variaveis.OperacaoEmAndamento.Controle.PercentualVelocidadeSP),
|
|
||||||
ervas_no_radar = _Sensoriamento.Atuador?.ErvasNoRadar ?? false,
|
ervas_no_radar = _Sensoriamento.Atuador?.ErvasNoRadar ?? false,
|
||||||
percentual_ervas_no_radar = _Sensoriamento.Atuador?.PercentualErvasNoRadar ?? 0,
|
percentual_ervas_no_radar = _Sensoriamento.Atuador?.PercentualErvasNoRadar ?? 0,
|
||||||
percentual_reservatorio = _Sensoriamento.Atuador?.PercentualReservatorio ?? 0,
|
percentual_reservatorio = _Sensoriamento.Atuador?.PercentualReservatorio ?? 0,
|
||||||
|
|
|
||||||
|
|
@ -29,5 +29,5 @@
|
||||||
"top_topics_and_observing_domains": [ ]
|
"top_topics_and_observing_domains": [ ]
|
||||||
} ],
|
} ],
|
||||||
"hex_encoded_hmac_key": "40F346D3248C3AFDF2BEE1FE496DBD32F7CED6E5AE98B881ABC421AA7E7B5642",
|
"hex_encoded_hmac_key": "40F346D3248C3AFDF2BEE1FE496DBD32F7CED6E5AE98B881ABC421AA7E7B5642",
|
||||||
"next_scheduled_calculation_time": "13403030306182389"
|
"next_scheduled_calculation_time": "13403030306182806"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
2025/09/15-17:35:19.244 585c Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001
|
2025/09/17-15:12:39.370 5024 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001
|
||||||
2025/09/15-17:35:19.253 585c Recovering log #3
|
2025/09/17-15:12:39.379 5024 Recovering log #3
|
||||||
2025/09/15-17:35:19.256 585c Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/000003.log
|
2025/09/17-15:12:39.382 5024 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/000003.log
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
2025/09/15-15:57:42.267 2cc0 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001
|
2025/09/17-14:18:37.212 4ffc Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001
|
||||||
2025/09/15-15:57:42.276 2cc0 Recovering log #3
|
2025/09/17-14:18:37.221 4ffc Recovering log #3
|
||||||
2025/09/15-15:57:42.279 2cc0 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/000003.log
|
2025/09/17-14:18:37.224 4ffc Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/000003.log
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"net":{"http_server_properties":{"servers":[{"alternative_service":[{"advertised_alpns":["h3"],"expiration":"13402522885929406","port":443,"protocol_str":"quic"}],"anonymization":["DAAAAAcAAABmaWxlOi8vAA==",false,0],"network_stats":{"srtt":27069},"server":"https://tile.openstreetmap.org","supports_spdy":true}],"supports_quic":{"address":"2804:d78:67d:1400:60e0:3daf:3723:e31f","used_quic":true},"version":5},"network_qualities":{"CAASABiAgICA+P////8B":"4G","CAESABiAgICA+P////8B":"4G","CAISABiAgICA+P////8B":"4G","CAYSABiAgICA+P////8B":"Offline"}}}
|
{"net":{"http_server_properties":{"servers":[{"alternative_service":[{"advertised_alpns":["h3"],"expiration":"13402692759854060","port":443,"protocol_str":"quic"}],"anonymization":["DAAAAAcAAABmaWxlOi8vAA==",false,0],"network_stats":{"srtt":37977},"server":"https://tile.openstreetmap.org","supports_spdy":true}],"supports_quic":{"address":"2804:d78:67d:1400:5011:1759:4b8a:6d1a","used_quic":true},"version":5},"network_qualities":{"CAASABiAgICA+P////8B":"4G","CAESABiAgICA+P////8B":"4G","CAISABiAgICA+P////8B":"4G","CAYSABiAgICA+P////8B":"Offline"}}}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"sts":[{"expiry":1789498662.856284,"host":"bWGAftl61rqoc0YzqPncsLvQQh/iC2Bdp3ejUeGC83w=","mode":"force-https","sts_include_subdomains":true,"sts_observed":1757962662.856286}],"version":2}
|
{"sts":[{"expiry":1789574554.859671,"host":"bWGAftl61rqoc0YzqPncsLvQQh/iC2Bdp3ejUeGC83w=","mode":"force-https","sts_include_subdomains":true,"sts_observed":1758038554.859674}],"version":2}
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
2025/09/15-17:36:02.774 585c Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/MANIFEST-000001
|
2025/09/17-15:14:15.816 5024 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/MANIFEST-000001
|
||||||
2025/09/15-17:36:02.775 585c Recovering log #3
|
2025/09/17-15:14:15.817 5024 Recovering log #3
|
||||||
2025/09/15-17:36:02.778 585c Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/000003.log
|
2025/09/17-15:14:15.820 5024 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/000003.log
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
2025/09/15-16:16:16.964 2cc0 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/MANIFEST-000001
|
2025/09/17-14:21:30.033 4ffc Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/MANIFEST-000001
|
||||||
2025/09/15-16:16:16.966 2cc0 Recovering log #3
|
2025/09/17-14:21:30.034 4ffc Recovering log #3
|
||||||
2025/09/15-16:16:16.969 2cc0 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/000003.log
|
2025/09/17-14:21:30.037 4ffc Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/000003.log
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
2025/09/15-17:35:19.173 1788 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/MANIFEST-000001
|
2025/09/17-15:12:39.298 5a8 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/MANIFEST-000001
|
||||||
2025/09/15-17:35:19.176 1788 Recovering log #7
|
2025/09/17-15:12:39.300 5a8 Recovering log #7
|
||||||
2025/09/15-17:35:19.176 1788 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/000007.log
|
2025/09/17-15:12:39.300 5a8 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/000007.log
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
2025/09/15-15:57:42.197 4e88 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/MANIFEST-000001
|
2025/09/17-14:18:37.135 16a8 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/MANIFEST-000001
|
||||||
2025/09/15-15:57:42.199 4e88 Recovering log #7
|
2025/09/17-14:18:37.138 16a8 Recovering log #7
|
||||||
2025/09/15-15:57:42.199 4e88 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/000007.log
|
2025/09/17-14:18:37.139 16a8 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/000007.log
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<meta name="viewport" content="width=device-width,
|
<meta name="viewport" content="width=device-width,
|
||||||
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||||
<style>
|
<style>
|
||||||
#map_413b17cf3f148cf9e5299ab727cb1cef {
|
#map_82cc7fa00003bb6a2c7d6d614b5d85cb {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100.0%;
|
width: 100.0%;
|
||||||
height: 100.0%;
|
height: 100.0%;
|
||||||
|
|
@ -54,14 +54,14 @@
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
||||||
<div class="folium-map" id="map_413b17cf3f148cf9e5299ab727cb1cef" ></div>
|
<div class="folium-map" id="map_82cc7fa00003bb6a2c7d6d614b5d85cb" ></div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
var map_413b17cf3f148cf9e5299ab727cb1cef = L.map(
|
var map_82cc7fa00003bb6a2c7d6d614b5d85cb = L.map(
|
||||||
"map_413b17cf3f148cf9e5299ab727cb1cef",
|
"map_82cc7fa00003bb6a2c7d6d614b5d85cb",
|
||||||
{
|
{
|
||||||
center: [0.0, 0.0],
|
center: [0.0, 0.0],
|
||||||
crs: L.CRS.EPSG3857,
|
crs: L.CRS.EPSG3857,
|
||||||
|
|
@ -77,6 +77,26 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var tile_layer_6f5ee2ed5cadfb801d737455328ac759 = L.tileLayer(
|
||||||
|
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
|
||||||
|
{
|
||||||
|
"minZoom": 0,
|
||||||
|
"maxZoom": 19,
|
||||||
|
"maxNativeZoom": 19,
|
||||||
|
"noWrap": false,
|
||||||
|
"attribution": "\u0026copy; \u003ca href=\"https://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e contributors",
|
||||||
|
"subdomains": "abc",
|
||||||
|
"detectRetina": false,
|
||||||
|
"tms": false,
|
||||||
|
"opacity": 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
tile_layer_6f5ee2ed5cadfb801d737455328ac759.addTo(map_82cc7fa00003bb6a2c7d6d614b5d85cb);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -96,7 +116,7 @@
|
||||||
}
|
}
|
||||||
trajeto_json_add({"features": []});
|
trajeto_json_add({"features": []});
|
||||||
|
|
||||||
trajeto_json.addTo(map_413b17cf3f148cf9e5299ab727cb1cef);
|
trajeto_json.addTo(map_82cc7fa00003bb6a2c7d6d614b5d85cb);
|
||||||
|
|
||||||
function adicionarGeometria(novaGeometria) {
|
function adicionarGeometria(novaGeometria) {
|
||||||
trajeto_json.addData(novaGeometria);
|
trajeto_json.addData(novaGeometria);
|
||||||
|
|
@ -159,9 +179,9 @@
|
||||||
|
|
||||||
var marcadorEquipamento = L.marker([0, 0], {
|
var marcadorEquipamento = L.marker([0, 0], {
|
||||||
icon: customIcon
|
icon: customIcon
|
||||||
}).addTo(map_413b17cf3f148cf9e5299ab727cb1cef);
|
}).addTo(map_82cc7fa00003bb6a2c7d6d614b5d85cb);
|
||||||
|
|
||||||
var marcadorBase = L.marker([0, 0], {}).addTo(map_413b17cf3f148cf9e5299ab727cb1cef);
|
var marcadorBase = L.marker([0, 0], {}).addTo(map_82cc7fa00003bb6a2c7d6d614b5d85cb);
|
||||||
var icon = L.AwesomeMarkers.icon(
|
var icon = L.AwesomeMarkers.icon(
|
||||||
{"extraClasses": "fa-rotate-0", "icon": "info-sign", "iconColor": "white", "markerColor": "red", "prefix": "glyphicon"}
|
{"extraClasses": "fa-rotate-0", "icon": "info-sign", "iconColor": "white", "markerColor": "red", "prefix": "glyphicon"}
|
||||||
);
|
);
|
||||||
|
|
@ -226,7 +246,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foco) {
|
if (foco) {
|
||||||
map_413b17cf3f148cf9e5299ab727cb1cef.setView(novaPosicao, map_413b17cf3f148cf9e5299ab727cb1cef.getZoom());
|
map_82cc7fa00003bb6a2c7d6d614b5d85cb.setView(novaPosicao, map_82cc7fa00003bb6a2c7d6d614b5d85cb.getZoom());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -248,7 +268,7 @@
|
||||||
marcadorDinamico.setRotationAngle(angulo);
|
marcadorDinamico.setRotationAngle(angulo);
|
||||||
|
|
||||||
adicionarCoordenada("Tj", [novaLongitude, novaLatitude]);
|
adicionarCoordenada("Tj", [novaLongitude, novaLatitude]);
|
||||||
map_413b17cf3f148cf9e5299ab727cb1cef.setView(novaPosicao, map_413b17cf3f148cf9e5299ab727cb1cef.getZoom());*/
|
map_82cc7fa00003bb6a2c7d6d614b5d85cb.setView(novaPosicao, map_82cc7fa00003bb6a2c7d6d614b5d85cb.getZoom());*/
|
||||||
});
|
});
|
||||||
|
|
||||||
function calcularOrientacao(P1latitude, P1longitude, P2latitude, P2longitude) {
|
function calcularOrientacao(P1latitude, P1longitude, P2latitude, P2longitude) {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ def definir_comando(parada_necessaria: bool, frear: bool, erro: bool, filtro_vel
|
||||||
mostrar_log(f"🟥 Movimento parado: operação não está em andamento ou finalizando: {status_operacao.name}")
|
mostrar_log(f"🟥 Movimento parado: operação não está em andamento ou finalizando: {status_operacao.name}")
|
||||||
return _montar_comando_retorno(0.0, False)
|
return _montar_comando_retorno(0.0, False)
|
||||||
|
|
||||||
_dados_ww = ContextoGlobalRedis.get(CtxKey.DadosWeedWorker, {}).get("analise", {})
|
_dados_vw = ContextoGlobalRedis.get(CtxKey.DadosWeedWorker, {}).get("analise", {})
|
||||||
_snr = ContextoGlobalRedis.get_modulo(T_Code.Snr)
|
_snr = ContextoGlobalRedis.get_modulo(T_Code.Snr)
|
||||||
sonar_ativado = _operacao.get("Snr", {}).get("sonar_ativado", False)
|
sonar_ativado = _operacao.get("Snr", {}).get("sonar_ativado", False)
|
||||||
visual_worker_operante = (_snr.get("saude", {}).get("status", StatusModulo.DESCONECTADO.value)) == StatusModulo.OPERANTE.value
|
visual_worker_operante = (_snr.get("saude", {}).get("status", StatusModulo.DESCONECTADO.value)) == StatusModulo.OPERANTE.value
|
||||||
|
|
@ -42,11 +42,11 @@ def definir_comando(parada_necessaria: bool, frear: bool, erro: bool, filtro_vel
|
||||||
#ervas_no_radar = _contexto.get("Gerais", {}).get("ervas_no_radar", False)
|
#ervas_no_radar = _contexto.get("Gerais", {}).get("ervas_no_radar", False)
|
||||||
#percentual_ervas_no_radar = (_contexto.get("Gerais", {}).get("percentual_ervas_no_radar", 0)) * 100.0
|
#percentual_ervas_no_radar = (_contexto.get("Gerais", {}).get("percentual_ervas_no_radar", 0)) * 100.0
|
||||||
|
|
||||||
ervas_no_radar = _dados_ww.get("ervas_no_radar", False)
|
ervas_no_radar = _dados_vw.get("ervas_no_radar", False)
|
||||||
percentual_ervas_no_radar = _dados_ww.get("estatisticas", {}).get("ema_global", 0.0)
|
percentual_ervas_no_radar = _dados_vw.get("estatisticas", {}).get("erva", {}).get("ema_global", 0.0)
|
||||||
|
|
||||||
vel_min = 15
|
vel_min = 15
|
||||||
ervas_min_percenet = 0.5
|
ervas_min_percenet = 0.005
|
||||||
vel_com_ervas = _operacao.get("Mov", {}).get("percent_vel_min", 0)
|
vel_com_ervas = _operacao.get("Mov", {}).get("percent_vel_min", 0)
|
||||||
vel_sem_ervas = _operacao.get("Mov", {}).get("percent_vel_max", 100)
|
vel_sem_ervas = _operacao.get("Mov", {}).get("percent_vel_max", 100)
|
||||||
ang_max = _operacao.get("Dir", {}).get("angulo_max", 30)
|
ang_max = _operacao.get("Dir", {}).get("angulo_max", 30)
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ def comando_controle(percentual_velocidade: float, frear: bool, angulo: float, t
|
||||||
}
|
}
|
||||||
|
|
||||||
def comando_parado():
|
def comando_parado():
|
||||||
return comando_controle(0, 0, TipoMovimentoDirecional.RodasDianteiras)
|
return comando_controle(0, False, 0, TipoMovimentoDirecional.RodasDianteiras)
|
||||||
|
|
||||||
def log_status_operacao():
|
def log_status_operacao():
|
||||||
modo = ModoOperacao(ContextoGlobalRedis.get_operacao().get("modo"))
|
modo = ModoOperacao(ContextoGlobalRedis.get_operacao().get("modo"))
|
||||||
|
|
|
||||||
|
|
@ -412,7 +412,7 @@ class CameraManager:
|
||||||
t1 = time.time()
|
t1 = time.time()
|
||||||
grid_conf["ultima_chamada"] = self._ultima_analise_matriz_confianca.get("ultima_chamada", t0)
|
grid_conf["ultima_chamada"] = self._ultima_analise_matriz_confianca.get("ultima_chamada", t0)
|
||||||
self._calcular_performance(t0, t1, grid_conf)
|
self._calcular_performance(t0, t1, grid_conf)
|
||||||
snapshot = self.data_fuser.update(grid_conf, ts=t1, velocidade_ms=vel)
|
snapshot = self.data_fuser.update(grid_conf, velocidade_ms=vel)
|
||||||
self._ultima_analise_matriz_confianca = grid_conf
|
self._ultima_analise_matriz_confianca = grid_conf
|
||||||
#self._ultima_analise_segmentacao["corredor_perfil"] = self.segmentacao_manager.calcular_perfil_corredor(matriz, fov_h)
|
#self._ultima_analise_segmentacao["corredor_perfil"] = self.segmentacao_manager.calcular_perfil_corredor(matriz, fov_h)
|
||||||
ContextoGlobalRedis.atualizar_ctx_dict(
|
ContextoGlobalRedis.atualizar_ctx_dict(
|
||||||
|
|
|
||||||
|
|
@ -287,7 +287,7 @@ class CostmapFuser:
|
||||||
# (pixel inseguro mais perto vs linha que bloqueia)
|
# (pixel inseguro mais perto vs linha que bloqueia)
|
||||||
def _min_non_none(a, b):
|
def _min_non_none(a, b):
|
||||||
try:
|
try:
|
||||||
if a is None and b is None: return 0
|
if a is None and b is None: return None
|
||||||
if a is None: return b
|
if a is None: return b
|
||||||
if b is None: return a
|
if b is None: return a
|
||||||
return a if a <= b else b
|
return a if a <= b else b
|
||||||
|
|
@ -406,7 +406,7 @@ class CostmapFuser:
|
||||||
|
|
||||||
if use_persistence:
|
if use_persistence:
|
||||||
v = float(max(0.0, velocidade_mps or 0.0))
|
v = float(max(0.0, velocidade_mps or 0.0))
|
||||||
dist_freio = max(0.30, (v*v) / max(1e-9, 2.0 * a_max_freio))
|
dist_freio = (v*v) / max(1e-9, 2.0 * a_max_freio)
|
||||||
dist_necessaria = dist_freio + margem_parada
|
dist_necessaria = dist_freio + margem_parada
|
||||||
decision["dist_necessaria"] = float(dist_necessaria)
|
decision["dist_necessaria"] = float(dist_necessaria)
|
||||||
|
|
||||||
|
|
@ -427,7 +427,7 @@ class CostmapFuser:
|
||||||
if (d_ref is not None) and np.isfinite(d_ref) and (d_ref > margem_parada):
|
if (d_ref is not None) and np.isfinite(d_ref) and (d_ref > margem_parada):
|
||||||
v_max_sug = float(np.sqrt(max(0.0, 2.0 * a_max_freio * (d_ref - margem_parada))))
|
v_max_sug = float(np.sqrt(max(0.0, 2.0 * a_max_freio * (d_ref - margem_parada))))
|
||||||
|
|
||||||
if d_for_stop <= dist_necessaria:
|
if (d_for_stop is not None) and np.isfinite(d_for_stop) and (d_for_stop <= dist_necessaria):
|
||||||
stop_now = True
|
stop_now = True
|
||||||
|
|
||||||
# histerese
|
# histerese
|
||||||
|
|
@ -592,7 +592,7 @@ class CostmapFuser:
|
||||||
row_dist_m, row_scale_x, self.central_cols,
|
row_dist_m, row_scale_x, self.central_cols,
|
||||||
use_persistence=True,
|
use_persistence=True,
|
||||||
velocidade_mps=velocidade_ms,
|
velocidade_mps=velocidade_ms,
|
||||||
a_max_freio=0.8, margem_parada=0.60,
|
a_max_freio=0.4, margem_parada=0.60,
|
||||||
N_on=2, N_off=5, blackout_imediato=True,
|
N_on=2, N_off=5, blackout_imediato=True,
|
||||||
|
|
||||||
det_score_f = det_score,
|
det_score_f = det_score,
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,14 @@ namespace AgroMonitor.Forms
|
||||||
|
|
||||||
// Verifica atualizações nos equipamentos conectados
|
// Verifica atualizações nos equipamentos conectados
|
||||||
VerificarAtualizacoesEquipamentos();
|
VerificarAtualizacoesEquipamentos();
|
||||||
|
|
||||||
|
int enderecoEquipamentoEmFoco = cmbEquipamento.SelectedIndex > -1 ? Convert.ToInt32(cmbEquipamento.Text) : Convert.ToInt32(LoRaBaseService.parametrosModel.address);
|
||||||
|
foreach (var eq in VariaveisMonitoramento.EquipamentosConectados)
|
||||||
|
{
|
||||||
|
int enderecoEquipamentoLog = Convert.ToInt32(eq.Key);
|
||||||
|
bool foco = enderecoEquipamentoEmFoco == enderecoEquipamentoLog && chbFoco.Checked;
|
||||||
|
GPSService.EnviarCoordenadasParaMapa(eq.Value.Coordenadas.Latitude, eq.Value.Coordenadas.Longitude, eq.Value.Coordenadas.Orientacao, foco, eq.Key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void VerificarAtualizacoesEquipamentos()
|
private void VerificarAtualizacoesEquipamentos()
|
||||||
|
|
@ -81,7 +89,7 @@ namespace AgroMonitor.Forms
|
||||||
if (!Logs.ContainsKey(key) || !EquipamentosIguais(VariaveisMonitoramento.EquipamentosConectadosLogs[key], Logs[key]))
|
if (!Logs.ContainsKey(key) || !EquipamentosIguais(VariaveisMonitoramento.EquipamentosConectadosLogs[key], Logs[key]))
|
||||||
{
|
{
|
||||||
// Se sim, consuma o último valor (último log)
|
// Se sim, consuma o último valor (último log)
|
||||||
ConsumirUltimoValor(VariaveisMonitoramento.EquipamentosConectadosLogs[key]);
|
//ConsumirUltimoValor(VariaveisMonitoramento.EquipamentosConectadosLogs[key]);
|
||||||
// Atualiza o estado anterior da lista EquipamentosConectados
|
// Atualiza o estado anterior da lista EquipamentosConectados
|
||||||
Logs[key] = new List<LoRaProtocoloTransmissaoModel>(VariaveisMonitoramento.EquipamentosConectadosLogs[key]);
|
Logs[key] = new List<LoRaProtocoloTransmissaoModel>(VariaveisMonitoramento.EquipamentosConectadosLogs[key]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,3 +43,16 @@
|
||||||
0:02:56 Tab4 PageLoad
|
0:02:56 Tab4 PageLoad
|
||||||
0:05:15 Memory Pressure: Critical
|
0:05:15 Memory Pressure: Critical
|
||||||
0:05:16 Microsoft.UnloadController.IsUnclosableApp_IsNotWebApp
|
0:05:16 Microsoft.UnloadController.IsUnclosableApp_IsNotWebApp
|
||||||
|
0:00:00 Startup
|
||||||
|
0:00:00 Microsoft.DeleteProfileHelper.CleanUpEphemeralProfiles
|
||||||
|
0:00:00 Microsoft.DeleteProfileHelper.CleanUpDeletedProfiles
|
||||||
|
0:00:00 Microsoft.NewBrowser_Popup
|
||||||
|
0:00:00 Microsoft.BrowserList.AddBrowser
|
||||||
|
0:00:00 Browser1 Insert active Tab1 at 0
|
||||||
|
0:00:00 Tab1 StartNav1 #auto_toplevel
|
||||||
|
0:00:00 Tab1 StartNav2 #typed
|
||||||
|
0:00:00 Tab1 FinishNav1
|
||||||
|
0:00:00 Tab1 PageLoad
|
||||||
|
0:00:00 Tab1 FinishNav2
|
||||||
|
0:00:00 Tab1 PageLoad
|
||||||
|
0:00:33 Microsoft.Shutdown.TabStripModel.SendDetachWebContentsNotifications
|
||||||
|
|
|
||||||
|
|
@ -15,5 +15,5 @@
|
||||||
"top_topics_and_observing_domains": [ ]
|
"top_topics_and_observing_domains": [ ]
|
||||||
} ],
|
} ],
|
||||||
"hex_encoded_hmac_key": "171DAE543B88106F5155169E0A8C7502CB2A0757E4948C32E2A04D196E23BE70",
|
"hex_encoded_hmac_key": "171DAE543B88106F5155169E0A8C7502CB2A0757E4948C32E2A04D196E23BE70",
|
||||||
"next_scheduled_calculation_time": "13403098310652891"
|
"next_scheduled_calculation_time": "13403098310652905"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 21 KiB |