Added support for CommandBlind and CommandString
Modified the tracking rates to be setable. However, the get is now simulated.
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
|
||||
@@ -163,16 +163,20 @@ namespace ASCOM.MeadeAutostar497
|
||||
|
||||
public void CommandBlind(string command, bool raw)
|
||||
{
|
||||
tl.LogMessage("CommandBlind", $"command={command} raw={raw}");
|
||||
|
||||
CheckConnected("CommandBlind");
|
||||
// Call CommandString and return as soon as it finishes
|
||||
//this.CommandString(command, raw);
|
||||
_telescopeController.CommandBlind(command, raw);
|
||||
// or
|
||||
throw new ASCOM.MethodNotImplementedException("CommandBlind");
|
||||
//throw new ASCOM.MethodNotImplementedException("CommandBlind");
|
||||
// DO NOT have both these sections! One or the other
|
||||
}
|
||||
|
||||
public bool CommandBool(string command, bool raw)
|
||||
{
|
||||
tl.LogMessage("CommandBool", $"command={command} raw={raw}");
|
||||
CheckConnected("CommandBool");
|
||||
string ret = CommandString(command, raw);
|
||||
// TODO decode the return string and return true or false
|
||||
@@ -183,11 +187,13 @@ namespace ASCOM.MeadeAutostar497
|
||||
|
||||
public string CommandString(string command, bool raw)
|
||||
{
|
||||
tl.LogMessage("CommandString", $"command={command} raw={raw}");
|
||||
// it's a good idea to put all the low level communication with the device here,
|
||||
// then all communication calls this function
|
||||
// you need something to ensure that only one command is in progress at a time
|
||||
CheckConnected("CommandString");
|
||||
throw new ASCOM.MethodNotImplementedException("CommandString");
|
||||
//throw new ASCOM.MethodNotImplementedException("CommandString");
|
||||
return _telescopeController.CommandString(command, raw);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@@ -455,8 +461,8 @@ namespace ASCOM.MeadeAutostar497
|
||||
{
|
||||
get
|
||||
{
|
||||
tl.LogMessage("CanSetTracking", "Get - " + false.ToString());
|
||||
return false;
|
||||
tl.LogMessage("CanSetTracking", "Get - " + true.ToString());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -876,19 +882,20 @@ namespace ASCOM.MeadeAutostar497
|
||||
}
|
||||
}
|
||||
|
||||
private bool _tracking = true;
|
||||
public bool Tracking
|
||||
{
|
||||
get
|
||||
{
|
||||
//todo implementing this, it exists.
|
||||
bool tracking = true;
|
||||
tl.LogMessage("Tracking", "Get - " + tracking.ToString());
|
||||
return tracking;
|
||||
|
||||
tl.LogMessage("Tracking", $"Get - {_tracking}" );
|
||||
return _tracking;
|
||||
}
|
||||
set
|
||||
{
|
||||
tl.LogMessage("Tracking Set", "Not implemented");
|
||||
throw new ASCOM.PropertyNotImplementedException("Tracking", true);
|
||||
tl.LogMessage($"Tracking Set", $"{value}");
|
||||
_tracking = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -902,8 +909,8 @@ namespace ASCOM.MeadeAutostar497
|
||||
}
|
||||
set
|
||||
{
|
||||
tl.LogMessage("TrackingRate Set", "Not implemented");
|
||||
throw new ASCOM.PropertyNotImplementedException("TrackingRate", true);
|
||||
tl.LogMessage("TrackingRate Set", $"{value}");
|
||||
_telescopeController.TrackingRate = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace ASCOM.MeadeAutostar497.Controller
|
||||
double Declination { get; }
|
||||
double TargetRightAscension { get; set; }
|
||||
double TargetDeclination { get; set; }
|
||||
DriveRates TrackingRate { get; }
|
||||
DriveRates TrackingRate { get; set; }
|
||||
int FocuserMaxIncrement { get; set; }
|
||||
int FocuserMaxStep { get; set; }
|
||||
void AbortSlew();
|
||||
@@ -36,5 +36,7 @@ namespace ASCOM.MeadeAutostar497.Controller
|
||||
void MoveAxis(TelescopeAxes axis, double rate);
|
||||
void FocuserHalt();
|
||||
void FocuserMove(int position);
|
||||
string CommandString(string command, bool raw);
|
||||
void CommandBlind(string command, bool raw);
|
||||
}
|
||||
}
|
||||
@@ -478,21 +478,23 @@ namespace ASCOM.MeadeAutostar497.Controller
|
||||
}
|
||||
}
|
||||
|
||||
private DriveRates _trackingRate = DriveRates.driveSidereal;
|
||||
public DriveRates TrackingRate
|
||||
{
|
||||
get
|
||||
{
|
||||
var result = SerialPort.CommandTerminated(":GT#", "#");
|
||||
//var result = SerialPort.CommandTerminated(":GT#", "#");
|
||||
|
||||
double rate = double.Parse(result);
|
||||
//double rate = double.Parse(result);
|
||||
|
||||
|
||||
if (rate == 60.1)
|
||||
return DriveRates.driveLunar;
|
||||
else if (rate == 60.1)
|
||||
return DriveRates.driveSidereal;
|
||||
//if (rate == 60.1)
|
||||
// return DriveRates.driveLunar;
|
||||
//else if (rate == 60.1)
|
||||
// return DriveRates.driveSidereal;
|
||||
|
||||
return DriveRates.driveKing;
|
||||
//return DriveRates.driveKing;
|
||||
return _trackingRate;
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -508,16 +510,20 @@ namespace ASCOM.MeadeAutostar497.Controller
|
||||
//:TL# Set Lunar Tracking Rage
|
||||
//Returns: Nothing
|
||||
break;
|
||||
case DriveRates.driveSolar:
|
||||
SerialPort.Command(":TS#");
|
||||
//:TS# Select Solar tracking rate. [LS Only]
|
||||
//Returns: Nothing
|
||||
break;
|
||||
//case DriveRates.driveSolar:
|
||||
// SerialPort.Command(":TS#");
|
||||
// //:TS# Select Solar tracking rate. [LS Only]
|
||||
// //Returns: Nothing
|
||||
// break;
|
||||
case DriveRates.driveKing:
|
||||
//:TM# Select custom tracking rate [ no-op in Autostar II]
|
||||
//Returns: Nothing
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(value), value, null);
|
||||
}
|
||||
|
||||
_trackingRate = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -872,6 +878,16 @@ namespace ASCOM.MeadeAutostar497.Controller
|
||||
}
|
||||
}
|
||||
|
||||
public string CommandString(string command, bool raw)
|
||||
{
|
||||
return SerialPort.CommandTerminated(command, "#");
|
||||
}
|
||||
|
||||
public void CommandBlind(string command, bool raw)
|
||||
{
|
||||
SerialPort.Command(command);
|
||||
}
|
||||
|
||||
private void MoveFocuser(bool directionOut, int steps)
|
||||
{
|
||||
SerialPort.Command(directionOut ? ":F+#" : ":F-#");
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<RegisterForComInterop>true</RegisterForComInterop>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
|
||||
Reference in New Issue
Block a user