Modified the LX200 Classic connections, so that if a :GVP is returned when :GVP# is sent, it assumes an error. A timeout will be assumed to be an LX200 Classic.

This commit is contained in:
2019-10-12 12:40:01 +01:00
parent 7a92581fa8
commit 7f6f478dfc
2 changed files with 25 additions and 6 deletions
+24 -5
View File
@@ -231,11 +231,9 @@ namespace ASCOM.Meade.net
{
if (!ConnectedDevices.ContainsKey(deviceId))
ConnectedDevices.Add(deviceId, new DeviceHardware());
ConnectedDevices[deviceId].Count++; // increment the value
if (!ConnectedDeviceIds.ContainsKey(driverId))
ConnectedDeviceIds.Add(driverId, new DeviceHardware());
ConnectedDeviceIds[driverId].Count++; // increment the value
if (deviceId == "Serial")
{
@@ -252,10 +250,31 @@ namespace ASCOM.Meade.net
SharedSerial.Handshake = SerialHandshake.None;
SharedSerial.Connected = true;
ProductName = SendString(":GVP#");
FirmwareVersion = SendString(":GVN#");
try
{
ProductName = SendString(":GVP#");
FirmwareVersion = SendString(":GVN#");
}
catch (TimeoutException)
{
ProductName = TelescopeList.LX200CLASSIC;
FirmwareVersion = "Unknown";
}
if (ProductName == ":GVP")
{
//This means that the serial port is looping back what's been sent, something is very wrong.
SharedSerial.Connected = false;
throw new Exception("Serial port is looping back data, something is wrong with the hardware.");
}
}
}
else
throw new ArgumentException($"deviceId {deviceId} not currently supported");
ConnectedDevices[deviceId].Count++; // increment the value
ConnectedDeviceIds[driverId].Count++; // increment the value
return new ConnectionInfo
{
+1 -1
View File
@@ -27,7 +27,7 @@
#region LX200EMC
// ReSharper disable once InconsistentNaming
public static readonly string LX200CLASSIC = ":GVP"; //GVP command is not supported!
public static readonly string LX200CLASSIC = "LX200 Classic"; //GVP command is not supported!
#endregion
}
}