/// <summary> /// Read the device configuration from the ASCOM Profile store /// </summary> internal void ReadProfile() { DomeSettings settings = DomeSettings.FromProfile(); Globals.DomeAzimuthAdjustment = settings.AzimuthAdjustment; Globals.UsePOTHDomeSlaveCalculation = settings.UsePOTHDomeSlaveCalculation; _logger.Enabled = settings.IsLoggingEnabled; }
private static void SaveDomeSettings() { DomeSettings domeSettings = DomeSettings.FromProfile(); domeSettings.AzimuthAdjustment = Globals.DomeAzimuthAdjustment; domeSettings.UsePOTHDomeSlaveCalculation = Globals.UsePOTHDomeSlaveCalculation; domeSettings.ToProfile(); }
public static DomeSettings FromProfile() { string domeID; double layoutXOffset; double layoutYOffset; double layoutZOffset; int domeRadius; int gemAxisOffset; int azimuthAccuracy; double azimuthAdjustment; int slaveInterval; bool loggerEnabled; bool usePOTHCalculation; double fastUpdatePeriod; using (Profile profile = new Profile()) { profile.DeviceType = "Dome"; domeID = profile.GetValue(DriverID, _domeIDProfileName, String.Empty, _domeIDDefault); layoutXOffset = Convert.ToDouble(profile.GetValue(DriverID, _xOffsetProfileName, String.Empty, _offsetDefault), CultureInfo.InvariantCulture); layoutYOffset = Convert.ToDouble(profile.GetValue(DriverID, _yOffsetProfileName, String.Empty, _offsetDefault), CultureInfo.InvariantCulture); layoutZOffset = Convert.ToDouble(profile.GetValue(DriverID, _zOffsetProfileName, String.Empty, _offsetDefault), CultureInfo.InvariantCulture); domeRadius = Convert.ToInt32(profile.GetValue(DriverID, _radiusProfileName, String.Empty, _radiusDefault)); gemAxisOffset = Convert.ToInt32(profile.GetValue(DriverID, _gemAxisOffsetProfileName, String.Empty, _gemAxisOffsetDefault)); azimuthAccuracy = Convert.ToInt32(profile.GetValue(DriverID, _azimuthAccuracyProfileName, String.Empty, _azimuthAccuracyDefault)); azimuthAdjustment = Convert.ToDouble(profile.GetValue(DriverID, _azimuthAdjustmentProfileName, String.Empty, _azimuthAdjustmentDefault)); slaveInterval = Convert.ToInt32(profile.GetValue(DriverID, _slaveIntervalProfileName, String.Empty, _slaveIntervalDefault)); loggerEnabled = Convert.ToBoolean(profile.GetValue(DriverID, _traceStateProfileName, String.Empty, _traceStateDefault)); usePOTHCalculation = Convert.ToBoolean(profile.GetValue(DriverID, _usePOTHSlavingCalculationProfileName, String.Empty, _usePOTHSlavingCalculationDefault)); fastUpdatePeriod = Convert.ToDouble(profile.GetValue(DriverID, _fastUpdateProfileName, String.Empty, _fastUpdateDefault)); } // Prevent the user from circumventing the valid fast update by setting the value in the profile store directly. fastUpdatePeriod = Math.Max(Globals.DOME_FAST_UPDATE_MIN, Math.Min(fastUpdatePeriod, Globals.DOME_FAST_UPDATE_MAX)); DomeLayoutSettings layoutSettings = new DomeLayoutSettings { DomeScopeOffset = new System.Windows.Media.Media3D.Point3D(layoutXOffset, layoutYOffset, layoutZOffset), DomeRadius = domeRadius, GemAxisOffset = gemAxisOffset, AzimuthAccuracy = azimuthAccuracy, SlaveInterval = slaveInterval }; DomeSettings settings = new DomeSettings { DomeID = domeID, DomeLayout = layoutSettings, AzimuthAdjustment = azimuthAdjustment, UsePOTHDomeSlaveCalculation = usePOTHCalculation, IsLoggingEnabled = loggerEnabled, FastUpdatePeriod = fastUpdatePeriod }; return(settings); }
private void SaveDomeSettings() { // Read the current settings and update them with the changes // to preserve the logging flag. DomeSettings settings = DomeSettings.FromProfile(); settings.DomeID = DomeManager.DomeID; settings.DomeLayout = Globals.DomeLayout; settings.ToProfile(); }
public static DomeSettings FromProfile() { string domeID; double layoutXOffset; double layoutYOffset; double layoutZOffset; int domeRadius; int gemAxisOffset; int azimuthAccuracy; double azimuthAdjustment; int slaveInterval; bool loggerEnabled; bool usePOTHCalculation; bool FindHomeAtStartup; using (Profile profile = new Profile()) { profile.DeviceType = "Dome"; domeID = profile.GetValue(DriverID, _domeIDProfileName, String.Empty, _domeIDDefault); layoutXOffset = Convert.ToDouble(profile.GetValue(DriverID, _xOffsetProfileName, String.Empty, _offsetDefault), CultureInfo.InvariantCulture); layoutYOffset = Convert.ToDouble(profile.GetValue(DriverID, _yOffsetProfileName, String.Empty, _offsetDefault), CultureInfo.InvariantCulture); layoutZOffset = Convert.ToDouble(profile.GetValue(DriverID, _zOffsetProfileName, String.Empty, _offsetDefault), CultureInfo.InvariantCulture); domeRadius = Convert.ToInt32(profile.GetValue(DriverID, _radiusProfileName, String.Empty, _radiusDefault)); gemAxisOffset = Convert.ToInt32(profile.GetValue(DriverID, _gemAxisOffsetProfileName, String.Empty, _gemAxisOffsetDefault)); azimuthAccuracy = Convert.ToInt32(profile.GetValue(DriverID, _azimuthAccuracyProfileName, String.Empty, _azimuthAccuracyDefault)); azimuthAdjustment = Convert.ToDouble(profile.GetValue(DriverID, _azimuthAdjustmentProfileName, String.Empty, _azimuthAdjustmentDefault)); slaveInterval = Convert.ToInt32(profile.GetValue(DriverID, _slaveIntervalProfileName, String.Empty, _slaveIntervalDefault)); loggerEnabled = Convert.ToBoolean(profile.GetValue(DriverID, _traceStateProfileName, String.Empty, _traceStateDefault)); usePOTHCalculation = Convert.ToBoolean(profile.GetValue(DriverID, _usePOTHSlavingCalculationProfileName, String.Empty, _usePOTHSlavingCalculationDefault)); FindHomeAtStartup = Convert.ToBoolean(profile.GetValue(DriverID, _FindHomeAtStartupProfileName, String.Empty, _FindHomeAtStartupDefault)); } DomeLayoutSettings layoutSettings = new DomeLayoutSettings { DomeScopeOffset = new System.Windows.Media.Media3D.Point3D(layoutXOffset, layoutYOffset, layoutZOffset), DomeRadius = domeRadius, GemAxisOffset = gemAxisOffset, AzimuthAccuracy = azimuthAccuracy, SlaveInterval = slaveInterval }; DomeSettings settings = new DomeSettings { DomeID = domeID, DomeLayout = layoutSettings, AzimuthAdjustment = azimuthAdjustment, UsePOTHDomeSlaveCalculation = usePOTHCalculation, FindDomeHomeAtStartup = FindHomeAtStartup, IsLoggingEnabled = loggerEnabled }; return(settings); }
/// <summary> /// Write the device configuration to the ASCOM Profile store /// </summary> internal void SaveProfile() { DomeSettings settings = new DomeSettings { DomeID = DomeManager.DomeID, DomeLayout = Globals.DomeLayout, AzimuthAdjustment = Globals.DomeAzimuthAdjustment, IsLoggingEnabled = _logger.Enabled }; settings.ToProfile(); }
private static void LoadDeviceSettings() { TelescopeSettings scopeSettings = TelescopeSettings.FromProfile(); TelescopeManager.SetTelescopeID(scopeSettings.TelescopeID); DomeSettings domeSettings = DomeSettings.FromProfile(); DomeManager.SetDomeID(domeSettings.DomeID); Globals.DomeLayout = domeSettings.DomeLayout; Globals.DomeAzimuthAdjustment = domeSettings.AzimuthAdjustment; Globals.UsePOTHDomeSlaveCalculation = domeSettings.UsePOTHDomeSlaveCalculation; Globals.FindDomeHomeAtStartup = domeSettings.FindDomeHomeAtStartup; FocuserSettings focuserSettings = FocuserSettings.FromProfile(); FocuserManager.SetFocuserID(focuserSettings.FocuserID); Globals.FocuserTemperatureOffset = focuserSettings.TemperatureOffset; }