// Default technique to force a reset on algo parameters is simply to remove the keys from the Registry - a subsequent creation of the algo // class will then use default values for everything. If this is too brute-force for a particular algo, the function can be overridden. // For algos that use a min-move parameter, a smart value will be applied based on image scale void GuideAlgorithm::ResetParams() { wxString configPath = GetConfigPath(); pConfig->Profile.DeleteGroup(configPath); if (GetMinMove() >= 0) SetMinMove(SmartDefaultMinMove()); }
GuideAlgorithmLowpass::GuideAlgorithmLowpass(Mount *pMount, GuideAxis axis) : GuideAlgorithm(pMount, axis) { double minMove = pConfig->Profile.GetDouble(GetConfigPath() + "/minMove", DefaultMinMove); SetMinMove(minMove); double slopeWeight = pConfig->Profile.GetDouble(GetConfigPath() + "/SlopeWeight", DefaultSlopeWeight); SetSlopeWeight(slopeWeight); reset(); }
GuideAlgorithmResistSwitch::GuideAlgorithmResistSwitch(Mount *pMount, GuideAxis axis) : GuideAlgorithm(pMount, axis) { double minMove = pConfig->Profile.GetDouble(GetConfigPath() + "/minMove", DefaultMinMove); SetMinMove(minMove); double aggr = pConfig->Profile.GetDouble(GetConfigPath() + "/aggression", DefaultAggression); SetAggression(aggr); bool enable = pConfig->Profile.GetBoolean(GetConfigPath() + "/fastSwitch", true); SetFastSwitchEnabled(enable); reset(); }
GuideAlgorithmHysteresis::GuideAlgorithmHysteresis(Mount *pMount, GuideAxis axis) : GuideAlgorithm(pMount, axis) { wxString configPath = GetConfigPath(); double minMove = pConfig->Profile.GetDouble(configPath + "/minMove", DefaultMinMove); SetMinMove(minMove); double hysteresis = pConfig->Profile.GetDouble(configPath + "/hysteresis", DefaultHysteresis); SetHysteresis(hysteresis); double aggression = pConfig->Profile.GetDouble(configPath + "/aggression", DefaultAggression); SetAggression(aggression); reset(); }
bool GuideAlgorithmResistSwitch::SetParam(const wxString& name, double val) { bool err; if (name == "minMove") err = SetMinMove(val); else if (name == "fasetSwitch") { SetFastSwitchEnabled(val != 0.0); err = false; } else if (name == "aggression") err = SetAggression(val); else err = true; return !err; }