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:
@@ -231,11 +231,9 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
if (!ConnectedDevices.ContainsKey(deviceId))
|
if (!ConnectedDevices.ContainsKey(deviceId))
|
||||||
ConnectedDevices.Add(deviceId, new DeviceHardware());
|
ConnectedDevices.Add(deviceId, new DeviceHardware());
|
||||||
ConnectedDevices[deviceId].Count++; // increment the value
|
|
||||||
|
|
||||||
if (!ConnectedDeviceIds.ContainsKey(driverId))
|
if (!ConnectedDeviceIds.ContainsKey(driverId))
|
||||||
ConnectedDeviceIds.Add(driverId, new DeviceHardware());
|
ConnectedDeviceIds.Add(driverId, new DeviceHardware());
|
||||||
ConnectedDeviceIds[driverId].Count++; // increment the value
|
|
||||||
|
|
||||||
if (deviceId == "Serial")
|
if (deviceId == "Serial")
|
||||||
{
|
{
|
||||||
@@ -252,11 +250,32 @@ namespace ASCOM.Meade.net
|
|||||||
SharedSerial.Handshake = SerialHandshake.None;
|
SharedSerial.Handshake = SerialHandshake.None;
|
||||||
SharedSerial.Connected = true;
|
SharedSerial.Connected = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
ProductName = SendString(":GVP#");
|
ProductName = SendString(":GVP#");
|
||||||
FirmwareVersion = SendString(":GVN#");
|
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
|
return new ConnectionInfo
|
||||||
{
|
{
|
||||||
//Connections = ConnectedDevices[deviceId].Count,
|
//Connections = ConnectedDevices[deviceId].Count,
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#region LX200EMC
|
#region LX200EMC
|
||||||
// ReSharper disable once InconsistentNaming
|
// 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
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user