Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/auxiliary/dome.cpp
1 | /* Ekos | 1 | /* Ekos | ||
---|---|---|---|---|---|
2 | Copyright (C) 2012 Jasem Mutlaq <mutlaqja@ikarustech.com> | 2 | Copyright (C) 2012 Jasem Mutlaq <mutlaqja@ikarustech.com> | ||
3 | 3 | | |||
4 | This application is free software; you can redistribute it and/or | 4 | This application is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU General Public | 5 | modify it under the terms of the GNU General Public | ||
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either | ||
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. | ||
8 | */ | 8 | */ | ||
9 | 9 | | |||
10 | #include "dome.h" | 10 | #include "dome.h" | ||
11 | 11 | | |||
12 | #include "domeadaptor.h" | 12 | #include "domeadaptor.h" | ||
13 | #include "ekos/manager.h" | 13 | #include "ekos/manager.h" | ||
14 | #include "indi/driverinfo.h" | 14 | #include "indi/driverinfo.h" | ||
15 | #include "indi/clientmanager.h" | 15 | #include "indi/clientmanager.h" | ||
16 | #include "kstars.h" | 16 | #include "kstars.h" | ||
17 | #include "ekos_debug.h" | ||||
17 | 18 | | |||
18 | #include <basedevice.h> | 19 | #include <basedevice.h> | ||
19 | 20 | | |||
20 | namespace Ekos | 21 | namespace Ekos | ||
21 | { | 22 | { | ||
22 | Dome::Dome() | 23 | Dome::Dome() | ||
23 | { | 24 | { | ||
24 | new DomeAdaptor(this); | 25 | new DomeAdaptor(this); | ||
Show All 38 Lines | 60 | { | |||
63 | return currentDome->canPark(); | 64 | return currentDome->canPark(); | ||
64 | } | 65 | } | ||
65 | 66 | | |||
66 | bool Dome::park() | 67 | bool Dome::park() | ||
67 | { | 68 | { | ||
68 | if (currentDome == nullptr || currentDome->canPark() == false) | 69 | if (currentDome == nullptr || currentDome->canPark() == false) | ||
69 | return false; | 70 | return false; | ||
70 | 71 | | |||
72 | qCDebug(KSTARS_EKOS) << "Parking dome..."; | ||||
71 | return currentDome->Park(); | 73 | return currentDome->Park(); | ||
72 | } | 74 | } | ||
73 | 75 | | |||
74 | bool Dome::unpark() | 76 | bool Dome::unpark() | ||
75 | { | 77 | { | ||
76 | if (currentDome == nullptr || currentDome->canPark() == false) | 78 | if (currentDome == nullptr || currentDome->canPark() == false) | ||
77 | return false; | 79 | return false; | ||
78 | 80 | | |||
81 | qCDebug(KSTARS_EKOS) << "Unparking dome..."; | ||||
79 | return currentDome->UnPark(); | 82 | return currentDome->UnPark(); | ||
80 | } | 83 | } | ||
81 | 84 | | |||
82 | bool Dome::abort() | 85 | bool Dome::abort() | ||
83 | { | 86 | { | ||
84 | if (currentDome == nullptr) | 87 | if (currentDome == nullptr) | ||
85 | return false; | 88 | return false; | ||
86 | 89 | | |||
90 | qCDebug(KSTARS_EKOS) << "Aborting..."; | ||||
87 | return currentDome->Abort(); | 91 | return currentDome->Abort(); | ||
88 | } | 92 | } | ||
89 | 93 | | |||
90 | bool Dome::isMoving() | 94 | bool Dome::isMoving() | ||
91 | { | 95 | { | ||
92 | if (currentDome == nullptr) | 96 | if (currentDome == nullptr) | ||
93 | return false; | 97 | return false; | ||
94 | 98 | | |||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | 139 | if (currentDome) | |||
136 | currentDome->setRelativePosition(position); | 140 | currentDome->setRelativePosition(position); | ||
137 | } | 141 | } | ||
138 | 142 | | |||
139 | bool Dome::moveDome(bool moveCW, bool start) | 143 | bool Dome::moveDome(bool moveCW, bool start) | ||
140 | { | 144 | { | ||
141 | if (currentDome == nullptr) | 145 | if (currentDome == nullptr) | ||
142 | return false; | 146 | return false; | ||
143 | 147 | | |||
148 | if (isRolloffRoof()) | ||||
149 | qCDebug(KSTARS_EKOS) << (moveCW ? "Opening" : "Closing") << "rolloff roof" << (start ? "started." : "stopped."); | ||||
150 | else | ||||
151 | qCDebug(KSTARS_EKOS) << "Moving dome" << (moveCW ? "" : "counter") << "clockwise" << (start ? "started." : "stopped."); | ||||
144 | return currentDome->moveDome(moveCW ? ISD::Dome::DOME_CW : ISD::Dome::DOME_CCW, | 152 | return currentDome->moveDome(moveCW ? ISD::Dome::DOME_CW : ISD::Dome::DOME_CCW, | ||
145 | start ? ISD::Dome::MOTION_START : ISD::Dome::MOTION_STOP); | 153 | start ? ISD::Dome::MOTION_START : ISD::Dome::MOTION_STOP); | ||
146 | } | 154 | } | ||
147 | 155 | | |||
148 | bool Dome::isAutoSync() | 156 | bool Dome::isAutoSync() | ||
149 | { | 157 | { | ||
150 | if (currentDome) | 158 | if (currentDome) | ||
151 | return currentDome->isAutoSync(); | 159 | return currentDome->isAutoSync(); | ||
Show All 16 Lines | 173 | { | |||
168 | // no dome, no shutter | 176 | // no dome, no shutter | ||
169 | return false; | 177 | return false; | ||
170 | } | 178 | } | ||
171 | 179 | | |||
172 | bool Dome::controlShutter(bool open) | 180 | bool Dome::controlShutter(bool open) | ||
173 | { | 181 | { | ||
174 | 182 | | |||
175 | if (currentDome) | 183 | if (currentDome) | ||
184 | { | ||||
185 | qCDebug(KSTARS_EKOS) << (open ? "Opening" : "Closing") << " shutter..."; | ||||
176 | return currentDome->ControlShutter(open); | 186 | return currentDome->ControlShutter(open); | ||
187 | } | ||||
177 | // no dome, no shutter control | 188 | // no dome, no shutter control | ||
178 | return false; | 189 | return false; | ||
179 | } | 190 | } | ||
180 | 191 | | |||
181 | void Dome::removeDevice(ISD::GDInterface *device) | 192 | void Dome::removeDevice(ISD::GDInterface *device) | ||
182 | { | 193 | { | ||
183 | device->disconnect(this); | 194 | device->disconnect(this); | ||
184 | if (currentDome && !strcmp(currentDome->getDeviceName(), device->getDeviceName())) | 195 | if (currentDome && !strcmp(currentDome->getDeviceName(), device->getDeviceName())) | ||
185 | { | 196 | { | ||
186 | currentDome = nullptr; | 197 | currentDome = nullptr; | ||
187 | } | 198 | } | ||
188 | } | 199 | } | ||
189 | 200 | | |||
190 | void Dome::setStatus(ISD::Dome::Status status) | 201 | void Dome::setStatus(ISD::Dome::Status status) | ||
191 | { | 202 | { | ||
192 | // special case for rolloff roofs. | 203 | // special case for rolloff roofs. | ||
193 | if (isRolloffRoof()) | 204 | if (isRolloffRoof()) | ||
194 | { | 205 | { | ||
195 | // if a parked rollof roof starts to move, its state changes to unparking | 206 | // if a parked rolloff roof starts to move, its state changes to unparking | ||
196 | if (status == ISD::Dome::DOME_MOVING_CW && (m_ParkStatus == ISD::PARK_PARKED || m_ParkStatus == ISD::PARK_PARKING)) | 207 | if (status == ISD::Dome::DOME_MOVING_CW && (m_ParkStatus == ISD::PARK_PARKED || m_ParkStatus == ISD::PARK_PARKING)) | ||
197 | { | 208 | { | ||
198 | m_ParkStatus = ISD::PARK_UNPARKING; | 209 | m_ParkStatus = ISD::PARK_UNPARKING; | ||
210 | qCDebug(KSTARS_EKOS) << "Unparking rolloff roof (status = " << status << ")."; | ||||
199 | emit newParkStatus(m_ParkStatus); | 211 | emit newParkStatus(m_ParkStatus); | ||
200 | } | 212 | } | ||
201 | // if a unparked rollof roof starts to move, its state changes to parking | 213 | // if a unparked rolloff roof starts to move, its state changes to parking | ||
202 | else if (status == ISD::Dome::DOME_MOVING_CCW && (m_ParkStatus == ISD::PARK_UNPARKED || m_ParkStatus == ISD::PARK_UNPARKING)) | 214 | else if (status == ISD::Dome::DOME_MOVING_CCW && (m_ParkStatus == ISD::PARK_UNPARKED || m_ParkStatus == ISD::PARK_UNPARKING)) | ||
203 | { | 215 | { | ||
204 | m_ParkStatus = ISD::PARK_PARKING; | 216 | m_ParkStatus = ISD::PARK_PARKING; | ||
217 | qCDebug(KSTARS_EKOS) << "Parking rolloff roof (status = " << status << ")."; | ||||
205 | emit newParkStatus(m_ParkStatus); | 218 | emit newParkStatus(m_ParkStatus); | ||
206 | } | 219 | } | ||
220 | else | ||||
221 | { | ||||
222 | qCDebug(KSTARS_EKOS) << "Rolloff roof status = " << status << "."; | ||||
223 | } | ||||
207 | } | 224 | } | ||
208 | // in all other cases, do nothing | 225 | // in all other cases, do nothing | ||
209 | } | 226 | } | ||
210 | 227 | | |||
211 | } | 228 | } |