Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send AUX commands to MC imitating attached HC #752

Merged
merged 1 commit into from
Mar 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
49 changes: 48 additions & 1 deletion indi-celestronaux/celestronaux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down Expand Up @@ -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();
}
knro marked this conversation as resolved.
Show resolved Hide resolved

if (InitPark())
{
// If loading parking data is successful, we just set the default parking values.
Expand Down Expand Up @@ -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);
}

/////////////////////////////////////////////////////////////////////////////////////
///
/////////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion indi-celestronaux/celestronaux.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down