2010-12-18 18:23:09 -04:00
|
|
|
namespace ArducopterConfigurator.PresentationModels
|
|
|
|
{
|
2010-12-22 06:04:16 -04:00
|
|
|
/// <summary>
|
|
|
|
/// Vm for Altitude hold settings
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// Todo: this one is weird because the APM sends and receives the values
|
|
|
|
/// in a different order
|
|
|
|
/// There is a unit test to cover it but it will need fixing.
|
|
|
|
/// </remarks>
|
2010-12-18 18:23:09 -04:00
|
|
|
public class AltitudeHoldConfigVm : MonitorVm
|
|
|
|
{
|
2010-12-20 18:14:39 -04:00
|
|
|
public AltitudeHoldConfigVm(IComms sp)
|
2010-12-18 18:23:09 -04:00
|
|
|
: base(sp)
|
|
|
|
{
|
|
|
|
PropsInUpdateOrder = new[] { "P", "I", "D", };
|
|
|
|
|
|
|
|
RefreshCommand = new DelegateCommand(_ => RefreshValues());
|
|
|
|
UpdateCommand = new DelegateCommand(_ => UpdateValues());
|
|
|
|
}
|
|
|
|
|
|
|
|
public ICommand RefreshCommand { get; private set; }
|
|
|
|
public ICommand UpdateCommand { get; private set; }
|
|
|
|
|
2010-12-20 18:14:39 -04:00
|
|
|
public float P { get; set; }
|
|
|
|
public float I { get; set; }
|
|
|
|
public float D { get; set; }
|
2010-12-18 18:23:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
private void RefreshValues()
|
|
|
|
{
|
|
|
|
SendString("F");
|
|
|
|
}
|
|
|
|
|
|
|
|
public void UpdateValues()
|
|
|
|
{
|
|
|
|
SendPropsWithCommand("E");
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void OnActivated()
|
|
|
|
{
|
|
|
|
RefreshValues();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void OnStringReceived(string strReceived)
|
|
|
|
{
|
|
|
|
PopulatePropsFromUpdate(strReceived,true);
|
|
|
|
}
|
|
|
|
|
|
|
|
public override string Name
|
|
|
|
{
|
|
|
|
get { return "Altitude Hold"; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|