Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/focus/focusalgorithms.h
Show All 33 Lines | 27 | struct FocusParams { | |||
---|---|---|---|---|---|
34 | // Minimum position the focuser is allowed to reach. | 34 | // Minimum position the focuser is allowed to reach. | ||
35 | int minPositionAllowed; | 35 | int minPositionAllowed; | ||
36 | // Maximum position the focuser is allowed to reach. | 36 | // Maximum position the focuser is allowed to reach. | ||
37 | int maxPositionAllowed; | 37 | int maxPositionAllowed; | ||
38 | // Maximum number of iterations (captures) the focuser may try. | 38 | // Maximum number of iterations (captures) the focuser may try. | ||
39 | int maxIterations; | 39 | int maxIterations; | ||
40 | // The focus algorithm may terminate if it gets within this fraction of the best focus, e.g. 0.10. | 40 | // The focus algorithm may terminate if it gets within this fraction of the best focus, e.g. 0.10. | ||
41 | double focusTolerance; | 41 | double focusTolerance; | ||
42 | // The name of the filter used, if any. | ||||
43 | QString filterName; | ||||
42 | 44 | | |||
43 | FocusParams(int _maxTravel, int _initialStepSize, int _startPosition, | 45 | FocusParams(int _maxTravel, int _initialStepSize, int _startPosition, | ||
44 | int _minPositionAllowed, int _maxPositionAllowed, | 46 | int _minPositionAllowed, int _maxPositionAllowed, | ||
45 | int _maxIterations, double _focusTolerance) : | 47 | int _maxIterations, double _focusTolerance, const QString &filterName_) : | ||
46 | maxTravel(_maxTravel), initialStepSize(_initialStepSize), | 48 | maxTravel(_maxTravel), initialStepSize(_initialStepSize), | ||
47 | startPosition(_startPosition), minPositionAllowed(_minPositionAllowed), | 49 | startPosition(_startPosition), minPositionAllowed(_minPositionAllowed), | ||
48 | maxPositionAllowed(_maxPositionAllowed), maxIterations(_maxIterations), | 50 | maxPositionAllowed(_maxPositionAllowed), maxIterations(_maxIterations), | ||
49 | focusTolerance(_focusTolerance) {} | 51 | focusTolerance(_focusTolerance), filterName(filterName_) {} | ||
50 | }; | 52 | }; | ||
51 | 53 | | |||
52 | // Constructor initializes an autofocus algorithm from the input params. | 54 | // Constructor initializes an autofocus algorithm from the input params. | ||
53 | FocusAlgorithmInterface(const FocusParams &_params) : params(_params) {} | 55 | FocusAlgorithmInterface(const FocusParams &_params) : params(_params) {} | ||
54 | virtual ~FocusAlgorithmInterface() {} | 56 | virtual ~FocusAlgorithmInterface() {} | ||
55 | 57 | | |||
56 | // After construction, this should be called to get the initial position desired by the | 58 | // After construction, this should be called to get the initial position desired by the | ||
57 | // focus algorithm. It returns the start position passed to the constructor if | 59 | // focus algorithm. It returns the start position passed to the constructor if | ||
Show All 16 Lines | |||||
74 | 76 | | |||
75 | // Returns the params used to construct this object. | 77 | // Returns the params used to construct this object. | ||
76 | const FocusParams& getParams() const { return params; } | 78 | const FocusParams& getParams() const { return params; } | ||
77 | 79 | | |||
78 | protected: | 80 | protected: | ||
79 | FocusParams params; | 81 | FocusParams params; | ||
80 | bool done = false; | 82 | bool done = false; | ||
81 | int focusSolution = -1; | 83 | int focusSolution = -1; | ||
84 | double focusHFR = -1; | ||||
82 | QString doneString; | 85 | QString doneString; | ||
83 | }; | 86 | }; | ||
84 | 87 | | |||
85 | // Creates a LinearFocuser. Caller responsible for the memory. | 88 | // Creates a LinearFocuser. Caller responsible for the memory. | ||
86 | FocusAlgorithmInterface *MakeLinearFocuser(const FocusAlgorithmInterface::FocusParams& params); | 89 | FocusAlgorithmInterface *MakeLinearFocuser(const FocusAlgorithmInterface::FocusParams& params); | ||
87 | } | 90 | } | ||
88 | 91 | |