Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/mount/mount.h
Show All 23 Lines | |||||
24 | namespace Ekos | 24 | namespace Ekos | ||
25 | { | 25 | { | ||
26 | /** | 26 | /** | ||
27 | *@class Mount | 27 | *@class Mount | ||
28 | *@short Supports controlling INDI telescope devices including setting/retrieving mount properties, slewing, motion and speed controls, in addition to enforcing altitude limits and parking/unparking. | 28 | *@short Supports controlling INDI telescope devices including setting/retrieving mount properties, slewing, motion and speed controls, in addition to enforcing altitude limits and parking/unparking. | ||
29 | *@author Jasem Mutlaq | 29 | *@author Jasem Mutlaq | ||
30 | *@version 1.3 | 30 | *@version 1.3 | ||
31 | */ | 31 | */ | ||
32 | | ||||
32 | class Mount : public QWidget, public Ui::Mount | 33 | class Mount : public QWidget, public Ui::Mount | ||
33 | { | 34 | { | ||
34 | Q_OBJECT | 35 | Q_OBJECT | ||
35 | Q_CLASSINFO("D-Bus Interface", "org.kde.kstars.Ekos.Mount") | 36 | Q_CLASSINFO("D-Bus Interface", "org.kde.kstars.Ekos.Mount") | ||
36 | Q_PROPERTY(ISD::Telescope::Status status READ status NOTIFY newStatus) | 37 | Q_PROPERTY(ISD::Telescope::Status status READ status NOTIFY newStatus) | ||
37 | Q_PROPERTY(ISD::ParkStatus parkStatus READ parkStatus NOTIFY newParkStatus) | 38 | Q_PROPERTY(ISD::ParkStatus parkStatus READ parkStatus NOTIFY newParkStatus) | ||
38 | Q_PROPERTY(QStringList logText READ logText NOTIFY newLog) | 39 | Q_PROPERTY(QStringList logText READ logText NOTIFY newLog) | ||
39 | Q_PROPERTY(QList<double> altitudeLimits READ altitudeLimits WRITE setAltitudeLimits) | 40 | Q_PROPERTY(QList<double> altitudeLimits READ altitudeLimits WRITE setAltitudeLimits) | ||
40 | Q_PROPERTY(bool altitudeLimitsEnabled READ altitudeLimitsEnabled WRITE setAltitudeLimitsEnabled) | 41 | Q_PROPERTY(bool altitudeLimitsEnabled READ altitudeLimitsEnabled WRITE setAltitudeLimitsEnabled) | ||
41 | Q_PROPERTY(QList<double> equatorialCoords READ equatorialCoords) | 42 | Q_PROPERTY(QList<double> equatorialCoords READ equatorialCoords) | ||
42 | Q_PROPERTY(QList<double> horizontalCoords READ horizontalCoords) | 43 | Q_PROPERTY(QList<double> horizontalCoords READ horizontalCoords) | ||
43 | Q_PROPERTY(QList<double> telescopeInfo READ telescopeInfo WRITE setTelescopeInfo) | 44 | Q_PROPERTY(QList<double> telescopeInfo READ telescopeInfo WRITE setTelescopeInfo) | ||
45 | Q_PROPERTY(SkyPoint currentTarget READ currentTarget) | ||||
mutlaqja: READ should be just currentTarget like the rest | |||||
wreissenberger: Good point, I will change it. | |||||
TallFurryMan: currentTargetPosition? | |||||
44 | Q_PROPERTY(double hourAngle READ hourAngle) | 46 | Q_PROPERTY(double hourAngle READ hourAngle) | ||
47 | Q_PROPERTY(double initialHA READ initialHA) | ||||
45 | Q_PROPERTY(int slewRate READ slewRate WRITE setSlewRate) | 48 | Q_PROPERTY(int slewRate READ slewRate WRITE setSlewRate) | ||
46 | Q_PROPERTY(int slewStatus READ slewStatus) | 49 | Q_PROPERTY(int slewStatus READ slewStatus) | ||
47 | Q_PROPERTY(QStringList logText READ logText NOTIFY newLog) | | |||
48 | Q_PROPERTY(bool canPark READ canPark) | 50 | Q_PROPERTY(bool canPark READ canPark) | ||
49 | 51 | | |||
50 | public: | 52 | public: | ||
51 | Mount(); | 53 | Mount(); | ||
52 | ~Mount(); | 54 | ~Mount(); | ||
53 | 55 | | |||
54 | //typedef enum { PARKING_IDLE, PARKING_OK, UNPARKING_OK, PARKING_BUSY, UNPARKING_BUSY, PARKING_ERROR } ParkingStatus; | 56 | //typedef enum { PARKING_IDLE, PARKING_OK, UNPARKING_OK, PARKING_BUSY, UNPARKING_BUSY, PARKING_ERROR } ParkingStatus; | ||
55 | 57 | | |||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Line(s) | |||||
146 | Q_SCRIPTABLE QList<double> equatorialCoords(); | 148 | Q_SCRIPTABLE QList<double> equatorialCoords(); | ||
147 | 149 | | |||
148 | /** DBUS interface function. | 150 | /** DBUS interface function. | ||
149 | * Get Horizontal coords. An array of doubles is returned. First element is Azimuth in degrees. Second elements is Altitude in degrees. | 151 | * Get Horizontal coords. An array of doubles is returned. First element is Azimuth in degrees. Second elements is Altitude in degrees. | ||
150 | */ | 152 | */ | ||
151 | Q_SCRIPTABLE QList<double> horizontalCoords(); | 153 | Q_SCRIPTABLE QList<double> horizontalCoords(); | ||
152 | 154 | | |||
153 | /** DBUS interface function. | 155 | /** DBUS interface function. | ||
156 | * Get Horizontal coords. | ||||
157 | */ | ||||
158 | Q_SCRIPTABLE SkyPoint currentTarget(); | ||||
159 | | ||||
160 | /** DBUS interface function. | ||||
154 | * Get mount hour angle in hours (-12 to +12). | 161 | * Get mount hour angle in hours (-12 to +12). | ||
155 | */ | 162 | */ | ||
156 | Q_SCRIPTABLE double hourAngle(); | 163 | Q_SCRIPTABLE double hourAngle(); | ||
157 | 164 | | |||
165 | double initialPositionHA; | ||||
166 | /** DBUS interface function. | ||||
167 | * Get the hour angle of that time the mount has slewed to the current position. | ||||
168 | */ | ||||
169 | Q_SCRIPTABLE double initialHA() {return initialPositionHA; } | ||||
170 | | ||||
171 | Q_SCRIPTABLE void setInitialHA(double ha) { initialPositionHA = ha; } | ||||
172 | | ||||
158 | /** DBUS interface function. | 173 | /** DBUS interface function. | ||
159 | * Aborts the mount motion | 174 | * Aborts the mount motion | ||
160 | * @return true if the command is sent successfully, false otherwise. | 175 | * @return true if the command is sent successfully, false otherwise. | ||
161 | */ | 176 | */ | ||
162 | Q_INVOKABLE Q_SCRIPTABLE bool abort(); | 177 | Q_INVOKABLE Q_SCRIPTABLE bool abort(); | ||
163 | 178 | | |||
164 | /** DBUS interface function. | 179 | /** DBUS interface function. | ||
165 | * Get the mount slew status ("Idle","Complete", "Busy", "Error") | 180 | * Get the mount slew status ("Idle","Complete", "Busy", "Error") | ||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | |||||
225 | Q_INVOKABLE void findTarget(); | 240 | Q_INVOKABLE void findTarget(); | ||
226 | 241 | | |||
227 | // Center mount in Sky Map | 242 | // Center mount in Sky Map | ||
228 | Q_INVOKABLE void centerMount(); | 243 | Q_INVOKABLE void centerMount(); | ||
229 | 244 | | |||
230 | // Get list of scopes | 245 | // Get list of scopes | ||
231 | QJsonArray getScopes() const; | 246 | QJsonArray getScopes() const; | ||
232 | 247 | | |||
248 | /* | ||||
249 | * @brief Execute a meridian flip if necessary. | ||||
250 | * @return true if a meridian flip was necessary | ||||
251 | */ | ||||
252 | Q_INVOKABLE bool executeMeridianFlip(); | ||||
253 | | ||||
233 | public slots: | 254 | public slots: | ||
234 | 255 | | |||
235 | /** | 256 | /** | ||
236 | * @brief syncTelescopeInfo Update telescope information to reflect any property changes | 257 | * @brief syncTelescopeInfo Update telescope information to reflect any property changes | ||
237 | */ | 258 | */ | ||
238 | void syncTelescopeInfo(); | 259 | void syncTelescopeInfo(); | ||
239 | /** | 260 | /** | ||
240 | * @brief updateNumber Update number properties under watch in the mount module | 261 | * @brief updateNumber Update number properties under watch in the mount module | ||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | |||||
302 | void disableAltLimits(); | 323 | void disableAltLimits(); | ||
303 | 324 | | |||
304 | bool setScopeConfig(int index); | 325 | bool setScopeConfig(int index); | ||
305 | 326 | | |||
306 | void toggleMountToolBox(); | 327 | void toggleMountToolBox(); | ||
307 | 328 | | |||
308 | private slots: | 329 | private slots: | ||
309 | 330 | | |||
331 | /** | ||||
332 | * @brief registerNewModule Register an Ekos module as it arrives via DBus | ||||
333 | * and create the appropriate DBus interface to communicate with it. | ||||
334 | * @param name of module | ||||
335 | */ | ||||
336 | void registerNewModule(const QString &name); | ||||
337 | | ||||
310 | void startParkTimer(); | 338 | void startParkTimer(); | ||
311 | void stopParkTimer(); | 339 | void stopParkTimer(); | ||
312 | void startAutoPark(); | 340 | void startAutoPark(); | ||
313 | 341 | | |||
314 | signals: | 342 | signals: | ||
315 | void newLog(const QString &text); | 343 | void newLog(const QString &text); | ||
316 | void newCoords(const QString &ra, const QString &dec, const QString &az, const QString &alt); | 344 | void newCoords(const QString &ra, const QString &dec, const QString &az, const QString &alt); | ||
317 | void newTarget(const QString &name); | 345 | void newTarget(const QString &name); | ||
318 | void newStatus(ISD::Telescope::Status status); | 346 | void newStatus(ISD::Telescope::Status status); | ||
319 | void newParkStatus(ISD::ParkStatus status); | 347 | void newParkStatus(ISD::ParkStatus status); | ||
320 | void slewRateChanged(int index); | 348 | void slewRateChanged(int index); | ||
321 | void ready(); | 349 | void ready(); | ||
322 | 350 | | |||
323 | private: | 351 | private: | ||
324 | void syncGPS(); | 352 | void syncGPS(); | ||
325 | 353 | | |||
354 | QPointer<QDBusInterface> captureInterface { nullptr }; | ||||
355 | | ||||
326 | ISD::Telescope *currentTelescope = nullptr; | 356 | ISD::Telescope *currentTelescope = nullptr; | ||
327 | ISD::GDInterface *currentGPS = nullptr; | 357 | ISD::GDInterface *currentGPS = nullptr; | ||
328 | QStringList m_LogText; | 358 | QStringList m_LogText; | ||
359 | SkyPoint currentTargetPosition; | ||||
329 | SkyPoint telescopeCoord; | 360 | SkyPoint telescopeCoord; | ||
330 | QString lastNotificationMessage; | 361 | QString lastNotificationMessage; | ||
331 | QTimer updateTimer; | 362 | QTimer updateTimer; | ||
332 | QTimer autoParkTimer; | 363 | QTimer autoParkTimer; | ||
333 | double lastAlt; | 364 | double lastAlt; | ||
334 | int abortDispatch; | 365 | int abortDispatch; | ||
335 | bool altLimitEnabled; | 366 | bool altLimitEnabled; | ||
336 | bool GPSInitialized = {false}; | 367 | bool GPSInitialized = {false}; | ||
337 | 368 | | |||
338 | ISD::Telescope::Status m_Status = ISD::Telescope::MOUNT_IDLE; | 369 | ISD::Telescope::Status m_Status = ISD::Telescope::MOUNT_IDLE; | ||
339 | ISD::ParkStatus m_ParkStatus = ISD::PARK_UNKNOWN; | 370 | ISD::ParkStatus m_ParkStatus = ISD::PARK_UNKNOWN; | ||
340 | 371 | | |||
341 | QQuickView *m_BaseView = nullptr; | 372 | QQuickView *m_BaseView = nullptr; | ||
342 | QQuickItem *m_BaseObj = nullptr; | 373 | QQuickItem *m_BaseObj = nullptr; | ||
343 | QQmlContext *m_Ctxt = nullptr; | 374 | QQmlContext *m_Ctxt = nullptr; | ||
344 | 375 | | |||
345 | QQuickItem *m_SpeedSlider = nullptr, *m_SpeedLabel = nullptr, *m_raValue = nullptr, *m_deValue = nullptr, | 376 | QQuickItem *m_SpeedSlider = nullptr, *m_SpeedLabel = nullptr, *m_raValue = nullptr, *m_deValue = nullptr, | ||
346 | *m_azValue = nullptr, *m_altValue = nullptr, *m_haValue = nullptr, *m_zaValue = nullptr, | 377 | *m_azValue = nullptr, *m_altValue = nullptr, *m_haValue = nullptr, *m_zaValue = nullptr, | ||
347 | *m_targetText = nullptr, *m_targetRAText = nullptr, *m_targetDEText = nullptr, *m_Park = nullptr, | 378 | *m_targetText = nullptr, *m_targetRAText = nullptr, *m_targetDEText = nullptr, *m_Park = nullptr, | ||
348 | *m_Unpark = nullptr, *m_statusText = nullptr, *m_J2000Check = nullptr, *m_JNowCheck=nullptr; | 379 | *m_Unpark = nullptr, *m_statusText = nullptr, *m_J2000Check = nullptr, *m_JNowCheck=nullptr; | ||
349 | }; | 380 | }; | ||
350 | } | 381 | } | ||
351 | 382 | | |||
383 | | ||||
352 | #endif // Mount | 384 | #endif // Mount |
READ should be just currentTarget like the rest