Compare commits

...

54 Commits

Author SHA1 Message Date
ColinD 5c2bd21f1e Merged in develop (pull request #42)
1.3.4
2022-05-14 12:12:54 +00:00
ColinD 39a6bfca80 Merged in feature/LX200ClassicPark (pull request #41)
Feature/LX200ClassicPark
2022-05-14 12:08:17 +00:00
ColinD f551081454 LX200 Park unit test added. 2022-05-14 12:57:00 +01:00
ColinD 5c362a5a9a Changed how the part position is calculated. 2022-05-10 11:39:40 +01:00
ColinD abb985559e Upgraded error trapping for all the public methods in the driver. 2022-05-09 20:06:01 +01:00
ColinD ddd6178416 Removed side of pier set that isn't needed. 2022-05-09 14:57:40 +01:00
ColinD 356377ce36 Removed the requirement for GW Support when trying to set the alignment mode. 2022-05-09 12:09:59 +01:00
ColinD 1b220334d6 Added a general try catch to the UnPark method. 2022-05-08 15:31:56 +01:00
ColinD bb54356b58 Added more loggins to the unparking process 2022-05-08 15:22:04 +01:00
ColinD ebca231d9a Made sure that the alignment mode is preserved when parked, across sessions. 2022-05-08 15:15:30 +01:00
ColinD 2b5205d9c5 I think this will allow the LX200Classic to unpark 2022-05-08 14:46:53 +01:00
ColinD 81d2b98bfe Added ability to unpark the LX200 Classic 2022-05-08 14:30:39 +01:00
ColinD 9ee6adf063 Merge remote-tracking branch 'origin/feature/LX200ClassicPark' into feature/LX200ClassicPark
# Conflicts:
#	Meade.net/SharedResources.cs
2022-05-08 13:01:49 +01:00
ColinD 554b1af082 Maybe this is what's missing to get the telescope to park 2022-05-08 13:00:05 +01:00
ColinD 70f72e3df7 Upgraded the align mode command to have a retry and added support for land mode. 2022-05-08 13:00:05 +01:00
ColinD 3af02920c4 Added more logging to DoSlewAsync, Added a retry to the AltAz Slew. 2022-05-08 13:00:05 +01:00
ColinD ede7c33302 Added Alt Az coordinates to the connected message. 2022-05-08 13:00:05 +01:00
ColinD 9866578cab Added more error checks for connected, and found a couple of logic holds in the code that sets the IsConnected property. 2022-05-08 12:58:28 +01:00
ColinD d9093635de Added a log message for when connected check fails. 2022-05-08 12:58:27 +01:00
ColinD 885edba1c5 Removed the AL command as I think it's failing 2022-05-08 12:58:27 +01:00
ColinD 1949c50764 Modified the deubgging information. 2022-05-08 12:58:27 +01:00
ColinD 2b7d12fac9 Added some debugging messages 2022-05-08 12:58:26 +01:00
ColinD f168acc90b Added work around for LX200 classed to be able to turn tracking off when parking. 2022-05-08 12:58:26 +01:00
ColinD 8f6ea33139 Changes LX200 Park to use Alt 0 Az 0. i.e. Pointing level and North 2022-05-08 12:58:26 +01:00
ColinD c6f938bd5c Merge remote-tracking branch 'origin/feature/LX200ClassicPark' into feature/LX200ClassicPark 2022-05-08 12:58:25 +01:00
ColinD c271f0c4d3 New Park routine for the LX-200 Classic, uses the same technique as the 5.0.4 driver. 2022-05-08 12:58:25 +01:00
ColinD 35a76fe52c Merged in feature/PortSpeed (pull request #40)
Feature/PortSpeed

* Added support for changing the speed of the autostar

* Added support for changing the speed of the autostar

* Merge remote-tracking branch 'origin/feature/PortSpeed' into feature/PortSpeed

* Upgraded unit testing to make sure that speed changes are properly tested
2022-05-08 11:52:45 +00:00
ColinD 64e42f961c Maybe this is what's missing to get the telescope to park 2022-05-07 19:37:16 +01:00
ColinD 8eb093c13a Upgraded the align mode command to have a retry and added support for land mode. 2022-05-07 18:09:37 +01:00
ColinD a204f9c57f Added more logging to DoSlewAsync, Added a retry to the AltAz Slew. 2022-05-07 16:54:22 +01:00
ColinD 700802033b Added Alt Az coordinates to the connected message. 2022-05-07 14:00:29 +01:00
ColinD 350dd23ed1 Added more error checks for connected, and found a couple of logic holds in the code that sets the IsConnected property. 2022-05-07 12:22:46 +01:00
ColinD 5e65ea7946 Added a log message for when connected check fails. 2022-05-07 12:15:45 +01:00
ColinD 0c70688b60 Removed the AL command as I think it's failing 2022-05-07 10:00:57 +01:00
ColinD af3cca7611 Modified the deubgging information. 2022-05-06 21:31:12 +01:00
ColinD ef498fc5a0 Added some debugging messages 2022-05-06 20:09:40 +01:00
ColinD ceca3a15dc Added work around for LX200 classed to be able to turn tracking off when parking. 2022-05-06 13:39:34 +01:00
ColinD a9b8a60e43 Changes LX200 Park to use Alt 0 Az 0. i.e. Pointing level and North 2022-05-06 12:14:24 +01:00
ColinD 7a85f7ca9e Merge remote-tracking branch 'origin/feature/LX200ClassicPark' into feature/LX200ClassicPark 2022-05-05 21:50:28 +01:00
ColinD 57c5a34fe2 New Park routine for the LX-200 Classic, uses the same technique as the 5.0.4 driver. 2022-05-05 21:50:13 +01:00
ColinD a68e86d8cd Added unit tests for long duration pulse guides. 2022-05-05 20:56:18 +01:00
ColinD 503eec38a3 Added check to ensure that telescope is in Polar Mode when attempting to PulseGuide. CanPulseGuide also fails when scope is in AltAz mode. 2022-05-05 20:40:51 +01:00
ColinD ed54487a88 New Park routine for the LX-200 Classic, uses the same technique as the 5.0.4 driver. 2022-05-05 18:55:38 +01:00
ColinD f788320927 Refactor to use ProfileProperties instead of assigning individual variables.
Added support for ApertureArea and ApertureDiameter
2022-05-03 21:57:25 +01:00
ColinD dc68bb0b4c Added Focal Length property to telescope setup screen 2022-04-28 23:55:35 +01:00
ColinD 1a66f41d78 Add support for the IsGuiding function 2022-04-28 23:20:56 +01:00
ColinD 826f887bdf Added mossing file 2021-12-17 13:16:20 +00:00
ColinD 7ac3c95c8e modified the get tracking code to make it less better. amd more tolerant of lunar speeds, taken from Nasa and other sources (Info from David Richards) 2021-12-17 13:11:32 +00:00
ColinD acb1533f21 Upgraded the tracking rate detection, now detects solar, lunar and sidereal better than before. 2021-12-15 20:23:46 +00:00
ColinD eda3a53d6f Added logging to MoxingAxis call to see if a telescope axis is moving 2021-12-13 14:09:16 +00:00
ColinD 6786db65fe Overridden the alignment status ToString to help with logging 2021-12-13 12:58:40 +00:00
ColinD df7dfb7c04 Modified the implementation of side of pier support detection. Hopefully will now,
Added extra checking to ensure that a slew cannot be started whilst a slew is in progress.
2021-12-11 19:10:18 +00:00
ColinD 771e325067 Merged in develop (pull request #39)
Removed unneeded lock and will cause a lock recursion and break things.
2021-10-18 17:56:27 +00:00
ColinD a5a3bd5bd4 Removed unneeded lock and will cause a lock recursion and break things. 2021-10-14 13:50:24 +01:00
18 changed files with 3419 additions and 1439 deletions
@@ -42,8 +42,6 @@ namespace Meade.net.Focuser.UnitTests
_sharedResourcesWrapperMock = new Mock<ISharedResourcesWrapper>();
_sharedResourcesWrapperMock.Setup(x => x.Lock(It.IsAny<Action>())).Callback<Action>(action => { action(); });
_sharedResourcesWrapperMock.Setup(x => x.ReadProfile()).Returns(() => _profileProperties);
_focuser = new ASCOM.Meade.net.Focuser(_utilMock.Object, _sharedResourcesWrapperMock.Object);
@@ -422,8 +420,6 @@ namespace Meade.net.Focuser.UnitTests
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F+", false), Times.Once);
}
_sharedResourcesWrapperMock.Verify(x => x.Lock(It.IsAny<Action>()), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(position)), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(_profileProperties.BacklashCompensation)), Times.Never);
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Once());
@@ -455,8 +451,6 @@ namespace Meade.net.Focuser.UnitTests
_utilMock.Verify(x => x.WaitForMilliseconds(_profileProperties.BacklashCompensation), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Exactly(2));
}
_sharedResourcesWrapperMock.Verify(x => x.Lock(It.IsAny<Action>()), Times.Once);
}
[Test]
@@ -18,12 +18,13 @@ namespace Meade.net.Telescope.UnitTests
{
public class TestProperties
{
public string AlignmentMode { get; internal set; } = "P";
internal string telescopeRaResult { get; set; } = "HH:MM:SS";
internal double rightAscension { get; set; } = 1.2; //todo rename to declination;
internal double declination { get; set; } = 45;
internal string SiteLatitudeString { get; set; } = "testLatString";
internal double SiteLatitudeValue { get; set; } = 123.45;
internal double SiteLatitudeValue { get; set; } = 12.45;
internal string telescopeDate { get; set; } = "10/15/20";
internal string telescopeTime { get; set; } = "20:15:10";
@@ -57,6 +58,7 @@ namespace Meade.net.Telescope.UnitTests
private bool _isParked;
private ParkedPosition _parkedPosition;
private string _siderealTrackingRate;
private bool _restartTracking;
[SetUp]
public void Setup()
@@ -84,7 +86,8 @@ namespace Meade.net.Telescope.UnitTests
SendDateTime = false,
ParkedBehaviour = ParkedBehaviour.NoCoordinates,
ParkedAlt = 0,
ParkedAz = 180
ParkedAz = 180,
FocalLength = 2000
};
_utilMock = new Mock<IUtil>();
@@ -95,9 +98,6 @@ namespace Meade.net.Telescope.UnitTests
_sharedResourcesWrapperMock.Setup(x => x.SendString("GZ", false)).Returns("DDD*MMSS");
_sharedResourcesWrapperMock.Setup(x => x.ReadProfile()).Returns(() =>_profileProperties);
_sharedResourcesWrapperMock.Setup(x => x.Lock(It.IsAny<Action>())).Callback<Action>(action => { action(); });
_sharedResourcesWrapperMock.Setup(x => x.Lock(It.IsAny<Func<ASCOM.Meade.net.Telescope.TelescopeDateDetails>>())).Returns<Func<ASCOM.Meade.net.Telescope.TelescopeDateDetails>>( func => func());
_sharedResourcesWrapperMock.Setup(x => x.Lock(It.IsAny<Func<AltitudeData>>())).Returns<Func<AltitudeData>>(func => func());
_connectionInfo = new ConnectionInfo
{
@@ -131,6 +131,7 @@ namespace Meade.net.Telescope.UnitTests
_testProperties.AlignmentStatus = alignmentStatus.ToCharArray();
_sharedResourcesWrapperMock.Setup(x => x.SendChars("GW", false, 3)).Returns(() => new string(_testProperties.AlignmentStatus));
_sharedResourcesWrapperMock.Setup(x => x.SendString("GW", false)).Returns(() => new string(_testProperties.AlignmentStatus));
_sharedResourcesWrapperMock.Setup(x => x.SendBlind("AP", false)).Callback(() => _testProperties.AlignmentStatus[1] = 'T');
_sharedResourcesWrapperMock.Setup(x => x.SendBlind("AL", false)).Callback(() => _testProperties.AlignmentStatus[1] = 'N');
@@ -146,17 +147,21 @@ namespace Meade.net.Telescope.UnitTests
_testProperties.TrackingRate = _siderealTrackingRate;
_sharedResourcesWrapperMock.Setup(x => x.SendString("GT", false)).Returns(() => _testProperties.TrackingRate);
_sharedResourcesWrapperMock.Setup(x => x.SendBlind("TL", false)).Callback(() => _testProperties.TrackingRate = "lunar");
_sharedResourcesWrapperMock.Setup(x => x.SendBlind("TL", false)).Callback(() => _testProperties.TrackingRate = "57.9");
_sharedResourcesWrapperMock.Setup(x => x.SendBlind("TQ", false)).Callback(() => _testProperties.TrackingRate = _siderealTrackingRate);
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => productName);
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => firmwareVersion);
_sharedResourcesWrapperMock.Setup(x => x.SetParked(It.IsAny<bool>(), It.IsAny<ParkedPosition>())).Callback<bool,ParkedPosition>((isParked, parkedPostion) => {
_sharedResourcesWrapperMock.Setup(x => x.SetParked(It.IsAny<bool>(), It.IsAny<ParkedPosition>(), It.IsAny<bool>())).Callback<bool,ParkedPosition,bool>((isParked, parkedPostion, restartTracking) => {
_isParked = isParked;
_parkedPosition = parkedPostion;
_restartTracking = restartTracking;
});
const char ack = (char)6;
_sharedResourcesWrapperMock.Setup(x => x.SendChar(ack.ToString(), false)).Returns( () => _testProperties.AlignmentMode);
_sharedResourcesWrapperMock.SetupGet(x => x.IsParked).Returns(() => _isParked);
_sharedResourcesWrapperMock.SetupGet(x => x.ParkedPosition).Returns(() => _parkedPosition);
@@ -219,9 +224,7 @@ namespace Meade.net.Telescope.UnitTests
{
string expectedResult = "test result string";
_sharedResourcesWrapperMock.Setup(x => x.SendString("ED", false)).Returns(expectedResult);
_telescope.Connected = true;
ConnectTelescope();
var actualResult = _telescope.Action("handbox", "readdisplay");
@@ -477,7 +480,7 @@ namespace Meade.net.Telescope.UnitTests
if (expectedConnected)
{
_sharedResourcesWrapperMock.Verify(x => x.SendString("GZ", false), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendString("GZ", false), Times.AtLeastOnce);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"Rg{_profileProperties.GuideRateArcSecondsPerSecond:00.0}", false), Times.Never);
}
}
@@ -488,7 +491,7 @@ namespace Meade.net.Telescope.UnitTests
ConnectTelescope(TelescopeList.LX200GPS, string.Empty);
_sharedResourcesWrapperMock.Verify(x => x.Connect("Serial", It.IsAny<string>(), It.IsAny<ITraceLogger>()), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendString("GZ", false), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendString("GZ", false), Times.AtLeastOnce);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"Rg{_profileProperties.GuideRateArcSecondsPerSecond:00.0}", false), Times.Once);
}
@@ -638,12 +641,9 @@ namespace Meade.net.Telescope.UnitTests
public void IsNewPulseGuidingSupported_ThenIsSupported_ThenReturnsTrue(string guidingStyle, string productName, string firmware, bool isSupported)
{
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(productName);
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(firmware);
_profileProperties.GuidingStyle = guidingStyle;
_telescope.Connected = true;
ConnectTelescope(productName, firmware);
var result = _telescope.IsNewPulseGuidingSupported();
@@ -798,9 +798,7 @@ namespace Meade.net.Telescope.UnitTests
[TestCase("G", AlignmentModes.algGermanPolar, TelescopeList.Autostar497, TelescopeList.Autostar497_43Eg)]
public void AlignmentMode_Get_WhenScopeInAltAz_ReturnsAltAz(string telescopeMode, AlignmentModes alignmentMode, string productName, string firmware)
{
const char ack = (char)6;
_sharedResourcesWrapperMock.Setup(x => x.SendChar(ack.ToString(), false)).Returns(telescopeMode);
_testProperties.AlignmentMode = telescopeMode;
ConnectTelescope(productName, firmware, $"{telescopeMode}N0");
var actualResult = _telescope.AlignmentMode;
@@ -813,6 +811,8 @@ namespace Meade.net.Telescope.UnitTests
{
ConnectTelescope();
_testProperties.AlignmentMode = "";
Assert.Throws<InvalidValueException>(() =>
{
var actualResult = _telescope.AlignmentMode;
@@ -832,52 +832,38 @@ namespace Meade.net.Telescope.UnitTests
[TestCase(TelescopeList.Autostar497, TelescopeList.Autostar497_43Eg, AlignmentModes.algGermanPolar, "AP")]
public void AlignmentMode_Set_WhenConnected_ThenSendsExpectedCommand(string productName, string firmware, AlignmentModes alignmentMode, string expectedCommand)
{
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(productName);
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(firmware);
_telescope.Connected = true;
ConnectTelescope(productName, firmware);
_telescope.AlignmentMode = alignmentMode;
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(expectedCommand, false), Times.Once);
}
[TestCase("AUTOSTAR", "43Ef")]
public void AlignmentMode_Set_WhenAutostarFirmwareToLow_ThenThrowsException(string productName, string firmware)
{
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(productName);
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(firmware);
_telescope.Connected = true;
//[TestCase(TelescopeList.Autostar497, "43Ef")]
//public void AlignmentMode_Set_WhenAutostarFirmwareToLow_ThenThrowsException(string productName, string firmware)
//{
// ConnectTelescope(productName, firmware);
var excpetion = Assert.Throws<PropertyNotImplementedException>(() => _telescope.AlignmentMode = AlignmentModes.algAltAz);
// var excpetion = Assert.Throws<PropertyNotImplementedException>(() => _telescope.AlignmentMode = AlignmentModes.algAltAz);
Assert.That(excpetion.Property, Is.EqualTo("AlignmentMode"));
Assert.That(excpetion.AccessorSet, Is.True);
}
// Assert.That(excpetion.Property, Is.EqualTo("AlignmentMode"));
// Assert.That(excpetion.AccessorSet, Is.True);
//}
[Test]
public void ApertureArea_Get_ThrowsNotImplementedException()
public void ApertureArea_Get_ReturnsExpectedResult()
{
var excpetion = Assert.Throws<PropertyNotImplementedException>(() =>
{
var result = _telescope.ApertureArea;
Assert.Fail($"{result} should not have returned");
});
var result = _telescope.ApertureArea;
Assert.That(excpetion.Property, Is.EqualTo("ApertureArea"));
Assert.That(excpetion.AccessorSet, Is.False);
Assert.That(result, Is.EqualTo(_profileProperties.ApertureArea / 1000));
}
[Test]
public void ApertureDiameter_Get_ThrowsNotImplementedException()
{
var excpetion = Assert.Throws<PropertyNotImplementedException>(() =>
{
var result = _telescope.ApertureDiameter;
Assert.Fail($"{result} should not have returned");
});
var result = _telescope.ApertureDiameter;
Assert.That(excpetion.Property, Is.EqualTo("ApertureDiameter"));
Assert.That(excpetion.AccessorSet, Is.False);
Assert.That(result, Is.EqualTo(_profileProperties.ApertureDiameter / 1000));
}
[Test]
@@ -944,13 +930,25 @@ namespace Meade.net.Telescope.UnitTests
}
[Test]
public void CanPulseGuide_Get_ReturnsTrue()
public void CanPulseGuide_GetInPolarMode_ReturnsTrue()
{
_testProperties.AlignmentMode = "P";
ConnectTelescope();
var result = _telescope.CanPulseGuide;
Assert.That(result, Is.True);
}
[Test]
public void CanPulseGuide_GetInAltAzMode_ReturnsFalse()
{
_testProperties.AlignmentMode = "A";
ConnectTelescope();
var result = _telescope.CanPulseGuide;
Assert.That(result, Is.False);
}
[Test]
public void CanSetDeclinationRate_Get_ReturnsFalse()
{
@@ -983,9 +981,7 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void CanSetGuideRates_Get_WhenConnectedToLX200GPS_ThenReturnsTrue()
{
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.LX200GPS);
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => TelescopeList.LX200GPS_42G);
_telescope.Connected = true;
ConnectTelescope(TelescopeList.LX200GPS, TelescopeList.LX200GPS_42G);
var result = _telescope.CanSetGuideRates;
@@ -1432,16 +1428,11 @@ namespace Meade.net.Telescope.UnitTests
}
[Test]
public void FocalLength_Get_ThenThrowsException()
public void FocalLength_Get_ThenReturnsValue()
{
var excpetion = Assert.Throws<PropertyNotImplementedException>(() =>
{
var result = _telescope.FocalLength;
Assert.Fail($"{result} should not have returned");
});
var result = _telescope.FocalLength;
Assert.That(excpetion.Property, Is.EqualTo("FocalLength"));
Assert.That(excpetion.AccessorSet, Is.False);
Assert.That(result, Is.EqualTo(_profileProperties.FocalLength/1000));
}
[Test]
@@ -1642,6 +1633,28 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(_telescope.AtPark, Is.True);
}
[Test]
public void Park_WhenLX200NotParked_ThenSendsParkCommand()
{
var alt = 77.55;
var altAsDM = "77*30";
_utilMock.Setup(x => x.DegreesToDM(alt, "*", "", 2)).Returns(altAsDM);
var az = 180;
var azAsDM = "180*00";
_utilMock.Setup(x => x.DegreesToDM(az, "*", "", 2)).Returns(azAsDM);
_sharedResourcesWrapperMock.Setup(x => x.SendBool("Sa+77*30", false)).Returns(true);
_sharedResourcesWrapperMock.Setup(x => x.SendBool("Sz180*00", false)).Returns(true);
ConnectTelescope(TelescopeList.LX200CLASSIC);
Assert.That(_telescope.AtPark, Is.False);
_telescope.Park();
Assert.That(_telescope.AtPark, Is.True);
}
[Test]
public void Park_WhenParked_ThenDoesNothing()
{
@@ -1668,13 +1681,16 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(exception.Message, Is.EqualTo("Not connected to telescope when trying to execute: PulseGuide"));
}
[TestCase(GuideDirections.guideEast)]
[TestCase(GuideDirections.guideWest)]
[TestCase(GuideDirections.guideNorth)]
[TestCase(GuideDirections.guideSouth)]
public void PulseGuide_WhenConnectedAndNewerPulseGuidingAvailable_ThenSendsNewCommandsAndWaits(GuideDirections direction)
[TestCase(GuideDirections.guideEast, 0)]
[TestCase(GuideDirections.guideWest, 0)]
[TestCase(GuideDirections.guideNorth, 0)]
[TestCase(GuideDirections.guideSouth, 0)]
[TestCase(GuideDirections.guideEast, 22161)]
[TestCase(GuideDirections.guideWest, 22161)]
[TestCase(GuideDirections.guideNorth, 22161)]
[TestCase(GuideDirections.guideSouth, 22161)]
public void PulseGuide_WhenConnectedAndNewerPulseGuidingAvailable_ThenSendsNewCommandsAndWaits(GuideDirections direction, int duration)
{
var duration = 0;
ConnectTelescope();
_telescope.PulseGuide(direction, duration);
@@ -1716,6 +1732,23 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(exception.Message, Is.EqualTo("Unable to PulseGuide whilst slewing to target."));
}
[TestCase(GuideDirections.guideEast)]
[TestCase(GuideDirections.guideWest)]
[TestCase(GuideDirections.guideNorth)]
[TestCase(GuideDirections.guideSouth)]
public void PulseGuide_WhenAltAzPulseGuideAttempted_ThenThrowsExpectedException(GuideDirections direction)
{
_testProperties.AlignmentMode = "A";
_sharedResourcesWrapperMock.Setup(x => x.SendString("D", false)).Returns("");
var duration = 1;
ConnectTelescope();
var exception = Assert.Throws<InvalidOperationException>(() => _telescope.PulseGuide(direction, duration));
Assert.That(exception.Message, Is.EqualTo("Unable to PulseGuide whilst in AltAz mode."));
}
[TestCase(GuideDirections.guideEast, TelescopeAxes.axisPrimary)]
[TestCase(GuideDirections.guideWest, TelescopeAxes.axisPrimary)]
[TestCase(GuideDirections.guideNorth, TelescopeAxes.axisSecondary)]
@@ -1930,11 +1963,12 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(excpetion.Method, Is.EqualTo("SetPark"));
}
[Test]
public void SideOfPier_Get_WhenMeridianFlipNotSupported_ThenThrowsException()
[TestCase(TelescopeList.LX200CLASSIC, null)]
[TestCase(TelescopeList.Autostar497, TelescopeList.Autostar497_31Ee)]
[TestCase(TelescopeList.LX200GPS, TelescopeList.LX200GPS_42F)]
public void SideOfPier_Get_WhenMeridianFlipNotSupported_ThenThrowsException(string model, string firmware)
{
// LX200 classic is a fork mounted scope so it does not support meridian flips
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(TelescopeList.LX200CLASSIC);
ConnectTelescope(model, firmware);
var excpetion = Assert.Throws<PropertyNotImplementedException>(() =>
{
@@ -1946,6 +1980,41 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(excpetion.AccessorSet, Is.False);
}
[TestCase(TelescopeList.Autostar497, TelescopeList.Autostar497_43Eg)]
[TestCase(TelescopeList.LX200GPS, TelescopeList.LX200GPS_42G)]
public void SideOfPier_Get_WhenMeridianFlipSupported_ThenReturnsResult(string model, string firmware)
{
ConnectTelescope(model, firmware);
Assert.DoesNotThrow(() => { var result = _telescope.SideOfPier; });
}
[TestCase(TelescopeList.Autostar497, TelescopeList.Autostar497_43Eg, AlignmentModes.algAltAz, 'A')]
[TestCase(TelescopeList.Autostar497, TelescopeList.Autostar497_43Eg, AlignmentModes.algPolar, 'P')]
public void SideOfPier_Get_WhenMeridianFlipNotSupportedByAlignementMode_ThenThrowsException(string model, string firmware, AlignmentModes alignmode, char alignmentStatus)
{
ConnectTelescope(model, firmware);
_testProperties.AlignmentStatus = new[] { alignmentStatus, 'T', '1' };
var excpetion = Assert.Throws<PropertyNotImplementedException>(() =>
{
var result = _telescope.SideOfPier;
Assert.Fail($"{result} should not have returned");
});
Assert.That(excpetion.Property, Is.EqualTo("SideOfPier"));
Assert.That(excpetion.AccessorSet, Is.False);
}
[TestCase(TelescopeList.Autostar497, TelescopeList.Autostar497_43Eg, AlignmentModes.algGermanPolar, 'G')]
public void SideOfPier_Get_WhenMeridianFlipSupportedByAlignementMode_ThenDoesNotThrow(string model, string firmware, AlignmentModes alignmode, char alignmentStatus)
{
ConnectTelescope(model, firmware);
_testProperties.AlignmentStatus = new[] { alignmentStatus, 'T', '1' };
Assert.DoesNotThrow(() => { var result = _telescope.SideOfPier; });
}
[Test]
public void SideOfPier_Set_ThenThrowsException()
{
@@ -2119,7 +2188,7 @@ namespace Meade.net.Telescope.UnitTests
_sharedResourcesWrapperMock.Verify(x => x.SendString("Gg", false), Times.Exactly(3));
_sharedResourcesWrapperMock.Verify(x => x.SendChar("MS", false), Times.Exactly(2));
_sharedResourcesWrapperMock.Verify(x => x.SendString("D", false), Times.Exactly(3));
_sharedResourcesWrapperMock.Verify(x => x.SendString("D", false), Times.AtLeast(3));
}
[Test]
@@ -2666,23 +2735,28 @@ namespace Meade.net.Telescope.UnitTests
_sharedResourcesWrapperMock.Verify(x => x.SendChar(command, false), Times.Once);
}
[Test]
public void Tracking_Get_WhenDefault_ThenIsTrue()
[TestCase("A", true)]
[TestCase("P", true)]
[TestCase("L", false)]
public void Tracking_Get_WhenGetsValue_ThenIsExpectedResult(string alignmentMode, bool expectedResult)
{
Assert.That(_telescope.Tracking, Is.True);
}
ConnectTelescope();
_testProperties.AlignmentMode = alignmentMode;
[TestCase(true)]
[TestCase(false)]
public void Tracking_Set_WhenCanSetTrackingIsFalse_ThenThrowsNotImplementedException(bool tracking)
{
// GW is not supported, so CanSetTracking is false
ConnectTelescope(firmwareVersion: TelescopeList.Autostar497_30Ee);
Assert.That(_telescope.Tracking, Is.EqualTo(expectedResult));
}
Assert.Throws<ASCOM.NotImplementedException>( () => { _telescope.Tracking = tracking; } );
}
//[TestCase(true)]
//[TestCase(false)]
//public void Tracking_Set_WhenCanSetTrackingIsFalse_ThenThrowsNotImplementedException(bool tracking)
//{
// // GW is not supported, so CanSetTracking is false
// ConnectTelescope(firmwareVersion: TelescopeList.Autostar497_30Ee);
[TestCase(true, "AP")]
// Assert.Throws<ASCOM.NotImplementedException>( () => { _telescope.Tracking = tracking; } );
//}
// [TestCase(true, "AP")]
[TestCase(false, "AL")]
public void Tracking_Set_WhenCanSetTrackingIsTrue_ThenValueIsUpdated(bool tracking, string alignmentCommand)
{
@@ -2745,9 +2819,13 @@ namespace Meade.net.Telescope.UnitTests
}
[TestCase(DriveRates.driveSidereal, "60.1")]
[TestCase(DriveRates.driveLunar, "60.1")]
[TestCase(DriveRates.driveSolar, "60.0")]
[TestCase(DriveRates.driveLunar, "57.9")]
[TestCase(DriveRates.driveSidereal, "+60.1")]
[TestCase(DriveRates.driveLunar, "+60.1")]
[TestCase(DriveRates.driveSolar, "+60.0")]
[TestCase(DriveRates.driveLunar, "+57.9")]
[TestCase(DriveRates.driveLunar, "57.3")]
[TestCase(DriveRates.driveLunar, "58.9")]
public void TrackingRate_Get_WhenConnected_ThenSendsCommandToTelescope(DriveRates rate, string trackingRate)
{
_siderealTrackingRate = trackingRate;
@@ -3272,12 +3350,15 @@ namespace Meade.net.Telescope.UnitTests
{
_sharedResourcesWrapperMock.Setup(x => x.SendChar("MS", false)).Returns("0");
var preTestItterations = 1;
var slewCounter = 0;
var iterations = 10;
_sharedResourcesWrapperMock.Setup(x => x.SendString("D", false)).Returns(() =>
{
slewCounter++;
if (slewCounter <= iterations)
if (slewCounter <= preTestItterations)
return "";
else if (slewCounter <= iterations)
return "|";
return "";
});
@@ -3289,7 +3370,7 @@ namespace Meade.net.Telescope.UnitTests
_telescope.SlewToTarget();
_utilMock.Verify(x => x.WaitForMilliseconds(It.IsAny<int>()), Times.Exactly(iterations));
_utilMock.Verify(x => x.WaitForMilliseconds(It.IsAny<int>()), Times.Exactly(iterations - preTestItterations));
}
[Test]
@@ -3366,12 +3447,15 @@ namespace Meade.net.Telescope.UnitTests
_sharedResourcesWrapperMock.Setup(x => x.SendChar("MS", false)).Returns("0");
var preTestItterations = 1;
var slewCounter = 0;
var iterations = 10;
_sharedResourcesWrapperMock.Setup(x => x.SendString("D", false)).Returns(() =>
{
slewCounter++;
if (slewCounter <= iterations)
if (slewCounter <= preTestItterations)
return "";
else if (slewCounter <= iterations)
return "|";
return "";
});
@@ -3383,7 +3467,7 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(_telescope.TargetDeclination, Is.EqualTo(dmsResult));
_sharedResourcesWrapperMock.Verify(x => x.SendChar("MS", false), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(It.IsAny<int>()), Times.Exactly(iterations));
_utilMock.Verify(x => x.WaitForMilliseconds(It.IsAny<int>()), Times.Exactly(iterations - preTestItterations));
}
[Test]
@@ -3408,7 +3492,7 @@ namespace Meade.net.Telescope.UnitTests
ConnectTelescope();
var exception = Assert.Throws<InvalidValueException>(() => _telescope.SlewToAltAzAsync(0, -0.1));
Assert.That(exception.Message, Is.EqualTo("Altitide cannot be less than 0."));
Assert.That(exception.Message, Is.EqualTo("Altitude cannot be less than 0."));
}
[Test]
@@ -3486,12 +3570,15 @@ namespace Meade.net.Telescope.UnitTests
_sharedResourcesWrapperMock.Setup(x => x.SendChar("MS", false)).Returns("0");
var preTestItterations = 1;
var slewCounter = 0;
var iterations = 10;
_sharedResourcesWrapperMock.Setup(x => x.SendString("D", false)).Returns(() =>
{
slewCounter++;
if (slewCounter <= iterations)
if (slewCounter <= preTestItterations)
return "";
else if (slewCounter <= iterations)
return "|";
return "";
});
@@ -3503,7 +3590,7 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(_telescope.TargetRightAscension, Is.EqualTo(_testProperties.rightAscension));
Assert.That(_telescope.TargetDeclination, Is.EqualTo(_testProperties.declination));
_sharedResourcesWrapperMock.Verify(x => x.SendChar("MS", false), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(It.IsAny<int>()), Times.Exactly(iterations));
_utilMock.Verify(x => x.WaitForMilliseconds(It.IsAny<int>()), Times.Exactly(iterations - preTestItterations));
}
[Test]
+5
View File
@@ -7,5 +7,10 @@ namespace ASCOM.Meade.net
public AlignmentModes AlignmentMode { get; set; }
public bool Tracking { get; set; }
public Alignment Status { get; set; }
public override string ToString()
{
return $"AlignmentStatus AlignmentMode={AlignmentMode};Tracking={Tracking};Status={Status}";
}
}
}
@@ -0,0 +1,10 @@
namespace System
{
static class DoubelExtensions
{
public static bool Between(this double value, double lower, double higher)
{
return value >= lower & value <= higher;
}
}
}
@@ -128,6 +128,7 @@
<Compile Include="Clock.cs" />
<Compile Include="ComparisonResult.cs" />
<Compile Include="DoubleExtensions.cs" />
<Compile Include="ExtensionMethods\DoubelExtensions.cs" />
<Compile Include="IClock.cs" />
<Compile Include="StringExtensions.cs" />
<Compile Include="Telescope.cs" />
@@ -187,11 +188,16 @@
<Name>Meade.net</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
File diff suppressed because it is too large Load Diff
+411 -1
View File
@@ -171,6 +171,9 @@ namespace Meade.net.UnitTests
string ParkedBehaviourDefault = "No Coordinates";
string ParkedAltDefault = "0";
string ParkedAzimuthDefault = "180";
string FocalLengthDefault = "2000";
string ApertureAreaDefault = "32685";
string ApertureDiameterDefault = "203";
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
profileWrapperMock.SetupAllProperties();
@@ -222,6 +225,19 @@ namespace Meade.net.UnitTests
x.GetValue(DriverId, "Parked Azimuth", string.Empty, ParkedAzimuthDefault))
.Returns(() => ParkedAzimuthDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Focal Length (mm)", string.Empty, FocalLengthDefault))
.Returns(() => FocalLengthDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Aperture Area (mm²)", string.Empty, ApertureAreaDefault))
.Returns(() => ApertureAreaDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Aperture Diameter (mm)", string.Empty, ApertureDiameterDefault))
.Returns(() => ApertureDiameterDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Send Date and time on connect", string.Empty, "false"))
.Returns(() => SendDateTimeDefault);
@@ -295,6 +311,9 @@ namespace Meade.net.UnitTests
string ParkedBehaviourDefault = "No Coordinates";
string ParkedAltDefault = "0";
string ParkedAzimuthDefault = "180";
string FocalLengthDefault = "2000";
string ApertureAreaDefault = "32685";
string ApertureDiameterDefault = "203";
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
profileWrapperMock.SetupAllProperties();
@@ -337,6 +356,18 @@ namespace Meade.net.UnitTests
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Azimuth", string.Empty, ParkedAzimuthDefault))
.Returns(() => ParkedAzimuthDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Focal Length (mm)", string.Empty, FocalLengthDefault))
.Returns(() => FocalLengthDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Aperture Area (mm²)", string.Empty, ApertureAreaDefault))
.Returns(() => ApertureAreaDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Aperture Diameter (mm)", string.Empty, ApertureDiameterDefault))
.Returns(() => ApertureDiameterDefault);
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
@@ -347,7 +378,7 @@ namespace Meade.net.UnitTests
_serialMock.Setup(x => x.Transmit("#:GVP#")).Callback(() => { serialPortReturn = ":GVP#"; });
_serialMock.Setup(x => x.Transmit("#:GG#")).Callback(() => { serialPortReturn = "0"; });
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns( () => serialPortReturn);
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(() => serialPortReturn);
var result = Assert.Throws<Exception>(() => { SharedResources.Connect(deviceId, string.Empty, _traceLoggerMock.Object); });
Assert.That(result.Message, Is.EqualTo("Serial port is looping back data, something is wrong with the hardware."));
@@ -375,6 +406,9 @@ namespace Meade.net.UnitTests
string ParkedBehaviourDefault = "No Coordinates";
string ParkedAltDefault = "0";
string ParkedAzimuthDefault = "180";
string FocalLengthDefault = "2000";
string ApertureAreaDefault = "32685";
string ApertureDiameterDefault = "203";
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
profileWrapperMock.SetupAllProperties();
@@ -416,6 +450,15 @@ namespace Meade.net.UnitTests
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Azimuth", string.Empty, ParkedAzimuthDefault))
.Returns(() => ParkedAzimuthDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Focal Length (mm)", string.Empty, FocalLengthDefault))
.Returns(() => FocalLengthDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Aperture Area (mm²)", string.Empty, ApertureAreaDefault))
.Returns(() => ApertureAreaDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Aperture Diameter (mm)", string.Empty, ApertureDiameterDefault))
.Returns(() => ApertureDiameterDefault);
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
@@ -468,6 +511,9 @@ namespace Meade.net.UnitTests
string ParkedBehaviourDefault = "No Coordinates";
string ParkedAltDefault = "0";
string ParkedAzimuthDefault = "180";
string FocalLengthDefault = "2000";
string ApertureAreaDefault = "32685";
string ApertureDiameterDefault = "203";
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
profileWrapperMock.SetupAllProperties();
@@ -509,6 +555,15 @@ namespace Meade.net.UnitTests
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Azimuth", string.Empty, ParkedAzimuthDefault))
.Returns(() => ParkedAzimuthDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Focal Length (mm)", string.Empty, FocalLengthDefault))
.Returns(() => FocalLengthDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Aperture Area (mm²)", string.Empty, ApertureAreaDefault))
.Returns(() => ApertureAreaDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Aperture Diameter (mm)", string.Empty, ApertureDiameterDefault))
.Returns(() => ApertureDiameterDefault);
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
@@ -535,6 +590,349 @@ namespace Meade.net.UnitTests
}
}
[Test]
public void Connect_WhenSpeedIsFastAndAutostarSetToFast_ThenConnectsDirectlyAtFastSpeed()
{
string deviceId = "Serial";
string DriverId = "ASCOM.MeadeGeneric.Telescope";
string TraceStateDefault = "false";
string ComPortDefault = "COM1";
string SpeedDefault = "57600";
string DataBitsDefault = "8";
string StopBitsDefault = "One";
string HandshakeDefault = "None";
string ParityDefault = "None";
string RtsDtrEnabledDefault = "false";
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
string PrecisionDefault = "Unchanged";
string ParkedBehaviourDefault = "No Coordinates";
string ParkedAltDefault = "0";
string ParkedAzimuthDefault = "180";
string FocalLengthDefault = "2000";
string ApertureAreaDefault = "32685";
string ApertureDiameterDefault = "203";
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
profileWrapperMock.SetupAllProperties();
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Trace Level", string.Empty, TraceStateDefault))
.Returns(TraceStateDefault);
profileWrapperMock.Setup(x => x.GetValue(DriverId, "COM Port", string.Empty, ComPortDefault))
.Returns(ComPortDefault);
profileWrapperMock
.Setup(x => x.GetValue(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
.Returns(PrecisionDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
.Returns(() => SpeedDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
.Returns(() => DataBitsDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
.Returns(() => StopBitsDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Hand Shake", string.Empty, HandshakeDefault))
.Returns(() => HandshakeDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
.Returns(() => ParityDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Rts / Dtr", string.Empty, RtsDtrEnabledDefault))
.Returns(() => RtsDtrEnabledDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Behaviour", string.Empty, ParkedBehaviourDefault))
.Returns(() => ParityDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Altitude", string.Empty, ParkedAltDefault))
.Returns(() => ParkedAltDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Azimuth", string.Empty, ParkedAzimuthDefault))
.Returns(() => ParkedAzimuthDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Focal Length (mm)", string.Empty, FocalLengthDefault))
.Returns(() => FocalLengthDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Aperture Area (mm²)", string.Empty, ApertureAreaDefault))
.Returns(() => ApertureAreaDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Aperture Diameter (mm)", string.Empty, ApertureDiameterDefault))
.Returns(() => ApertureDiameterDefault);
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
SharedResources.ProfileFactory = profileFactoryMock.Object;
string serialPortReturn = string.Empty;
_serialMock.Setup(x => x.Transmit("#:GVP#")).Callback(() => { serialPortReturn = TelescopeList.LX200GPS; });
_serialMock.Setup(x => x.Transmit("#:GVN#")).Callback(() => { serialPortReturn = TelescopeList.LX200GPS_42G; });
_serialMock.Setup(x => x.Transmit("#:GG#")).Callback(() => { serialPortReturn = "0"; });
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(() => serialPortReturn);
var connectionResult = SharedResources.Connect(deviceId, string.Empty, _traceLoggerMock.Object);
try
{
Assert.That(connectionResult.SameDevice, Is.EqualTo(1));
Assert.That(SharedResources.ProductName, Is.EqualTo(TelescopeList.LX200GPS));
Assert.That(SharedResources.FirmwareVersion, Is.EqualTo(TelescopeList.LX200GPS_42G));
}
finally
{
SharedResources.Disconnect(deviceId, String.Empty);
}
}
[TestCase("57600")]
[TestCase("38400")]
[TestCase("28800")]
[TestCase("19200")]
[TestCase("14400")]
[TestCase("4800")]
[TestCase("2400")]
[TestCase("1200")]
public void Connect_WhenSpeedIsFastAndAutostarAtDefault_ThenConnectsAutoStarSpeedChanged(string WantedSpeed)
{
string deviceId = "Serial";
string DriverId = "ASCOM.MeadeGeneric.Telescope";
string TraceStateDefault = "false";
string ComPortDefault = "COM1";
string SpeedDefault = "9600";
string DataBitsDefault = "8";
string StopBitsDefault = "One";
string HandshakeDefault = "None";
string ParityDefault = "None";
string RtsDtrEnabledDefault = "false";
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
string PrecisionDefault = "Unchanged";
string ParkedBehaviourDefault = "No Coordinates";
string ParkedAltDefault = "0";
string ParkedAzimuthDefault = "180";
string FocalLengthDefault = "2000";
string ApertureAreaDefault = "32685";
string ApertureDiameterDefault = "203";
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
profileWrapperMock.SetupAllProperties();
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Trace Level", string.Empty, TraceStateDefault))
.Returns(TraceStateDefault);
profileWrapperMock.Setup(x => x.GetValue(DriverId, "COM Port", string.Empty, ComPortDefault))
.Returns(ComPortDefault);
profileWrapperMock
.Setup(x => x.GetValue(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
.Returns(PrecisionDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
.Returns(() => WantedSpeed);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
.Returns(() => DataBitsDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
.Returns(() => StopBitsDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Hand Shake", string.Empty, HandshakeDefault))
.Returns(() => HandshakeDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
.Returns(() => ParityDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Rts / Dtr", string.Empty, RtsDtrEnabledDefault))
.Returns(() => RtsDtrEnabledDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Behaviour", string.Empty, ParkedBehaviourDefault))
.Returns(() => ParityDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Altitude", string.Empty, ParkedAltDefault))
.Returns(() => ParkedAltDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Azimuth", string.Empty, ParkedAzimuthDefault))
.Returns(() => ParkedAzimuthDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Focal Length (mm)", string.Empty, FocalLengthDefault))
.Returns(() => FocalLengthDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Aperture Area (mm²)", string.Empty, ApertureAreaDefault))
.Returns(() => ApertureAreaDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Aperture Diameter (mm)", string.Empty, ApertureDiameterDefault))
.Returns(() => ApertureDiameterDefault);
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
SharedResources.ProfileFactory = profileFactoryMock.Object;
string serialPortReturn = string.Empty;
_serialMock.Setup(x => x.Transmit("#:GVP#")).Callback(() => { serialPortReturn = TelescopeList.LX200GPS; });
_serialMock.Setup(x => x.Transmit("#:GVN#")).Callback(() => { serialPortReturn = TelescopeList.LX200GPS_42G; });
_serialMock.Setup(x => x.Transmit("#:SB1#")).Callback(() => { serialPortReturn = "1"; });
var ggCall = 0;
_serialMock.Setup(x => x.Transmit("#:GG#")).Callback(() => {
ggCall++;
if (ggCall == 1)
throw new Exception("Fake Timeout");
else
serialPortReturn = "0"; });
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(() => serialPortReturn);
_serialMock.Setup(x => x.ReceiveCounted(1)).Returns(() => "1");
var connectionResult = SharedResources.Connect(deviceId, string.Empty, _traceLoggerMock.Object);
try
{
Assert.That(SharedResources.ProductName, Is.EqualTo(TelescopeList.LX200GPS));
Assert.That(SharedResources.FirmwareVersion, Is.EqualTo(TelescopeList.LX200GPS_42G));
_traceLoggerMock.Verify(x => x.LogIssue("Connect", $"Telescope serial port speed change, connecting at ps{WantedSpeed}."), Times.Once);
}
finally
{
SharedResources.Disconnect(deviceId, String.Empty);
}
}
[TestCase("57600")]
[TestCase("38400")]
[TestCase("28800")]
[TestCase("19200")]
[TestCase("14400")]
[TestCase("4800")]
[TestCase("2400")]
[TestCase("1200")]
public void Connect_WhenAutostarReportsFailedToChangeSpeec_ThenConnectsAutoStarAtDefaultSpeed(string WantedSpeed)
{
string deviceId = "Serial";
string DriverId = "ASCOM.MeadeGeneric.Telescope";
string TraceStateDefault = "false";
string ComPortDefault = "COM1";
string SpeedDefault = "9600";
string DataBitsDefault = "8";
string StopBitsDefault = "One";
string HandshakeDefault = "None";
string ParityDefault = "None";
string RtsDtrEnabledDefault = "false";
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
string PrecisionDefault = "Unchanged";
string ParkedBehaviourDefault = "No Coordinates";
string ParkedAltDefault = "0";
string ParkedAzimuthDefault = "180";
string FocalLengthDefault = "2000";
string ApertureAreaDefault = "32685";
string ApertureDiameterDefault = "203";
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
profileWrapperMock.SetupAllProperties();
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Trace Level", string.Empty, TraceStateDefault))
.Returns(TraceStateDefault);
profileWrapperMock.Setup(x => x.GetValue(DriverId, "COM Port", string.Empty, ComPortDefault))
.Returns(ComPortDefault);
profileWrapperMock
.Setup(x => x.GetValue(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
.Returns(PrecisionDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
.Returns(() => WantedSpeed);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
.Returns(() => DataBitsDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
.Returns(() => StopBitsDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Hand Shake", string.Empty, HandshakeDefault))
.Returns(() => HandshakeDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
.Returns(() => ParityDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Rts / Dtr", string.Empty, RtsDtrEnabledDefault))
.Returns(() => RtsDtrEnabledDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Behaviour", string.Empty, ParkedBehaviourDefault))
.Returns(() => ParityDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Altitude", string.Empty, ParkedAltDefault))
.Returns(() => ParkedAltDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Azimuth", string.Empty, ParkedAzimuthDefault))
.Returns(() => ParkedAzimuthDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Focal Length (mm)", string.Empty, FocalLengthDefault))
.Returns(() => FocalLengthDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Aperture Area (mm²)", string.Empty, ApertureAreaDefault))
.Returns(() => ApertureAreaDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Aperture Diameter (mm)", string.Empty, ApertureDiameterDefault))
.Returns(() => ApertureDiameterDefault);
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
SharedResources.ProfileFactory = profileFactoryMock.Object;
string serialPortReturn = string.Empty;
_serialMock.Setup(x => x.Transmit("#:GVP#")).Callback(() => { serialPortReturn = TelescopeList.LX200GPS; });
_serialMock.Setup(x => x.Transmit("#:GVN#")).Callback(() => { serialPortReturn = TelescopeList.LX200GPS_42G; });
_serialMock.Setup(x => x.Transmit("#:SB1#")).Callback(() => { serialPortReturn = "1"; });
var ggCall = 0;
_serialMock.Setup(x => x.Transmit("#:GG#")).Callback(() => {
ggCall++;
if (ggCall == 1)
throw new Exception("Fake Timeout");
else
serialPortReturn = "0";
});
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(() => serialPortReturn);
_serialMock.Setup(x => x.ReceiveCounted(1)).Returns(() => "0");
var connectionResult = SharedResources.Connect(deviceId, string.Empty, _traceLoggerMock.Object);
try
{
Assert.That(SharedResources.ProductName, Is.EqualTo(TelescopeList.LX200GPS));
Assert.That(SharedResources.FirmwareVersion, Is.EqualTo(TelescopeList.LX200GPS_42G));
_traceLoggerMock.Verify(x => x.LogIssue("Connect", $"Telescope not responding to speed change, connecting at ps{SpeedDefault}."), Times.Once);
}
finally
{
SharedResources.Disconnect(deviceId, String.Empty);
}
}
[Test]
public void Connect_WhenSerialPortIsNotRespondingCorrectly_ThenExceptionThrown()
{
@@ -558,6 +956,9 @@ namespace Meade.net.UnitTests
string ParkedBehaviourDefault = "No Coordinates";
string ParkedAltDefault = "0";
string ParkedAzimuthDefault = "180";
string FocalLengthDefault = "2000";
string ApertureAreaDefault = "32685";
string ApertureDiameterDefault = "203";
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
profileWrapperMock.SetupAllProperties();
@@ -598,6 +999,15 @@ namespace Meade.net.UnitTests
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Azimuth", string.Empty, ParkedAzimuthDefault))
.Returns(() => ParkedAzimuthDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Focal Length (mm)", string.Empty, FocalLengthDefault))
.Returns(() => FocalLengthDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Aperture Area (mm²)", string.Empty, ApertureAreaDefault))
.Returns(() => ApertureAreaDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Aperture Diameter (mm)", string.Empty, ApertureDiameterDefault))
.Returns(() => ApertureDiameterDefault);
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
+22 -25
View File
@@ -176,12 +176,12 @@ namespace ASCOM.Meade.net
}
catch (Exception ex)
{
LogMessage("Connected Set", "Error connecting to port {0} - {1}", ComPort, ex.Message);
LogMessage("Connected Set", "Error connecting to port {0} - {1}", _profileProperties.ComPort, ex.Message);
}
}
else
{
LogMessage("Connected Set", "Disconnecting from port {0}", ComPort);
LogMessage("Connected Set", "Disconnecting from port {0}", _profileProperties.ComPort);
SharedResourcesWrapper.Disconnect("Serial", DriverId);
IsConnected = false;
}
@@ -295,37 +295,34 @@ namespace ASCOM.Meade.net
return;
var direction = position > 0;
if (ReverseFocusDirection)
if (_profileProperties.ReverseFocusDirection)
direction = !direction;
//backlash compensation.
var backlashCompensationSteps = direction ? Math.Abs(_profileProperties.BacklashCompensation) : 0;
SharedResourcesWrapper.Lock(() =>
var steps = Math.Abs(position) + backlashCompensationSteps;
MoveFocuser(direction, steps);
//todo refactor the backlash compensation to combine the commands into as few moves as practicle.
//ApplyBacklashCompensation(direction);
if (direction & backlashCompensationSteps != 0)
{
//backlash compensation.
var backlashCompensationSteps = direction ? Math.Abs(BacklashCompensation) : 0;
Tl.LogMessage("Move", "Applying backlash compensation");
MoveFocuser(!direction, backlashCompensationSteps);
}
var steps = Math.Abs(position) + backlashCompensationSteps;
MoveFocuser(direction, steps);
//todo refactor the backlash compensation to combine the commands into as few moves as practicle.
//ApplyBacklashCompensation(direction);
if (direction & backlashCompensationSteps != 0)
{
Tl.LogMessage("Move", "Applying backlash compensation");
MoveFocuser(!direction, backlashCompensationSteps);
}
DynamicBreaking(direction);
//todo implement dynamic braking
//dynamic breaking is sending the command to move in the opposite direction immediatly followed by the command to stop.
});
DynamicBreaking(direction);
//todo implement dynamic braking
//dynamic breaking is sending the command to move in the opposite direction immediatly followed by the command to stop.
}
private void DynamicBreaking(bool directionOut)
{
if (!UseDynamicBreaking)
if (!_profileProperties.DynamicBreaking)
return;
Tl.LogMessage("Move", "Applying dynamic breaking");
+19 -46
View File
@@ -1,7 +1,6 @@
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using ASCOM.Meade.net.AstroMaths;
using ASCOM.Meade.net.Wrapper;
using ASCOM.Utilities;
@@ -20,20 +19,8 @@ namespace ASCOM.Meade.net
/// </summary>
protected static readonly string DriverDescription = "Meade Generic";
protected static string ComPort; // Variables to hold the currrent device configuration
protected static int BacklashCompensation;
protected static bool ReverseFocusDirection;
protected static bool UseDynamicBreaking;
protected double GuideRate;
protected string Precision;
protected string GuidingStyle;
protected double SiteElevation;
protected short ProfileSettleTime;
protected bool SendDateTime;
protected ParkedBehaviour ParkedBehaviour;
protected HorizonCoordinates ParkedAltAz;
protected readonly ISharedResourcesWrapper SharedResourcesWrapper;
protected ProfileProperties _profileProperties;
public MeadeTelescopeBase()
{
@@ -62,39 +49,25 @@ namespace ASCOM.Meade.net
/// </summary>
protected void ReadProfile()
{
var profileProperties = SharedResourcesWrapper.ReadProfile();
Tl.Enabled = profileProperties.TraceLogger;
ComPort = profileProperties.ComPort;
BacklashCompensation = profileProperties.BacklashCompensation;
ReverseFocusDirection = profileProperties.ReverseFocusDirection;
UseDynamicBreaking = profileProperties.DynamicBreaking;
GuideRate = profileProperties.GuideRateArcSecondsPerSecond;
Precision = profileProperties.Precision;
GuidingStyle = profileProperties.GuidingStyle.ToLower();
SiteElevation = profileProperties.SiteElevation;
ProfileSettleTime = profileProperties.SettleTime;
SendDateTime = profileProperties.SendDateTime;
ParkedBehaviour = profileProperties.ParkedBehaviour;
ParkedAltAz = new HorizonCoordinates
{
Altitude = profileProperties.ParkedAlt,
Azimuth = profileProperties.ParkedAz
};
_profileProperties = SharedResourcesWrapper.ReadProfile();
Tl.Enabled = _profileProperties.TraceLogger;
LogMessage("ReadProfile", $"Trace logger enabled: {Tl.Enabled}");
LogMessage("ReadProfile", $"Com Port: {ComPort}");
LogMessage("ReadProfile", $"Backlash Steps: {BacklashCompensation}");
LogMessage("ReadProfile", $"Dynamic breaking: {UseDynamicBreaking}");
LogMessage("ReadProfile", $"Guide Rate: {GuideRate}");
LogMessage("ReadProfile", $"Precision: {Precision}");
LogMessage("ReadProfile", $"Guiding Style: {GuidingStyle}");
LogMessage("ReadProfile", $"Site Elevation: {SiteElevation}");
LogMessage("ReadProfile", $"Settle Time after slew: {ProfileSettleTime}");
LogMessage("ReadProfile", $"Send date and time on connect: {SendDateTime}");
LogMessage("ReadProfile", $"Parked Behaviour: {ParkedBehaviour}");
LogMessage("ReadProfile", $"Parked Alt: {ParkedAltAz.Altitude}");
LogMessage("ReadProfile", $"Parked Az: {ParkedAltAz.Azimuth}");
LogMessage("ReadProfile", $"Com Port: {_profileProperties.ComPort}");
LogMessage("ReadProfile", $"Backlash Steps: {_profileProperties.BacklashCompensation}");
LogMessage("ReadProfile", $"Dynamic breaking: {_profileProperties.DynamicBreaking}");
LogMessage("ReadProfile", $"Guide Rate: {_profileProperties.GuideRateArcSecondsPerSecond}");
LogMessage("ReadProfile", $"Precision: {_profileProperties.Precision}");
LogMessage("ReadProfile", $"Guiding Style: {_profileProperties.GuidingStyle}");
LogMessage("ReadProfile", $"Site Elevation: {_profileProperties.SiteElevation}");
LogMessage("ReadProfile", $"Settle Time after slew: {_profileProperties.SettleTime}");
LogMessage("ReadProfile", $"Send date and time on connect: {_profileProperties.SendDateTime}");
LogMessage("ReadProfile", $"Parked Behaviour: {_profileProperties.ParkedBehaviour}");
LogMessage("ReadProfile", $"Parked Alt: {_profileProperties.ParkedAlt}");
LogMessage("ReadProfile", $"Parked Az: {_profileProperties.ParkedAz}");
LogMessage("ReadProfile", $"Focal Length: {_profileProperties.FocalLength}");
LogMessage("ReadProfile", $"Aperture Area: {_profileProperties.ApertureArea}");
LogMessage("ReadProfile", $"Aperture Area: {_profileProperties.ApertureDiameter}");
}
/// <summary>
@@ -159,7 +132,7 @@ namespace ASCOM.Meade.net
protected void UpdateSiteElevation()
{
var profileProperties = SharedResourcesWrapper.ReadProfile();
profileProperties.SiteElevation = SiteElevation;
profileProperties.SiteElevation = _profileProperties.SiteElevation;
SharedResourcesWrapper.WriteProfile(profileProperties);
}
}
+3
View File
@@ -23,5 +23,8 @@ namespace ASCOM.Meade.net
public ParkedBehaviour ParkedBehaviour { get; set; }
public double ParkedAlt { get; set; }
public double ParkedAz { get; set; }
public double FocalLength { get; set; }
public double ApertureArea { get; set; }
public double ApertureDiameter { get; set; }
}
}
+9
View File
@@ -144,5 +144,14 @@ namespace ASCOM.Meade.net.Properties {
return ResourceManager.GetString("SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Please enter only numbers..
/// </summary>
internal static string SetupDialogForm_txtFocalLength_TextChanged_1_Please_enter_only_numbers_ {
get {
return ResourceManager.GetString("SetupDialogForm_txtFocalLength_TextChanged_1_Please_enter_only_numbers_", resourceCulture);
}
}
}
}
+3
View File
@@ -147,4 +147,7 @@ Valid are : -register, -unregister and -embedding</value>
<data name="SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_" xml:space="preserve">
<value>Please enter only numbers.</value>
</data>
<data name="SetupDialogForm_txtFocalLength_TextChanged_1_Please_enter_only_numbers_" xml:space="preserve">
<value>Please enter only numbers.</value>
</data>
</root>
+61 -5
View File
@@ -25,7 +25,7 @@ namespace ASCOM.Meade.net
SetItemsFromEnum(cboStopBits.Items, typeof(SerialStopBits));
SetItemsFromEnum(cboParity.Items, typeof(SerialParity));
SetItemsFromEnumValues(cboSpeed.Items, typeof(SerialSpeed));
SetItemFromEnumValues(cboSpeed.Items, SerialSpeed.ps1200, SerialSpeed.ps57600);
SetItemsFromEnum(cboHandShake.Items, typeof(SerialHandshake));
SetItemsFromEnum(cboParkedBehaviour.Items, typeof(ParkedBehaviour));
}
@@ -41,13 +41,30 @@ namespace ASCOM.Meade.net
}
}
private void SetItemsFromEnumValues(IList items, Type enumItems)
//private void SetItemsFromEnumValues(IList items, Type enumItems)
//{
// items.Clear();
// foreach (int item in Enum.GetValues(enumItems))
// {
// items.Add(item);
// }
//}
private void SetItemFromEnumValues<T>(IList items, T minValue, T maxValue)
{
items.Clear();
foreach (int item in Enum.GetValues(enumItems))
var type = typeof(T);
var intMinValue = (int)Convert.ChangeType(minValue, typeof(int));
var intMaxValue = (int)Convert.ChangeType(maxValue, typeof(int));
foreach (int item in Enum.GetValues(type))
{
items.Add(item);
if ((item >= intMinValue) && (item <= intMaxValue))
items.Add(item);
}
}
@@ -188,6 +205,33 @@ namespace ASCOM.Meade.net
txtParkedAz.Text = "180";
}
try
{
txtFocalLength.Text = profileProperties.FocalLength.ToString(CultureInfo.CurrentCulture);
}
catch (Exception)
{
txtFocalLength.Text = "2000";
}
try
{
txtApertureArea.Text = profileProperties.ApertureArea.ToString(CultureInfo.CurrentCulture);
}
catch (Exception)
{
txtApertureArea.Text = "32685";
}
try
{
txtApertureDiameter.Text = profileProperties.ApertureDiameter.ToString(CultureInfo.CurrentCulture);
}
catch (Exception)
{
txtApertureDiameter.Text = "203";
}
UpdateParkedItemsEnabled();
}
@@ -214,7 +258,10 @@ namespace ASCOM.Meade.net
SendDateTime = cbxSendDateTime.Checked,
ParkedBehaviour = EnumExtensionMethods.GetValueFromDescription<ParkedBehaviour>(cboParkedBehaviour.SelectedItem.ToString()),
ParkedAlt = double.Parse(txtParkedAlt.Text),
ParkedAz = double.Parse(txtParkedAz.Text)
ParkedAz = double.Parse(txtParkedAz.Text),
FocalLength = double.Parse(txtFocalLength.Text),
ApertureArea = double.Parse(txtApertureArea.Text),
ApertureDiameter = double.Parse(txtApertureDiameter.Text)
};
return profileProperties;
@@ -320,6 +367,15 @@ namespace ASCOM.Meade.net
txtParkedAz.Text = txtParkedAz.Text.Remove(txtParkedAz.Text.Length - 1);
}
}
private void txt_FocalLength_TextChanged_1(object sender, EventArgs e)
{
if (System.Text.RegularExpressions.Regex.IsMatch(txtFocalLength.Text, "[^0-9]"))
{
MessageBox.Show(Resources.SetupDialogForm_txtFocalLength_TextChanged_1_Please_enter_only_numbers_);
txtFocalLength.Text = txtFocalLength.Text.Remove(txtFocalLength.Text.Length - 1);
}
}
}
}
+73
View File
@@ -82,6 +82,15 @@ namespace ASCOM.Meade.net
this.label24 = new System.Windows.Forms.Label();
this.txtParkedAlt = new System.Windows.Forms.TextBox();
this.txtParkedAz = new System.Windows.Forms.TextBox();
this.label25 = new System.Windows.Forms.Label();
this.txtFocalLength = new System.Windows.Forms.TextBox();
this.label26 = new System.Windows.Forms.Label();
this.label27 = new System.Windows.Forms.Label();
this.txtApertureDiameter = new System.Windows.Forms.TextBox();
this.label28 = new System.Windows.Forms.Label();
this.label29 = new System.Windows.Forms.Label();
this.txtApertureArea = new System.Windows.Forms.TextBox();
this.label30 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.picASCOM)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudSettleTime)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numDatabits)).BeginInit();
@@ -389,10 +398,65 @@ namespace ASCOM.Meade.net
this.txtParkedAz.Name = "txtParkedAz";
this.txtParkedAz.TextChanged += new System.EventHandler(this.txtParkedAz_TextChanged);
//
// label25
//
resources.ApplyResources(this.label25, "label25");
this.label25.Name = "label25";
//
// txtFocalLength
//
resources.ApplyResources(this.txtFocalLength, "txtFocalLength");
this.txtFocalLength.Name = "txtFocalLength";
this.txtFocalLength.TextChanged += new System.EventHandler(this.txt_FocalLength_TextChanged_1);
//
// label26
//
resources.ApplyResources(this.label26, "label26");
this.label26.Name = "label26";
//
// label27
//
resources.ApplyResources(this.label27, "label27");
this.label27.Name = "label27";
//
// txtApetureDiameter
//
resources.ApplyResources(this.txtApertureDiameter, "txtApertureDiameter");
this.txtApertureDiameter.Name = "txtApertureDiameter";
//
// label28
//
resources.ApplyResources(this.label28, "label28");
this.label28.Name = "label28";
//
// label29
//
resources.ApplyResources(this.label29, "label29");
this.label29.Name = "label29";
//
// txtApetureArea
//
resources.ApplyResources(this.txtApertureArea, "txtApertureArea");
this.txtApertureArea.Name = "txtApertureArea";
//
// label30
//
resources.ApplyResources(this.label30, "label30");
this.label30.Name = "label30";
//
// SetupDialogForm
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label29);
this.Controls.Add(this.txtApertureArea);
this.Controls.Add(this.label30);
this.Controls.Add(this.label27);
this.Controls.Add(this.txtApertureDiameter);
this.Controls.Add(this.label28);
this.Controls.Add(this.label26);
this.Controls.Add(this.txtFocalLength);
this.Controls.Add(this.label25);
this.Controls.Add(this.txtParkedAz);
this.Controls.Add(this.txtParkedAlt);
this.Controls.Add(this.label24);
@@ -507,5 +571,14 @@ namespace ASCOM.Meade.net
private Label label24;
private TextBox txtParkedAlt;
private TextBox txtParkedAz;
private Label label25;
private TextBox txtFocalLength;
private Label label26;
private Label label27;
private TextBox txtApertureDiameter;
private Label label28;
private Label label29;
private TextBox txtApertureArea;
private Label label30;
}
}
+315 -75
View File
@@ -145,7 +145,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cmdOK.ZOrder" xml:space="preserve">
<value>47</value>
<value>56</value>
</data>
<data name="cmdCancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Right</value>
@@ -172,7 +172,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cmdCancel.ZOrder" xml:space="preserve">
<value>46</value>
<value>55</value>
</data>
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 9</value>
@@ -196,7 +196,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>45</value>
<value>54</value>
</data>
<data name="picASCOM.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value>
@@ -223,7 +223,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;picASCOM.ZOrder" xml:space="preserve">
<value>44</value>
<value>53</value>
</data>
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -250,13 +250,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label2.ZOrder" xml:space="preserve">
<value>43</value>
<value>52</value>
</data>
<data name="chkTrace.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="chkTrace.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 305</value>
<value>97, 380</value>
</data>
<data name="chkTrace.Size" type="System.Drawing.Size, System.Drawing">
<value>90, 17</value>
@@ -277,7 +277,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;chkTrace.ZOrder" xml:space="preserve">
<value>42</value>
<value>51</value>
</data>
<data name="comboBoxComPort.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 87</value>
@@ -298,13 +298,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;comboBoxComPort.ZOrder" xml:space="preserve">
<value>41</value>
<value>50</value>
</data>
<data name="label3.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label3.Location" type="System.Drawing.Point, System.Drawing">
<value>290, 169</value>
<value>290, 262</value>
</data>
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
<value>61, 13</value>
@@ -325,13 +325,10 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label3.ZOrder" xml:space="preserve">
<value>40</value>
<value>49</value>
</data>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="txtGuideRate.Location" type="System.Drawing.Point, System.Drawing">
<value>375, 166</value>
<value>388, 259</value>
</data>
<data name="txtGuideRate.Size" type="System.Drawing.Size, System.Drawing">
<value>46, 20</value>
@@ -342,6 +339,9 @@
<data name="txtGuideRate.Text" xml:space="preserve">
<value>10.0</value>
</data>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="txtGuideRate.ToolTip" xml:space="preserve">
<value>LX-200GPS only</value>
</data>
@@ -355,13 +355,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;txtGuideRate.ZOrder" xml:space="preserve">
<value>39</value>
<value>48</value>
</data>
<data name="label4.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label4.Location" type="System.Drawing.Point, System.Drawing">
<value>427, 169</value>
<value>440, 262</value>
</data>
<data name="label4.Size" type="System.Drawing.Size, System.Drawing">
<value>122, 13</value>
@@ -382,13 +382,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label4.ZOrder" xml:space="preserve">
<value>38</value>
<value>47</value>
</data>
<data name="lblPercentOfSiderealRate.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="lblPercentOfSiderealRate.Location" type="System.Drawing.Point, System.Drawing">
<value>427, 182</value>
<value>440, 275</value>
</data>
<data name="lblPercentOfSiderealRate.Size" type="System.Drawing.Size, System.Drawing">
<value>105, 13</value>
@@ -409,13 +409,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;lblPercentOfSiderealRate.ZOrder" xml:space="preserve">
<value>37</value>
<value>46</value>
</data>
<data name="label5.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label5.Location" type="System.Drawing.Point, System.Drawing">
<value>290, 201</value>
<value>290, 294</value>
</data>
<data name="label5.Size" type="System.Drawing.Size, System.Drawing">
<value>50, 13</value>
@@ -436,7 +436,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label5.ZOrder" xml:space="preserve">
<value>36</value>
<value>45</value>
</data>
<data name="cboPrecision.Items" xml:space="preserve">
<value>Unchanged</value>
@@ -448,7 +448,7 @@
<value>High</value>
</data>
<data name="cboPrecision.Location" type="System.Drawing.Point, System.Drawing">
<value>375, 198</value>
<value>388, 291</value>
</data>
<data name="cboPrecision.Size" type="System.Drawing.Size, System.Drawing">
<value>90, 21</value>
@@ -466,7 +466,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cboPrecision.ZOrder" xml:space="preserve">
<value>35</value>
<value>44</value>
</data>
<data name="label6.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -475,7 +475,7 @@
<value>NoControl</value>
</data>
<data name="label6.Location" type="System.Drawing.Point, System.Drawing">
<value>290, 228</value>
<value>290, 321</value>
</data>
<data name="label6.Size" type="System.Drawing.Size, System.Drawing">
<value>67, 13</value>
@@ -496,7 +496,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label6.ZOrder" xml:space="preserve">
<value>34</value>
<value>43</value>
</data>
<data name="cboGuidingStyle.Items" xml:space="preserve">
<value>Auto</value>
@@ -508,7 +508,7 @@
<value>Pulse guiding</value>
</data>
<data name="cboGuidingStyle.Location" type="System.Drawing.Point, System.Drawing">
<value>375, 225</value>
<value>388, 318</value>
</data>
<data name="cboGuidingStyle.Size" type="System.Drawing.Size, System.Drawing">
<value>90, 21</value>
@@ -526,7 +526,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cboGuidingStyle.ZOrder" xml:space="preserve">
<value>33</value>
<value>42</value>
</data>
<data name="label7.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -556,7 +556,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label7.ZOrder" xml:space="preserve">
<value>32</value>
<value>41</value>
</data>
<data name="label8.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -568,7 +568,7 @@
<value>NoControl</value>
</data>
<data name="label8.Location" type="System.Drawing.Point, System.Drawing">
<value>290, 284</value>
<value>290, 359</value>
</data>
<data name="label8.Size" type="System.Drawing.Size, System.Drawing">
<value>52, 13</value>
@@ -589,10 +589,10 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label8.ZOrder" xml:space="preserve">
<value>31</value>
<value>40</value>
</data>
<data name="txtBacklashSteps.Location" type="System.Drawing.Point, System.Drawing">
<value>375, 302</value>
<value>388, 377</value>
</data>
<data name="txtBacklashSteps.Size" type="System.Drawing.Size, System.Drawing">
<value>46, 20</value>
@@ -613,7 +613,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;txtBacklashSteps.ZOrder" xml:space="preserve">
<value>29</value>
<value>38</value>
</data>
<data name="label9.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -622,7 +622,7 @@
<value>NoControl</value>
</data>
<data name="label9.Location" type="System.Drawing.Point, System.Drawing">
<value>290, 305</value>
<value>290, 380</value>
</data>
<data name="label9.Size" type="System.Drawing.Size, System.Drawing">
<value>79, 13</value>
@@ -643,7 +643,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label9.ZOrder" xml:space="preserve">
<value>30</value>
<value>39</value>
</data>
<data name="label10.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -652,7 +652,7 @@
<value>NoControl</value>
</data>
<data name="label10.Location" type="System.Drawing.Point, System.Drawing">
<value>427, 305</value>
<value>440, 380</value>
</data>
<data name="label10.Size" type="System.Drawing.Size, System.Drawing">
<value>20, 13</value>
@@ -673,7 +673,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label10.ZOrder" xml:space="preserve">
<value>28</value>
<value>37</value>
</data>
<data name="label11.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -706,13 +706,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label11.ZOrder" xml:space="preserve">
<value>27</value>
<value>36</value>
</data>
<data name="cbxReverseDirection.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="cbxReverseDirection.Location" type="System.Drawing.Point, System.Drawing">
<value>375, 328</value>
<value>388, 403</value>
</data>
<data name="cbxReverseDirection.Size" type="System.Drawing.Size, System.Drawing">
<value>109, 17</value>
@@ -733,13 +733,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cbxReverseDirection.ZOrder" xml:space="preserve">
<value>26</value>
<value>35</value>
</data>
<data name="cbxDynamicBreaking.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="cbxDynamicBreaking.Location" type="System.Drawing.Point, System.Drawing">
<value>375, 351</value>
<value>388, 426</value>
</data>
<data name="cbxDynamicBreaking.Size" type="System.Drawing.Size, System.Drawing">
<value>112, 17</value>
@@ -760,7 +760,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cbxDynamicBreaking.ZOrder" xml:space="preserve">
<value>25</value>
<value>34</value>
</data>
<data name="cbxRtsDtr.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -793,11 +793,8 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cbxRtsDtr.ZOrder" xml:space="preserve">
<value>24</value>
<value>33</value>
</data>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="cbxSendDateTime.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
@@ -829,13 +826,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cbxSendDateTime.ZOrder" xml:space="preserve">
<value>6</value>
<value>15</value>
</data>
<data name="label12.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label12.Location" type="System.Drawing.Point, System.Drawing">
<value>290, 96</value>
<value>290, 189</value>
</data>
<data name="label12.Size" type="System.Drawing.Size, System.Drawing">
<value>72, 13</value>
@@ -856,10 +853,10 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label12.ZOrder" xml:space="preserve">
<value>23</value>
<value>32</value>
</data>
<data name="txtElevation.Location" type="System.Drawing.Point, System.Drawing">
<value>375, 93</value>
<value>388, 186</value>
</data>
<data name="txtElevation.Size" type="System.Drawing.Size, System.Drawing">
<value>100, 20</value>
@@ -877,13 +874,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;txtElevation.ZOrder" xml:space="preserve">
<value>22</value>
<value>31</value>
</data>
<data name="label13.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label13.Location" type="System.Drawing.Point, System.Drawing">
<value>481, 96</value>
<value>494, 189</value>
</data>
<data name="label13.Size" type="System.Drawing.Size, System.Drawing">
<value>38, 13</value>
@@ -904,13 +901,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label13.ZOrder" xml:space="preserve">
<value>21</value>
<value>30</value>
</data>
<data name="label14.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label14.Location" type="System.Drawing.Point, System.Drawing">
<value>290, 127</value>
<value>290, 220</value>
</data>
<data name="label14.Size" type="System.Drawing.Size, System.Drawing">
<value>56, 13</value>
@@ -931,10 +928,10 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label14.ZOrder" xml:space="preserve">
<value>20</value>
<value>29</value>
</data>
<data name="nudSettleTime.Location" type="System.Drawing.Point, System.Drawing">
<value>375, 125</value>
<value>388, 218</value>
</data>
<data name="nudSettleTime.Size" type="System.Drawing.Size, System.Drawing">
<value>120, 20</value>
@@ -952,13 +949,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;nudSettleTime.ZOrder" xml:space="preserve">
<value>19</value>
<value>28</value>
</data>
<data name="label15.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label15.Location" type="System.Drawing.Point, System.Drawing">
<value>501, 127</value>
<value>514, 220</value>
</data>
<data name="label15.Size" type="System.Drawing.Size, System.Drawing">
<value>47, 13</value>
@@ -979,7 +976,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label15.ZOrder" xml:space="preserve">
<value>18</value>
<value>27</value>
</data>
<data name="label16.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -1006,7 +1003,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label16.ZOrder" xml:space="preserve">
<value>17</value>
<value>26</value>
</data>
<data name="cboStopBits.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 163</value>
@@ -1027,7 +1024,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cboStopBits.ZOrder" xml:space="preserve">
<value>16</value>
<value>25</value>
</data>
<data name="numDatabits.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 137</value>
@@ -1048,7 +1045,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;numDatabits.ZOrder" xml:space="preserve">
<value>15</value>
<value>24</value>
</data>
<data name="cboParity.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 190</value>
@@ -1069,7 +1066,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cboParity.ZOrder" xml:space="preserve">
<value>14</value>
<value>23</value>
</data>
<data name="cboSpeed.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 217</value>
@@ -1090,7 +1087,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cboSpeed.ZOrder" xml:space="preserve">
<value>13</value>
<value>22</value>
</data>
<data name="cboHandShake.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 244</value>
@@ -1111,7 +1108,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cboHandShake.ZOrder" xml:space="preserve">
<value>12</value>
<value>21</value>
</data>
<data name="label17.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -1138,7 +1135,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label17.ZOrder" xml:space="preserve">
<value>11</value>
<value>20</value>
</data>
<data name="label18.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -1165,7 +1162,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label18.ZOrder" xml:space="preserve">
<value>10</value>
<value>19</value>
</data>
<data name="label19.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -1192,7 +1189,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label19.ZOrder" xml:space="preserve">
<value>9</value>
<value>18</value>
</data>
<data name="label20.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -1219,7 +1216,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label20.ZOrder" xml:space="preserve">
<value>8</value>
<value>17</value>
</data>
<data name="label21.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -1231,7 +1228,7 @@
<value>NoControl</value>
</data>
<data name="label21.Location" type="System.Drawing.Point, System.Drawing">
<value>15, 284</value>
<value>15, 359</value>
</data>
<data name="label21.Size" type="System.Drawing.Size, System.Drawing">
<value>73, 13</value>
@@ -1252,7 +1249,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label21.ZOrder" xml:space="preserve">
<value>7</value>
<value>16</value>
</data>
<data name="cboParkedBehaviour.Items" xml:space="preserve">
<value>No Coordinates</value>
@@ -1282,7 +1279,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cboParkedBehaviour.ZOrder" xml:space="preserve">
<value>5</value>
<value>14</value>
</data>
<data name="label22.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -1309,7 +1306,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label22.ZOrder" xml:space="preserve">
<value>4</value>
<value>13</value>
</data>
<data name="label23.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -1336,7 +1333,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label23.ZOrder" xml:space="preserve">
<value>3</value>
<value>12</value>
</data>
<data name="label24.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -1363,7 +1360,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label24.ZOrder" xml:space="preserve">
<value>2</value>
<value>11</value>
</data>
<data name="txtParkedAlt.Location" type="System.Drawing.Point, System.Drawing">
<value>697, 151</value>
@@ -1384,7 +1381,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;txtParkedAlt.ZOrder" xml:space="preserve">
<value>1</value>
<value>10</value>
</data>
<data name="txtParkedAz.Location" type="System.Drawing.Point, System.Drawing">
<value>697, 177</value>
@@ -1405,8 +1402,251 @@
<value>$this</value>
</data>
<data name="&gt;&gt;txtParkedAz.ZOrder" xml:space="preserve">
<value>9</value>
</data>
<data name="label25.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label25.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label25.Location" type="System.Drawing.Point, System.Drawing">
<value>290, 90</value>
</data>
<data name="label25.Size" type="System.Drawing.Size, System.Drawing">
<value>69, 13</value>
</data>
<data name="label25.TabIndex" type="System.Int32, mscorlib">
<value>48</value>
</data>
<data name="label25.Text" xml:space="preserve">
<value>Focal Length</value>
</data>
<data name="&gt;&gt;label25.Name" xml:space="preserve">
<value>label25</value>
</data>
<data name="&gt;&gt;label25.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label25.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label25.ZOrder" xml:space="preserve">
<value>8</value>
</data>
<data name="txtFocalLength.Location" type="System.Drawing.Point, System.Drawing">
<value>388, 87</value>
</data>
<data name="txtFocalLength.Size" type="System.Drawing.Size, System.Drawing">
<value>100, 20</value>
</data>
<data name="txtFocalLength.TabIndex" type="System.Int32, mscorlib">
<value>49</value>
</data>
<data name="&gt;&gt;txtFocalLength.Name" xml:space="preserve">
<value>txtFocalLength</value>
</data>
<data name="&gt;&gt;txtFocalLength.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;txtFocalLength.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;txtFocalLength.ZOrder" xml:space="preserve">
<value>7</value>
</data>
<data name="label26.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label26.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label26.Location" type="System.Drawing.Point, System.Drawing">
<value>494, 90</value>
</data>
<data name="label26.Size" type="System.Drawing.Size, System.Drawing">
<value>23, 13</value>
</data>
<data name="label26.TabIndex" type="System.Int32, mscorlib">
<value>50</value>
</data>
<data name="label26.Text" xml:space="preserve">
<value>mm</value>
</data>
<data name="&gt;&gt;label26.Name" xml:space="preserve">
<value>label26</value>
</data>
<data name="&gt;&gt;label26.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label26.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label26.ZOrder" xml:space="preserve">
<value>6</value>
</data>
<data name="label27.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label27.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label27.Location" type="System.Drawing.Point, System.Drawing">
<value>494, 114</value>
</data>
<data name="label27.Size" type="System.Drawing.Size, System.Drawing">
<value>23, 13</value>
</data>
<data name="label27.TabIndex" type="System.Int32, mscorlib">
<value>53</value>
</data>
<data name="label27.Text" xml:space="preserve">
<value>mm</value>
</data>
<data name="&gt;&gt;label27.Name" xml:space="preserve">
<value>label27</value>
</data>
<data name="&gt;&gt;label27.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label27.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label27.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="txtApertureDiameter.Location" type="System.Drawing.Point, System.Drawing">
<value>388, 111</value>
</data>
<data name="txtApertureDiameter.Size" type="System.Drawing.Size, System.Drawing">
<value>100, 20</value>
</data>
<data name="txtApertureDiameter.TabIndex" type="System.Int32, mscorlib">
<value>52</value>
</data>
<data name="&gt;&gt;txtApertureDiameter.Name" xml:space="preserve">
<value>txtApertureDiameter</value>
</data>
<data name="&gt;&gt;txtApertureDiameter.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;txtApertureDiameter.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;txtApertureDiameter.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="label28.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label28.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label28.Location" type="System.Drawing.Point, System.Drawing">
<value>290, 114</value>
</data>
<data name="label28.Size" type="System.Drawing.Size, System.Drawing">
<value>92, 13</value>
</data>
<data name="label28.TabIndex" type="System.Int32, mscorlib">
<value>51</value>
</data>
<data name="label28.Text" xml:space="preserve">
<value>Aperture Diameter</value>
</data>
<data name="&gt;&gt;label28.Name" xml:space="preserve">
<value>label28</value>
</data>
<data name="&gt;&gt;label28.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label28.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label28.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<data name="label29.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label29.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label29.Location" type="System.Drawing.Point, System.Drawing">
<value>494, 139</value>
</data>
<data name="label29.Size" type="System.Drawing.Size, System.Drawing">
<value>23, 13</value>
</data>
<data name="label29.TabIndex" type="System.Int32, mscorlib">
<value>56</value>
</data>
<data name="label29.Text" xml:space="preserve">
<value>mm</value>
</data>
<data name="&gt;&gt;label29.Name" xml:space="preserve">
<value>label29</value>
</data>
<data name="&gt;&gt;label29.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label29.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label29.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="txtApertureArea.Location" type="System.Drawing.Point, System.Drawing">
<value>388, 136</value>
</data>
<data name="txtApertureArea.Size" type="System.Drawing.Size, System.Drawing">
<value>100, 20</value>
</data>
<data name="txtApertureArea.TabIndex" type="System.Int32, mscorlib">
<value>55</value>
</data>
<data name="&gt;&gt;txtApertureArea.Name" xml:space="preserve">
<value>txtApertureArea</value>
</data>
<data name="&gt;&gt;txtApertureArea.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;txtApertureArea.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;txtApertureArea.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="label30.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label30.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label30.Location" type="System.Drawing.Point, System.Drawing">
<value>290, 139</value>
</data>
<data name="label30.Size" type="System.Drawing.Size, System.Drawing">
<value>72, 13</value>
</data>
<data name="label30.TabIndex" type="System.Int32, mscorlib">
<value>54</value>
</data>
<data name="label30.Text" xml:space="preserve">
<value>Aperture Area</value>
</data>
<data name="&gt;&gt;label30.Name" xml:space="preserve">
<value>label30</value>
</data>
<data name="&gt;&gt;label30.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label30.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label30.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
+116 -25
View File
@@ -18,7 +18,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Security.AccessControl;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using ASCOM.DeviceInterface;
@@ -198,6 +198,9 @@ namespace ASCOM.Meade.net
private const string ParkedBehaviourName = "Parked Behaviour";
private const string ParkedAltName = "Parked Altitude";
private const string ParkedAzimuthName = "Parked Azimuth";
private const string FocalLengthName = "Focal Length (mm)";
private const string ApertureAreaName = "Aperture Area (mm²)";
private const string ApertureDiameterName = "Aperture Diameter (mm)";
public static void WriteProfile(ProfileProperties profileProperties)
{
@@ -226,6 +229,9 @@ namespace ASCOM.Meade.net
driverProfile.WriteValue(DriverId, ParkedBehaviourName, profileProperties.ParkedBehaviour.GetDescription());
driverProfile.WriteValue(DriverId, ParkedAltName, profileProperties.ParkedAlt.ToString(CultureInfo.InvariantCulture));
driverProfile.WriteValue(DriverId, ParkedAzimuthName, profileProperties.ParkedAz.ToString(CultureInfo.InvariantCulture));
driverProfile.WriteValue(DriverId, FocalLengthName, profileProperties.FocalLength.ToString(CultureInfo.InvariantCulture));
driverProfile.WriteValue(DriverId, ApertureAreaName, profileProperties.ApertureArea.ToString(CultureInfo.InvariantCulture));
driverProfile.WriteValue(DriverId, ApertureDiameterName, profileProperties.ApertureDiameter.ToString(CultureInfo.InvariantCulture));
}
}
}
@@ -250,6 +256,9 @@ namespace ASCOM.Meade.net
private const string ParkedBehaviourDefault = "No Coordinates";
private const string ParkedAltDefault = "0";
private const string ParkedAzimuthDefault = "180";
private const string FocalLengthDefault = "2000";
private const string ApertureAreaDefault = "32685";
private const string ApertureDiameterDefault = "203";
public static ProfileProperties ReadProfile()
{
@@ -280,6 +289,9 @@ namespace ASCOM.Meade.net
profileProperties.ParkedBehaviour = EnumExtensionMethods.GetValueFromDescription<ParkedBehaviour>(driverProfile.GetValue(DriverId, ParkedBehaviourName, string.Empty, ParkedBehaviourDefault));
profileProperties.ParkedAlt = double.Parse(driverProfile.GetValue(DriverId, ParkedAltName, string.Empty, ParkedAltDefault), NumberFormatInfo.InvariantInfo);
profileProperties.ParkedAz = double.Parse(driverProfile.GetValue(DriverId, ParkedAzimuthName, string.Empty, ParkedAzimuthDefault), NumberFormatInfo.InvariantInfo);
profileProperties.FocalLength = double.Parse(driverProfile.GetValue(DriverId, FocalLengthName, string.Empty, FocalLengthDefault), NumberFormatInfo.InvariantInfo);
profileProperties.ApertureArea = double.Parse(driverProfile.GetValue(DriverId, ApertureAreaName, string.Empty, ApertureAreaDefault), NumberFormatInfo.InvariantInfo);
profileProperties.ApertureDiameter = double.Parse(driverProfile.GetValue(DriverId, ApertureDiameterName, string.Empty, ApertureDiameterDefault), NumberFormatInfo.InvariantInfo);
}
return profileProperties;
@@ -377,10 +389,73 @@ namespace ASCOM.Meade.net
SharedSerial.DataBits = profileProperties.DataBits;
SharedSerial.StopBits = (SerialStopBits)Enum.Parse(typeof(SerialStopBits), profileProperties.StopBits);
SharedSerial.Parity = (SerialParity)Enum.Parse(typeof(SerialParity), profileProperties.Parity);
SharedSerial.Speed = (SerialSpeed)profileProperties.Speed;
SharedSerial.Handshake = (SerialHandshake)Enum.Parse(typeof(SerialHandshake), profileProperties.Handshake);
SharedSerial.Connected = true;
SharedSerial.ReceiveTimeout = 5; //5 second timeout;
SharedSerial.Speed = SerialSpeed.ps9600;
var wantedSpeed = (SerialSpeed)profileProperties.Speed;
if (wantedSpeed != SerialSpeed.ps9600)
{
SharedSerial.Speed = wantedSpeed;
SharedSerial.Connected = true;
var speedRampNeeded = false;
//Test if communication is working.
try
{
string utcOffSet = SendString("GG");
}
catch (Exception)
{
speedRampNeeded = true;
}
if (speedRampNeeded)
{
SharedSerial.Connected = false;
SharedSerial.Speed = SerialSpeed.ps9600;
SharedSerial.Connected = true;
int newSpeedIndex = GetSpeedIndex(wantedSpeed);
//:SBn# Set Baud Rate n, where n is an ASCII digit (1..9) with the following interpertation
// 1 56.7K
// 2 38.4K
// 3 28.8K
// 4 19.2K
// 5 14.4K
// 6 9600
// 7 4800
// 8 2400
// 9 1200
//Returns:
// 1 At the current baud rate and then changes to the new rate for further communication
//SendBlind($"SB{newSpeedIndex}");
try
{
var speedChanged = SendChar($"SB{newSpeedIndex}");
if (speedChanged == "1")
{
SharedSerial.Connected = false;
SharedSerial.Speed = wantedSpeed;
traceLogger.LogIssue("Connect",
$"Telescope serial port speed change, connecting at {SharedSerial.Speed}.");
}
else
{
throw new Exception("Autostar not signalled speed change.");
}
}
catch (Exception)
{
SharedSerial.Connected = false;
SharedSerial.Speed = SerialSpeed.ps9600;
traceLogger.LogIssue("Connect", $"Telescope not responding to speed change, connecting at {SharedSerial.Speed}.");
}
}
}
SharedSerial.Connected = true;
try
{
ProductName = SendString("GVP");
@@ -439,6 +514,23 @@ namespace ASCOM.Meade.net
}
}
private static int GetSpeedIndex(SerialSpeed speed)
{
switch (speed)
{
case SerialSpeed.ps57600: return 1;
case SerialSpeed.ps38400: return 2;
case SerialSpeed.ps28800: return 3;
case SerialSpeed.ps19200: return 4;
case SerialSpeed.ps14400: return 5;
case SerialSpeed.ps9600: return 6;
case SerialSpeed.ps4800: return 7;
case SerialSpeed.ps2400: return 8;
case SerialSpeed.ps1200: return 9;
default: throw new NotSupportedException($"{SpeedDefault} not supported");
}
}
public static void Disconnect(string deviceId, string driverId)
{
lock (LockObject)
@@ -475,23 +567,7 @@ namespace ASCOM.Meade.net
}
#endregion
public static void Lock(Action action)
{
lock (LockObject)
{
action();
}
}
public static T Lock<T>(Func<T> func)
{
lock (LockObject)
{
return func();
}
}
/// <summary>
/// Skeleton of a hardware class, all this does is hold a count of the connections,
/// in reality extra code will be needed to handle the hardware in some way
@@ -506,10 +582,25 @@ namespace ASCOM.Meade.net
}
}
public static void SetParked(bool atPark, ParkedPosition parkedPosition)
public static void SetParked(bool atPark, ParkedPosition parkedPosition, bool restartTracking)
{
IsParked = atPark;
ParkedPosition = parkedPosition;
RestartTracking = restartTracking;
}
private static readonly ThreadSafeValue<bool> _restartTracking = false;
public static bool RestartTracking
{
get => _restartTracking;
private set => _restartTracking.Set(value);
}
private static ParkedPosition _parkedPosition;
public static ParkedPosition ParkedPosition
{
get => _parkedPosition;
private set => Interlocked.Exchange(ref _parkedPosition, value);
}
private static readonly ThreadSafeValue<bool> _isParked = false;
@@ -519,11 +610,11 @@ namespace ASCOM.Meade.net
private set => _isParked.Set(value);
}
private static ParkedPosition _parkedPosition;
public static ParkedPosition ParkedPosition
private static readonly ThreadSafeValue<AlignmentModes> _alignmentMode = AlignmentModes.algAltAz;
public static AlignmentModes AlignmentMode
{
get => _parkedPosition;
private set => Interlocked.Exchange(ref _parkedPosition, value);
get => _alignmentMode;
set => _alignmentMode.Set(value);
}
private static readonly ThreadSafeValue<PierSide> _sideOfPier = PierSide.pierUnknown;
+1
View File
@@ -23,6 +23,7 @@
// ReSharper disable once InconsistentNaming
public const string LX200GPS = "LX2001";
public const string LX200GPS_42F = "4.2F";
// ReSharper disable once InconsistentNaming
public const string LX200GPS_42G = "4.2G";
#endregion
+7 -17
View File
@@ -12,10 +12,7 @@ namespace ASCOM.Meade.net.Wrapper
string ProductName { get; }
string FirmwareVersion { get; }
void Lock(Action action);
T Lock<T>(Func<T> func);
string SendString(string message, bool raw = false);
void SendBlind(string message, bool raw = false);
bool SendBool(string command, bool raw = false);
@@ -30,9 +27,10 @@ namespace ASCOM.Meade.net.Wrapper
void WriteProfile(ProfileProperties profileProperties);
void ReadCharacters(int throwAwayCharacters);
void SetParked(bool atPark, ParkedPosition parkedPosition);
void SetParked(bool atPark, ParkedPosition parkedPosition, bool restartTracking);
bool IsParked { get; }
ParkedPosition ParkedPosition { get; }
bool RestartTracking { get; }
PierSide SideOfPier { get; set; }
double? TargetRightAscension { get; set; }
@@ -69,16 +67,6 @@ namespace ASCOM.Meade.net.Wrapper
public string FirmwareVersion => SharedResources.FirmwareVersion;
public void Lock(Action action)
{
SharedResources.Lock(action);
}
public T Lock<T>(Func<T> func)
{
return SharedResources.Lock(func);
}
public string SendString(string message, bool raw = false)
{
return SharedResources.SendString(message, raw);
@@ -129,13 +117,15 @@ namespace ASCOM.Meade.net.Wrapper
SharedResources.WriteProfile(profileProperties);
}
public void SetParked(bool atPark, ParkedPosition parkedPosition)
public void SetParked(bool atPark, ParkedPosition parkedPosition, bool restartTracking)
{
SharedResources.SetParked(atPark, parkedPosition);
SharedResources.SetParked(atPark, parkedPosition, restartTracking);
}
public bool IsParked => SharedResources.IsParked;
public bool RestartTracking => SharedResources.RestartTracking;
public ParkedPosition ParkedPosition => SharedResources.ParkedPosition;
public PierSide SideOfPier