Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/observatory/observatorydomemodel.cpp
Show All 14 Lines | |||||
15 | 15 | | |||
16 | void ObservatoryDomeModel::initModel(Dome *dome) | 16 | void ObservatoryDomeModel::initModel(Dome *dome) | ||
17 | { | 17 | { | ||
18 | domeInterface = dome; | 18 | domeInterface = dome; | ||
19 | 19 | | |||
20 | connect(domeInterface, &Dome::ready, this, &ObservatoryDomeModel::ready); | 20 | connect(domeInterface, &Dome::ready, this, &ObservatoryDomeModel::ready); | ||
21 | connect(domeInterface, &Dome::disconnected, this, &ObservatoryDomeModel::disconnected); | 21 | connect(domeInterface, &Dome::disconnected, this, &ObservatoryDomeModel::disconnected); | ||
22 | connect(domeInterface, &Dome::newStatus, this, &ObservatoryDomeModel::newStatus); | 22 | connect(domeInterface, &Dome::newStatus, this, &ObservatoryDomeModel::newStatus); | ||
23 | connect(domeInterface, &Dome::newParkStatus, this, &ObservatoryDomeModel::newParkStatus); | ||||
23 | connect(domeInterface, &Dome::newShutterStatus, this, &ObservatoryDomeModel::newShutterStatus); | 24 | connect(domeInterface, &Dome::newShutterStatus, this, &ObservatoryDomeModel::newShutterStatus); | ||
24 | connect(domeInterface, &Dome::azimuthPositionChanged, this, &ObservatoryDomeModel::azimuthPositionChanged); | 25 | connect(domeInterface, &Dome::azimuthPositionChanged, this, &ObservatoryDomeModel::azimuthPositionChanged); | ||
25 | connect(domeInterface, &Dome::newAutoSyncStatus, this, &ObservatoryDomeModel::newAutoSyncStatus); | 26 | connect(domeInterface, &Dome::newAutoSyncStatus, this, &ObservatoryDomeModel::newAutoSyncStatus); | ||
26 | 27 | | |||
27 | } | 28 | } | ||
28 | 29 | | |||
29 | ISD::Dome::Status ObservatoryDomeModel::status() | 30 | ISD::Dome::Status ObservatoryDomeModel::status() | ||
30 | { | 31 | { | ||
Show All 25 Lines | |||||
56 | { | 57 | { | ||
57 | if (domeInterface == nullptr) | 58 | if (domeInterface == nullptr) | ||
58 | return; | 59 | return; | ||
59 | 60 | | |||
60 | emit newLog(i18n("Unparking dome...")); | 61 | emit newLog(i18n("Unparking dome...")); | ||
61 | domeInterface->unpark(); | 62 | domeInterface->unpark(); | ||
62 | } | 63 | } | ||
63 | 64 | | |||
65 | ISD::ParkStatus ObservatoryDomeModel::parkStatus() | ||||
66 | { | ||||
67 | if (domeInterface == nullptr) | ||||
68 | return ISD::PARK_UNKNOWN; | ||||
69 | else if (isRolloffRoof()) | ||||
70 | { | ||||
71 | // we need to override the parking status of the dome interface for opening and closing rolloff roofs | ||||
72 | if (domeInterface->status() == ISD::Dome::DOME_MOVING_CW) | ||||
73 | return ISD::PARK_UNPARKING; | ||||
74 | else if (domeInterface->status() == ISD::Dome::DOME_MOVING_CCW) | ||||
75 | return ISD::PARK_PARKING; | ||||
76 | } | ||||
77 | | ||||
78 | // in all other cases use the underlying park status | ||||
79 | return domeInterface->parkStatus(); | ||||
80 | } | ||||
81 | | ||||
64 | void ObservatoryDomeModel::setAutoSync(bool activate) | 82 | void ObservatoryDomeModel::setAutoSync(bool activate) | ||
65 | { | 83 | { | ||
66 | if (domeInterface == nullptr) | 84 | if (domeInterface == nullptr) | ||
67 | return; | 85 | return; | ||
68 | 86 | | |||
69 | if (domeInterface->setAutoSync(activate)) | 87 | if (domeInterface->setAutoSync(activate)) | ||
70 | emit newLog(i18n(activate ? "Slaving activated." : "Slaving deactivated.")); | 88 | emit newLog(i18n(activate ? "Slaving activated." : "Slaving deactivated.")); | ||
71 | 89 | | |||
Show All 21 Lines | |||||
93 | { | 111 | { | ||
94 | if (domeInterface == nullptr) | 112 | if (domeInterface == nullptr) | ||
95 | return; | 113 | return; | ||
96 | 114 | | |||
97 | emit newLog(i18n("Closing shutter...")); | 115 | emit newLog(i18n("Closing shutter...")); | ||
98 | domeInterface->controlShutter(false); | 116 | domeInterface->controlShutter(false); | ||
99 | } | 117 | } | ||
100 | 118 | | |||
119 | bool ObservatoryDomeModel::moveDome(bool moveCW, bool start) | ||||
120 | { | ||||
121 | if (domeInterface == nullptr) | ||||
122 | return false; | ||||
123 | | ||||
124 | emit newLog(i18n("%2 dome motion %1...", moveCW ? "clockwise" : "counter clockwise", start ? "Starting" : "Stopping")); | ||||
125 | return domeInterface->moveDome(moveCW, start); | ||||
126 | } | ||||
127 | | ||||
101 | void ObservatoryDomeModel::execute(WeatherActions actions) | 128 | void ObservatoryDomeModel::execute(WeatherActions actions) | ||
102 | { | 129 | { | ||
103 | if (hasShutter() && actions.closeShutter) | 130 | if (hasShutter() && actions.closeShutter) | ||
104 | closeShutter(); | 131 | closeShutter(); | ||
105 | if (actions.parkDome) | 132 | if (actions.parkDome) | ||
106 | park(); | 133 | park(); | ||
107 | } | 134 | } | ||
108 | 135 | | |||
109 | } | 136 | } |