diff --git a/indi-celestronaux/celestronaux.cpp b/indi-celestronaux/celestronaux.cpp index 2bd6ef539..5f72c877a 100644 --- a/indi-celestronaux/celestronaux.cpp +++ b/indi-celestronaux/celestronaux.cpp @@ -134,7 +134,7 @@ bool CelestronAUX::Handshake() LOG_INFO("Setting serial speed to 9600 baud."); - // detect if connectd to HC port or to mount USB port + // detect if connected to HC port or to mount USB port // ask for HC version char version[10]; if ((m_isHandController = detectHC(version, 10))) @@ -513,6 +513,17 @@ bool CelestronAUX::updateProperties() FirmwareTP[FW_GPS].setText(fwText); defineProperty(FirmwareTP); + // When no HC is attached, the following three commands needs to be send + // to the motor controller (MC): MC_SET_POSITION, MC_SET_CORDWRAP_POSITION + // and MC_CORDWRAP_ON. These three commands are also send by the HC + // to the MC during HC startup and quick align process. + // TODO: One can set the HC in pass through mode, that is, + // the HC relays the AUX commands only and does not interfere in the communication. + if (!m_isHandController && m_MountType == EQ_GEM) + { + startupWithoutHC(); + } + if (InitPark()) { // If loading parking data is successful, we just set the default parking values. @@ -2033,6 +2044,42 @@ bool CelestronAUX::isHomingDone(INDI_HO_AXIS axis) return true; } +///////////////////////////////////////////////////////////////////////////////////// +/// +///////////////////////////////////////////////////////////////////////////////////// +void CelestronAUX::startupWithoutHC() +{ + AUXBuffer data(3); + data[0] = 0x40; + data[1] = 0x00; + data[2] = 0x00; + + AUXCommand command(MC_SET_POSITION, APP, AZM, data); + sendAUXCommand(command); + readAUXResponse(command); + + command = AUXCommand(MC_SET_POSITION, APP, ALT, data); + sendAUXCommand(command); + readAUXResponse(command); + + data[0] = 0xc0; + command = AUXCommand(MC_SET_CORDWRAP_POS, APP, AZM, data); + sendAUXCommand(command); + readAUXResponse(command); + + command = AUXCommand(MC_SET_CORDWRAP_POS, APP, ALT, data); + sendAUXCommand(command); + readAUXResponse(command); + + command = AUXCommand(MC_ENABLE_CORDWRAP, APP, AZM); + sendAUXCommand(command); + readAUXResponse(command); + + command = AUXCommand(MC_ENABLE_CORDWRAP, APP, ALT); + sendAUXCommand(command); + readAUXResponse(command); +} + ///////////////////////////////////////////////////////////////////////////////////// /// ///////////////////////////////////////////////////////////////////////////////////// diff --git a/indi-celestronaux/celestronaux.h b/indi-celestronaux/celestronaux.h index 242311d76..75cd39b70 100644 --- a/indi-celestronaux/celestronaux.h +++ b/indi-celestronaux/celestronaux.h @@ -226,12 +226,12 @@ class CelestronAUX : { return m_Location.latitude >= 0; } + void startupWithoutHC(); bool getModel(AUXTargets target); bool getVersion(AUXTargets target); void getVersions(); void hex_dump(char *buf, AUXBuffer data, size_t size); - double AzimuthToDegrees(double degree); double DegreesToAzimuth(double degree);