ajustes lever arm

This commit is contained in:
Diego Freitas 2026-07-03 16:25:38 -03:00
parent 357014b10a
commit 66ad55aeb3
2 changed files with 51 additions and 14 deletions

View File

@ -2478,17 +2478,43 @@ namespace AgroBase.Models
return;
}
double? laLateral = lever.Item1;
double? laFrontal = lever.Item2;
double? totalLateralCm = lever.Item1;
double? totalFrontalCm = lever.Item2;
if (laLateral == null && laFrontal == null)
if (totalLateralCm == null && totalFrontalCm == null)
return;
double totalAtualLateralCm =
GPSService.LeverArm?.LateralTotalCm ??
VariaveisEquipamento.LeverArmLateralCm;
double totalAtualFrontalCm =
GPSService.LeverArm?.FrontalTotalCm ??
VariaveisEquipamento.LeverArmFrontalCm;
double novoTotalLateralCm =
totalLateralCm ?? totalAtualLateralCm;
double novoTotalFrontalCm =
totalFrontalCm ?? totalAtualFrontalCm;
double campoLateralCm =
novoTotalLateralCm - VariaveisEquipamento.LeverArmLateralCm;
double campoFrontalCm =
novoTotalFrontalCm - VariaveisEquipamento.LeverArmFrontalCm;
Variaveis.MostrarLog(
$"[ComandoBase][LeverArm] Total RX: frontal={novoTotalFrontalCm:0.##}cm, lateral={novoTotalLateralCm:0.##}cm | " +
$"Fisico: frontal={VariaveisEquipamento.LeverArmFrontalCm:0.##}cm, lateral={VariaveisEquipamento.LeverArmLateralCm:0.##}cm | " +
$"Campo: frontal={campoFrontalCm:0.##}cm, lateral={campoLateralCm:0.##}cm"
);
GPSService.LeverArm = new GeoLeverArm(
offsetFisicoFrontalCm: VariaveisEquipamento.LeverArmFrontalCm,
offsetFisicoLateralCm: VariaveisEquipamento.LeverArmLateralCm,
offsetCampoFrontalCm: laFrontal ?? 0,
offsetCampoLateralCm: laLateral ?? 0
offsetCampoFrontalCm: campoFrontalCm,
offsetCampoLateralCm: campoLateralCm
);
}

View File

@ -201,12 +201,16 @@ namespace OperationControl.ViewModels.Views.Operacao.Monitoramento.Diagnostico
set
{
if (SetProperty(ref _gpsLeverArmLateral, value))
GpsLeverArmLateralTexto = $"{value * 10.0:00} cm";
GpsLeverArmLateralTexto = $"{value:0.##} cm";
}
}
private string _gpsLeverArmLateralTexto = "00 cm";
public string GpsLeverArmLateralTexto { get => _gpsLeverArmLateralTexto; set => SetProperty(ref _gpsLeverArmLateralTexto, value); }
private string _gpsLeverArmLateralTexto = "0 cm";
public string GpsLeverArmLateralTexto
{
get => _gpsLeverArmLateralTexto;
set => SetProperty(ref _gpsLeverArmLateralTexto, value);
}
private double _gpsLeverArmFrontal;
public double GpsLeverArmFrontal
@ -215,12 +219,16 @@ namespace OperationControl.ViewModels.Views.Operacao.Monitoramento.Diagnostico
set
{
if (SetProperty(ref _gpsLeverArmFrontal, value))
GpsLeverArmFrontalTexto = $"{value * 10.0:00} cm";
GpsLeverArmFrontalTexto = $"{value:0.##} cm";
}
}
private string _gpsLeverArmFrontalTexto = "00 cm";
public string GpsLeverArmFrontalTexto { get => _gpsLeverArmFrontalTexto; set => SetProperty(ref _gpsLeverArmFrontalTexto, value); }
private string _gpsLeverArmFrontalTexto = "0 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); }
@ -617,8 +625,8 @@ namespace OperationControl.ViewModels.Views.Operacao.Monitoramento.Diagnostico
TxtGpsOrientacao = $"{dados?.OrientacaoReal ?? 0}";
if (clicado)
{
GpsLeverArmLateral = (dados?.LeverArmLateral ?? 0) / 10.0;
GpsLeverArmFrontal = (dados?.LeverArmFrontal ?? 0) / 10.0;
GpsLeverArmLateral = (dados?.LeverArmLateral ?? 0);
GpsLeverArmFrontal = (dados?.LeverArmFrontal ?? 0);
}
}
@ -810,7 +818,10 @@ namespace OperationControl.ViewModels.Views.Operacao.Monitoramento.Diagnostico
{
if (MessageBox.Show("Tem certeza que deseja redefinir o lever arm do GNSS?", "Lever Arm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
VariaveisControleOperacao.EnviarComandoLeverArm(lateral: GpsLeverArmLateral * 10.0, frontal: GpsLeverArmFrontal * 10.0);
VariaveisControleOperacao.EnviarComandoLeverArm(
lateral: GpsLeverArmLateral,
frontal: GpsLeverArmFrontal
);
}
}