2010-12-18 18:23:09 -04:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
|
|
|
namespace ArducopterConfigurator.PresentationModels
|
|
|
|
{
|
2011-02-14 10:48:47 -04:00
|
|
|
public class CalibrationOffsetsDataVm : VmBase, IPresentationModel
|
2010-12-18 18:23:09 -04:00
|
|
|
{
|
2011-02-13 05:25:54 -04:00
|
|
|
public CalibrationOffsetsDataVm()
|
2010-12-18 18:23:09 -04:00
|
|
|
{
|
|
|
|
PropsInUpdateOrder = new[]
|
|
|
|
{
|
|
|
|
"GyroRollOffset",
|
|
|
|
"GyroPitchOffset",
|
|
|
|
"GyroYawOffset",
|
|
|
|
"AccelRollOffset",
|
|
|
|
"AccelPitchOffset",
|
|
|
|
"AccelZOffset"
|
|
|
|
};
|
|
|
|
|
|
|
|
RefreshCommand = new DelegateCommand(_ => RefreshValues());
|
|
|
|
UpdateCommand = new DelegateCommand(_ => UpdateValues());
|
|
|
|
}
|
|
|
|
|
|
|
|
public ICommand RefreshCommand { get; private set; }
|
|
|
|
|
|
|
|
public ICommand UpdateCommand { get; private set; }
|
|
|
|
|
2010-12-22 06:04:16 -04:00
|
|
|
public float GyroRollOffset { get; set; }
|
|
|
|
public float GyroPitchOffset { get; set; }
|
|
|
|
public float GyroYawOffset { get; set; }
|
2010-12-18 18:23:09 -04:00
|
|
|
|
2010-12-22 06:04:16 -04:00
|
|
|
public float AccelRollOffset { get; set; }
|
|
|
|
public float AccelPitchOffset { get; set; }
|
|
|
|
public float AccelZOffset { get; set; }
|
2010-12-18 18:23:09 -04:00
|
|
|
|
2011-02-13 05:25:54 -04:00
|
|
|
private void RefreshValues()
|
2010-12-18 18:23:09 -04:00
|
|
|
{
|
2011-02-13 05:25:54 -04:00
|
|
|
if (sendTextToApm != null)
|
|
|
|
sendTextToApm(this, new sendTextToApmEventArgs("J"));
|
2010-12-18 18:23:09 -04:00
|
|
|
}
|
|
|
|
|
2011-02-13 05:25:54 -04:00
|
|
|
public void UpdateValues()
|
2010-12-18 18:23:09 -04:00
|
|
|
{
|
2011-02-13 05:25:54 -04:00
|
|
|
if (sendTextToApm != null)
|
|
|
|
sendTextToApm(this, new sendTextToApmEventArgs(ComposePropsWithCommand("I")));
|
2010-12-18 18:23:09 -04:00
|
|
|
}
|
|
|
|
|
2011-02-13 05:25:54 -04:00
|
|
|
public string Name
|
2010-12-18 18:23:09 -04:00
|
|
|
{
|
2011-02-13 05:25:54 -04:00
|
|
|
get { return "Calibration"; }
|
2010-12-18 18:23:09 -04:00
|
|
|
}
|
|
|
|
|
2011-02-13 05:25:54 -04:00
|
|
|
public void Activate()
|
|
|
|
{
|
|
|
|
RefreshValues();
|
|
|
|
}
|
2010-12-18 18:23:09 -04:00
|
|
|
|
2011-02-13 05:25:54 -04:00
|
|
|
public void DeActivate()
|
2010-12-18 18:23:09 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-02-13 05:25:54 -04:00
|
|
|
public event EventHandler updatedByApm;
|
|
|
|
|
|
|
|
public void handleLineOfText(string strRx)
|
2010-12-18 18:23:09 -04:00
|
|
|
{
|
2011-02-13 05:25:54 -04:00
|
|
|
PopulatePropsFromUpdate(strRx, true);
|
2010-12-18 18:23:09 -04:00
|
|
|
}
|
2011-02-13 05:25:54 -04:00
|
|
|
|
|
|
|
public event EventHandler<sendTextToApmEventArgs> sendTextToApm;
|
2010-12-18 18:23:09 -04:00
|
|
|
}
|
|
|
|
}
|