Added reverse direction feature

This commit is contained in:
2020-06-04 23:31:41 +01:00
parent 71ed5cc58b
commit 8d097fefe1
7 changed files with 86 additions and 28 deletions
+10 -3
View File
@@ -47,6 +47,9 @@ namespace ASCOM.Meade.net
private static string _comPort; // Variables to hold the currrent device configuration
private static int _backlashCompensation;
private static bool _reverseFocusDirection;
/// <summary>
/// Private variable to hold an ASCOM Utilities object
/// </summary>
@@ -339,7 +342,6 @@ namespace ASCOM.Meade.net
_tl.LogMessage("Move", position.ToString());
CheckConnected("Move");
//todo implement direction reverse
//todo implement dynamic braking
if (position < -MaxIncrement || position > MaxIncrement)
@@ -350,10 +352,14 @@ namespace ASCOM.Meade.net
if (position == 0)
return;
var direction = position > 0;
if (_reverseFocusDirection)
direction = !direction;
_sharedResourcesWrapper.Lock(() =>
{
MoveFocuser(position > 0, Math.Abs(position));
ApplyBacklashCompensation(position > 0);
MoveFocuser(direction, Math.Abs(position));
ApplyBacklashCompensation(direction);
//This gives the focuser time to physically stop.
_utilities.WaitForMilliseconds(1000);
});
@@ -559,6 +565,7 @@ namespace ASCOM.Meade.net
_tl.Enabled = profileProperties.TraceLogger;
_comPort = profileProperties.ComPort;
_backlashCompensation = profileProperties.BacklashCompensation;
_reverseFocusDirection = profileProperties.ReverseFocusDirection;
LogMessage("ReadProfile", $"Trace logger enabled: {_tl.Enabled}");
LogMessage("ReadProfile", $"Com Port: {_comPort}");