[Kstars-devel] KDE/kdeedu/kstars/kstars/indi
Jasem Mutlaq
mutlaqja at ikarustech.com
Thu Mar 23 19:00:48 CET 2006
SVN commit 521848 by mutlaqja:
Check proper coords formats. If the controller doesn't support :U, it might be only constricted to only one format. This patch might fix problems with non-meade controllers.
CCMAIL: kstars-devel at kde.org
M +12 -9 lx200basic.cpp
M +50 -11 lx200driver.c
M +1 -1 lx200driver.h
--- trunk/KDE/kdeedu/kstars/kstars/indi/lx200basic.cpp #521847:521848
@@ -138,7 +138,7 @@
IDLog("Julian Day is %g\n", JD);
IDLog("Initilizing from LX200 Basic device...\n");
- IDLog("Driver Version: 2005-07-20\n");
+ IDLog("Driver Version: 2006-03-23\n");
//enableSimulation(true);
}
@@ -494,8 +494,8 @@
dx = targetRA - currentRA;
dy = targetDEC - currentDEC;
- IDLog("targetRA is %g, currentRA is %g\n", targetRA, currentRA);
- IDLog("targetDEC is %g, currentDEC is %g\n*************************\n", targetDEC, currentDEC);
+ //IDLog("targetRA is %g, currentRA is %g\n", targetRA, currentRA);
+ //IDLog("targetDEC is %g, currentDEC is %g\n*************************\n", targetDEC, currentDEC);
// Wait until acknowledged or within threshold
if (fabs(dx) <= RA_THRESHOLD && fabs(dy) <= DEC_THRESHOLD)
@@ -556,6 +556,9 @@
void LX200Basic::getBasicData()
{
+
+ checkLX200Format();
+
// Get current RA/DEC
getLX200RA(¤tRA);
getLX200DEC(¤tDEC);
@@ -603,7 +606,7 @@
// Track
case LX200_TRACK:
- IDLog("We're in LX200_TRACK\n");
+ //IDLog("We're in LX200_TRACK\n");
if (EqNP.s == IPS_BUSY)
{
IDLog("Aboring Slew\n");
@@ -619,9 +622,9 @@
if (dx >= TRACKING_THRESHOLD || dy >= TRACKING_THRESHOLD)
{
- IDLog("Exceeded Tracking threshold, will attempt to slew to the new target.\n");
- IDLog("targetRA is %g, currentRA is %g\n", targetRA, currentRA);
- IDLog("targetDEC is %g, currentDEC is %g\n*************************\n", targetDEC, currentDEC);
+ //IDLog("Exceeded Tracking threshold, will attempt to slew to the new target.\n");
+ //IDLog("targetRA is %g, currentRA is %g\n", targetRA, currentRA);
+ //IDLog("targetDEC is %g, currentDEC is %g\n*************************\n", targetDEC, currentDEC);
if ((err = Slew()))
{
@@ -637,7 +640,7 @@
}
else
{
- IDLog("Tracking called, but tracking threshold not reached yet.\n");
+ //IDLog("Tracking called, but tracking threshold not reached yet.\n");
EqNP.s = IPS_OK;
EqNP.np[0].value = currentRA;
EqNP.np[1].value = currentDEC;
@@ -771,7 +774,7 @@
return;
}
- IDLog("telescope test successfful\n");
+ //IDLog("telescope test successfful\n");
PowerSP.s = IPS_OK;
IDSetSwitch (&PowerSP, "Telescope is online. Retrieving basic data...");
getBasicData();
--- trunk/KDE/kdeedu/kstars/kstars/indi/lx200driver.c #521847:521848
@@ -36,7 +36,7 @@
#define LX200_TIMEOUT 5 /* FD timeout in seconds */
int fd;
-int read_ret, write_ret;
+int read_ret, write_ret, controller_format;
/**************************************************************************
Basic I/O
@@ -723,12 +723,18 @@
int setObjectRA(double ra)
{
- int h, m, s;
+ int h, m, s, frac_m;
char tempString[16];
getSexComponents(ra, &h, &m, &s);
- snprintf(tempString, sizeof( tempString ), "#:Sr %02d:%02d:%02d#", h, m, s);
+ frac_m = (s / 60.0);
+
+ if (controller_format == LX200_LONG_FORMAT)
+ snprintf(tempString, sizeof( tempString ), "#:Sr %02d:%02d:%02d#", h, m, s);
+ else
+ snprintf(tempString, sizeof( tempString ), "#:Sr %02d:%02d.%02d#", h, m, frac_m);
+
IDLog("Set Object RA String %s\n", tempString);
return (setStandardProcedure(tempString));
}
@@ -741,15 +747,29 @@
getSexComponents(dec, &d, &m, &s);
- /* case with negative zero */
- if (!d && dec < 0)
- snprintf(tempString, sizeof( tempString ), "#:Sd -%02d:%02d:%02d#", d, m, s);
- else
- snprintf(tempString, sizeof( tempString ), "#:Sd %+03d:%02d:%02d#", d, m, s);
+ switch(controller_format)
+ {
+
+ case LX200_SHORT_FORMAT:
+ /* case with negative zero */
+ if (!d && dec < 0)
+ snprintf(tempString, sizeof( tempString ), "#:Sd -%02d*%02d#", d, m);
+ else
+ snprintf(tempString, sizeof( tempString ), "#:Sd %+03d*%02d#", d, m);
+ break;
+ case LX200_LONG_FORMAT:
+ /* case with negative zero */
+ if (!d && dec < 0)
+ snprintf(tempString, sizeof( tempString ), "#:Sd -%02d:%02d:%02d#", d, m, s);
+ else
+ snprintf(tempString, sizeof( tempString ), "#:Sd %+03d:%02d:%02d#", d, m, s);
+ break;
+ }
+
IDLog("Set Object DEC String %s\n", tempString);
- return (setStandardProcedure(tempString));
+ return (setStandardProcedure(tempString));
}
@@ -1195,8 +1215,8 @@
int checkLX200Format()
{
-
char tempString[16];
+ controller_format = LX200_LONG_FORMAT;
if (portWrite("#:GR#") < 0)
return -1;
@@ -1208,11 +1228,30 @@
tempString[read_ret - 1] = '\0';
- /* Short */
+ /* If it's short, change to long, our preferred format */
if (tempString[5] == '.')
+ {
if (portWrite("#:U#") < 0)
return -1;
+ }
+ else
+ return 0;
+
+ /* Does #:U# has any effect?? */
+ if (portWrite("#:GR#") < 0)
+ return -1;
+
+ read_ret = portRead(tempString, -1, LX200_TIMEOUT);
+ if (read_ret < 1)
+ return read_ret;
+
+ tempString[read_ret - 1] = '\0';
+
+ /* Controller doesn't support #:U# */
+ if (tempString[5] == '.')
+ controller_format = LX200_SHORT_FORMAT;
+
return 0;
}
--- trunk/KDE/kdeedu/kstars/kstars/indi/lx200driver.h #521847:521848
@@ -28,7 +28,7 @@
/* Directions */
enum TDirection { LX200_NORTH, LX200_WEST, LX200_EAST, LX200_SOUTH, LX200_ALL};
/* Formats of Right ascention and Declenation */
-enum TFormat { LX200_FORMAT_SHORT, LX200_FORMAT_LONG};
+enum TFormat { LX200_SHORT_FORMAT, LX200_LONG_FORMAT};
/* Time Format */
enum TTimeFormat { LX200_24, LX200_AM, LX200_PM};
/* Focus operation */
More information about the Kstars-devel
mailing list