Code inspections
This commit is contained in:
@@ -64,7 +64,7 @@ namespace ASCOM.Meade.net
|
||||
/// Initializes a new instance of the <see cref="Meade.net"/> class.
|
||||
/// Must be public for COM registration.
|
||||
/// </summary>
|
||||
public Telescope() : base()
|
||||
public Telescope()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -373,11 +373,11 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
ReadProfile();
|
||||
|
||||
LogMessage("Connected Set", "Connecting to port {0}", _comPort);
|
||||
LogMessage("Connected Set", "Connecting to port {0}", ComPort);
|
||||
var connectionInfo = _sharedResourcesWrapper.Connect("Serial", DriverId, _tl);
|
||||
try
|
||||
{
|
||||
LogMessage("Connected Set", $"Connected to port {_comPort}. Product: {_sharedResourcesWrapper.ProductName} Version:{_sharedResourcesWrapper.FirmwareVersion}");
|
||||
LogMessage("Connected Set", $"Connected to port {ComPort}. Product: {_sharedResourcesWrapper.ProductName} Version:{_sharedResourcesWrapper.FirmwareVersion}");
|
||||
|
||||
_userNewerPulseGuiding = IsNewPulseGuidingSupported();
|
||||
_targetDeclination = InvalidParameter;
|
||||
@@ -396,7 +396,7 @@ namespace ASCOM.Meade.net
|
||||
|
||||
if (CanSetGuideRates)
|
||||
{
|
||||
SetNewGuideRate(_guideRate, "Connect");
|
||||
SetNewGuideRate(GuideRate, "Connect");
|
||||
}
|
||||
|
||||
SetTelescopePrecision("Connect");
|
||||
@@ -417,12 +417,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}", ComPort, ex.Message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMessage("Connected Set", "Disconnecting from port {0}", _comPort);
|
||||
LogMessage("Connected Set", "Disconnecting from port {0}", ComPort);
|
||||
_sharedResourcesWrapper.Disconnect("Serial", DriverId);
|
||||
IsConnected = false;
|
||||
}
|
||||
@@ -431,7 +431,7 @@ namespace ASCOM.Meade.net
|
||||
|
||||
private void SetTelescopePrecision(string propertyName)
|
||||
{
|
||||
switch (_precision.ToLower())
|
||||
switch (Precision.ToLower())
|
||||
{
|
||||
case "high":
|
||||
TelescopePointingPrecision(true);
|
||||
@@ -449,7 +449,7 @@ namespace ASCOM.Meade.net
|
||||
|
||||
public bool IsNewPulseGuidingSupported()
|
||||
{
|
||||
switch (_guidingStyle)
|
||||
switch (GuidingStyle)
|
||||
{
|
||||
case "guide rate slew":
|
||||
return false;
|
||||
@@ -1181,7 +1181,7 @@ namespace ASCOM.Meade.net
|
||||
|
||||
//info from RickB says that 15.04107 is a better value for
|
||||
|
||||
_guideRate = value;
|
||||
GuideRate = value;
|
||||
|
||||
WriteProfile();
|
||||
}
|
||||
@@ -1200,8 +1200,8 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
get
|
||||
{
|
||||
var degreesPerSecond = ArcSecondPerSecondToDegreesPerSecond(_guideRate);
|
||||
LogMessage("GuideRateDeclination Get", $"{_guideRate} arc seconds / second = {degreesPerSecond} degrees per second");
|
||||
var degreesPerSecond = ArcSecondPerSecondToDegreesPerSecond(GuideRate);
|
||||
LogMessage("GuideRateDeclination Get", $"{GuideRate} arc seconds / second = {degreesPerSecond} degrees per second");
|
||||
return degreesPerSecond;
|
||||
}
|
||||
set
|
||||
@@ -1215,8 +1215,8 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
get
|
||||
{
|
||||
double degreesPerSecond = ArcSecondPerSecondToDegreesPerSecond(_guideRate);
|
||||
LogMessage("GuideRateRightAscension Get", $"{_guideRate} arc seconds / second = {degreesPerSecond} degrees per second");
|
||||
double degreesPerSecond = ArcSecondPerSecondToDegreesPerSecond(GuideRate);
|
||||
LogMessage("GuideRateRightAscension Get", $"{GuideRate} arc seconds / second = {degreesPerSecond} degrees per second");
|
||||
return degreesPerSecond;
|
||||
}
|
||||
set
|
||||
@@ -2321,8 +2321,8 @@ namespace ASCOM.Meade.net
|
||||
var profileProperties = new ProfileProperties
|
||||
{
|
||||
TraceLogger = _tl.Enabled,
|
||||
ComPort = _comPort,
|
||||
GuideRateArcSecondsPerSecond = _guideRate
|
||||
ComPort = ComPort,
|
||||
GuideRateArcSecondsPerSecond = GuideRate
|
||||
};
|
||||
|
||||
_sharedResourcesWrapper.WriteProfile(profileProperties);
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace ASCOM.Meade.net
|
||||
/// Initializes a new instance of the <see cref="Meade.net"/> class.
|
||||
/// Must be public for COM registration.
|
||||
/// </summary>
|
||||
public Focuser() : base()
|
||||
public Focuser()
|
||||
{
|
||||
//todo move this out to IOC
|
||||
var util = new Util(); //Initialise util object
|
||||
@@ -169,12 +169,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}", ComPort, ex.Message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMessage("Connected Set", "Disconnecting from port {0}", _comPort);
|
||||
LogMessage("Connected Set", "Disconnecting from port {0}", ComPort);
|
||||
_sharedResourcesWrapper.Disconnect("Serial", DriverId);
|
||||
IsConnected = false;
|
||||
}
|
||||
@@ -287,13 +287,13 @@ namespace ASCOM.Meade.net
|
||||
return;
|
||||
|
||||
var direction = position > 0;
|
||||
if (_reverseFocusDirection)
|
||||
if (ReverseFocusDirection)
|
||||
direction = !direction;
|
||||
|
||||
_sharedResourcesWrapper.Lock(() =>
|
||||
{
|
||||
//backlash compensation.
|
||||
var backlashCompensationSteps = direction ? Math.Abs(_backlashCompensation) : 0;
|
||||
var backlashCompensationSteps = direction ? Math.Abs(BacklashCompensation) : 0;
|
||||
|
||||
var steps = Math.Abs(position) + backlashCompensationSteps;
|
||||
|
||||
@@ -317,7 +317,7 @@ namespace ASCOM.Meade.net
|
||||
|
||||
private void DynamicBreaking(bool directionOut)
|
||||
{
|
||||
if (!_useDynamicBreaking)
|
||||
if (!UseDynamicBreaking)
|
||||
return;
|
||||
|
||||
_tl.LogMessage("Move", "Applying dynamic breaking");
|
||||
|
||||
@@ -19,13 +19,13 @@ 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 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 readonly ISharedResourcesWrapper _sharedResourcesWrapper;
|
||||
|
||||
@@ -60,21 +60,21 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
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();
|
||||
ComPort = profileProperties.ComPort;
|
||||
BacklashCompensation = profileProperties.BacklashCompensation;
|
||||
ReverseFocusDirection = profileProperties.ReverseFocusDirection;
|
||||
UseDynamicBreaking = profileProperties.DynamicBreaking;
|
||||
GuideRate = profileProperties.GuideRateArcSecondsPerSecond;
|
||||
Precision = profileProperties.Precision;
|
||||
GuidingStyle = profileProperties.GuidingStyle.ToLower();
|
||||
|
||||
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", $"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}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user