Fixed a few code inspections

This commit is contained in:
2021-03-01 11:19:27 +00:00
parent b0ef75ae66
commit f57a73843a
3 changed files with 26 additions and 21 deletions
+9 -9
View File
@@ -1392,6 +1392,7 @@ namespace ASCOM.Meade.net
//We're going faster than Guide speed, so need to wait for the scope to settle.
SetSlewingMinEndTime();
}
_movingPrimary = false;
SharedResourcesWrapper.SendBlind(":Qe#");
//:Qe# Halt eastward Slews
@@ -1580,7 +1581,7 @@ namespace ASCOM.Meade.net
/// <summary>
/// convert a HH:MM.T (classic LX200 RA Notation) string to a double hours. T is the decimal part of minutes which is converted into seconds
/// </summary>
public double HMToHours(string hm)
public double HmToHours(string hm)
{
var token = hm.Split('.');
if (token.Length != 2)
@@ -1601,7 +1602,7 @@ namespace ASCOM.Meade.net
//Returns: HH:MM.T# or HH:MM:SS#
//Depending which precision is set for the telescope
double rightAscension = HMToHours(result);
double rightAscension = HmToHours(result);
LogMessage("RightAscension", $"Get - {result} convert to {rightAscension} {_utilitiesExtra.HoursToHMS(rightAscension)}");
return rightAscension;
@@ -1686,7 +1687,7 @@ namespace ASCOM.Meade.net
CheckConnected("SiteElevation Set");
LogMessage("SiteElevation", $"Set: {value}");
if (value == base.SiteElevation)
if (Math.Abs(value - base.SiteElevation) < 0.1)
{
LogMessage("SiteElevation", $"Set: no change detected");
return;
@@ -2119,14 +2120,14 @@ namespace ASCOM.Meade.net
// At least the classic LX200 low precision might not slew to the exact target position
// This Requires to retrieve the aimed target ra de from the telescope
double ra = RightAscension;
if (_targetRightAscension != InvalidParameter &&
if (Math.Abs(_targetRightAscension - InvalidParameter) > 0.1 &&
_utilities.HoursToHMS(ra, ":", ":", ":", _digitsRa) != _utilities.HoursToHMS(_targetRightAscension, ":", ":", ":", _digitsRa))
{
LogMessage("SyncToTarget", $"differ RA real {ra} targeted {_targetRightAscension}");
_targetRightAscension = ra;
}
double de = Declination;
if (_targetDeclination != InvalidParameter &&
if (Math.Abs(_targetDeclination - InvalidParameter) > 0.1 &&
_utilities.DegreesToDMS(de, "*", ":", ":", _digitsDe) != _utilities.DegreesToDMS(_targetDeclination, "*", ":", ":", _digitsDe))
{
LogMessage("SyncToTarget", $"differ DE real {de} targeted {_targetDeclination}");
@@ -2167,10 +2168,9 @@ namespace ASCOM.Meade.net
throw new InvalidValueException("Declination cannot be less than -90.");
var dms = "";
if (IsLongFormat)
dms = _utilities.DegreesToDMS(value, "*", ":", ":", _digitsDe);
else
dms = _utilities.DegreesToDM(value, "*", "", _digitsDe);
dms = IsLongFormat ?
_utilities.DegreesToDMS(value, "*", ":", ":", _digitsDe) :
_utilities.DegreesToDM(value, "*", "", _digitsDe);
var s = value < 0 ? string.Empty : "+";
+16 -11
View File
@@ -337,18 +337,23 @@ namespace ASCOM.Meade.net
{
key?.SetValue(null, progid); // Could be assyTitle/Desc??, but .NET components show ProgId here
key?.SetValue("AppId", _sAppId);
using (RegistryKey key2 = key.CreateSubKey("Implemented Categories"))
if (key != null)
{
key2?.CreateSubKey("{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}");
}
using (RegistryKey key2 = key.CreateSubKey("ProgId"))
{
key2?.SetValue(null, progid);
}
key.CreateSubKey("Programmable");
using (RegistryKey key2 = key.CreateSubKey("LocalServer32"))
{
key2?.SetValue(null, Application.ExecutablePath);
using (RegistryKey key2 = key.CreateSubKey("Implemented Categories"))
{
key2?.CreateSubKey("{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}");
}
using (RegistryKey key2 = key.CreateSubKey("ProgId"))
{
key2?.SetValue(null, progid);
}
key.CreateSubKey("Programmable");
using (RegistryKey key2 = key.CreateSubKey("LocalServer32"))
{
key2?.SetValue(null, Application.ExecutablePath);
}
}
}
//
+1 -1
View File
@@ -164,7 +164,7 @@ namespace ASCOM.Meade.net
driverProfile.WriteValue(DriverId, BacklashCompensationName, profileProperties.BacklashCompensation.ToString());
driverProfile.WriteValue(DriverId, ReverseFocusDirectionName, profileProperties.ReverseFocusDirection.ToString());
driverProfile.WriteValue(DriverId, DynamicBreakingName, profileProperties.DynamicBreaking.ToString());
driverProfile.WriteValue(DriverId, SiteElevationName, profileProperties.SiteElevation.ToString());
driverProfile.WriteValue(DriverId, SiteElevationName, profileProperties.SiteElevation.ToString(CultureInfo.InvariantCulture));
driverProfile.WriteValue(DriverId, SettleTimeName, profileProperties.SettleTime.ToString());
}
}