Novas funções no novo operation control
This commit is contained in:
parent
d0e58be553
commit
c28d18257a
|
|
@ -547,6 +547,7 @@ namespace AgroBase.Models.Operacoes
|
|||
PercentualRuaAtual = t.PercentualRuaAtual,
|
||||
PontoAtualDistanciaAtual = t.PontoAtual.DistanciaAtual,
|
||||
PontoAtualIdx = t.PontoAtual.idxPonto,
|
||||
PontoAtualIdxCorredor = t.PontoAtual.idxCorredor,
|
||||
ProximoPontoAproximando = t.ProximoPonto.Aproximando,
|
||||
ProximoPontoDistanciaAtual = t.ProximoPonto.DistanciaAtual,
|
||||
ProximoPontoIdx = t.ProximoPonto.idxPonto,
|
||||
|
|
@ -825,6 +826,7 @@ namespace AgroBase.Models.Operacoes
|
|||
public bool ProximoPontoAproximando { get; set; }
|
||||
public double ProximoPontoDistanciaAtual { get; set; }
|
||||
public int PontoAtualIdx { get; set; }
|
||||
public int PontoAtualIdxCorredor { get; set; }
|
||||
public double PontoAtualDistanciaAtual { get; set; }
|
||||
public double DistanciaEsquerda { get; set; }
|
||||
public double DistanciaDireita { get; set; }
|
||||
|
|
@ -834,7 +836,7 @@ namespace AgroBase.Models.Operacoes
|
|||
public double DistanciaTotal { get; set; }
|
||||
public string TempoEstimadoOperacao { get; set; }
|
||||
public bool CorredorAtualDentro { get; set; }
|
||||
public double CorredorAtualIdx { get; set; }
|
||||
public int CorredorAtualIdx { get; set; }
|
||||
public double CorredorAtualDistanciaTotal { get; set; }
|
||||
public double CorredorAtualDistanciaPercorrida { get; set; }
|
||||
|
||||
|
|
@ -862,6 +864,7 @@ namespace AgroBase.Models.Operacoes
|
|||
PercentualRuaAtual = PercentualRuaAtual,
|
||||
PontoAtualDistanciaAtual = PontoAtualDistanciaAtual,
|
||||
PontoAtualIdx = PontoAtualIdx,
|
||||
PontoAtualIdxCorredor = PontoAtualIdxCorredor,
|
||||
ProximoPontoAproximando = ProximoPontoAproximando,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OperationControl.ViewModels.Base
|
||||
{
|
||||
public abstract class NotifyBase : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
protected bool SetProperty<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
|
||||
{
|
||||
if (EqualityComparer<T>.Default.Equals(field, value))
|
||||
return false;
|
||||
|
||||
field = value;
|
||||
OnPropertyChanged(propertyName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
using OperationControl.ViewModels.Base;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OperationControl.ViewModels.Views.Operacao.Diagnostico
|
||||
{
|
||||
public class DiagnosticoGraficoSerieViewModel : NotifyBase
|
||||
{
|
||||
private string _label;
|
||||
public string Label
|
||||
{
|
||||
get => _label;
|
||||
set => SetProperty(ref _label, value);
|
||||
}
|
||||
|
||||
private string _unidade;
|
||||
public string Unidade
|
||||
{
|
||||
get => _unidade;
|
||||
set => SetProperty(ref _unidade, value);
|
||||
}
|
||||
|
||||
public ObservableCollection<double> Valores { get; } = new();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
using OperationControl.ViewModels.Base;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using static AgroBase.Models.Enums;
|
||||
using Brush = System.Windows.Media.Brush;
|
||||
using Brushes = System.Windows.Media.Brushes;
|
||||
|
||||
namespace OperationControl.ViewModels.Views.Operacao.Diagnostico
|
||||
{
|
||||
public class DiagnosticoModuloItemViewModel : NotifyBase
|
||||
{
|
||||
private StatusModulo _status = StatusModulo.Desconectado;
|
||||
private bool _mandatorio;
|
||||
private bool _emUso;
|
||||
private bool _selecionado;
|
||||
private bool _iniciado;
|
||||
|
||||
private Brush _backgroundBrush = Brushes.Gray;
|
||||
private Brush _foregroundBrush = Brushes.White;
|
||||
private Brush _borderBrushColor = Brushes.Transparent;
|
||||
private Thickness _borderThicknessValue = new Thickness(1);
|
||||
|
||||
public string IdVisual { get; set; } = string.Empty;
|
||||
public T_Code Modulo { get; set; }
|
||||
public string LabelModulo { get; set; } = string.Empty;
|
||||
public S_Code SCode { get; set; }
|
||||
public string TextoBase { get; set; } = string.Empty;
|
||||
public double Left { get; set; }
|
||||
public double Top { get; set; }
|
||||
|
||||
public DiagnosticoModuloItemViewModel()
|
||||
{
|
||||
AtualizarVisual();
|
||||
}
|
||||
|
||||
public StatusModulo Status
|
||||
{
|
||||
get => _status;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _status, value))
|
||||
{
|
||||
AtualizarVisual();
|
||||
OnPropertyChanged(nameof(TextoExibicao));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Mandatorio
|
||||
{
|
||||
get => _mandatorio;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _mandatorio, value))
|
||||
{
|
||||
AtualizarVisual();
|
||||
OnPropertyChanged(nameof(TextoExibicao));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool EmUso
|
||||
{
|
||||
get => _emUso;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _emUso, value))
|
||||
{
|
||||
AtualizarVisual();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Selecionado
|
||||
{
|
||||
get => _selecionado;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _selecionado, value))
|
||||
{
|
||||
AtualizarVisual();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Iniciado
|
||||
{
|
||||
get => _iniciado;
|
||||
set => SetProperty(ref _iniciado, value);
|
||||
}
|
||||
|
||||
public Brush BackgroundBrush
|
||||
{
|
||||
get => _backgroundBrush;
|
||||
set => SetProperty(ref _backgroundBrush, value);
|
||||
}
|
||||
|
||||
public Brush ForegroundBrush
|
||||
{
|
||||
get => _foregroundBrush;
|
||||
set => SetProperty(ref _foregroundBrush, value);
|
||||
}
|
||||
|
||||
public Brush BorderBrushColor
|
||||
{
|
||||
get => _borderBrushColor;
|
||||
set => SetProperty(ref _borderBrushColor, value);
|
||||
}
|
||||
|
||||
public Thickness BorderThicknessValue
|
||||
{
|
||||
get => _borderThicknessValue;
|
||||
set => SetProperty(ref _borderThicknessValue, value);
|
||||
}
|
||||
|
||||
public string TextoExibicao => $"{(Mandatorio ? "🔒" : "🔓")} {TextoBase}";
|
||||
|
||||
public void AtualizarVisual()
|
||||
{
|
||||
ForegroundBrush = Brushes.White;
|
||||
|
||||
BackgroundBrush = Status switch
|
||||
{
|
||||
StatusModulo.Desconectado => EmUso ? Brushes.Red : Brushes.Gray,
|
||||
StatusModulo.Conectado => Brushes.SteelBlue,
|
||||
StatusModulo.Falha => Brushes.Red,
|
||||
StatusModulo.Alerta => Brushes.Orange,
|
||||
StatusModulo.Operante => Brushes.Green,
|
||||
_ => Brushes.DimGray
|
||||
};
|
||||
|
||||
BorderBrushColor = Selecionado ? Brushes.Gold : Brushes.Transparent;
|
||||
BorderThicknessValue = Selecionado ? new Thickness(2) : new Thickness(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,832 @@
|
|||
using AgroBase.Models.Operacoes;
|
||||
using OperationControl.Models;
|
||||
using OperationControl.ViewModels.Base;
|
||||
using System.Collections.ObjectModel;
|
||||
using static AgroBase.Models.Enums;
|
||||
using System.Windows.Input;
|
||||
using OperationControl.Helpers;
|
||||
using static AgroBase.Services.CoolerControlService;
|
||||
|
||||
namespace OperationControl.ViewModels.Views.Operacao.Diagnostico
|
||||
{
|
||||
public class DiagnosticoOpcoesViewModel : NotifyBase
|
||||
{
|
||||
private DiagnosticoModuloItemViewModel _itemAtual;
|
||||
private OperacaoParametrosModel _dadosAtual;
|
||||
|
||||
#region VISIBILIDADES
|
||||
|
||||
private bool _mostrarOpcoesSemDados = true;
|
||||
public bool MostrarOpcoesSemDados { get => _mostrarOpcoesSemDados; set => SetProperty(ref _mostrarOpcoesSemDados, value); }
|
||||
|
||||
private bool _mostrarOpcoesSensoriamento;
|
||||
public bool MostrarOpcoesSensoriamento { get => _mostrarOpcoesSensoriamento; set => SetProperty(ref _mostrarOpcoesSensoriamento, value); }
|
||||
|
||||
private bool _mostrarOpcoesAtuador;
|
||||
public bool MostrarOpcoesAtuador { get => _mostrarOpcoesAtuador; set => SetProperty(ref _mostrarOpcoesAtuador, value); }
|
||||
|
||||
private bool _mostrarOpcoesBico;
|
||||
public bool MostrarOpcoesBico { get => _mostrarOpcoesBico; set => SetProperty(ref _mostrarOpcoesBico, value); }
|
||||
|
||||
private bool _mostrarOpcoesBomba;
|
||||
public bool MostrarOpcoesBomba { get => _mostrarOpcoesBomba; set => SetProperty(ref _mostrarOpcoesBomba, value); }
|
||||
|
||||
private bool _mostrarOpcoesDirecional;
|
||||
public bool MostrarOpcoesDirecional { get => _mostrarOpcoesDirecional; set => SetProperty(ref _mostrarOpcoesDirecional, value); }
|
||||
|
||||
private bool _mostrarOpcoesGps;
|
||||
public bool MostrarOpcoesGps { get => _mostrarOpcoesGps; set => SetProperty(ref _mostrarOpcoesGps, value); }
|
||||
|
||||
private bool _mostrarOpcoesTrajetoria;
|
||||
public bool MostrarOpcoesTrajetoria { get => _mostrarOpcoesTrajetoria; set => SetProperty(ref _mostrarOpcoesTrajetoria, value); }
|
||||
|
||||
private bool _mostrarOpcoesRele;
|
||||
public bool MostrarOpcoesRele { get => _mostrarOpcoesRele; set => SetProperty(ref _mostrarOpcoesRele, value); }
|
||||
|
||||
private bool _mostrarOpcoesServo;
|
||||
public bool MostrarOpcoesServo { get => _mostrarOpcoesServo; set => SetProperty(ref _mostrarOpcoesServo, value); }
|
||||
|
||||
private bool _mostrarOpcoesNpc;
|
||||
public bool MostrarOpcoesNpc { get => _mostrarOpcoesNpc; set => SetProperty(ref _mostrarOpcoesNpc, value); }
|
||||
|
||||
#endregion
|
||||
|
||||
#region CAMPOS ATUADOR MOD
|
||||
|
||||
private double _barraAltura;
|
||||
public double BarraAltura { get => _barraAltura; set => SetProperty(ref _barraAltura, value); }
|
||||
|
||||
private string _barraAlturaTexto = "0 cm";
|
||||
public string BarraAlturaTexto { get => _barraAlturaTexto; set => SetProperty(ref _barraAlturaTexto, value); }
|
||||
|
||||
#endregion
|
||||
|
||||
#region BICO
|
||||
|
||||
private string _bicoTitulo = "Bico - Testes";
|
||||
public string BicoTitulo { get => _bicoTitulo; set => SetProperty(ref _bicoTitulo, value); }
|
||||
|
||||
private double _bicoAngulo;
|
||||
public double BicoAngulo
|
||||
{
|
||||
get => _bicoAngulo;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _bicoAngulo, value))
|
||||
BicoAnguloTexto = $"{Convert.ToInt32(value):00}°";
|
||||
}
|
||||
}
|
||||
|
||||
private string _bicoAnguloTexto = "00°";
|
||||
public string BicoAnguloTexto { get => _bicoAnguloTexto; set => SetProperty(ref _bicoAnguloTexto, value); }
|
||||
|
||||
private string _bicoAnguloAbertura = "0";
|
||||
public string BicoAnguloAbertura { get => _bicoAnguloAbertura; set => SetProperty(ref _bicoAnguloAbertura, value); }
|
||||
|
||||
private string _txtBicoComando = "—";
|
||||
public string TxtBicoComando { get => _txtBicoComando; set => SetProperty(ref _txtBicoComando, value); }
|
||||
|
||||
private string _txtBicoStatusReal = "—";
|
||||
public string TxtBicoStatusReal { get => _txtBicoStatusReal; set => SetProperty(ref _txtBicoStatusReal, value); }
|
||||
|
||||
private string _txtBicoTempoLigado = "00:00:00";
|
||||
public string TxtBicoTempoLigado { get => _txtBicoTempoLigado; set => SetProperty(ref _txtBicoTempoLigado, value); }
|
||||
|
||||
private string _txtBicoVazao = "0,0 mL/s";
|
||||
public string TxtBicoVazao { get => _txtBicoVazao; set => SetProperty(ref _txtBicoVazao, value); }
|
||||
|
||||
private string _txtBicoPressao = "0,0 psi";
|
||||
public string TxtBicoPressao { get => _txtBicoPressao; set => SetProperty(ref _txtBicoPressao, value); }
|
||||
|
||||
private string _txtBicoAtuacoes = "—";
|
||||
public string TxtBicoAtuacoes { get => _txtBicoAtuacoes; set => SetProperty(ref _txtBicoAtuacoes, value); }
|
||||
|
||||
#endregion
|
||||
|
||||
#region BOMBA
|
||||
|
||||
private string _bombaTitulo = "Bomba - Testes";
|
||||
public string BombaTitulo { get => _bombaTitulo; set => SetProperty(ref _bombaTitulo, value); }
|
||||
|
||||
private double _bombaPressaoAlvo;
|
||||
public double BombaPressaoAlvo
|
||||
{
|
||||
get => _bombaPressaoAlvo;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _bombaPressaoAlvo, value))
|
||||
BombaPressaoAlvoTexto = $"{value:0} psi";
|
||||
}
|
||||
}
|
||||
|
||||
private string _bombaPressaoAlvoTexto = "0 psi";
|
||||
public string BombaPressaoAlvoTexto { get => _bombaPressaoAlvoTexto; set => SetProperty(ref _bombaPressaoAlvoTexto, value); }
|
||||
|
||||
private string _txtBombaComando = "—";
|
||||
public string TxtBombaComando { get => _txtBombaComando; set => SetProperty(ref _txtBombaComando, value); }
|
||||
|
||||
private string _txtBombaStatusReal = "—";
|
||||
public string TxtBombaStatusReal { get => _txtBombaStatusReal; set => SetProperty(ref _txtBombaStatusReal, value); }
|
||||
|
||||
private string _txtBombaPressaoLinha = "0,0 psi";
|
||||
public string TxtBombaPressaoLinha { get => _txtBombaPressaoLinha; set => SetProperty(ref _txtBombaPressaoLinha, value); }
|
||||
|
||||
private string _txtBombaPotencia = "0 %";
|
||||
public string TxtBombaPotencia { get => _txtBombaPotencia; set => SetProperty(ref _txtBombaPotencia, value); }
|
||||
|
||||
#endregion
|
||||
|
||||
#region DIRECIONAL
|
||||
|
||||
public ObservableCollection<string> DirMovimentosDisponiveis { get; } = new();
|
||||
public ObservableCollection<string> DirDirecoesDisponiveis { get; } = new();
|
||||
|
||||
private string _dirMovimentoSelecionado;
|
||||
public string DirMovimentoSelecionado { get => _dirMovimentoSelecionado; set => SetProperty(ref _dirMovimentoSelecionado, value); }
|
||||
|
||||
private string _dirDirecaoSelecionada;
|
||||
public string DirDirecaoSelecionada { get => _dirDirecaoSelecionada; set => SetProperty(ref _dirDirecaoSelecionada, value); }
|
||||
|
||||
private double _dirAngulo;
|
||||
public double DirAngulo
|
||||
{
|
||||
get => _dirAngulo;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _dirAngulo, value))
|
||||
DirAnguloTexto = $"{Convert.ToInt32(value)}°";
|
||||
}
|
||||
}
|
||||
|
||||
private string _dirAnguloTexto = "0°";
|
||||
public string DirAnguloTexto { get => _dirAnguloTexto; set => SetProperty(ref _dirAnguloTexto, value); }
|
||||
|
||||
private string _dirTitulo = "Direcional - Testes";
|
||||
public string DirTitulo { get => _dirTitulo; set => SetProperty(ref _dirTitulo, value); }
|
||||
|
||||
private string _txtDirSentidoSP = "—";
|
||||
public string TxtDirSentidoSP { get => _txtDirSentidoSP; set => SetProperty(ref _txtDirSentidoSP, value); }
|
||||
|
||||
private string _txtDirSentido = "—";
|
||||
public string TxtDirSentido { get => _txtDirSentido; set => SetProperty(ref _txtDirSentido, value); }
|
||||
|
||||
private string _txtDirAnguloSP = "0°";
|
||||
public string TxtDirAnguloSP { get => _txtDirAnguloSP; set => SetProperty(ref _txtDirAnguloSP, value); }
|
||||
|
||||
private string _txtDirAngulo = "0°";
|
||||
public string TxtDirAngulo { get => _txtDirAngulo; set => SetProperty(ref _txtDirAngulo, value); }
|
||||
|
||||
#endregion
|
||||
|
||||
#region GPS
|
||||
|
||||
private double _gpsLeverArmLateral;
|
||||
public double GpsLeverArmLateral
|
||||
{
|
||||
get => _gpsLeverArmLateral;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _gpsLeverArmLateral, value))
|
||||
GpsLeverArmLateralTexto = $"{(value * 10.0):00} cm";
|
||||
}
|
||||
}
|
||||
|
||||
private string _gpsLeverArmLateralTexto = "00 cm";
|
||||
public string GpsLeverArmLateralTexto { get => _gpsLeverArmLateralTexto; set => SetProperty(ref _gpsLeverArmLateralTexto, value); }
|
||||
|
||||
private double _gpsLeverArmFrontal;
|
||||
public double GpsLeverArmFrontal
|
||||
{
|
||||
get => _gpsLeverArmFrontal;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _gpsLeverArmFrontal, value))
|
||||
GpsLeverArmFrontalTexto = $"{(value * 10.0):00} cm";
|
||||
}
|
||||
}
|
||||
|
||||
private string _gpsLeverArmFrontalTexto = "00 cm";
|
||||
public string GpsLeverArmFrontalTexto { get => _gpsLeverArmFrontalTexto; set => SetProperty(ref _gpsLeverArmFrontalTexto, value); }
|
||||
|
||||
private string _txtGpsCorrecao = "SemCorreção";
|
||||
public string TxtGpsCorrecao { get => _txtGpsCorrecao; set => SetProperty(ref _txtGpsCorrecao, value); }
|
||||
|
||||
private string _txtGpsIdade = "0";
|
||||
public string TxtGpsIdade { get => _txtGpsIdade; set => SetProperty(ref _txtGpsIdade, value); }
|
||||
|
||||
private string _txtGpsPrecisao = "0";
|
||||
public string TxtGpsPrecisao { get => _txtGpsPrecisao; set => SetProperty(ref _txtGpsPrecisao, value); }
|
||||
|
||||
private string _txtGpsNSatelites = "0";
|
||||
public string TxtGpsNSatelites { get => _txtGpsNSatelites; set => SetProperty(ref _txtGpsNSatelites, value); }
|
||||
|
||||
private string _txtGpsDistBase = "0";
|
||||
public string TxtGpsDistBase { get => _txtGpsDistBase; set => SetProperty(ref _txtGpsDistBase, value); }
|
||||
|
||||
private string _txtGpsOrientacao = "0";
|
||||
public string TxtGpsOrientacao { get => _txtGpsOrientacao; set => SetProperty(ref _txtGpsOrientacao, value); }
|
||||
|
||||
#endregion
|
||||
|
||||
#region TRAJETORIA
|
||||
|
||||
private bool _trajetoriaBatLiberada;
|
||||
public bool TrajetoriaBatLiberada { get => _trajetoriaBatLiberada; set => SetProperty(ref _trajetoriaBatLiberada, value); }
|
||||
|
||||
private bool _trajetoriaHerbLiberado;
|
||||
public bool TrajetoriaHerbLiberado { get => _trajetoriaHerbLiberado; set => SetProperty(ref _trajetoriaHerbLiberado, value); }
|
||||
|
||||
private bool _trajetoriaPodeConfirmar = true;
|
||||
public bool TrajetoriaPodeConfirmar { get => _trajetoriaPodeConfirmar; set => SetProperty(ref _trajetoriaPodeConfirmar, value); }
|
||||
|
||||
private string _txtTrajetoriaDistCorredor = "0,00 m";
|
||||
public string TxtTrajetoriaDistCorredor { get => _txtTrajetoriaDistCorredor; set => SetProperty(ref _txtTrajetoriaDistCorredor, value); }
|
||||
|
||||
private string _txtTrajetoriaDistBateria = "0,00 m";
|
||||
public string TxtTrajetoriaDistBateria { get => _txtTrajetoriaDistBateria; set => SetProperty(ref _txtTrajetoriaDistBateria, value); }
|
||||
|
||||
private string _txtTrajetoriaDistPulverizador = "0,00 m";
|
||||
public string TxtTrajetoriaDistPulverizador { get => _txtTrajetoriaDistPulverizador; set => SetProperty(ref _txtTrajetoriaDistPulverizador, value); }
|
||||
|
||||
private string _txtTrajetoriaStatus = "Desconhecido";
|
||||
public string TxtTrajetoriaStatus { get => _txtTrajetoriaStatus; set => SetProperty(ref _txtTrajetoriaStatus, value); }
|
||||
|
||||
private string _txtTrajetoriaBatOk = "Não";
|
||||
public string TxtTrajetoriaBatOk { get => _txtTrajetoriaBatOk; set => SetProperty(ref _txtTrajetoriaBatOk, value); }
|
||||
|
||||
private string _txtTrajetoriaHerbOk = "Não";
|
||||
public string TxtTrajetoriaHerbOk { get => _txtTrajetoriaHerbOk; set => SetProperty(ref _txtTrajetoriaHerbOk, value); }
|
||||
|
||||
#endregion
|
||||
|
||||
#region RELE
|
||||
|
||||
private string _releTitulo = "Relé - Testes";
|
||||
public string ReleTitulo { get => _releTitulo; set => SetProperty(ref _releTitulo, value); }
|
||||
|
||||
private string _txtReleComando = "—";
|
||||
public string TxtReleComando { get => _txtReleComando; set => SetProperty(ref _txtReleComando, value); }
|
||||
|
||||
private string _txtReleStatusReal = "—";
|
||||
public string TxtReleStatusReal { get => _txtReleStatusReal; set => SetProperty(ref _txtReleStatusReal, value); }
|
||||
|
||||
#endregion
|
||||
|
||||
#region SERVO
|
||||
|
||||
private double _servoAngulo;
|
||||
public double ServoAngulo
|
||||
{
|
||||
get => _servoAngulo;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _servoAngulo, value))
|
||||
ServoAnguloTexto = $"{Convert.ToInt32(value):0}°";
|
||||
}
|
||||
}
|
||||
|
||||
private string _servoAnguloTexto = "0°";
|
||||
public string ServoAnguloTexto { get => _servoAnguloTexto; set => SetProperty(ref _servoAnguloTexto, value); }
|
||||
|
||||
private string _txtServoComando = "—";
|
||||
public string TxtServoComando { get => _txtServoComando; set => SetProperty(ref _txtServoComando, value); }
|
||||
|
||||
private string _txtServoLeitura = "—";
|
||||
public string TxtServoLeitura { get => _txtServoLeitura; set => SetProperty(ref _txtServoLeitura, value); }
|
||||
|
||||
private string _txtServoIncremental = "—";
|
||||
public string TxtServoIncremental { get => _txtServoIncremental; set => SetProperty(ref _txtServoIncremental, value); }
|
||||
|
||||
#endregion
|
||||
|
||||
#region NPC
|
||||
|
||||
public ObservableCollection<CoolerMode> NpcCoolerModosDisponiveis { get; } = new();
|
||||
private bool _npcCoolerEntradaHabilitado;
|
||||
public bool NpcCoolerEntradaHabilitado
|
||||
{
|
||||
get => _npcCoolerEntradaHabilitado;
|
||||
set => SetProperty(ref _npcCoolerEntradaHabilitado, value);
|
||||
}
|
||||
|
||||
private bool _npcCoolerSaidaHabilitado;
|
||||
public bool NpcCoolerSaidaHabilitado
|
||||
{
|
||||
get => _npcCoolerSaidaHabilitado;
|
||||
set => SetProperty(ref _npcCoolerSaidaHabilitado, value);
|
||||
}
|
||||
|
||||
private CoolerMode _npcCoolerModoSelecionado;
|
||||
public CoolerMode NpcCoolerModoSelecionado
|
||||
{
|
||||
get => _npcCoolerModoSelecionado;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _npcCoolerModoSelecionado, value))
|
||||
{
|
||||
AtualizarEstadoCoolerModo();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void AtualizarEstadoCoolerModo()
|
||||
{
|
||||
switch (NpcCoolerModoSelecionado)
|
||||
{
|
||||
case CoolerMode.Off:
|
||||
NpcCoolerEntradaHabilitado = false;
|
||||
NpcCoolerSaidaHabilitado = false;
|
||||
NpcCoolerEntrada = false;
|
||||
NpcCoolerSaida = false;
|
||||
break;
|
||||
|
||||
case CoolerMode.Manual:
|
||||
NpcCoolerEntradaHabilitado = true;
|
||||
NpcCoolerSaidaHabilitado = true;
|
||||
NpcCoolerEntrada = false;
|
||||
NpcCoolerSaida = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
NpcCoolerEntradaHabilitado = false;
|
||||
NpcCoolerSaidaHabilitado = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _npcCoolerEntrada;
|
||||
public bool NpcCoolerEntrada { get => _npcCoolerEntrada; set => SetProperty(ref _npcCoolerEntrada, value); }
|
||||
|
||||
private bool _npcCoolerSaida;
|
||||
public bool NpcCoolerSaida { get => _npcCoolerSaida; set => SetProperty(ref _npcCoolerSaida, value); }
|
||||
|
||||
private string _npcCoolerTempOn = "0";
|
||||
public string NpcCoolerTempOn { get => _npcCoolerTempOn; set => SetProperty(ref _npcCoolerTempOn, value); }
|
||||
|
||||
private string _npcCoolerTempTurbo = "0";
|
||||
public string NpcCoolerTempTurbo { get => _npcCoolerTempTurbo; set => SetProperty(ref _npcCoolerTempTurbo, value); }
|
||||
|
||||
private string _txtNpcCoolerModo = "—";
|
||||
public string TxtNpcCoolerModo { get => _txtNpcCoolerModo; set => SetProperty(ref _txtNpcCoolerModo, value); }
|
||||
|
||||
private string _txtNpcCoolerTemperatura = "—";
|
||||
public string TxtNpcCoolerTemperatura { get => _txtNpcCoolerTemperatura; set => SetProperty(ref _txtNpcCoolerTemperatura, value); }
|
||||
|
||||
private string _txtNpcCoolerEntrada = "—";
|
||||
public string TxtNpcCoolerEntrada { get => _txtNpcCoolerEntrada; set => SetProperty(ref _txtNpcCoolerEntrada, value); }
|
||||
|
||||
private string _txtNpcCoolerSaida = "—";
|
||||
public string TxtNpcCoolerSaida { get => _txtNpcCoolerSaida; set => SetProperty(ref _txtNpcCoolerSaida, value); }
|
||||
|
||||
#endregion
|
||||
|
||||
#region COMMANDS
|
||||
|
||||
public ICommand SensoriamentoReiniciarCommand { get; }
|
||||
public ICommand AtuadorReiniciarCommand { get; }
|
||||
public ICommand BarraMoverCommand { get; }
|
||||
|
||||
public ICommand BicoLigarCommand { get; }
|
||||
public ICommand BicoDesligarCommand { get; }
|
||||
public ICommand BicoMoverCommand { get; }
|
||||
public ICommand BicoSalvarAnguloAberturaCommand { get; }
|
||||
|
||||
public ICommand BombaLigarCommand { get; }
|
||||
public ICommand BombaDesligarCommand { get; }
|
||||
|
||||
public ICommand DirReferenciarCommand { get; }
|
||||
public ICommand DirMovimentarCommand { get; }
|
||||
|
||||
public ICommand GpsSalvarCommand { get; }
|
||||
public ICommand TrajetoriaConfirmarCommand { get; }
|
||||
|
||||
public ICommand ReleLigarCommand { get; }
|
||||
public ICommand ReleDesligarCommand { get; }
|
||||
|
||||
public ICommand ServoEnviarCommand { get; }
|
||||
public ICommand NpcCoolerEnviarCommand { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
public DiagnosticoOpcoesViewModel()
|
||||
{
|
||||
foreach (var nome in Enum.GetNames(typeof(TipoMovimentoDirecional)))
|
||||
DirMovimentosDisponiveis.Add(nome);
|
||||
|
||||
foreach (var nome in Enum.GetNames(typeof(Direcao)))
|
||||
DirDirecoesDisponiveis.Add(nome);
|
||||
|
||||
foreach (var modo in Enum.GetValues<CoolerMode>())
|
||||
NpcCoolerModosDisponiveis.Add(modo);
|
||||
|
||||
SensoriamentoReiniciarCommand = new RelayCommand(_ => SensoriamentoReiniciar());
|
||||
AtuadorReiniciarCommand = new RelayCommand(_ => AtuadorReiniciar());
|
||||
BarraMoverCommand = new RelayCommand(_ => BarraMover());
|
||||
|
||||
BicoLigarCommand = new RelayCommand(_ => BicoLigar());
|
||||
BicoDesligarCommand = new RelayCommand(_ => BicoDesligar());
|
||||
BicoMoverCommand = new RelayCommand(_ => BicoMover());
|
||||
BicoSalvarAnguloAberturaCommand = new RelayCommand(_ => BicoSalvarAnguloAbertura());
|
||||
|
||||
BombaLigarCommand = new RelayCommand(_ => BombaLigar());
|
||||
BombaDesligarCommand = new RelayCommand(_ => BombaDesligar());
|
||||
|
||||
DirReferenciarCommand = new RelayCommand(_ => DirReferenciar());
|
||||
DirMovimentarCommand = new RelayCommand(_ => DirMovimentar());
|
||||
|
||||
GpsSalvarCommand = new RelayCommand(_ => GpsSalvar());
|
||||
TrajetoriaConfirmarCommand = new RelayCommand(_ => TrajetoriaConfirmar());
|
||||
|
||||
ReleLigarCommand = new RelayCommand(_ => ReleLigar());
|
||||
ReleDesligarCommand = new RelayCommand(_ => ReleDesligar());
|
||||
|
||||
ServoEnviarCommand = new RelayCommand(_ => ServoEnviar());
|
||||
NpcCoolerEnviarCommand = new RelayCommand(_ => NpcCoolerEnviar());
|
||||
}
|
||||
|
||||
public void Atualizar(DiagnosticoModuloItemViewModel item, OperacaoParametrosModel dados)
|
||||
{
|
||||
_itemAtual = item;
|
||||
_dadosAtual = dados;
|
||||
|
||||
ResetarVisibilidades();
|
||||
ResetarCampos();
|
||||
|
||||
if (_itemAtual == null || _dadosAtual?.DadosLeitura == null)
|
||||
{
|
||||
MostrarOpcoesSemDados = true;
|
||||
return;
|
||||
}
|
||||
|
||||
var rover = _dadosAtual.DadosLeitura;
|
||||
|
||||
switch (_itemAtual.Modulo)
|
||||
{
|
||||
case T_Code.Atu:
|
||||
switch (_itemAtual.SCode)
|
||||
{
|
||||
case S_Code.sMOD:
|
||||
MostrarOpcoesAtuador = true;
|
||||
BarraAltura = rover.Controle?.AlturaBarra ?? 0;
|
||||
break;
|
||||
|
||||
case S_Code.sBIC:
|
||||
MostrarOpcoesBico = true;
|
||||
PreencherBico(rover);
|
||||
break;
|
||||
|
||||
case S_Code.sBMB:
|
||||
MostrarOpcoesBomba = true;
|
||||
PreencherBomba(rover);
|
||||
break;
|
||||
|
||||
case S_Code.sSRV:
|
||||
MostrarOpcoesServo = true;
|
||||
PreencherServoAtuador(rover);
|
||||
break;
|
||||
|
||||
default:
|
||||
MostrarOpcoesSemDados = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case T_Code.Sen:
|
||||
switch (_itemAtual.SCode)
|
||||
{
|
||||
case S_Code.sMOD:
|
||||
MostrarOpcoesSensoriamento = true;
|
||||
break;
|
||||
|
||||
case S_Code.sRLE:
|
||||
MostrarOpcoesRele = true;
|
||||
PreencherRele(rover);
|
||||
break;
|
||||
|
||||
case S_Code.sSRV:
|
||||
MostrarOpcoesServo = true;
|
||||
PreencherServoSensoriamento(rover);
|
||||
break;
|
||||
|
||||
default:
|
||||
MostrarOpcoesSemDados = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case T_Code.Dir:
|
||||
MostrarOpcoesDirecional = true;
|
||||
PreencherDirecional(rover);
|
||||
break;
|
||||
|
||||
case T_Code.Gps:
|
||||
MostrarOpcoesGps = true;
|
||||
PreencherGps(rover);
|
||||
break;
|
||||
|
||||
case T_Code.Trj:
|
||||
MostrarOpcoesTrajetoria = true;
|
||||
PreencherTrajetoria(rover);
|
||||
break;
|
||||
|
||||
case T_Code.Npc:
|
||||
MostrarOpcoesNpc = true;
|
||||
PreencherNpc(rover);
|
||||
break;
|
||||
|
||||
default:
|
||||
MostrarOpcoesSemDados = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#region PREENCHIMENTO
|
||||
|
||||
private void PreencherBico(OperacaoParametrosDadosModel rover)
|
||||
{
|
||||
var bico = rover?.Atuador?.Bicos?.FirstOrDefault(x => x.ID == _itemAtual.LabelModulo);
|
||||
BicoTitulo = $"Bico {_itemAtual.LabelModulo} - Testes";
|
||||
TxtBicoComando = (bico?.ComandoEstado ?? false) ? "Ligado" : "Desligado";
|
||||
TxtBicoStatusReal = (bico?.LeituraEstado ?? false) ? "Ligado" : "Desligado";
|
||||
TxtBicoTempoLigado = $"{bico?.TempoAtuado ?? 0:0.##} ms";
|
||||
TxtBicoVazao = $"{bico?.VazaoInstantaneaMLs ?? 0:0.##} mL/s";
|
||||
TxtBicoPressao = $"{rover?.Atuador?.PressaoLinhaPsi ?? 0:0.##} psi";
|
||||
TxtBicoAtuacoes = $"{bico?.QtdAtuacoes ?? 0}";
|
||||
BicoAngulo = bico?.ComandoAngulo ?? 0;
|
||||
BicoAnguloAbertura = (bico?.AnguloAbertura ?? 0).ToString();
|
||||
}
|
||||
|
||||
private void PreencherBomba(OperacaoParametrosDadosModel rover)
|
||||
{
|
||||
var bomba = rover?.Atuador?.Bombas?.FirstOrDefault(x => x.ID == _itemAtual.LabelModulo);
|
||||
BombaTitulo = $"Bomba {_itemAtual.LabelModulo} - Testes";
|
||||
TxtBombaComando = (bomba?.ComandoEstado ?? false) ? "Ligado" : "Desligado";
|
||||
TxtBombaStatusReal = (bomba?.LeituraEstado ?? false) ? "Ligado" : "Desligado";
|
||||
TxtBombaPressaoLinha = $"{rover?.Atuador?.PressaoLinhaPsi ?? 0:0.##} psi";
|
||||
TxtBombaPotencia = $"{bomba?.Potencia ?? 0:0.#} %";
|
||||
BombaPressaoAlvo = bomba?.Potencia ?? 0;
|
||||
}
|
||||
|
||||
private void PreencherDirecional(OperacaoParametrosDadosModel rover)
|
||||
{
|
||||
var mod = rover?.Direcional?.Modulos?.FirstOrDefault(x => x.Mod_ID == _itemAtual.LabelModulo);
|
||||
DirTitulo = $"Direcional {_itemAtual.LabelModulo} - Testes";
|
||||
TxtDirSentidoSP = $"{mod?.Sentido_SP ?? Sentido.Parado}";
|
||||
TxtDirSentido = $"{mod?.SentidoReal ?? Sentido.Parado}";
|
||||
TxtDirAnguloSP = $"{mod?.Angulo_SP ?? 0:0.00}°";
|
||||
TxtDirAngulo = $"{mod?.AnguloDriver ?? 0:0.00}°";
|
||||
DirAngulo = mod?.Angulo_SP ?? 0;
|
||||
}
|
||||
|
||||
private void PreencherGps(OperacaoParametrosDadosModel rover)
|
||||
{
|
||||
var dados = rover?.Gnss;
|
||||
GpsLeverArmLateral = (dados?.LeverArmLateral ?? 0) / 10.0;
|
||||
GpsLeverArmFrontal = (dados?.LeverArmFrontal ?? 0) / 10.0;
|
||||
TxtGpsCorrecao = $"{dados?.QualidadeFix ?? TiposCorrecaoGPS.SemCorrecao}";
|
||||
TxtGpsIdade = $"{dados?.IdadeCorrecao ?? -1}";
|
||||
TxtGpsPrecisao = $"{dados?.PrecisaoCm ?? -1}";
|
||||
TxtGpsNSatelites = $"{dados?.NumeroSatelites ?? 0}";
|
||||
TxtGpsDistBase = "0";
|
||||
TxtGpsOrientacao = $"{dados?.OrientacaoReal ?? 0}";
|
||||
}
|
||||
|
||||
private void PreencherTrajetoria(OperacaoParametrosDadosModel rover)
|
||||
{
|
||||
var dados = rover?.Trajetoria?.AutonomiaCorredor;
|
||||
TxtTrajetoriaDistCorredor = $"{dados?.DistanciaCorredor_m ?? 0:0.00} m";
|
||||
TxtTrajetoriaDistBateria = $"{dados?.DistanciaSeguraBateria_m ?? 0:0.00} m";
|
||||
TxtTrajetoriaDistPulverizador = $"{dados?.DistanciaSeguraHerbicida_m ?? 0:0.00} m";
|
||||
TxtTrajetoriaStatus = $"{dados?.Status ?? AgroBase.Models.AutonomiaCorredorStatus.Desconhecido}";
|
||||
TxtTrajetoriaBatOk = (dados?.BateriaSuficiente ?? false) ? "Sim" : "Não";
|
||||
TxtTrajetoriaHerbOk = (dados?.HerbicidaSuficiente ?? false) ? "Sim" : "Não";
|
||||
TrajetoriaPodeConfirmar = !(dados?.Liberado ?? false);
|
||||
TrajetoriaBatLiberada = true; // dados?.BateriaSuficiente ?? false;
|
||||
TrajetoriaHerbLiberado = true; // dados?.HerbicidaSuficiente ?? false;
|
||||
}
|
||||
|
||||
private void PreencherRele(OperacaoParametrosDadosModel rover)
|
||||
{
|
||||
var rele = rover?.Sensoriamento?.Reles?.FirstOrDefault(x => x.ID == _itemAtual.LabelModulo);
|
||||
ReleTitulo = $"Relé {_itemAtual.LabelModulo} - Testes";
|
||||
TxtReleComando = (rele?.ComandoEstado ?? false) ? "Ligado" : "Desligado";
|
||||
TxtReleStatusReal = (rele?.LeituraEstado ?? false) ? "Ligado" : "Desligado";
|
||||
}
|
||||
|
||||
private void PreencherServoSensoriamento(OperacaoParametrosDadosModel rover)
|
||||
{
|
||||
var servo = rover?.Sensoriamento?.Servos?.FirstOrDefault(x => x.ID == _itemAtual.LabelModulo);
|
||||
TxtServoComando = $"{servo?.ComandoAngulo ?? 0}°";
|
||||
TxtServoLeitura = $"{servo?.LeituraAngulo ?? 0}°";
|
||||
TxtServoIncremental = (servo?.Incremental ?? false) ? "Incremental" : "Decremental";
|
||||
ServoAngulo = servo?.ComandoAngulo ?? 0;
|
||||
}
|
||||
|
||||
private void PreencherServoAtuador(OperacaoParametrosDadosModel rover)
|
||||
{
|
||||
var servo = rover?.Atuador?.Servos?.FirstOrDefault(x => x.ID == _itemAtual.LabelModulo);
|
||||
TxtServoComando = $"{servo?.ComandoAngulo ?? 0}°";
|
||||
TxtServoLeitura = $"{servo?.LeituraAngulo ?? 0}°";
|
||||
TxtServoIncremental = (servo?.Incremental ?? false) ? "Incremental" : "Decremental";
|
||||
ServoAngulo = servo?.ComandoAngulo ?? 0;
|
||||
}
|
||||
|
||||
private void PreencherNpc(OperacaoParametrosDadosModel rover)
|
||||
{
|
||||
var dados = rover?.Refrigeracao;
|
||||
TxtNpcCoolerModo = $"{dados?.Modo}";
|
||||
TxtNpcCoolerTemperatura = $"{dados?.Temperatura ?? 0:0.00} °C";
|
||||
TxtNpcCoolerEntrada = $"{dados?.EstadoEntrada} ({dados?.LeituraEntrada})";
|
||||
TxtNpcCoolerSaida = $"{dados?.EstadoSaida} ({dados?.LeituraSaida})";
|
||||
|
||||
NpcCoolerModoSelecionado = dados?.Modo ?? CoolerMode.Off;
|
||||
NpcCoolerEntrada = (dados?.EstadoEntrada ?? Estado.Desligado) == Estado.Ligado;
|
||||
NpcCoolerSaida = (dados?.EstadoSaida ?? Estado.Desligado) == Estado.Ligado;
|
||||
NpcCoolerTempOn = $"{dados?.TemperaturaLigar ?? 0}";
|
||||
NpcCoolerTempTurbo = $"{dados?.TemperaturaTurbo ?? 0}";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RESET
|
||||
|
||||
private void ResetarVisibilidades()
|
||||
{
|
||||
MostrarOpcoesSemDados = false;
|
||||
MostrarOpcoesSensoriamento = false;
|
||||
MostrarOpcoesAtuador = false;
|
||||
MostrarOpcoesBico = false;
|
||||
MostrarOpcoesBomba = false;
|
||||
MostrarOpcoesDirecional = false;
|
||||
MostrarOpcoesGps = false;
|
||||
MostrarOpcoesTrajetoria = false;
|
||||
MostrarOpcoesRele = false;
|
||||
MostrarOpcoesServo = false;
|
||||
MostrarOpcoesNpc = false;
|
||||
}
|
||||
|
||||
private void ResetarCampos()
|
||||
{
|
||||
BarraAltura = 0;
|
||||
BicoAngulo = 0;
|
||||
BicoAnguloAbertura = "0";
|
||||
BombaPressaoAlvo = 0;
|
||||
DirAngulo = 0;
|
||||
GpsLeverArmLateral = 0;
|
||||
GpsLeverArmFrontal = 0;
|
||||
TrajetoriaBatLiberada = false;
|
||||
TrajetoriaHerbLiberado = false;
|
||||
ServoAngulo = 0;
|
||||
NpcCoolerEntrada = false;
|
||||
NpcCoolerSaida = false;
|
||||
NpcCoolerTempOn = "0";
|
||||
NpcCoolerTempTurbo = "0";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region COMMAND ACTIONS
|
||||
|
||||
private void SensoriamentoReiniciar()
|
||||
{
|
||||
if (_itemAtual?.Modulo != T_Code.Sen) return;
|
||||
VariaveisControleOperacao.EnviarComandoSensoriamento(_itemAtual.LabelModulo, true);
|
||||
}
|
||||
|
||||
private void AtuadorReiniciar()
|
||||
{
|
||||
if (_itemAtual?.Modulo != T_Code.Atu) return;
|
||||
VariaveisControleOperacao.EnviarComandoAtuador(_itemAtual.LabelModulo, true);
|
||||
}
|
||||
|
||||
private void BarraMover()
|
||||
{
|
||||
if (_itemAtual?.Modulo != T_Code.Atu) return;
|
||||
VariaveisControleOperacao.EnviarComandoAtuador(_itemAtual.LabelModulo, altura: Convert.ToInt32(BarraAltura));
|
||||
}
|
||||
|
||||
private void BicoLigar()
|
||||
{
|
||||
if (_itemAtual?.Modulo != T_Code.Atu || _itemAtual.SCode != S_Code.sBIC) return;
|
||||
VariaveisControleOperacao.EnviarComandoAtuador(_itemAtual.LabelModulo, status: true);
|
||||
}
|
||||
|
||||
private void BicoDesligar()
|
||||
{
|
||||
if (_itemAtual?.Modulo != T_Code.Atu || _itemAtual.SCode != S_Code.sBIC) return;
|
||||
VariaveisControleOperacao.EnviarComandoAtuador(_itemAtual.LabelModulo, status: false);
|
||||
}
|
||||
|
||||
private void BicoMover()
|
||||
{
|
||||
if (_itemAtual?.Modulo != T_Code.Atu || _itemAtual.SCode != S_Code.sBIC) return;
|
||||
VariaveisControleOperacao.EnviarComandoAtuador(_itemAtual.LabelModulo, angulo_controle: Convert.ToInt32(BicoAngulo));
|
||||
}
|
||||
|
||||
private void BicoSalvarAnguloAbertura()
|
||||
{
|
||||
if (_itemAtual?.Modulo != T_Code.Atu || _itemAtual.SCode != S_Code.sBIC) return;
|
||||
if (!int.TryParse(BicoAnguloAbertura, out int ang)) return;
|
||||
VariaveisControleOperacao.EnviarComandoAtuador(_itemAtual.LabelModulo, angulo_abertura: ang);
|
||||
}
|
||||
|
||||
private void BombaLigar()
|
||||
{
|
||||
if (_itemAtual?.Modulo != T_Code.Atu || _itemAtual.SCode != S_Code.sBMB) return;
|
||||
VariaveisControleOperacao.EnviarComandoAtuador(_itemAtual.LabelModulo, status: true);
|
||||
}
|
||||
|
||||
private void BombaDesligar()
|
||||
{
|
||||
if (_itemAtual?.Modulo != T_Code.Atu || _itemAtual.SCode != S_Code.sBMB) return;
|
||||
VariaveisControleOperacao.EnviarComandoAtuador(_itemAtual.LabelModulo, status: false);
|
||||
}
|
||||
|
||||
private void DirReferenciar()
|
||||
{
|
||||
if (_itemAtual?.Modulo != T_Code.Dir) return;
|
||||
VariaveisControleOperacao.EnviarComandoReferenciamento(mod_id: _itemAtual.LabelModulo);
|
||||
}
|
||||
|
||||
private void DirMovimentar()
|
||||
{
|
||||
if (_itemAtual?.Modulo != T_Code.Dir) return;
|
||||
if (string.IsNullOrWhiteSpace(DirMovimentoSelecionado) || string.IsNullOrWhiteSpace(DirDirecaoSelecionada)) return;
|
||||
|
||||
var tipo = (TipoMovimentoDirecional)Enum.Parse(typeof(TipoMovimentoDirecional), DirMovimentoSelecionado);
|
||||
var direcao = (Direcao)Enum.Parse(typeof(Direcao), DirDirecaoSelecionada);
|
||||
VariaveisControleOperacao.EnviarComandoDirecional(direcao, Convert.ToInt32(DirAngulo), tipo, mod_id: _itemAtual.LabelModulo);
|
||||
}
|
||||
|
||||
private void GpsSalvar()
|
||||
{
|
||||
VariaveisControleOperacao.EnviarComandoLeverArm(
|
||||
lateral: GpsLeverArmLateral * 10.0,
|
||||
frontal: GpsLeverArmFrontal * 10.0);
|
||||
}
|
||||
|
||||
private void TrajetoriaConfirmar()
|
||||
{
|
||||
if (_itemAtual?.Modulo != T_Code.Trj) return;
|
||||
|
||||
var trj = VariaveisControleOperacao.RoverEmFoco?.DadosLeitura?.Trajetoria;
|
||||
int idxCorredor = trj?.PontoAtualIdxCorredor ?? 0;
|
||||
VariaveisControleOperacao.EnviarConfirmacaoHumanaTrajetoria(
|
||||
idxCorredor,
|
||||
TrajetoriaBatLiberada,
|
||||
TrajetoriaHerbLiberado);
|
||||
}
|
||||
|
||||
private void ReleLigar()
|
||||
{
|
||||
if (_itemAtual?.Modulo != T_Code.Sen || _itemAtual.SCode != S_Code.sRLE) return;
|
||||
VariaveisControleOperacao.EnviarComandoSensoriamento(_itemAtual.LabelModulo, status: Estado.Ligado);
|
||||
}
|
||||
|
||||
private void ReleDesligar()
|
||||
{
|
||||
if (_itemAtual?.Modulo != T_Code.Sen || _itemAtual.SCode != S_Code.sRLE) return;
|
||||
VariaveisControleOperacao.EnviarComandoSensoriamento(_itemAtual.LabelModulo, status: Estado.Desligado);
|
||||
}
|
||||
|
||||
private void ServoEnviar()
|
||||
{
|
||||
if (_itemAtual == null || _itemAtual.SCode != S_Code.sSRV) return;
|
||||
|
||||
double angulo = Convert.ToInt32(ServoAngulo);
|
||||
|
||||
if (_itemAtual.Modulo == T_Code.Sen)
|
||||
{
|
||||
var servo = VariaveisControleOperacao.RoverEmFoco?.DadosLeitura?.Sensoriamento?.Servos?.FirstOrDefault(x => x.ID == _itemAtual.LabelModulo);
|
||||
if (!(servo?.Incremental ?? false)) angulo = 180 - angulo;
|
||||
VariaveisControleOperacao.EnviarComandoSensoriamento(_itemAtual.LabelModulo, status: angulo);
|
||||
}
|
||||
else if (_itemAtual.Modulo == T_Code.Atu)
|
||||
{
|
||||
var servo = VariaveisControleOperacao.RoverEmFoco?.DadosLeitura?.Atuador?.Servos?.FirstOrDefault(x => x.ID == _itemAtual.LabelModulo);
|
||||
if (!(servo?.Incremental ?? false)) angulo = 180 - angulo;
|
||||
VariaveisControleOperacao.EnviarComandoAtuador(_itemAtual.LabelModulo, angulo_controle: (int)angulo);
|
||||
}
|
||||
}
|
||||
|
||||
private void NpcCoolerEnviar()
|
||||
{
|
||||
if (_itemAtual?.Modulo != T_Code.Npc) return;
|
||||
|
||||
var modo = NpcCoolerModoSelecionado;
|
||||
var entrada = NpcCoolerEntrada ? Estado.Ligado : Estado.Desligado;
|
||||
var saida = NpcCoolerSaida ? Estado.Ligado : Estado.Desligado;
|
||||
|
||||
double.TryParse(NpcCoolerTempOn, out double tempOn);
|
||||
double.TryParse(NpcCoolerTempTurbo, out double tempTurbo);
|
||||
|
||||
VariaveisControleOperacao.EnviarComandoCoolerControl(
|
||||
modo,
|
||||
entrada: entrada,
|
||||
saida: saida,
|
||||
temp_on: tempOn,
|
||||
temp_turbo: tempTurbo);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,754 @@
|
|||
using OperationControl.ViewModels.Base;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Input;
|
||||
using OperationControl.Helpers;
|
||||
using static AgroBase.Models.Enums;
|
||||
using AgroBase.Models.Operacoes;
|
||||
using OperationControl.Models;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace OperationControl.ViewModels.Views.Operacao.Diagnostico
|
||||
{
|
||||
public class DiagnosticoViewModel : NotifyBase
|
||||
{
|
||||
public ObservableCollection<DiagnosticoModuloItemViewModel> DiagnosticoModulos { get; set; } = new ObservableCollection<DiagnosticoModuloItemViewModel>();
|
||||
public DiagnosticoOpcoesViewModel OpcoesVM { get; } = new DiagnosticoOpcoesViewModel();
|
||||
public ObservableCollection<DiagnosticoGraficoSerieViewModel> SeriesGrafico { get; } = new ObservableCollection<DiagnosticoGraficoSerieViewModel>();
|
||||
public ObservableCollection<string> LabelsGrafico { get; } = new ObservableCollection<string>();
|
||||
private string _ultimoIdGrafico = "";
|
||||
|
||||
|
||||
private DiagnosticoModuloItemViewModel _moduloSelecionado;
|
||||
public DiagnosticoModuloItemViewModel ModuloSelecionado
|
||||
{
|
||||
get => _moduloSelecionado;
|
||||
set
|
||||
{
|
||||
if (_moduloSelecionado == value)
|
||||
return;
|
||||
|
||||
if (_moduloSelecionado != null)
|
||||
_moduloSelecionado.Selecionado = false;
|
||||
|
||||
_moduloSelecionado = value;
|
||||
|
||||
if (_moduloSelecionado != null)
|
||||
_moduloSelecionado.Selecionado = true;
|
||||
|
||||
OnPropertyChanged();
|
||||
AtualizarResumoModuloSelecionado();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand SelecionarModuloCommand { get; }
|
||||
public ICommand SalvarSaudeCommand { get; }
|
||||
|
||||
|
||||
public DiagnosticoViewModel()
|
||||
{
|
||||
SelecionarModuloCommand = new RelayCommand(SelecionarModulo);
|
||||
SalvarSaudeCommand = new RelayCommand(SalvarSaudeModulo);
|
||||
InicializarModulos();
|
||||
}
|
||||
|
||||
private void InicializarModulos()
|
||||
{
|
||||
DiagnosticoModulos.Clear();
|
||||
|
||||
// =============================
|
||||
// BARRAMENTO DE TENSÕES
|
||||
// =============================
|
||||
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "BAT", Modulo = T_Code.Bat, LabelModulo = "", SCode = S_Code.sVZO, TextoBase = "BAT", Left = 70, Top = 70 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_AB3V", Modulo = T_Code.Sen, LabelModulo = "AB3V", SCode = S_Code.sCOR, TextoBase = "B3V3", Left = 145, Top = 70 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_AB5V", Modulo = T_Code.Sen, LabelModulo = "AB5V", SCode = S_Code.sCOR, TextoBase = "B5V0", Left = 220, Top = 70 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_AB7V2", Modulo = T_Code.Sen, LabelModulo = "AB7V2", SCode = S_Code.sCOR, TextoBase = "B7V2", Left = 295, Top = 70 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_AB12V", Modulo = T_Code.Sen, LabelModulo = "AB12V", SCode = S_Code.sCOR, TextoBase = "B12V", Left = 370, Top = 70 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_AB19V", Modulo = T_Code.Sen, LabelModulo = "AB19V", SCode = S_Code.sCOR, TextoBase = "B19V", Left = 445, Top = 70 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_AB24V", Modulo = T_Code.Sen, LabelModulo = "AB24V", SCode = S_Code.sCOR, TextoBase = "B24V", Left = 520, Top = 70 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_AB36V", Modulo = T_Code.Sen, LabelModulo = "AB36V", SCode = S_Code.sCOR, TextoBase = "B36V", Left = 595, Top = 70 });
|
||||
|
||||
|
||||
// =============================
|
||||
// FRENTE ESQUERDA
|
||||
// =============================
|
||||
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "DIR_EF", Modulo = T_Code.Dir, LabelModulo = "EF", SCode = S_Code.sVZO, TextoBase = "DIR", Left = 95, Top = 130 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "MOV_EF", Modulo = T_Code.Mov, LabelModulo = "EF", SCode = S_Code.sVZO, TextoBase = "MOV", Left = 95, Top = 170 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_FROEF", Modulo = T_Code.Sen, LabelModulo = "FROEF", SCode = S_Code.sSRV, TextoBase = "FRO", Left = 30, Top = 170 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_MAGEF", Modulo = T_Code.Sen, LabelModulo = "MAGEF", SCode = S_Code.sMAG, TextoBase = "MAG", Left = 30, Top = 210 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_TMVEF", Modulo = T_Code.Sen, LabelModulo = "TMVEF", SCode = S_Code.sNTC, TextoBase = "TMP", Left = 95, Top = 210 });
|
||||
|
||||
|
||||
// =============================
|
||||
// FRENTE DIREITA
|
||||
// =============================
|
||||
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "DIR_DF", Modulo = T_Code.Dir, LabelModulo = "DF", SCode = S_Code.sVZO, TextoBase = "DIR", Left = 540, Top = 130 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "MOV_DF", Modulo = T_Code.Mov, LabelModulo = "DF", SCode = S_Code.sVZO, TextoBase = "MOV", Left = 540, Top = 170 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_FRODF", Modulo = T_Code.Sen, LabelModulo = "FRODF", SCode = S_Code.sSRV, TextoBase = "FRO", Left = 605, Top = 170 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_MAGDF", Modulo = T_Code.Sen, LabelModulo = "MAGDF", SCode = S_Code.sMAG, TextoBase = "MAG", Left = 605, Top = 210 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_TMVDF", Modulo = T_Code.Sen, LabelModulo = "TMVDF", SCode = S_Code.sNTC, TextoBase = "TMP", Left = 540, Top = 210 });
|
||||
|
||||
|
||||
// =============================
|
||||
// CENTRO ROBÔ
|
||||
// =============================
|
||||
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SNR", Modulo = T_Code.Snr, LabelModulo = "", SCode = S_Code.sVZO, TextoBase = "SNR", Left = 315, Top = 130 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "LVX", Modulo = T_Code.Lvx, LabelModulo = "", SCode = S_Code.sVZO, TextoBase = "LDR", Left = 315, Top = 170 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "IMU", Modulo = T_Code.Imu, LabelModulo = "", SCode = S_Code.sVZO, TextoBase = "IMU", Left = 315, Top = 210 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "GPS", Modulo = T_Code.Gps, LabelModulo = "", SCode = S_Code.sVZO, TextoBase = "GPS", Left = 315, Top = 270 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN", Modulo = T_Code.Sen, LabelModulo = "", SCode = S_Code.sMOD, TextoBase = "SEN", Left = 315, Top = 310 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "NPC", Modulo = T_Code.Npc, LabelModulo = "", SCode = S_Code.sVZO, TextoBase = "NCP", Left = 315, Top = 350 });
|
||||
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_RLCIN", Modulo = T_Code.Sen, LabelModulo = "RLCIN", SCode = S_Code.sRLE, TextoBase = "CLE", Left = 160, Top = 310 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_RLCOUT", Modulo = T_Code.Sen, LabelModulo = "RLCOUT", SCode = S_Code.sRLE, TextoBase = "CLS", Left = 470, Top = 310 });
|
||||
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "CAN", Modulo = T_Code.Can, LabelModulo = "", SCode = S_Code.sVZO, TextoBase = "CAN", Left = 610, Top = 270 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "IPB", Modulo = T_Code.Ipb, LabelModulo = "", SCode = S_Code.sVZO, TextoBase = "LAN", Left = 610, Top = 310 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "TRJ", Modulo = T_Code.Trj, LabelModulo = "", SCode = S_Code.sVZO, TextoBase = "TRAJ", Left = 610, Top = 350 });
|
||||
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_LEDOP", Modulo = T_Code.Sen, LabelModulo = "LEDOP", SCode = S_Code.sLED, TextoBase = "OP", Left = 20, Top = 270 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_LEDMN", Modulo = T_Code.Sen, LabelModulo = "LEDMN", SCode = S_Code.sLED, TextoBase = "MN", Left = 20, Top = 310 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_LEDAT", Modulo = T_Code.Sen, LabelModulo = "LEDAT", SCode = S_Code.sLED, TextoBase = "AT", Left = 20, Top = 350 });
|
||||
|
||||
|
||||
// =============================
|
||||
// TRASEIRA ESQUERDA
|
||||
// =============================
|
||||
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "DIR_ET", Modulo = T_Code.Dir, LabelModulo = "ET", SCode = S_Code.sVZO, TextoBase = "DIR", Left = 95, Top = 470 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "MOV_ET", Modulo = T_Code.Mov, LabelModulo = "ET", SCode = S_Code.sVZO, TextoBase = "MOV", Left = 95, Top = 510 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_FROET", Modulo = T_Code.Sen, LabelModulo = "FROET", SCode = S_Code.sSRV, TextoBase = "FRO", Left = 30, Top = 510 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_MAGET", Modulo = T_Code.Sen, LabelModulo = "MAGET", SCode = S_Code.sMAG, TextoBase = "MAG", Left = 30, Top = 550 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_TMVET", Modulo = T_Code.Sen, LabelModulo = "TMVET", SCode = S_Code.sNTC, TextoBase = "TMP", Left = 95, Top = 550 });
|
||||
|
||||
|
||||
// =============================
|
||||
// TRASEIRA DIREITA
|
||||
// =============================
|
||||
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "DIR_DT", Modulo = T_Code.Dir, LabelModulo = "DT", SCode = S_Code.sVZO, TextoBase = "DIR", Left = 540, Top = 470 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "MOV_DT", Modulo = T_Code.Mov, LabelModulo = "DT", SCode = S_Code.sVZO, TextoBase = "MOV", Left = 540, Top = 510 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_FRODT", Modulo = T_Code.Sen, LabelModulo = "FRODT", SCode = S_Code.sSRV, TextoBase = "FRO", Left = 605, Top = 510 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_MAGDT", Modulo = T_Code.Sen, LabelModulo = "MAGDT", SCode = S_Code.sMAG, TextoBase = "MAG", Left = 605, Top = 550 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "SEN_TMVDT", Modulo = T_Code.Sen, LabelModulo = "TMVDT", SCode = S_Code.sNTC, TextoBase = "TMP", Left = 540, Top = 550 });
|
||||
|
||||
|
||||
// =============================
|
||||
// ATUADOR / SISTEMA DE PULVERIZAÇÃO
|
||||
// =============================
|
||||
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "ATU_PRSLN", Modulo = T_Code.Atu, LabelModulo = "PRSLN", SCode = S_Code.sPRS, TextoBase = "PRS", Left = 230, Top = 610 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "ATU", Modulo = T_Code.Atu, LabelModulo = "", SCode = S_Code.sMOD, TextoBase = "ATU", Left = 315, Top = 610 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "ATU_FLXLN", Modulo = T_Code.Atu, LabelModulo = "FLXLN", SCode = S_Code.sFLX, TextoBase = "FLX", Left = 400, Top = 610 });
|
||||
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "ATU_BOMBA", Modulo = T_Code.Atu, LabelModulo = "BOMBA", SCode = S_Code.sBMB, TextoBase = "BMB", Left = 230, Top = 650 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "ATU_MASRS", Modulo = T_Code.Atu, LabelModulo = "MASRS", SCode = S_Code.sMAS, TextoBase = "MAS", Left = 400, Top = 650 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "CAM", Modulo = T_Code.Cam, LabelModulo = "", SCode = S_Code.sVZO, TextoBase = "CAM", Left = 315, Top = 650 });
|
||||
|
||||
|
||||
// =============================
|
||||
// BICOS
|
||||
// =============================
|
||||
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "ATU_SRVB1", Modulo = T_Code.Atu, LabelModulo = "SRVB1", SCode = S_Code.sSRV, TextoBase = "SVB1", Left = 110, Top = 705 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "ATU_B01", Modulo = T_Code.Atu, LabelModulo = "B01", SCode = S_Code.sBIC, TextoBase = "B01", Left = 110, Top = 745 });
|
||||
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "ATU_MAGESQ", Modulo = T_Code.Atu, LabelModulo = "MAGESQ", SCode = S_Code.sMAG, TextoBase = "MAG", Left = 215, Top = 730 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "ATU_MAGALT", Modulo = T_Code.Atu, LabelModulo = "MAGALT", SCode = S_Code.sMAG, TextoBase = "MAG", Left = 315, Top = 705 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "ATU_MAGDIR", Modulo = T_Code.Atu, LabelModulo = "MAGDIR", SCode = S_Code.sMAG, TextoBase = "MAG", Left = 415, Top = 730 });
|
||||
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "ATU_B02", Modulo = T_Code.Atu, LabelModulo = "B02", SCode = S_Code.sBIC, TextoBase = "B02", Left = 315, Top = 745 });
|
||||
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "ATU_SRVB3", Modulo = T_Code.Atu, LabelModulo = "SRVB3", SCode = S_Code.sSRV, TextoBase = "SVB3", Left = 520, Top = 705 });
|
||||
DiagnosticoModulos.Add(new DiagnosticoModuloItemViewModel { IdVisual = "ATU_B03", Modulo = T_Code.Atu, LabelModulo = "B03", SCode = S_Code.sBIC, TextoBase = "B03", Left = 520, Top = 745 });
|
||||
}
|
||||
|
||||
|
||||
private void SelecionarModulo(object parameter)
|
||||
{
|
||||
if (parameter is DiagnosticoModuloItemViewModel item)
|
||||
ModuloSelecionado = item;
|
||||
}
|
||||
|
||||
#region RESUMO
|
||||
|
||||
private string _tituloModuloSelecionado = "Nenhum módulo selecionado";
|
||||
public string TituloModuloSelecionado
|
||||
{
|
||||
get => _tituloModuloSelecionado;
|
||||
set => SetProperty(ref _tituloModuloSelecionado, value);
|
||||
}
|
||||
|
||||
private string _descricaoModuloSelecionado = "Selecione um módulo no mapa para visualizar os detalhes.";
|
||||
public string DescricaoModuloSelecionado
|
||||
{
|
||||
get => _descricaoModuloSelecionado;
|
||||
set => SetProperty(ref _descricaoModuloSelecionado, value);
|
||||
}
|
||||
|
||||
private OperacaoParametrosModel _dadosOperacaoAtual;
|
||||
|
||||
private string _impedimentoModuloSelecionado = "Impedimento: Nenhum";
|
||||
public string ImpedimentoModuloSelecionado
|
||||
{
|
||||
get => _impedimentoModuloSelecionado;
|
||||
set => SetProperty(ref _impedimentoModuloSelecionado, value);
|
||||
}
|
||||
|
||||
private string _infoSaude = "Saúde: -";
|
||||
public string InfoSaude
|
||||
{
|
||||
get => _infoSaude;
|
||||
set => SetProperty(ref _infoSaude, value);
|
||||
}
|
||||
|
||||
private string _infoCan = "CAN: -";
|
||||
public string InfoCan
|
||||
{
|
||||
get => _infoCan;
|
||||
set => SetProperty(ref _infoCan, value);
|
||||
}
|
||||
|
||||
private string _infoLatencia = "Latência: -";
|
||||
public string InfoLatencia
|
||||
{
|
||||
get => _infoLatencia;
|
||||
set => SetProperty(ref _infoLatencia, value);
|
||||
}
|
||||
|
||||
private bool _mandatorioSelecionado;
|
||||
public bool MandatorioSelecionado
|
||||
{
|
||||
get => _mandatorioSelecionado;
|
||||
set => SetProperty(ref _mandatorioSelecionado, value);
|
||||
}
|
||||
|
||||
private bool _emUsoSelecionado;
|
||||
public bool EmUsoSelecionado
|
||||
{
|
||||
get => _emUsoSelecionado;
|
||||
set => SetProperty(ref _emUsoSelecionado, value);
|
||||
}
|
||||
|
||||
public ObservableCollection<string> CondicoesOperacionais { get; } = new();
|
||||
public ObservableCollection<string> LogsModuloSelecionado { get; } = new();
|
||||
|
||||
private string _infoModulo = "Módulo: -";
|
||||
public string InfoModulo
|
||||
{
|
||||
get => _infoModulo;
|
||||
set => SetProperty(ref _infoModulo, value);
|
||||
}
|
||||
|
||||
private string _infoLabel = "Label: -";
|
||||
public string InfoLabel
|
||||
{
|
||||
get => _infoLabel;
|
||||
set => SetProperty(ref _infoLabel, value);
|
||||
}
|
||||
|
||||
private string _infoSCode = "SCode: -";
|
||||
public string InfoSCode
|
||||
{
|
||||
get => _infoSCode;
|
||||
set => SetProperty(ref _infoSCode, value);
|
||||
}
|
||||
|
||||
private string _infoStatus = "Status: -";
|
||||
public string InfoStatus
|
||||
{
|
||||
get => _infoStatus;
|
||||
set => SetProperty(ref _infoStatus, value);
|
||||
}
|
||||
|
||||
private string _infoIniciado = "Iniciado: -";
|
||||
public string InfoIniciado
|
||||
{
|
||||
get => _infoIniciado;
|
||||
set => SetProperty(ref _infoIniciado, value);
|
||||
}
|
||||
|
||||
private string _infoMandatorio = "Mandatório: -";
|
||||
public string InfoMandatorio
|
||||
{
|
||||
get => _infoMandatorio;
|
||||
set => SetProperty(ref _infoMandatorio, value);
|
||||
}
|
||||
|
||||
private string _infoEmUso = "Em uso: -";
|
||||
public string InfoEmUso
|
||||
{
|
||||
get => _infoEmUso;
|
||||
set => SetProperty(ref _infoEmUso, value);
|
||||
}
|
||||
|
||||
private string _infoIdVisual = "ID visual: -";
|
||||
public string InfoIdVisual
|
||||
{
|
||||
get => _infoIdVisual;
|
||||
set => SetProperty(ref _infoIdVisual, value);
|
||||
}
|
||||
|
||||
private void AtualizarResumoModuloSelecionado()
|
||||
{
|
||||
CondicoesOperacionais.Clear();
|
||||
LogsModuloSelecionado.Clear();
|
||||
|
||||
if (ModuloSelecionado == null || _dadosOperacaoAtual == null)
|
||||
{
|
||||
TituloModuloSelecionado = "Nenhum módulo selecionado";
|
||||
DescricaoModuloSelecionado = "Selecione um módulo no mapa para visualizar os detalhes.";
|
||||
InfoModulo = "Módulo: -";
|
||||
InfoLabel = "Label: -";
|
||||
InfoSCode = "SCode: -";
|
||||
InfoStatus = "Status: -";
|
||||
InfoIniciado = "Iniciado: -";
|
||||
InfoMandatorio = "Mandatório: -";
|
||||
InfoEmUso = "Em uso: -";
|
||||
InfoIdVisual = "ID visual: -";
|
||||
InfoSaude = "Saúde: -";
|
||||
InfoCan = "CAN: -";
|
||||
InfoLatencia = "Latência: -";
|
||||
ImpedimentoModuloSelecionado = "Impedimento: Nenhum";
|
||||
MandatorioSelecionado = false;
|
||||
EmUsoSelecionado = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var rover = _dadosOperacaoAtual.DadosLeitura;
|
||||
var item = ModuloSelecionado;
|
||||
|
||||
var saudeModulo = rover?.ModulosSaude?.FirstOrDefault(x => x.modulo == item.Modulo);
|
||||
var individual = saudeModulo?.saude_individual?.FirstOrDefault(x => x.label == item.LabelModulo);
|
||||
var dispositivo = rover?.DispositivosMapeados?.FirstOrDefault(x => x.Dispositivo == item.Modulo && x.Mod_ID == item.LabelModulo);
|
||||
|
||||
var status = individual?.status ?? saudeModulo?.status ?? StatusModulo.Desconectado;
|
||||
var saude = individual?.saude ?? saudeModulo?.saude ?? 0;
|
||||
var motivos = string.Join(", ", (individual?.motivos ?? saudeModulo?.motivos) ?? new List<string>());
|
||||
|
||||
DateTime ucr = DateTime.MinValue;
|
||||
if (item.Modulo == T_Code.Sen)
|
||||
ucr = rover?.Sensoriamento?.UltimoComandoRespondido ?? DateTime.MinValue;
|
||||
else if (item.Modulo == T_Code.Atu)
|
||||
ucr = rover?.Atuador?.UltimoComandoRespondido ?? DateTime.MinValue;
|
||||
else if (item.Modulo == T_Code.Mov)
|
||||
ucr = rover?.Movimentacao?.Modulos?.FirstOrDefault(x => x.Mod_ID == item.LabelModulo)?.UltimoComandoRespondido ?? DateTime.MinValue;
|
||||
else if (item.Modulo == T_Code.Dir)
|
||||
ucr = rover?.Direcional?.Modulos?.FirstOrDefault(x => x.Mod_ID == item.LabelModulo)?.UltimoComandoRespondido ?? DateTime.MinValue;
|
||||
else
|
||||
ucr = rover?.Momento ?? DateTime.MinValue;
|
||||
|
||||
DateTime momento = rover?.Momento ?? DateTime.MinValue;
|
||||
double canLatencia = (ucr - momento).TotalMilliseconds;
|
||||
|
||||
TituloModuloSelecionado = $"Saúde do módulo {item.TextoBase}";
|
||||
DescricaoModuloSelecionado = $"Detalhes reais do item selecionado no mapa de diagnóstico.";
|
||||
|
||||
InfoModulo = $"Módulo: {item.Modulo}";
|
||||
InfoLabel = $"Label: {(string.IsNullOrWhiteSpace(item.LabelModulo) ? "-" : item.LabelModulo)}";
|
||||
InfoSCode = $"SCode: {item.SCode}";
|
||||
InfoStatus = $"Status: {status}";
|
||||
InfoIniciado = $"Iniciado: {(item.Iniciado ? "Sim" : "Não")}";
|
||||
InfoMandatorio = $"Mandatório: {(item.Mandatorio ? "Sim" : "Não")}";
|
||||
InfoEmUso = $"Em uso: {(item.EmUso ? "Sim" : "Não")}";
|
||||
InfoIdVisual = $"ID visual: {item.IdVisual}";
|
||||
InfoSaude = $"Saúde: {saude:0}%";
|
||||
InfoCan = $"CAN: {canLatencia:0} ms";
|
||||
InfoLatencia = $"Latência: {dispositivo?.Latencia ?? 0} ms";
|
||||
ImpedimentoModuloSelecionado = $"Impedimento: {(string.IsNullOrWhiteSpace(motivos) ? "Nenhum" : motivos)}";
|
||||
|
||||
MandatorioSelecionado = item.Mandatorio;
|
||||
EmUsoSelecionado = item.EmUso;
|
||||
|
||||
if (saudeModulo?.condicoes_operacionais != null)
|
||||
{
|
||||
foreach (var cond in saudeModulo.condicoes_operacionais)
|
||||
CondicoesOperacionais.Add($"{cond.descricao} (Valor: {cond.valor}, Severidade: {cond.severidade:0}%)");
|
||||
}
|
||||
|
||||
var logs = rover?.Logs?.Where(x => x.Dispositivo == item.Modulo);
|
||||
if (!string.IsNullOrWhiteSpace(item.LabelModulo))
|
||||
logs = logs?.Where(x => x.ID == item.LabelModulo);
|
||||
else
|
||||
logs = logs?.Where(x => x.ID == null);
|
||||
|
||||
if (logs != null)
|
||||
{
|
||||
foreach (var log in logs)
|
||||
LogsModuloSelecionado.Add($"{log.Momento:HH:mm:ss.fff} - {log.Mensagem}");
|
||||
}
|
||||
|
||||
OpcoesVM?.Atualizar(ModuloSelecionado, _dadosOperacaoAtual);
|
||||
AtualizarGraficoModuloSelecionado();
|
||||
}
|
||||
|
||||
public void AtualizarDados(OperacaoParametrosModel dados)
|
||||
{
|
||||
_dadosOperacaoAtual = dados;
|
||||
|
||||
if (dados == null)
|
||||
return;
|
||||
|
||||
foreach (var item in DiagnosticoModulos)
|
||||
{
|
||||
item.Status = ObterStatusModulo(item, dados);
|
||||
item.Mandatorio = ObterMandatorio(item, dados);
|
||||
item.EmUso = ObterEmUso(item, dados);
|
||||
item.Iniciado = ObterIniciado(item, dados);
|
||||
}
|
||||
|
||||
AtualizarResumoModuloSelecionado();
|
||||
}
|
||||
|
||||
private StatusModulo ObterStatusModulo(DiagnosticoModuloItemViewModel item, OperacaoParametrosModel dados)
|
||||
{
|
||||
var saudeModulo = dados?.DadosLeitura?.ModulosSaude?.FirstOrDefault(x => x.modulo == item.Modulo);
|
||||
if (saudeModulo == null)
|
||||
return StatusModulo.Desconectado;
|
||||
|
||||
var individual = saudeModulo.saude_individual?.FirstOrDefault(x => x.label == item.LabelModulo);
|
||||
|
||||
return individual?.status ?? saudeModulo.status;
|
||||
}
|
||||
|
||||
private bool ObterMandatorio(DiagnosticoModuloItemViewModel item, OperacaoParametrosModel dados)
|
||||
{
|
||||
if (dados == null)
|
||||
return false;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(item.LabelModulo))
|
||||
{
|
||||
return dados.DadosLeitura?.Operacao?.ModulosMandatorios?
|
||||
.FirstOrDefault(x => x.Dispositivo == item.Modulo)?
|
||||
.ComponentesEmUso?
|
||||
.Any(x => x.Key == item.LabelModulo && x.Value.Item1) ?? false;
|
||||
}
|
||||
|
||||
return dados.ModulosMandatorios?.Any(x => x.Dispositivo == item.Modulo && x.Mandatorio) ?? false;
|
||||
}
|
||||
|
||||
private bool ObterEmUso(DiagnosticoModuloItemViewModel item, OperacaoParametrosModel dados)
|
||||
{
|
||||
if (dados == null)
|
||||
return false;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(item.LabelModulo))
|
||||
{
|
||||
return dados.DadosLeitura?.Operacao?.ModulosMandatorios?
|
||||
.FirstOrDefault(x => x.Dispositivo == item.Modulo)?
|
||||
.ComponentesEmUso?
|
||||
.Any(x => x.Key == item.LabelModulo && x.Value.Item2) ?? false;
|
||||
}
|
||||
|
||||
return dados.ModulosMandatorios?.Any(x => x.Dispositivo == item.Modulo && x.Utilizar) ?? false;
|
||||
}
|
||||
|
||||
private bool ObterIniciado(DiagnosticoModuloItemViewModel item, OperacaoParametrosModel dados)
|
||||
{
|
||||
var rover = dados?.DadosLeitura;
|
||||
if (rover == null)
|
||||
return false;
|
||||
|
||||
switch (item.Modulo)
|
||||
{
|
||||
case T_Code.Mov:
|
||||
return rover.Movimentacao?.Modulos?.FirstOrDefault(x => x.Mod_ID == item.LabelModulo)?.Iniciado ?? false;
|
||||
|
||||
case T_Code.Dir:
|
||||
return rover.Direcional?.Modulos?.FirstOrDefault(x => x.Mod_ID == item.LabelModulo)?.Iniciado ?? false;
|
||||
|
||||
case T_Code.Atu:
|
||||
if (string.IsNullOrWhiteSpace(item.LabelModulo))
|
||||
return rover.Atuador?.Iniciado ?? false;
|
||||
|
||||
switch (item.SCode)
|
||||
{
|
||||
case S_Code.sBIC:
|
||||
return rover.Atuador?.Bicos?.FirstOrDefault(x => x.ID == item.LabelModulo)?.Inicializado ?? false;
|
||||
|
||||
case S_Code.sBMB:
|
||||
return rover.Atuador?.Bombas?.FirstOrDefault(x => x.ID == item.LabelModulo)?.Inicializado ?? false;
|
||||
|
||||
case S_Code.sSRV:
|
||||
return rover.Atuador?.Servos?.FirstOrDefault(x => x.ID == item.LabelModulo)?.Inicializado ?? false;
|
||||
|
||||
default:
|
||||
return rover.Atuador?.Sensores?.FirstOrDefault(x => x.ID == item.LabelModulo && x.Componente == item.SCode)?.Inicializado ?? false;
|
||||
}
|
||||
|
||||
case T_Code.Sen:
|
||||
if (string.IsNullOrWhiteSpace(item.LabelModulo))
|
||||
return rover.Sensoriamento?.Iniciado ?? false;
|
||||
|
||||
switch (item.SCode)
|
||||
{
|
||||
case S_Code.sLED:
|
||||
return rover.Sensoriamento?.Sinaleiros?.FirstOrDefault(x => x.ID == item.LabelModulo)?.Inicializado ?? false;
|
||||
|
||||
case S_Code.sRLE:
|
||||
return rover.Sensoriamento?.Reles?.FirstOrDefault(x => x.ID == item.LabelModulo)?.Inicializado ?? false;
|
||||
|
||||
case S_Code.sSRV:
|
||||
return rover.Sensoriamento?.Servos?.FirstOrDefault(x => x.ID == item.LabelModulo)?.Inicializado ?? false;
|
||||
|
||||
default:
|
||||
return rover.Sensoriamento?.Sensores?.FirstOrDefault(x => x.ID == item.LabelModulo && x.Componente == item.SCode)?.Inicializado ?? false;
|
||||
}
|
||||
|
||||
case T_Code.Imu:
|
||||
return rover.Imu?.Iniciado ?? false;
|
||||
|
||||
case T_Code.Npc:
|
||||
case T_Code.Ipb:
|
||||
return dados.Alive;
|
||||
|
||||
case T_Code.Can:
|
||||
return rover.DispositivosMapeados?.Any(x => x.Dispositivo == T_Code.Can) ?? false;
|
||||
|
||||
case T_Code.Cam:
|
||||
case T_Code.Snr:
|
||||
case T_Code.Lvx:
|
||||
case T_Code.Gps:
|
||||
return rover.DispositivosMapeados?.FirstOrDefault(x => x.Dispositivo == item.Modulo)?.Saude > 0;
|
||||
|
||||
case T_Code.Bat:
|
||||
return rover.Bateria?.Iniciado ?? false;
|
||||
|
||||
case T_Code.Trj:
|
||||
return rover.Trajetoria?.QtdPontos > 0;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void SalvarSaudeModulo(object parameter)
|
||||
{
|
||||
if (ModuloSelecionado == null)
|
||||
return;
|
||||
|
||||
var modulo = ModuloSelecionado.Modulo;
|
||||
var label = ModuloSelecionado.LabelModulo;
|
||||
|
||||
if (modulo == T_Code.Vzo)
|
||||
return;
|
||||
|
||||
var rover = VariaveisControleOperacao.RoverEmFoco;
|
||||
|
||||
if (rover == null)
|
||||
{
|
||||
MessageBox.Show($"Sem dados para o módulo {modulo} ({label})");
|
||||
return;
|
||||
}
|
||||
|
||||
var mod = rover.ModulosMandatorios?.FirstOrDefault(x => x.Dispositivo == modulo);
|
||||
if (mod == null)
|
||||
{
|
||||
mod = new AgroBase.Models.OperacaoModulosMandatoriosModel()
|
||||
{
|
||||
Dispositivo = modulo,
|
||||
ComponentesEmUso = new Dictionary<string, (bool, bool)>()
|
||||
};
|
||||
|
||||
if (rover.ModulosMandatorios == null)
|
||||
rover.ModulosMandatorios = new List<AgroBase.Models.OperacaoModulosMandatoriosModel>();
|
||||
|
||||
rover.ModulosMandatorios.Add(mod);
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(label))
|
||||
{
|
||||
mod.Mandatorio = MandatorioSelecionado;
|
||||
mod.Utilizar = EmUsoSelecionado;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mod.ComponentesEmUso == null)
|
||||
mod.ComponentesEmUso = new Dictionary<string, (bool, bool)>();
|
||||
|
||||
mod.ComponentesEmUso[label] = (MandatorioSelecionado, EmUsoSelecionado);
|
||||
}
|
||||
|
||||
VariaveisControleOperacao.EnviarParametrosOperacao(new AgroBase.Models.Operacoes.OperacaoParametrosModel()
|
||||
{
|
||||
ModulosMandatorios = rover.ModulosMandatorios,
|
||||
});
|
||||
|
||||
// opcional: refletir imediatamente no item selecionado
|
||||
ModuloSelecionado.Mandatorio = MandatorioSelecionado;
|
||||
ModuloSelecionado.EmUso = EmUsoSelecionado;
|
||||
|
||||
AtualizarResumoModuloSelecionado();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void AtualizarGraficoModuloSelecionado()
|
||||
{
|
||||
var idAtual = ModuloSelecionado?.IdVisual ?? "";
|
||||
if (_ultimoIdGrafico != idAtual)
|
||||
{
|
||||
SeriesGrafico.Clear();
|
||||
LabelsGrafico.Clear();
|
||||
_ultimoIdGrafico = idAtual;
|
||||
}
|
||||
|
||||
if (ModuloSelecionado == null || _dadosOperacaoAtual?.DadosLeitura == null)
|
||||
return;
|
||||
|
||||
var rover = _dadosOperacaoAtual.DadosLeitura;
|
||||
var item = ModuloSelecionado;
|
||||
|
||||
DateTime? momento = rover.Momento;
|
||||
if (momento.HasValue)
|
||||
{
|
||||
LabelsGrafico.Add(momento.Value.ToString("HH:mm:ss"));
|
||||
while (LabelsGrafico.Count > 60)
|
||||
LabelsGrafico.RemoveAt(0);
|
||||
}
|
||||
|
||||
void AddOrAppendSerie(string label, string unidade, double? valor)
|
||||
{
|
||||
if (!valor.HasValue)
|
||||
return;
|
||||
|
||||
var serie = SeriesGrafico.FirstOrDefault(x => x.Label == label && x.Unidade == unidade);
|
||||
if (serie == null)
|
||||
{
|
||||
serie = new DiagnosticoGraficoSerieViewModel
|
||||
{
|
||||
Label = label,
|
||||
Unidade = unidade
|
||||
};
|
||||
SeriesGrafico.Add(serie);
|
||||
}
|
||||
|
||||
serie.Valores.Add(valor.Value);
|
||||
|
||||
while (serie.Valores.Count > 60)
|
||||
serie.Valores.RemoveAt(0);
|
||||
}
|
||||
|
||||
switch (item.Modulo)
|
||||
{
|
||||
case T_Code.Sen:
|
||||
switch (item.SCode)
|
||||
{
|
||||
case S_Code.sCOR:
|
||||
var barramento = rover.Bateria?.Barramentos?.FirstOrDefault(x => x.ID == item.LabelModulo);
|
||||
AddOrAppendSerie("Corrente", "mA", barramento?.Corrente);
|
||||
AddOrAppendSerie("Tensão", "V", barramento?.Tensao);
|
||||
AddOrAppendSerie("Potência", "mW", barramento?.Potencia);
|
||||
AddOrAppendSerie("Energia", "J", barramento?.Energia);
|
||||
AddOrAppendSerie("Temperatura", "°C", barramento?.Temperatura);
|
||||
break;
|
||||
|
||||
case S_Code.sNTC:
|
||||
var ntc = rover.Sensoriamento?.Sensores?
|
||||
.FirstOrDefault(x => x.ID == item.LabelModulo && x.Componente == item.SCode)?
|
||||
.Valores?[0];
|
||||
AddOrAppendSerie("Temperatura", "°C", ntc);
|
||||
break;
|
||||
|
||||
case S_Code.sRLE:
|
||||
var rele = rover.Sensoriamento?.Reles?.FirstOrDefault(x => x.ID == item.LabelModulo);
|
||||
AddOrAppendSerie("Comando", "", rele?.ComandoEstado == true ? 1 : 0);
|
||||
AddOrAppendSerie("Leitura", "", rele?.LeituraEstado == true ? 1 : 0);
|
||||
break;
|
||||
|
||||
case S_Code.sSRV:
|
||||
var servoSen = rover.Sensoriamento?.Servos?.FirstOrDefault(x => x.ID == item.LabelModulo);
|
||||
AddOrAppendSerie("Comando", "°", servoSen?.ComandoAngulo);
|
||||
AddOrAppendSerie("Leitura", "°", servoSen?.LeituraAngulo);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case T_Code.Atu:
|
||||
switch (item.SCode)
|
||||
{
|
||||
case S_Code.sBIC:
|
||||
var bico = rover.Atuador?.Bicos?.FirstOrDefault(x => x.ID == item.LabelModulo);
|
||||
AddOrAppendSerie("Cmd", "", (bico?.ComandoEstado ?? false) ? 100 : 0);
|
||||
AddOrAppendSerie("Vazão", "mL/s", bico?.VazaoInstantaneaMLs);
|
||||
break;
|
||||
|
||||
case S_Code.sBMB:
|
||||
var bomba = rover.Atuador?.Bombas?.FirstOrDefault(x => x.ID == item.LabelModulo);
|
||||
AddOrAppendSerie("Cmd", "", (bomba?.ComandoEstado ?? false) ? 100 : 0);
|
||||
AddOrAppendSerie("Potência", "%", bomba?.Potencia);
|
||||
AddOrAppendSerie("Pressão", "psi", rover.Atuador?.PressaoLinhaPsi);
|
||||
break;
|
||||
|
||||
case S_Code.sPRS:
|
||||
AddOrAppendSerie("Pressão", "psi", rover.Atuador?.PressaoLinhaPsi);
|
||||
break;
|
||||
|
||||
case S_Code.sFLX:
|
||||
AddOrAppendSerie("Fluxo", "mL/s", rover.Atuador?.VazaoInstantaneaMLs);
|
||||
AddOrAppendSerie("Média", "mL/s", rover.Atuador?.VazaoMediaMLs);
|
||||
break;
|
||||
|
||||
case S_Code.sMAS:
|
||||
AddOrAppendSerie("Volume", "L", rover.Atuador?.VolumeReservatorioL);
|
||||
AddOrAppendSerie("Massa", "Kg", rover.Atuador?.MassaReservatorioKg);
|
||||
AddOrAppendSerie("Percentual", "%", rover.Atuador?.PercentualReservatorio);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case T_Code.Mov:
|
||||
var mov = rover.Movimentacao?.Modulos?.FirstOrDefault(x => x.Mod_ID == item.LabelModulo);
|
||||
AddOrAppendSerie("Tensão", "V", mov?.Tensao);
|
||||
AddOrAppendSerie("Corrente M", "A", mov?.Corrente_Motor);
|
||||
AddOrAppendSerie("Corrente B", "A", mov?.Corrente_Barramento);
|
||||
AddOrAppendSerie("Ciclo", "%", mov?.CicloTrabalho);
|
||||
AddOrAppendSerie("Temperatura", "°C", mov?.TemperaturaDriver);
|
||||
AddOrAppendSerie("RPM", "", mov?.RPM_Roda);
|
||||
break;
|
||||
|
||||
case T_Code.Npc:
|
||||
var npc = rover.PerformanceNcp;
|
||||
AddOrAppendSerie("GPU %", "%", npc?.GPU_load);
|
||||
AddOrAppendSerie("GPU °C", "°C", npc?.GPU_temp);
|
||||
AddOrAppendSerie("CPU %", "%", npc?.CPU_load);
|
||||
AddOrAppendSerie("CPU °C", "°C", npc?.CPU_temp);
|
||||
AddOrAppendSerie("RAM", "MB", npc?.RAM_usage);
|
||||
break;
|
||||
|
||||
case T_Code.Ipb:
|
||||
var conexao = rover.ModulosSaude?.FirstOrDefault(x => x.modulo == T_Code.Ipb);
|
||||
AddOrAppendSerie("Latência", "ms", conexao?.detalhes?["avg_rtt"]?.Value<double>());
|
||||
AddOrAppendSerie("Jitter", "ms", conexao?.detalhes?["jitter"]?.Value<double>());
|
||||
AddOrAppendSerie("Timeout", "%", conexao?.detalhes?["tmout_pct"]?.Value<double>());
|
||||
AddOrAppendSerie("Perda", "%", conexao?.detalhes?["loss_pct"]?.Value<double>());
|
||||
AddOrAppendSerie("Banda", "Mbps", conexao?.detalhes?["bw_total_mbps"]?.Value<double>());
|
||||
AddOrAppendSerie("Banda %", "%", conexao?.detalhes?["bw_util_pct"]?.Value<double>());
|
||||
break;
|
||||
|
||||
case T_Code.Gps:
|
||||
var gps = rover.Gnss;
|
||||
AddOrAppendSerie("Precisão", "cm", gps?.PrecisaoCm);
|
||||
AddOrAppendSerie("Altitude", "m", gps?.Altitude);
|
||||
AddOrAppendSerie("Idade", "s", gps?.IdadeCorrecao);
|
||||
AddOrAppendSerie("Satélites", "", gps?.NumeroSatelites);
|
||||
break;
|
||||
|
||||
case T_Code.Bat:
|
||||
var bat = rover.Bateria;
|
||||
AddOrAppendSerie("Tensão", "V", bat?.TensaoInstantanea);
|
||||
AddOrAppendSerie("Corrente", "A", bat?.CorrenteInstantanea);
|
||||
AddOrAppendSerie("Temperatura", "°C", bat?.Temperatura);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
using OperationControl.Controls;
|
||||
using OperationControl.Models;
|
||||
using OperationControl.ViewModels.Views.Operacao.Diagnostico;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace OperationControl.ViewModels.Views.Operacao
|
||||
{
|
||||
public class OperacaoCenterViewModel : INotifyPropertyChanged
|
||||
{
|
||||
|
||||
public DiagnosticoViewModel DiagnosticoVM { get; set; } = new DiagnosticoViewModel();
|
||||
|
||||
public OperacaoCenterViewModel()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@ using System.ComponentModel;
|
|||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using static AgroBase.Models.Enums;
|
||||
using Brush = System.Windows.Media.Brush;
|
||||
using Brushes = System.Windows.Media.Brushes;
|
||||
using SolidColorBrush = System.Windows.Media.SolidColorBrush;
|
||||
using Color = System.Windows.Media.Color;
|
||||
|
||||
namespace OperationControl.ViewModels.Views.Operacao
|
||||
{
|
||||
|
|
@ -31,15 +35,15 @@ namespace OperationControl.ViewModels.Views.Operacao
|
|||
|
||||
public string TextoBotaoOperacao => OperacaoEmExecucao ? "⏸ Pausar Operação" : "▶ Iniciar Operação";
|
||||
|
||||
public System.Windows.Media.Brush CorBotaoOperacao =>
|
||||
public Brush CorBotaoOperacao =>
|
||||
OperacaoEmExecucao
|
||||
? new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(120, 88, 20))
|
||||
: new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(30, 90, 58));
|
||||
? new SolidColorBrush(Color.FromRgb(120, 88, 20))
|
||||
: new SolidColorBrush(Color.FromRgb(30, 90, 58));
|
||||
|
||||
public System.Windows.Media.Brush BordaBotaoOperacao =>
|
||||
OperacaoEmExecucao
|
||||
? new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(170, 130, 40))
|
||||
: new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(74, 138, 91));
|
||||
? new SolidColorBrush(System.Windows.Media.Color.FromRgb(170, 130, 40))
|
||||
: new SolidColorBrush(System.Windows.Media.Color.FromRgb(74, 138, 91));
|
||||
|
||||
|
||||
private bool _roverSelecionado;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ using System.ComponentModel;
|
|||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using static AgroBase.Models.Enums;
|
||||
using Brush = System.Windows.Media.Brush;
|
||||
using Brushes = System.Windows.Media.Brushes;
|
||||
|
||||
namespace OperationControl.ViewModels.Views.Operacao
|
||||
{
|
||||
|
|
@ -231,6 +233,7 @@ namespace OperationControl.ViewModels.Views.Operacao
|
|||
Parametros.CapacidadeReservatorio = origem.CapacidadeReservatorio;
|
||||
|
||||
var controle_o = origem.Controle;
|
||||
if (controle_o == null) return;
|
||||
if (Parametros.Controle == null) Parametros.Controle = new OperacaoParametrosControleModel();
|
||||
var controle_p = Parametros.Controle;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
using AgroBase.Models;
|
||||
using System.ComponentModel;
|
||||
using static AgroBase.Models.Enums;
|
||||
using Brush = System.Windows.Media.Brush;
|
||||
using Brushes = System.Windows.Media.Brushes;
|
||||
|
||||
namespace OperationControl.ViewModels
|
||||
{
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ namespace OperationControl.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
private bool _baseFixada = true;
|
||||
private bool _baseFixada;
|
||||
public bool BaseFixada
|
||||
{
|
||||
get => _baseFixada;
|
||||
|
|
@ -372,6 +372,7 @@ namespace OperationControl.ViewModels
|
|||
System.Windows.Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
_viewPreparacaoMapaTop?._vm?.AtualizarDados(dados);
|
||||
_viewPreparacaoMapa?.MapaPreparacao?.markers?.UpdateMarkerPosition(VariaveisControleOperacao.BaseMarkerID, lat: dados?.Latitude, lon: dados?.Longitude, heading: dados?.OrientacaoReal);
|
||||
});
|
||||
break;
|
||||
|
||||
|
|
@ -638,6 +639,9 @@ namespace OperationControl.ViewModels
|
|||
r.HerbicidaPercentual = obj.Atuador?.PercentualReservatorio ?? 0;
|
||||
r.InfestacaoPercentual = obj.Atuador?.PercentualErvasTerreno ?? 0;
|
||||
});
|
||||
|
||||
_viewOperacaoCenter?._vm?.DiagnosticoVM?.AtualizarDados(rover);
|
||||
_viewOperacaoCenter?.AtualizarGraficoDiagnostico(_viewOperacaoCenter?._vm?.DiagnosticoVM);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,12 +5,53 @@
|
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:OperationControl.Views.Operacao"
|
||||
xmlns:controls="clr-namespace:OperationControl.Controls"
|
||||
xmlns:scott="clr-namespace:ScottPlot.WPF;assembly=ScottPlot.WPF"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800">
|
||||
|
||||
<UserControl.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
|
||||
|
||||
<Style x:Key="DiagnosticoModuloButtonStyle" TargetType="Button">
|
||||
<Setter Property="Width" Value="58"/>
|
||||
<Setter Property="Height" Value="24"/>
|
||||
<Setter Property="FontSize" Value="10"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Padding" Value="4,0"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border x:Name="Bd"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="10"
|
||||
SnapsToDevicePixels="True">
|
||||
<ContentPresenter HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
RecognizesAccessKey="True"/>
|
||||
</Border>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Bd" Property="Opacity" Value="0.92"/>
|
||||
</Trigger>
|
||||
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="Bd" Property="Opacity" Value="0.82"/>
|
||||
</Trigger>
|
||||
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Bd" Property="Opacity" Value="0.45"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid Background="#181818">
|
||||
|
|
@ -24,14 +65,790 @@
|
|||
|
||||
<!-- DIAGNÓSTICO -->
|
||||
<Grid Visibility="{Binding ExibirDiagnostico, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<Border Margin="12" Padding="20" CornerRadius="10" Background="#202020" BorderBrush="#353535" BorderThickness="1">
|
||||
<Grid Margin="12">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.55*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- COLUNA ESQUERDA | MAPA VISUAL DO ROBÔ -->
|
||||
<Border Grid.Column="0"
|
||||
Margin="0,0,10,0"
|
||||
Padding="16"
|
||||
CornerRadius="10"
|
||||
Background="#202020"
|
||||
BorderBrush="#353535"
|
||||
BorderThickness="1">
|
||||
<Grid>
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding TituloCentro}" HorizontalAlignment="Center" FontSize="24" FontWeight="SemiBold" Foreground="#DDDDDD" TextAlignment="Center"/>
|
||||
<TextBlock Text="{Binding SubtituloCentro}" HorizontalAlignment="Center" Margin="0,14,0,0" FontSize="14" Foreground="#AAAAAA" TextAlignment="Center" TextWrapping="Wrap" MaxWidth="500"/>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- CABEÇALHO -->
|
||||
<StackPanel Grid.Row="0" Margin="0,0,0,12">
|
||||
<TextBlock Text="Diagnóstico do rover"
|
||||
FontSize="18"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="#E6E6E6"/>
|
||||
|
||||
<TextBlock Text="Impedimento: Nenhum"
|
||||
Margin="0,6,0,0"
|
||||
FontSize="12"
|
||||
Foreground="#B8B8B8"
|
||||
TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- ÁREA DO ROBÔ -->
|
||||
<Viewbox Grid.Row="1" Stretch="Uniform">
|
||||
<Grid Width="700" Height="820">
|
||||
<!-- fundo -->
|
||||
<Border CornerRadius="12"
|
||||
Background="#1A1A1A"
|
||||
BorderBrush="#2F2F2F"
|
||||
BorderThickness="1"/>
|
||||
|
||||
<!-- imagem do robô -->
|
||||
<Image Source="/Resources/robo_superior.jpg"
|
||||
Width="800"
|
||||
Height="750"
|
||||
Stretch="Uniform"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"/>
|
||||
|
||||
<!-- overlay com módulos -->
|
||||
<ItemsControl ItemsSource="{Binding DiagnosticoVM.DiagnosticoModulos}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<Canvas />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
|
||||
<ItemsControl.ItemContainerStyle>
|
||||
<Style TargetType="ContentPresenter">
|
||||
<Setter Property="Canvas.Left" Value="{Binding Left}" />
|
||||
<Setter Property="Canvas.Top" Value="{Binding Top}" />
|
||||
</Style>
|
||||
</ItemsControl.ItemContainerStyle>
|
||||
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Button Content="{Binding TextoExibicao}"
|
||||
Style="{StaticResource DiagnosticoModuloButtonStyle}"
|
||||
Background="{Binding BackgroundBrush}"
|
||||
Foreground="{Binding ForegroundBrush}"
|
||||
BorderBrush="{Binding BorderBrushColor}"
|
||||
BorderThickness="{Binding BorderThicknessValue}"
|
||||
Command="{Binding DataContext.DiagnosticoVM.SelecionarModuloCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Grid>
|
||||
</Viewbox>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- COLUNA DIREITA | DETALHES -->
|
||||
<Border Grid.Column="1"
|
||||
Margin="10,0,0,0"
|
||||
Padding="16"
|
||||
CornerRadius="10"
|
||||
Background="#202020"
|
||||
BorderBrush="#353535"
|
||||
BorderThickness="1">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- TÍTULO -->
|
||||
<StackPanel Grid.Row="0">
|
||||
<TextBlock Text="{Binding DiagnosticoVM.TituloModuloSelecionado}"
|
||||
FontSize="18"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="#E6E6E6"/>
|
||||
|
||||
<TextBlock Text="{Binding DiagnosticoVM.DescricaoModuloSelecionado}"
|
||||
Margin="0,6,0,0"
|
||||
FontSize="12"
|
||||
Foreground="#A8A8A8"
|
||||
TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- RESUMO -->
|
||||
<Border Grid.Row="1"
|
||||
Margin="0,14,0,12"
|
||||
Padding="12"
|
||||
Background="#181818"
|
||||
BorderBrush="#2F2F2F"
|
||||
BorderThickness="1"
|
||||
CornerRadius="8">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- LINHA 1 -->
|
||||
<WrapPanel Grid.Row="0" Margin="0,0,0,8">
|
||||
<Border Background="#2B2B2B" CornerRadius="6" Padding="8,4" Margin="0,0,8,8">
|
||||
<TextBlock Text="{Binding DiagnosticoVM.InfoModulo}"
|
||||
Foreground="#D8D8D8"
|
||||
FontSize="12"/>
|
||||
</Border>
|
||||
|
||||
<Border Background="#2B2B2B" CornerRadius="6" Padding="8,4" Margin="0,0,8,8">
|
||||
<TextBlock Text="{Binding DiagnosticoVM.InfoLabel}"
|
||||
Foreground="#D8D8D8"
|
||||
FontSize="12"/>
|
||||
</Border>
|
||||
|
||||
<Border Background="#2B2B2B" CornerRadius="6" Padding="8,4" Margin="0,0,8,8">
|
||||
<TextBlock Text="{Binding DiagnosticoVM.InfoSCode}"
|
||||
Foreground="#D8D8D8"
|
||||
FontSize="12"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- LINHA 2 -->
|
||||
<WrapPanel Grid.Row="1" Margin="0,0,0,8">
|
||||
<Border Background="#2B2B2B" CornerRadius="6" Padding="8,4" Margin="0,0,8,8">
|
||||
<TextBlock Text="{Binding DiagnosticoVM.InfoStatus}"
|
||||
Foreground="#D8D8D8"
|
||||
FontSize="12"/>
|
||||
</Border>
|
||||
|
||||
<Border Background="#2B2B2B" CornerRadius="6" Padding="8,4" Margin="0,0,8,8">
|
||||
<TextBlock Text="{Binding DiagnosticoVM.InfoSaude}"
|
||||
Foreground="#D8D8D8"
|
||||
FontSize="12"/>
|
||||
</Border>
|
||||
|
||||
<Border Background="#2B2B2B" CornerRadius="6" Padding="8,4" Margin="0,0,8,8">
|
||||
<TextBlock Text="{Binding DiagnosticoVM.InfoIniciado}"
|
||||
Foreground="#D8D8D8"
|
||||
FontSize="12"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- LINHA 3 -->
|
||||
<WrapPanel Grid.Row="2" Margin="0,0,0,8">
|
||||
<Border Background="#2B2B2B" CornerRadius="6" Padding="8,4" Margin="0,0,8,8">
|
||||
<TextBlock Text="{Binding DiagnosticoVM.InfoCan}"
|
||||
Foreground="#D8D8D8"
|
||||
FontSize="12"/>
|
||||
</Border>
|
||||
|
||||
<Border Background="#2B2B2B" CornerRadius="6" Padding="8,4" Margin="0,0,8,8">
|
||||
<TextBlock Text="{Binding DiagnosticoVM.InfoLatencia}"
|
||||
Foreground="#D8D8D8"
|
||||
FontSize="12"/>
|
||||
</Border>
|
||||
|
||||
<Border Background="#2B2B2B" CornerRadius="6" Padding="8,4" Margin="0,0,8,8">
|
||||
<TextBlock Text="{Binding DiagnosticoVM.InfoIdVisual}"
|
||||
Foreground="#D8D8D8"
|
||||
FontSize="12"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- LINHA 4 -->
|
||||
<TextBlock Grid.Row="3"
|
||||
Text="{Binding DiagnosticoVM.ImpedimentoModuloSelecionado}"
|
||||
Foreground="#C8C8C8"
|
||||
FontSize="12"
|
||||
TextWrapping="Wrap"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- AÇÕES -->
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" Margin="0,0,0,12">
|
||||
<CheckBox Content="Mandatório" Margin="0,0,14,0" Foreground="#D8D8D8" VerticalAlignment="Center" IsChecked="{Binding DiagnosticoVM.MandatorioSelecionado, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Content="Em uso" Margin="0,0,14,0" Foreground="#D8D8D8" VerticalAlignment="Center" IsChecked="{Binding DiagnosticoVM.EmUsoSelecionado, Mode=TwoWay}"/>
|
||||
|
||||
<Button Content="Salvar" Width="80" Height="28" Background="#2E5C8A" Foreground="White" BorderBrush="#4F7EAD" Command="{Binding DiagnosticoVM.SalvarSaudeCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- TABS -->
|
||||
<TabControl Grid.Row="3"
|
||||
Background="#181818"
|
||||
BorderBrush="#2F2F2F"
|
||||
Foreground="#DDDDDD">
|
||||
<TabItem Header="Condições Operacionais">
|
||||
<Grid Background="#181818">
|
||||
<ListBox ItemsSource="{Binding DiagnosticoVM.CondicoesOperacionais}" Margin="8" Background="#121212" Foreground="#DDDDDD" BorderBrush="#2D2D2D"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Acompanhamento">
|
||||
<Grid Background="#181818">
|
||||
<scott:WpfPlot x:Name="pltSaude_Acompanhamento" Margin="8"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Opções">
|
||||
<Grid Background="#181818">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
Padding="8">
|
||||
<Grid>
|
||||
|
||||
<!-- SEM DADOS -->
|
||||
<TextBlock Text="Nenhum teste disponível para este módulo."
|
||||
FontSize="12"
|
||||
Foreground="#A8A8A8"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
TextWrapping="Wrap"
|
||||
Visibility="{Binding DiagnosticoVM.OpcoesVM.MostrarOpcoesSemDados, Converter={StaticResource BoolToVisibilityConverter}}"/>
|
||||
|
||||
<!-- SENSORIAMENTO -->
|
||||
<StackPanel Visibility="{Binding DiagnosticoVM.OpcoesVM.MostrarOpcoesSensoriamento, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="Reinicia o módulo" Foreground="#DDDDDD"/>
|
||||
<Button Content="Reiniciar"
|
||||
Width="90"
|
||||
Margin="8,0,0,0"
|
||||
Command="{Binding DiagnosticoVM.OpcoesVM.SensoriamentoReiniciarCommand}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<!-- ATUADOR -->
|
||||
<StackPanel Visibility="{Binding DiagnosticoVM.OpcoesVM.MostrarOpcoesAtuador, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="Reinicia o módulo" Foreground="#DDDDDD"/>
|
||||
<Button Content="Reiniciar"
|
||||
Width="90"
|
||||
Margin="8,0,0,0"
|
||||
Command="{Binding DiagnosticoVM.OpcoesVM.AtuadorReiniciarCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="Altura" Foreground="#DDDDDD"/>
|
||||
<Slider Width="120"
|
||||
Margin="8,0"
|
||||
Minimum="50"
|
||||
Maximum="80"
|
||||
Value="{Binding DiagnosticoVM.OpcoesVM.BarraAltura, Mode=TwoWay}"/>
|
||||
<Label Content="{Binding DiagnosticoVM.OpcoesVM.BarraAlturaTexto}" Foreground="#DDDDDD"/>
|
||||
<Button Content="Mover"
|
||||
Width="60"
|
||||
Margin="8,0,0,0"
|
||||
Command="{Binding DiagnosticoVM.OpcoesVM.BarraMoverCommand}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<!-- BICO -->
|
||||
<StackPanel Visibility="{Binding DiagnosticoVM.OpcoesVM.MostrarOpcoesBico, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.BicoTitulo}"
|
||||
FontWeight="Bold"
|
||||
Foreground="#DDDDDD"
|
||||
Margin="0,0,0,8"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Content="Ligar"
|
||||
Width="80"
|
||||
Margin="0,0,5,0"
|
||||
Command="{Binding DiagnosticoVM.OpcoesVM.BicoLigarCommand}"/>
|
||||
<Button Content="Desligar"
|
||||
Width="80"
|
||||
Command="{Binding DiagnosticoVM.OpcoesVM.BicoDesligarCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
|
||||
<Label Content="Movimento" Foreground="#DDDDDD"/>
|
||||
<Slider Width="160"
|
||||
Margin="8,0"
|
||||
Minimum="-90"
|
||||
Maximum="90"
|
||||
Value="{Binding DiagnosticoVM.OpcoesVM.BicoAngulo, Mode=TwoWay}"/>
|
||||
<Label Content="{Binding DiagnosticoVM.OpcoesVM.BicoAnguloTexto}" Foreground="#DDDDDD"/>
|
||||
<Button Content="Mover"
|
||||
Width="60"
|
||||
Margin="8,0,0,0"
|
||||
Command="{Binding DiagnosticoVM.OpcoesVM.BicoMoverCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
|
||||
<Label Content="Ângulo abertura" Foreground="#DDDDDD"/>
|
||||
<TextBox Width="60"
|
||||
Margin="8,0"
|
||||
Text="{Binding DiagnosticoVM.OpcoesVM.BicoAnguloAbertura, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
<Button Content="Salvar"
|
||||
Width="60"
|
||||
Command="{Binding DiagnosticoVM.OpcoesVM.BicoSalvarAnguloAberturaCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock Text="Bico - Leituras"
|
||||
Foreground="#DDDDDD"
|
||||
FontWeight="SemiBold"
|
||||
Margin="0,10,0,4"/>
|
||||
|
||||
<UniformGrid Rows="2" Columns="3" Margin="0,0,0,0">
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Comando enviado" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtBicoComando}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Status real" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtBicoStatusReal}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Tempo ligado" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtBicoTempoLigado}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Vazão" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtBicoVazao}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Pressão" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtBicoPressao}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Atuações" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtBicoAtuacoes}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
|
||||
<!-- BOMBA -->
|
||||
<StackPanel Visibility="{Binding DiagnosticoVM.OpcoesVM.MostrarOpcoesBomba, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.BombaTitulo}"
|
||||
FontWeight="Bold"
|
||||
Foreground="#DDDDDD"
|
||||
Margin="0,0,0,8"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Content="Ligar"
|
||||
Width="80"
|
||||
Margin="0,0,5,0"
|
||||
Command="{Binding DiagnosticoVM.OpcoesVM.BombaLigarCommand}"/>
|
||||
<Button Content="Desligar"
|
||||
Width="80"
|
||||
Margin="0,0,10,0"
|
||||
Command="{Binding DiagnosticoVM.OpcoesVM.BombaDesligarCommand}"/>
|
||||
|
||||
<TextBlock Text="Pressão alvo:"
|
||||
VerticalAlignment="Center"
|
||||
Margin="0,0,5,0"
|
||||
FontSize="10"
|
||||
Foreground="#DDDDDD"/>
|
||||
|
||||
<Slider Width="120"
|
||||
Minimum="0"
|
||||
Maximum="150"
|
||||
Margin="0,0,5,0"
|
||||
Value="{Binding DiagnosticoVM.OpcoesVM.BombaPressaoAlvo, Mode=TwoWay}"/>
|
||||
|
||||
<Label Content="{Binding DiagnosticoVM.OpcoesVM.BombaPressaoAlvoTexto}"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="10"
|
||||
Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
|
||||
<UniformGrid Rows="2" Columns="2" Margin="0,10,0,0">
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Comando enviado" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtBombaComando}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Status real" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtBombaStatusReal}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Pressão linha" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtBombaPressaoLinha}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Potência" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtBombaPotencia}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
|
||||
<!-- DIRECIONAL -->
|
||||
<StackPanel Visibility="{Binding DiagnosticoVM.OpcoesVM.MostrarOpcoesDirecional, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.DirTitulo}"
|
||||
FontWeight="Bold"
|
||||
Foreground="#DDDDDD"
|
||||
Margin="0,0,0,8"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Content="Referenciar"
|
||||
Width="90"
|
||||
Margin="0,0,5,0"
|
||||
Command="{Binding DiagnosticoVM.OpcoesVM.DirReferenciarCommand}"/>
|
||||
|
||||
<Button Content="Mover"
|
||||
Width="80"
|
||||
Command="{Binding DiagnosticoVM.OpcoesVM.DirMovimentarCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
|
||||
<ComboBox Width="130"
|
||||
Margin="0,0,8,0"
|
||||
ItemsSource="{Binding DiagnosticoVM.OpcoesVM.DirMovimentosDisponiveis}"
|
||||
SelectedItem="{Binding DiagnosticoVM.OpcoesVM.DirMovimentoSelecionado, Mode=TwoWay}"/>
|
||||
|
||||
<ComboBox Width="130"
|
||||
Margin="0,0,8,0"
|
||||
ItemsSource="{Binding DiagnosticoVM.OpcoesVM.DirDirecoesDisponiveis}"
|
||||
SelectedItem="{Binding DiagnosticoVM.OpcoesVM.DirDirecaoSelecionada, Mode=TwoWay}"/>
|
||||
|
||||
<Slider Width="120"
|
||||
Minimum="0"
|
||||
Maximum="180"
|
||||
Margin="0,0,8,0"
|
||||
Value="{Binding DiagnosticoVM.OpcoesVM.DirAngulo, Mode=TwoWay}"/>
|
||||
|
||||
<Label Content="{Binding DiagnosticoVM.OpcoesVM.DirAnguloTexto}"
|
||||
Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
|
||||
<UniformGrid Rows="2" Columns="2" Margin="0,10,0,0">
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Sentido controle" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtDirSentidoSP}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Sentido real" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtDirSentido}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Ângulo controle" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtDirAnguloSP}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Ângulo real" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtDirAngulo}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
|
||||
<!-- GPS -->
|
||||
<StackPanel Visibility="{Binding DiagnosticoVM.OpcoesVM.MostrarOpcoesGps, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<TextBlock Text="Lever Arm"
|
||||
FontWeight="Bold"
|
||||
Foreground="#DDDDDD"
|
||||
Margin="0,0,0,8"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,8">
|
||||
<Label Content="Lateral" Foreground="#DDDDDD"/>
|
||||
<Slider Width="110"
|
||||
Minimum="-5"
|
||||
Maximum="5"
|
||||
Margin="8,0"
|
||||
Value="{Binding DiagnosticoVM.OpcoesVM.GpsLeverArmLateral, Mode=TwoWay}"/>
|
||||
<Label Content="{Binding DiagnosticoVM.OpcoesVM.GpsLeverArmLateralTexto}" Foreground="#DDDDDD" Margin="0,0,10,0"/>
|
||||
|
||||
<Label Content="Frontal" Foreground="#DDDDDD"/>
|
||||
<Slider Width="110"
|
||||
Minimum="-10"
|
||||
Maximum="10"
|
||||
Margin="8,0"
|
||||
Value="{Binding DiagnosticoVM.OpcoesVM.GpsLeverArmFrontal, Mode=TwoWay}"/>
|
||||
<Label Content="{Binding DiagnosticoVM.OpcoesVM.GpsLeverArmFrontalTexto}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
|
||||
<Button Content="Salvar"
|
||||
Width="80"
|
||||
Margin="0,0,0,8"
|
||||
Command="{Binding DiagnosticoVM.OpcoesVM.GpsSalvarCommand}"/>
|
||||
|
||||
<UniformGrid Rows="2" Columns="3">
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Correção" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtGpsCorrecao}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Idade" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtGpsIdade}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Precisão" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtGpsPrecisao}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Satélites" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtGpsNSatelites}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Distância base" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtGpsDistBase}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Orientação" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtGpsOrientacao}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
|
||||
<!-- TRAJETORIA -->
|
||||
<StackPanel Visibility="{Binding DiagnosticoVM.OpcoesVM.MostrarOpcoesTrajetoria, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<TextBlock Text="Status do trabalho"
|
||||
FontWeight="Bold"
|
||||
Foreground="#DDDDDD"
|
||||
Margin="0,0,0,8"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,8">
|
||||
<CheckBox Content="Bateria Liberada"
|
||||
Margin="0,0,12,0"
|
||||
Foreground="#DDDDDD"
|
||||
IsChecked="{Binding DiagnosticoVM.OpcoesVM.TrajetoriaBatLiberada, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Content="Pulverizador Liberado"
|
||||
Margin="0,0,12,0"
|
||||
Foreground="#DDDDDD"
|
||||
IsChecked="{Binding DiagnosticoVM.OpcoesVM.TrajetoriaHerbLiberado, Mode=TwoWay}"/>
|
||||
|
||||
<Button Content="Confirmar"
|
||||
Width="80"
|
||||
Command="{Binding DiagnosticoVM.OpcoesVM.TrajetoriaConfirmarCommand}"
|
||||
IsEnabled="{Binding DiagnosticoVM.OpcoesVM.TrajetoriaPodeConfirmar}"/>
|
||||
</StackPanel>
|
||||
|
||||
<UniformGrid Rows="2" Columns="3">
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Distância corredor" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtTrajetoriaDistCorredor}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Distância segura bateria" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtTrajetoriaDistBateria}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Distância segura pulverizador" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtTrajetoriaDistPulverizador}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Status" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtTrajetoriaStatus}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Bateria suficiente" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtTrajetoriaBatOk}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Herbicida suficiente" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtTrajetoriaHerbOk}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
|
||||
<!-- RELÉ -->
|
||||
<StackPanel Visibility="{Binding DiagnosticoVM.OpcoesVM.MostrarOpcoesRele, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.ReleTitulo}"
|
||||
FontWeight="Bold"
|
||||
Foreground="#DDDDDD"
|
||||
Margin="0,0,0,8"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Content="Ligar"
|
||||
Width="80"
|
||||
Margin="0,0,5,0"
|
||||
Command="{Binding DiagnosticoVM.OpcoesVM.ReleLigarCommand}"/>
|
||||
<Button Content="Desligar"
|
||||
Width="80"
|
||||
Command="{Binding DiagnosticoVM.OpcoesVM.ReleDesligarCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
<UniformGrid Rows="1" Columns="2" Margin="0,10,0,0">
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Comando enviado" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtReleComando}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Status real" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtReleStatusReal}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
|
||||
<!-- SERVO -->
|
||||
<StackPanel Visibility="{Binding DiagnosticoVM.OpcoesVM.MostrarOpcoesServo, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<TextBlock Text="Servo - Testes"
|
||||
FontWeight="Bold"
|
||||
Foreground="#DDDDDD"
|
||||
Margin="0,0,0,8"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="Controle" Foreground="#DDDDDD"/>
|
||||
<Slider Width="160"
|
||||
Margin="8,0"
|
||||
Minimum="0"
|
||||
Maximum="90"
|
||||
Value="{Binding DiagnosticoVM.OpcoesVM.ServoAngulo, Mode=TwoWay}"/>
|
||||
<Label Content="{Binding DiagnosticoVM.OpcoesVM.ServoAnguloTexto}" Foreground="#DDDDDD"/>
|
||||
<Button Content="Enviar"
|
||||
Width="80"
|
||||
Margin="8,0,0,0"
|
||||
Command="{Binding DiagnosticoVM.OpcoesVM.ServoEnviarCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
<UniformGrid Rows="1" Columns="3" Margin="0,10,0,0">
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Comando enviado" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtServoComando}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Status real" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtServoLeitura}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Modo" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtServoIncremental}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
|
||||
<!-- NPC -->
|
||||
<StackPanel Visibility="{Binding DiagnosticoVM.OpcoesVM.MostrarOpcoesNpc, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,8">
|
||||
<Label Content="Modo de Controle" Foreground="#DDDDDD"/>
|
||||
<ComboBox Width="120"
|
||||
Margin="8,0"
|
||||
ItemsSource="{Binding DiagnosticoVM.OpcoesVM.NpcCoolerModosDisponiveis}"
|
||||
SelectedItem="{Binding DiagnosticoVM.OpcoesVM.NpcCoolerModoSelecionado, Mode=TwoWay}"/>
|
||||
<CheckBox Content="Entrada"
|
||||
Margin="10,0,0,0"
|
||||
Foreground="#DDDDDD"
|
||||
IsChecked="{Binding DiagnosticoVM.OpcoesVM.NpcCoolerEntrada, Mode=TwoWay}"/>
|
||||
<CheckBox Content="Saída"
|
||||
Margin="10,0,0,0"
|
||||
Foreground="#DDDDDD"
|
||||
IsChecked="{Binding DiagnosticoVM.OpcoesVM.NpcCoolerSaida, Mode=TwoWay}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,8">
|
||||
<Label Content="Temperatura ligar" Foreground="#DDDDDD"/>
|
||||
<TextBox Width="50"
|
||||
Margin="8,0"
|
||||
Text="{Binding DiagnosticoVM.OpcoesVM.NpcCoolerTempOn, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
|
||||
<Label Content="Temperatura turbo" Foreground="#DDDDDD" Margin="12,0,0,0"/>
|
||||
<TextBox Width="50"
|
||||
Margin="8,0"
|
||||
Text="{Binding DiagnosticoVM.OpcoesVM.NpcCoolerTempTurbo, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
|
||||
<Button Content="Enviar"
|
||||
Width="80"
|
||||
Margin="10,0,0,0"
|
||||
Command="{Binding DiagnosticoVM.OpcoesVM.NpcCoolerEnviarCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
<UniformGrid Rows="2" Columns="2">
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Modo controle" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtNpcCoolerModo}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Temperatura" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtNpcCoolerTemperatura}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Cooler entrada" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtNpcCoolerEntrada}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Cooler saída" FontSize="10" Foreground="#AAAAAA"/>
|
||||
<TextBlock Text="{Binding DiagnosticoVM.OpcoesVM.TxtNpcCoolerSaida}" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Logs">
|
||||
<Grid Background="#181818">
|
||||
<ListBox ItemsSource="{Binding DiagnosticoVM.LogsModuloSelecionado}" Margin="8" Background="#121212" Foreground="#DDDDDD" BorderBrush="#2D2D2D"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<!-- MONITORAMENTO -->
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using OperationControl.Controls;
|
||||
using OperationControl.Models;
|
||||
using OperationControl.ViewModels.Views.Operacao;
|
||||
using OperationControl.ViewModels.Views.Operacao.Diagnostico;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace OperationControl.Views.Operacao
|
||||
|
|
@ -39,7 +40,8 @@ namespace OperationControl.Views.Operacao
|
|||
public void IniciarStreamCameraFrontal()
|
||||
{
|
||||
videoFront.Iniciar();
|
||||
VariaveisControleOperacao.EnviarComandoTransmissaoVideo(AgroBase.Models.Enums.T_Code.Snr, true, ((AgroBase.Models.Enums.TipoFrameCamera)cmbCameraFrontalFrameTipo.SelectedIndex));
|
||||
var t = ((AgroBase.Models.Enums.TipoFrameCamera)cmbCameraFrontalFrameTipo.SelectedIndex);
|
||||
VariaveisControleOperacao.EnviarComandoTransmissaoVideo(AgroBase.Models.Enums.T_Code.Snr, true, AgroBase.Models.Enums.TipoFrameCamera.Rgb);
|
||||
}
|
||||
|
||||
public void PararStreamCameraFrontal(bool finalizar = false)
|
||||
|
|
@ -84,5 +86,28 @@ namespace OperationControl.Views.Operacao
|
|||
_vm.ProcessarStreetMapClicked(e);
|
||||
}
|
||||
|
||||
public void AtualizarGraficoDiagnostico(DiagnosticoViewModel vm)
|
||||
{
|
||||
if (vm == null || pltSaude_Acompanhamento == null)
|
||||
return;
|
||||
|
||||
var plot = pltSaude_Acompanhamento.Plot;
|
||||
plot.Clear();
|
||||
|
||||
foreach (var serie in vm.SeriesGrafico)
|
||||
{
|
||||
if (serie.Valores.Count == 0)
|
||||
continue;
|
||||
|
||||
double[] ys = serie.Valores.ToArray();
|
||||
double[] xs = Enumerable.Range(0, ys.Length).Select(i => (double)i).ToArray();
|
||||
|
||||
plot.Add.Scatter(xs, ys);
|
||||
}
|
||||
|
||||
plot.Axes.AutoScale();
|
||||
pltSaude_Acompanhamento.Refresh();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1501,7 +1501,7 @@ namespace OperationControl.Windows
|
|||
return;
|
||||
|
||||
var _Trajetoria = VariaveisControleOperacao.RoverEmFoco?.DadosLeitura?.Trajetoria;
|
||||
int idx_corredor = (_Trajetoria?.PontoAtualIdx ?? 0);
|
||||
int idx_corredor = (_Trajetoria?.PontoAtualIdxCorredor ?? 0);
|
||||
bool bat_liberada = chbTrajetoria_BatLiberada.IsChecked ?? false;
|
||||
bool herb_liberado = chbTrajetoria_HerbLiberado.IsChecked ?? false;
|
||||
string motivo = _Trajetoria?.AutonomiaCorredor?.Motivo ?? "";
|
||||
|
|
|
|||
Loading…
Reference in New Issue