TelescopeClientDirectNexStar.cpp   TelescopeClientDirectNexStar.cpp 
skipping to change at line 70 skipping to change at line 70
//Validation: Time delay //Validation: Time delay
if (time_delay <= 0 || time_delay > 10000000) if (time_delay <= 0 || time_delay > 10000000)
{ {
qWarning() << "ERROR creating TelescopeClientDirectNexStar: time_delay not valid (should be less than 10000000)"; qWarning() << "ERROR creating TelescopeClientDirectNexStar: time_delay not valid (should be less than 10000000)";
return; return;
} }
//end_of_timeout = -0x8000000000000000LL; //end_of_timeout = -0x8000000000000000LL;
#ifdef WIN32 #ifdef Q_OS_WIN32
if(serialDeviceName.right(serialDeviceName.size() - 3).toInt() > 9) if(serialDeviceName.right(serialDeviceName.size() - 3).toInt() > 9)
serialDeviceName = "\\\\.\\" + serialDeviceName + ":";//"\\. \COMxx", not sure if it will work serialDeviceName = "\\\\.\\" + serialDeviceName + ":";//"\\. \COMxx", not sure if it will work
else else
serialDeviceName = serialDeviceName + ":"; serialDeviceName = serialDeviceName + ":";
#endif //WIN32 #endif //Q_OS_WIN32
//Try to establish a connection to the telescope //Try to establish a connection to the telescope
nexstar = new NexStarConnection(*this, qPrintable(serialDeviceName)) ; nexstar = new NexStarConnection(*this, qPrintable(serialDeviceName)) ;
if (nexstar->isClosed()) if (nexstar->isClosed())
{ {
qWarning() << "ERROR creating TelescopeClientDirectNexStar: cannot open serial device" << serialDeviceName; qWarning() << "ERROR creating TelescopeClientDirectNexStar: cannot open serial device" << serialDeviceName;
return; return;
} }
//This connection will be deleted in the destructor of Server //This connection will be deleted in the destructor of Server
skipping to change at line 117 skipping to change at line 117
//! queues a GOTO command with the specified position to the write buffer. //! queues a GOTO command with the specified position to the write buffer.
//! For the data format of the command see the //! For the data format of the command see the
//! "Stellarium telescope control protocol" text file //! "Stellarium telescope control protocol" text file
void TelescopeClientDirectNexStar::telescopeGoto(const Vec3d &j2000Pos) void TelescopeClientDirectNexStar::telescopeGoto(const Vec3d &j2000Pos)
{ {
if (isConnected())//TODO: See the else clause, think how to do the s ame thing if (isConnected())//TODO: See the else clause, think how to do the s ame thing
{ {
//if (writeBufferEnd - writeBuffer + 20 < (int)sizeof(writeB uffer)) //if (writeBufferEnd - writeBuffer + 20 < (int)sizeof(writeB uffer))
{ {
const double ra = atan2(j2000Pos[1], j2000Pos[0]); const double ra_signed = atan2(j2000Pos[1], j2000Pos
[0]);
//Workaround for the discrepancy in precision betwee
n Windows/Linux/PPC Macs and Intel Macs:
const double ra = (ra_signed >= 0) ? ra_signed : (ra
_signed + 2.0 * M_PI);
const double dec = atan2(j2000Pos[2], sqrt(j2000Pos[ 0]*j2000Pos[0]+j2000Pos[1]*j2000Pos[1])); const double dec = atan2(j2000Pos[2], sqrt(j2000Pos[ 0]*j2000Pos[0]+j2000Pos[1]*j2000Pos[1]));
unsigned int ra_int = (unsigned int)floor(0.5 + ra*( ((unsigned int)0x80000000)/M_PI)); unsigned int ra_int = (unsigned int)floor(0.5 + ra*( ((unsigned int)0x80000000)/M_PI));
int dec_int = (int)floor(0.5 + dec*(((unsigned int)0 x80000000)/M_PI)); int dec_int = (int)floor(0.5 + dec*(((unsigned int)0 x80000000)/M_PI));
gotoReceived(ra_int, dec_int); gotoReceived(ra_int, dec_int);
} }
/* /*
else else
{ {
qDebug() << "TelescopeTCP(" << name << ")::telescope Goto: "<< "communication is too slow, I will ignore this command"; qDebug() << "TelescopeTCP(" << name << ")::telescope Goto: "<< "communication is too slow, I will ignore this command";
 End of changes. 3 change blocks. 
3 lines changed or deleted 8 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/