Added 5 second timeout for the serial port.

Fixed problem with the GW command not working on the Autostar 497.
This commit is contained in:
2019-05-02 18:45:18 +01:00
parent ae4ba48ce2
commit 7df8da2f59
4 changed files with 180 additions and 179 deletions
@@ -262,7 +262,9 @@ namespace ASCOM.MeadeAutostar497.Controller
{
get
{
var alignmentString = SerialPort.CommandTerminated(":GW#", "#");
char ack = (char)6;
//var alignmentString = SerialPort.CommandTerminated(":GW#", "#");
var alignmentString = SerialPort.CommandChar(ack.ToString());
//:GW# Get Scope Alignment Status
//Returns: <mount><tracking><alignment>#
// where:
@@ -270,13 +272,13 @@ namespace ASCOM.MeadeAutostar497.Controller
//tracking: T - tracking, N - not tracking
//alignment: 0 - needs alignment, 1 - one star aligned, 2 - two star aligned, 3 - three star aligned.
switch (alignmentString[0])
switch (alignmentString)
{
case 'A': return AlignmentModes.algAltAz;
case 'P': return AlignmentModes.algPolar;
case 'G': return AlignmentModes.algGermanPolar;
default:
throw new ASCOM.InvalidValueException($"unknown alignment returned from telescope: {alignmentString[0]}");
throw new ASCOM.InvalidValueException($"unknown alignment returned from telescope: {alignmentString}");
}
}
set