Readded support for guide rate get and set. This will use a default value of 0.67 sidereal rate. But can be overridden by a user.

This commit is contained in:
2019-07-22 15:06:03 +01:00
parent 692e39771c
commit 37437b7c7c
11 changed files with 261 additions and 72 deletions
@@ -30,6 +30,7 @@ namespace Meade.net.Telescope.UnitTests
_profileProperties = new ProfileProperties(); _profileProperties = new ProfileProperties();
_profileProperties.TraceLogger = false; _profileProperties.TraceLogger = false;
_profileProperties.ComPort = "TestCom1"; _profileProperties.ComPort = "TestCom1";
_profileProperties.GuideRateArcSecondsPerSecond = 1.23;
_utilMock = new Mock<IUtil>(); _utilMock = new Mock<IUtil>();
_utilExtraMock = new Mock<IUtilExtra>(); _utilExtraMock = new Mock<IUtilExtra>();
@@ -38,6 +39,7 @@ namespace Meade.net.Telescope.UnitTests
_sharedResourcesWrapperMock = new Mock<ISharedResourcesWrapper>(); _sharedResourcesWrapperMock = new Mock<ISharedResourcesWrapper>();
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GZ#")).Returns("DDD*MMSS"); _sharedResourcesWrapperMock.Setup(x => x.SendString(":GZ#")).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<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<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()); _sharedResourcesWrapperMock.Setup(x => x.Lock(It.IsAny<Func<AltitudeData>>())).Returns<Func<AltitudeData>>((func) => func());
@@ -643,8 +645,7 @@ namespace Meade.net.Telescope.UnitTests
var result = _telescope.CanSetGuideRates; var result = _telescope.CanSetGuideRates;
//Assert.That(result, Is.True); Assert.That(result, Is.True);
Assert.That(result, Is.False);
} }
[Test] [Test]
@@ -829,7 +830,7 @@ namespace Meade.net.Telescope.UnitTests
{ {
var result = _telescope.GuideRateDeclination; var result = _telescope.GuideRateDeclination;
Assert.That(result, Is.EqualTo(0.004178074616551509)); Assert.That(result, Is.EqualTo(0.00034166666666666666));
} }
[Test] [Test]
@@ -843,26 +844,26 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(excpetion.AccessorSet, Is.True); Assert.That(excpetion.AccessorSet, Is.True);
} }
//[Test] [Test]
//public void GuideRateDeclination_Set_WhenIsSupported_ThenSetsNewGuideRate() public void GuideRateDeclination_Set_WhenIsSupported_ThenSetsNewGuideRate()
//{ {
// var newGuideRate = 10; var newGuideRate = 0.00034166666666666666;
// _sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.LX200GPS); _sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.LX200GPS);
// _telescope.GuideRateDeclination = newGuideRate; _telescope.GuideRateDeclination = newGuideRate;
// _sharedResourcesWrapperMock.Verify( x => x.SendBlind(":Rg10.0#"),Times.Once); _sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Rg01.2#"), Times.Once);
// Assert.That(_telescope.GuideRateDeclination, Is.EqualTo(newGuideRate)); Assert.That(_telescope.GuideRateDeclination, Is.EqualTo(newGuideRate));
//} }
[Test] [Test]
public void GuideRateRightAscension_Get_ThenThrowsException() public void GuideRateRightAscension_Get_ThenThrowsException()
{ {
var result = _telescope.GuideRateRightAscension; var result = _telescope.GuideRateRightAscension;
Assert.That(result, Is.EqualTo(0.004178074616551509)); Assert.That(result, Is.EqualTo(0.00034166666666666666));
} }
[Test] [Test]
@@ -876,19 +877,19 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(excpetion.AccessorSet, Is.True); Assert.That(excpetion.AccessorSet, Is.True);
} }
//[Test] [Test]
//public void GuideRateRightAscension_Set_WhenIsSupported_ThenSetsNewGuideRate() public void GuideRateRightAscension_Set_WhenIsSupported_ThenSetsNewGuideRate()
//{ {
// var newGuideRate = 10; var newGuideRate = 0.00034166666666666666;
// _sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.LX200GPS); _sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.LX200GPS);
// _telescope.GuideRateRightAscension = newGuideRate; _telescope.GuideRateRightAscension = newGuideRate;
// _sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Rg10.0#"), Times.Once); _sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Rg01.2#"), Times.Once);
// Assert.That(_telescope.GuideRateDeclination, Is.EqualTo(newGuideRate)); Assert.That(_telescope.GuideRateDeclination, Is.EqualTo(newGuideRate));
//} }
[Test] [Test]
public void IsPulseGuiding_Get_ReturnsFalse() public void IsPulseGuiding_Get_ReturnsFalse()
+5
View File
@@ -6,5 +6,10 @@ namespace ASCOM.Meade.net
{ {
return int.Parse(str); return int.Parse(str);
} }
public static double ToDouble(this string str)
{
return double.Parse(str);
}
} }
} }
+57 -32
View File
@@ -112,8 +112,6 @@ namespace ASCOM.Meade.net
IsConnected = false; // Initialise connected to false IsConnected = false; // Initialise connected to false
_guideRate = 15.0 * (1.0 / 3600.0) / SIDRATE;
LogMessage("Telescope", "Completed initialisation"); LogMessage("Telescope", "Completed initialisation");
} }
@@ -376,15 +374,14 @@ namespace ASCOM.Meade.net
return false; return false;
} }
//todo implement ability to read and write the guide rate from the telescope. private bool IsGuideRateSettingSupported()
//private bool IsGuideRateSettingSupported() {
//{ if (_sharedResourcesWrapper.ProductName == TelescopeList.LX200GPS)
// if (_sharedResourcesWrapper.ProductName == TelescopeList.LX200GPS) {
// { return true;
// return true; }
// } return false;
// return false; }
//}
private bool FirmwareIsGreaterThan(string minVersion) private bool FirmwareIsGreaterThan(string minVersion)
{ {
@@ -759,8 +756,7 @@ namespace ASCOM.Meade.net
{ {
CheckConnected("CanSetGuideRates Get"); CheckConnected("CanSetGuideRates Get");
//var canSetGuideRate = IsGuideRateSettingSupported(); var canSetGuideRate = IsGuideRateSettingSupported();
var canSetGuideRate = false;
LogMessage("CanSetGuideRates", "Get - " + canSetGuideRate.ToString()); LogMessage("CanSetGuideRates", "Get - " + canSetGuideRate.ToString());
return canSetGuideRate; return canSetGuideRate;
@@ -946,33 +942,48 @@ namespace ASCOM.Meade.net
private void SetNewGuideRate(double value, string propertyName) private void SetNewGuideRate(double value, string propertyName)
{ {
//if (!IsGuideRateSettingSupported()) if (!IsGuideRateSettingSupported())
//{ {
LogMessage("GuideRateDeclination Set", "Not implemented"); LogMessage("GuideRateDeclination Set", "Not implemented");
throw new PropertyNotImplementedException(propertyName, true); throw new PropertyNotImplementedException(propertyName, true);
//} }
//if (!value.InRange(0, 15.0417)) var valueInArcSecondsPerSecond = DegreesPerSecondToArcSecondPerSecond(value);
//{
// throw new InvalidValueException(propertyName, value.ToString(), "0 to 15.0417”/sec");
//}
//_sharedResourcesWrapper.SendBlind($":Rg{value:00.0}#"); if (!valueInArcSecondsPerSecond.InRange(0, 15.0417))
////:RgSS.S# {
////Set guide rate to +/ -SS.S to arc seconds per second.This rate is added to or subtracted from the current tracking throw new InvalidValueException(propertyName, valueInArcSecondsPerSecond.ToString(), "0 to 15.0417”/sec");
////Rates when the CCD guider or handbox guider buttons are pressed when the guide rate is selected.Rate shall not exceed }
////sidereal speed(approx 15.0417”/sec)[Autostar II only]
////Returns: Nothing
// _guideRate = value; _sharedResourcesWrapper.SendBlind($":Rg{valueInArcSecondsPerSecond:00.0}#");
//:RgSS.S#
//Set guide rate to +/ -SS.S to arc seconds per second.This rate is added to or subtracted from the current tracking
//Rates when the CCD guider or handbox guider buttons are pressed when the guide rate is selected.Rate shall not exceed
//sidereal speed(approx 15.0417”/sec)[Autostar II only]
//Returns: Nothing
_guideRate = valueInArcSecondsPerSecond;
WriteProfile();
}
private double DegreesPerSecondToArcSecondPerSecond(double value)
{
return value * 3600.0;
}
private double ArcSecondPerSecondToDegreesPerSecond(double value)
{
return value / 3600.0;
} }
public double GuideRateDeclination public double GuideRateDeclination
{ {
get get
{ {
LogMessage("GuideRateDeclination Get", "Not implemented"); var degreesPerSecond = ArcSecondPerSecondToDegreesPerSecond(_guideRate);
return _guideRate; LogMessage("GuideRateDeclination Get", $"{_guideRate:00.0} arc seconds / second = {degreesPerSecond} degrees per second");
return degreesPerSecond;
} }
set set
{ {
@@ -984,8 +995,9 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
LogMessage("GuideRateRightAscension Get", "Not implemented"); var degreesPerSecond = ArcSecondPerSecondToDegreesPerSecond(_guideRate);
return _guideRate; LogMessage("GuideRateRightAscension Get", $"{_guideRate:00.0} arc seconds / second = {degreesPerSecond} degrees per second");
return degreesPerSecond;
} }
set set
{ {
@@ -2087,9 +2099,22 @@ namespace ASCOM.Meade.net
/// </summary> /// </summary>
internal void ReadProfile() internal void ReadProfile()
{ {
var profileProperties = _sharedResourcesWrapper.ReadProfile(); ProfileProperties profileProperties = _sharedResourcesWrapper.ReadProfile();
_tl.Enabled = profileProperties.TraceLogger; _tl.Enabled = profileProperties.TraceLogger;
_comPort = profileProperties.ComPort; _comPort = profileProperties.ComPort;
_guideRate = profileProperties.GuideRateArcSecondsPerSecond;
}
internal void WriteProfile()
{
var profileProperties = new ProfileProperties
{
TraceLogger = _tl.Enabled,
ComPort = _comPort,
GuideRateArcSecondsPerSecond = _guideRate
};
_sharedResourcesWrapper.WriteProfile(profileProperties);
} }
/// <summary> /// <summary>
-2
View File
@@ -9,14 +9,12 @@ namespace ASCOM.Meade.net
class GarbageCollection class GarbageCollection
{ {
private bool _mbContinueThread; private bool _mbContinueThread;
private bool _mGcWatchStopped;
private readonly int _miInterval; private readonly int _miInterval;
private readonly ManualResetEvent _mEventThreadEnded; private readonly ManualResetEvent _mEventThreadEnded;
public GarbageCollection(int iInterval) public GarbageCollection(int iInterval)
{ {
_mbContinueThread = true; _mbContinueThread = true;
_mGcWatchStopped = false;
_miInterval = iInterval; _miInterval = iInterval;
_mEventThreadEnded = new ManualResetEvent(false); _mEventThreadEnded = new ManualResetEvent(false);
} }
+1
View File
@@ -5,5 +5,6 @@ namespace ASCOM.Meade.net
// properies that are part of the profile // properies that are part of the profile
public string ComPort { get; set; } public string ComPort { get; set; }
public bool TraceLogger { get; set; } public bool TraceLogger { get; set; }
public double GuideRateArcSecondsPerSecond { get; set; }
} }
} }
+13
View File
@@ -46,6 +46,8 @@ namespace ASCOM.Meade.net
{ {
comboBoxComPort.SelectedItem = profileProperties.ComPort; comboBoxComPort.SelectedItem = profileProperties.ComPort;
} }
txtGuideRate.Text = profileProperties.GuideRateArcSecondsPerSecond.ToString();
} }
public ProfileProperties GetProfile() public ProfileProperties GetProfile()
@@ -63,5 +65,16 @@ namespace ASCOM.Meade.net
{ {
Activate(); Activate();
} }
private void TextBox1_TextChanged(object sender, EventArgs e)
{
//const double SIDRATE = 0.9972695677; //synodic/solar seconds per sidereal second
var newGuideRate = double.Parse(txtGuideRate.Text);
const double siderealArcSecondsPerSecond = 15.041;
var percentOfSideReal = (newGuideRate / siderealArcSecondsPerSecond * 100);
lblPercentOfSiderealRate.Text = $"({percentOfSideReal:00.0}% of sidereal rate)";
}
} }
} }
+33
View File
@@ -36,6 +36,10 @@ namespace ASCOM.Meade.net
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.chkTrace = new System.Windows.Forms.CheckBox(); this.chkTrace = new System.Windows.Forms.CheckBox();
this.comboBoxComPort = new System.Windows.Forms.ComboBox(); this.comboBoxComPort = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.txtGuideRate = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.lblPercentOfSiderealRate = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.picASCOM)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picASCOM)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
@@ -86,10 +90,35 @@ namespace ASCOM.Meade.net
resources.ApplyResources(this.comboBoxComPort, "comboBoxComPort"); resources.ApplyResources(this.comboBoxComPort, "comboBoxComPort");
this.comboBoxComPort.Name = "comboBoxComPort"; this.comboBoxComPort.Name = "comboBoxComPort";
// //
// label3
//
resources.ApplyResources(this.label3, "label3");
this.label3.Name = "label3";
//
// txtGuideRate
//
resources.ApplyResources(this.txtGuideRate, "txtGuideRate");
this.txtGuideRate.Name = "txtGuideRate";
this.txtGuideRate.TextChanged += new System.EventHandler(this.TextBox1_TextChanged);
//
// label4
//
resources.ApplyResources(this.label4, "label4");
this.label4.Name = "label4";
//
// lblPercentOfSiderealRate
//
resources.ApplyResources(this.lblPercentOfSiderealRate, "lblPercentOfSiderealRate");
this.lblPercentOfSiderealRate.Name = "lblPercentOfSiderealRate";
//
// SetupDialogForm // SetupDialogForm
// //
resources.ApplyResources(this, "$this"); resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.lblPercentOfSiderealRate);
this.Controls.Add(this.label4);
this.Controls.Add(this.txtGuideRate);
this.Controls.Add(this.label3);
this.Controls.Add(this.comboBoxComPort); this.Controls.Add(this.comboBoxComPort);
this.Controls.Add(this.chkTrace); this.Controls.Add(this.chkTrace);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
@@ -118,5 +147,9 @@ namespace ASCOM.Meade.net
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.CheckBox chkTrace; private System.Windows.Forms.CheckBox chkTrace;
private System.Windows.Forms.ComboBox comboBoxComPort; private System.Windows.Forms.ComboBox comboBoxComPort;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtGuideRate;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label lblPercentOfSiderealRate;
} }
} }
+114 -9
View File
@@ -123,7 +123,7 @@
</data> </data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="cmdOK.Location" type="System.Drawing.Point, System.Drawing"> <data name="cmdOK.Location" type="System.Drawing.Point, System.Drawing">
<value>281, 112</value> <value>281, 225</value>
</data> </data>
<data name="cmdOK.Size" type="System.Drawing.Size, System.Drawing"> <data name="cmdOK.Size" type="System.Drawing.Size, System.Drawing">
<value>59, 24</value> <value>59, 24</value>
@@ -145,13 +145,13 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;cmdOK.ZOrder" xml:space="preserve"> <data name="&gt;&gt;cmdOK.ZOrder" xml:space="preserve">
<value>6</value> <value>10</value>
</data> </data>
<data name="cmdCancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <data name="cmdCancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Right</value> <value>Bottom, Right</value>
</data> </data>
<data name="cmdCancel.Location" type="System.Drawing.Point, System.Drawing"> <data name="cmdCancel.Location" type="System.Drawing.Point, System.Drawing">
<value>281, 142</value> <value>281, 255</value>
</data> </data>
<data name="cmdCancel.Size" type="System.Drawing.Size, System.Drawing"> <data name="cmdCancel.Size" type="System.Drawing.Size, System.Drawing">
<value>59, 25</value> <value>59, 25</value>
@@ -172,7 +172,7 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;cmdCancel.ZOrder" xml:space="preserve"> <data name="&gt;&gt;cmdCancel.ZOrder" xml:space="preserve">
<value>5</value> <value>9</value>
</data> </data>
<data name="label1.Location" type="System.Drawing.Point, System.Drawing"> <data name="label1.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 9</value> <value>12, 9</value>
@@ -196,7 +196,7 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve"> <data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>4</value> <value>8</value>
</data> </data>
<data name="picASCOM.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <data name="picASCOM.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value> <value>Top, Right</value>
@@ -223,7 +223,7 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;picASCOM.ZOrder" xml:space="preserve"> <data name="&gt;&gt;picASCOM.ZOrder" xml:space="preserve">
<value>3</value> <value>7</value>
</data> </data>
<data name="label2.AutoSize" type="System.Boolean, mscorlib"> <data name="label2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@@ -250,7 +250,7 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;label2.ZOrder" xml:space="preserve"> <data name="&gt;&gt;label2.ZOrder" xml:space="preserve">
<value>2</value> <value>6</value>
</data> </data>
<data name="chkTrace.AutoSize" type="System.Boolean, mscorlib"> <data name="chkTrace.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@@ -277,7 +277,7 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;chkTrace.ZOrder" xml:space="preserve"> <data name="&gt;&gt;chkTrace.ZOrder" xml:space="preserve">
<value>1</value> <value>5</value>
</data> </data>
<data name="comboBoxComPort.Location" type="System.Drawing.Point, System.Drawing"> <data name="comboBoxComPort.Location" type="System.Drawing.Point, System.Drawing">
<value>77, 87</value> <value>77, 87</value>
@@ -298,6 +298,111 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;comboBoxComPort.ZOrder" xml:space="preserve"> <data name="&gt;&gt;comboBoxComPort.ZOrder" xml:space="preserve">
<value>4</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>13, 225</value>
</data>
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
<value>61, 13</value>
</data>
<data name="label3.TabIndex" type="System.Int32, mscorlib">
<value>8</value>
</data>
<data name="label3.Text" xml:space="preserve">
<value>Guide Rate</value>
</data>
<data name="&gt;&gt;label3.Name" xml:space="preserve">
<value>label3</value>
</data>
<data name="&gt;&gt;label3.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;label3.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label3.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="txtGuideRate.Location" type="System.Drawing.Point, System.Drawing">
<value>80, 222</value>
</data>
<data name="txtGuideRate.Size" type="System.Drawing.Size, System.Drawing">
<value>46, 20</value>
</data>
<data name="txtGuideRate.TabIndex" type="System.Int32, mscorlib">
<value>9</value>
</data>
<data name="txtGuideRate.Text" xml:space="preserve">
<value>10.0</value>
</data>
<data name="&gt;&gt;txtGuideRate.Name" xml:space="preserve">
<value>txtGuideRate</value>
</data>
<data name="&gt;&gt;txtGuideRate.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;txtGuideRate.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;txtGuideRate.ZOrder" xml:space="preserve">
<value>2</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>132, 225</value>
</data>
<data name="label4.Size" type="System.Drawing.Size, System.Drawing">
<value>122, 13</value>
</data>
<data name="label4.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="label4.Text" xml:space="preserve">
<value>Arc seconds per second</value>
</data>
<data name="&gt;&gt;label4.Name" xml:space="preserve">
<value>label4</value>
</data>
<data name="&gt;&gt;label4.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;label4.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label4.ZOrder" xml:space="preserve">
<value>1</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>132, 238</value>
</data>
<data name="lblPercentOfSiderealRate.Size" type="System.Drawing.Size, System.Drawing">
<value>105, 13</value>
</data>
<data name="lblPercentOfSiderealRate.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
</data>
<data name="lblPercentOfSiderealRate.Text" xml:space="preserve">
<value>(67% of sidereal rate)</value>
</data>
<data name="&gt;&gt;lblPercentOfSiderealRate.Name" xml:space="preserve">
<value>lblPercentOfSiderealRate</value>
</data>
<data name="&gt;&gt;lblPercentOfSiderealRate.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;lblPercentOfSiderealRate.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;lblPercentOfSiderealRate.ZOrder" xml:space="preserve">
<value>0</value> <value>0</value>
</data> </data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@@ -307,7 +412,7 @@
<value>6, 13</value> <value>6, 13</value>
</data> </data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing"> <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>350, 175</value> <value>350, 288</value>
</data> </data>
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms"> <data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
<value>CenterScreen</value> <value>CenterScreen</value>
+6 -4
View File
@@ -158,6 +158,7 @@ namespace ASCOM.Meade.net
// Constants used for Profile persistence // Constants used for Profile persistence
private const string ComPortProfileName = "COM Port"; private const string ComPortProfileName = "COM Port";
private const string TraceStateProfileName = "Trace Level"; private const string TraceStateProfileName = "Trace Level";
private const string GuideRateProfileName = "Guide Rate Arc Seconds Per Second";
public static void WriteProfile(ProfileProperties profileProperties) public static void WriteProfile(ProfileProperties profileProperties)
{ {
@@ -168,12 +169,14 @@ namespace ASCOM.Meade.net
driverProfile.DeviceType = "Telescope"; driverProfile.DeviceType = "Telescope";
driverProfile.WriteValue(DriverId, TraceStateProfileName, profileProperties.TraceLogger.ToString()); driverProfile.WriteValue(DriverId, TraceStateProfileName, profileProperties.TraceLogger.ToString());
driverProfile.WriteValue(DriverId, ComPortProfileName, profileProperties.ComPort); driverProfile.WriteValue(DriverId, ComPortProfileName, profileProperties.ComPort);
driverProfile.WriteValue(DriverId, GuideRateProfileName, profileProperties.GuideRateArcSecondsPerSecond.ToString());
} }
} }
} }
private const string ComPortDefault = "COM1"; private const string ComPortDefault = "COM1";
private const string TraceStateDefault = "false"; private const string TraceStateDefault = "false";
private const string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
public static ProfileProperties ReadProfile() public static ProfileProperties ReadProfile()
{ {
@@ -183,10 +186,9 @@ namespace ASCOM.Meade.net
using (Profile driverProfile = new Profile()) using (Profile driverProfile = new Profile())
{ {
driverProfile.DeviceType = "Telescope"; driverProfile.DeviceType = "Telescope";
profileProperties.ComPort = profileProperties.ComPort = driverProfile.GetValue(DriverId, ComPortProfileName, string.Empty, ComPortDefault);
driverProfile.GetValue(DriverId, ComPortProfileName, string.Empty, ComPortDefault); profileProperties.TraceLogger = Convert.ToBoolean(driverProfile.GetValue(DriverId, TraceStateProfileName, string.Empty, TraceStateDefault));
profileProperties.TraceLogger = Convert.ToBoolean(driverProfile.GetValue(DriverId, profileProperties.GuideRateArcSecondsPerSecond = double.Parse(driverProfile.GetValue(DriverId, GuideRateProfileName, string.Empty, GuideRateProfileNameDefault));
TraceStateProfileName, string.Empty, TraceStateDefault));
} }
return profileProperties; return profileProperties;
@@ -23,6 +23,7 @@ namespace ASCOM.Meade.net.Wrapper
ProfileProperties ReadProfile(); ProfileProperties ReadProfile();
void SetupDialog(); void SetupDialog();
void WriteProfile(ProfileProperties profileProperties);
} }
public class SharedResourcesWrapper : ISharedResourcesWrapper public class SharedResourcesWrapper : ISharedResourcesWrapper
@@ -80,5 +81,10 @@ namespace ASCOM.Meade.net.Wrapper
{ {
SharedResources.SetupDialog(); SharedResources.SetupDialog();
} }
public void WriteProfile(ProfileProperties profileProperties)
{
SharedResources.WriteProfile(profileProperties);
}
} }
} }
@@ -16,7 +16,7 @@
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>