kopia lustrzana https://github.com/Hamlib/Hamlib
rodzic
6f0d8bdcce
commit
bff29003ea
|
@ -136,7 +136,7 @@ celestron_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||||
tube is perpendicular to the azimuth axis.
|
tube is perpendicular to the azimuth axis.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "B%04X,%04X",
|
SNPRINTF(cmdstr, sizeof(cmdstr), "B%04X,%04X",
|
||||||
(unsigned)((az / 360.) * 65535),
|
(unsigned)((az / 360.) * 65535),
|
||||||
(unsigned)((el / 360.) * 65535));
|
(unsigned)((el / 360.) * 65535));
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ celestron_get_info(ROT *rot)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(info, sizeof(info), "V%c.%c", str[0], str[1]);
|
SNPRINTF(info, sizeof(info), "V%c.%c", str[0], str[1]);
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ cnctrk_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(axcmd, sizeof(axcmd), "/usr/bin/axis-remote --mdi 'G00 X %6.2f Y %6.2f' \n", az, el);
|
SNPRINTF(axcmd, sizeof(axcmd), "/usr/bin/axis-remote --mdi 'G00 X %6.2f Y %6.2f' \n", az, el);
|
||||||
return system(axcmd);
|
return system(axcmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,11 +109,11 @@ easycomm_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||||
|
|
||||||
if (rot->caps->rot_model == ROT_MODEL_EASYCOMM1)
|
if (rot->caps->rot_model == ROT_MODEL_EASYCOMM1)
|
||||||
{
|
{
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "AZ%.1f EL%.1f UP000 XXX DN000 XXX\n", az, el);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "AZ%.1f EL%.1f UP000 XXX DN000 XXX\n", az, el);
|
||||||
}
|
}
|
||||||
else // for easycomm 2 & 3 and upwards
|
else // for easycomm 2 & 3 and upwards
|
||||||
{
|
{
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "AZ%.1f EL%.1f\n", az, el);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "AZ%.1f EL%.1f\n", az, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = easycomm_transaction(rot, cmdstr, NULL, 0);
|
retval = easycomm_transaction(rot, cmdstr, NULL, 0);
|
||||||
|
@ -135,7 +135,7 @@ easycomm_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
||||||
|
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "AZ EL \n");
|
SNPRINTF(cmdstr, sizeof(cmdstr), "AZ EL \n");
|
||||||
|
|
||||||
retval = easycomm_transaction(rot, cmdstr, ackbuf, sizeof(ackbuf));
|
retval = easycomm_transaction(rot, cmdstr, ackbuf, sizeof(ackbuf));
|
||||||
|
|
||||||
|
@ -220,19 +220,19 @@ easycomm_rot_move(ROT *rot, int direction, int speed)
|
||||||
switch (direction)
|
switch (direction)
|
||||||
{
|
{
|
||||||
case ROT_MOVE_UP: /* Elevation increase */
|
case ROT_MOVE_UP: /* Elevation increase */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "MU\n");
|
SNPRINTF(cmdstr, sizeof(cmdstr), "MU\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ROT_MOVE_DOWN: /* Elevation decrease */
|
case ROT_MOVE_DOWN: /* Elevation decrease */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "MD\n");
|
SNPRINTF(cmdstr, sizeof(cmdstr), "MD\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ROT_MOVE_LEFT: /* Azimuth decrease */
|
case ROT_MOVE_LEFT: /* Azimuth decrease */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "ML\n");
|
SNPRINTF(cmdstr, sizeof(cmdstr), "ML\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ROT_MOVE_RIGHT: /* Azimuth increase */
|
case ROT_MOVE_RIGHT: /* Azimuth increase */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "MR\n");
|
SNPRINTF(cmdstr, sizeof(cmdstr), "MR\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -281,19 +281,19 @@ static int easycomm_rot_move_velocity(ROT *rot, int direction, int speed)
|
||||||
switch (direction)
|
switch (direction)
|
||||||
{
|
{
|
||||||
case ROT_MOVE_UP: /* Elevation increase */
|
case ROT_MOVE_UP: /* Elevation increase */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "VU%04d\n", easycomm_speed);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "VU%04d\n", easycomm_speed);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ROT_MOVE_DOWN: /* Elevation decrease */
|
case ROT_MOVE_DOWN: /* Elevation decrease */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "VD%04d\n", easycomm_speed);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "VD%04d\n", easycomm_speed);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ROT_MOVE_LEFT: /* Azimuth decrease */
|
case ROT_MOVE_LEFT: /* Azimuth decrease */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "VL%04d\n", easycomm_speed);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "VL%04d\n", easycomm_speed);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ROT_MOVE_RIGHT: /* Azimuth increase */
|
case ROT_MOVE_RIGHT: /* Azimuth increase */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "VR%04d\n", easycomm_speed);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "VR%04d\n", easycomm_speed);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -406,27 +406,27 @@ static int easycomm_rot_get_conf(ROT *rot, token_t token, char *val)
|
||||||
switch (token)
|
switch (token)
|
||||||
{
|
{
|
||||||
case TOK_GET_STATUS:
|
case TOK_GET_STATUS:
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "GS\n;");
|
SNPRINTF(cmdstr, sizeof(cmdstr), "GS\n;");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_GET_ERRORS:
|
case TOK_GET_ERRORS:
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "GE\n;");
|
SNPRINTF(cmdstr, sizeof(cmdstr), "GE\n;");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_GET_INPUT:
|
case TOK_GET_INPUT:
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "IP\n;");
|
SNPRINTF(cmdstr, sizeof(cmdstr), "IP\n;");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_GET_ANALOG_INPUT:
|
case TOK_GET_ANALOG_INPUT:
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "AN\n;");
|
SNPRINTF(cmdstr, sizeof(cmdstr), "AN\n;");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_GET_VERSION:
|
case TOK_GET_VERSION:
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "VE\n;");
|
SNPRINTF(cmdstr, sizeof(cmdstr), "VE\n;");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_GET_CONFIG:
|
case TOK_GET_CONFIG:
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "CR %c\n;", *val);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "CR %c\n;", *val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -478,7 +478,7 @@ static int easycomm_rot_set_conf(ROT *rot, token_t token, const char *val)
|
||||||
switch (token)
|
switch (token)
|
||||||
{
|
{
|
||||||
case TOK_SET_CONFIG:
|
case TOK_SET_CONFIG:
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "CW%s\n;", val);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "CW%s\n;", val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -89,7 +89,7 @@ static int ether_transaction(ROT *rot, char *cmd, int len, char *buf)
|
||||||
|
|
||||||
static int ether_rot_open(ROT *rot)
|
static int ether_rot_open(ROT *rot)
|
||||||
{
|
{
|
||||||
int ret, len;
|
int ret;
|
||||||
int sval;
|
int sval;
|
||||||
float min_az, max_az, min_el, max_el;
|
float min_az, max_az, min_el, max_el;
|
||||||
struct rot_state *rs = &rot->state;
|
struct rot_state *rs = &rot->state;
|
||||||
|
@ -100,10 +100,10 @@ static int ether_rot_open(ROT *rot)
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
/* elevation not need */
|
/* elevation not need */
|
||||||
|
|
||||||
len = snprintf(cmd, sizeof(cmd), "rotor state\n");
|
SNPRINTF(cmd, sizeof(cmd), "rotor state\n");
|
||||||
/*-180/180 0/90*/
|
/*-180/180 0/90*/
|
||||||
|
|
||||||
ret = ether_transaction(rot, cmd, len, buf);
|
ret = ether_transaction(rot, cmd, strlen(cmd), buf);
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
|
@ -133,16 +133,16 @@ static int ether_rot_close(ROT *rot)
|
||||||
|
|
||||||
static int ether_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
static int ether_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||||
{
|
{
|
||||||
int ret, len;
|
int ret;
|
||||||
char cmd[CMD_MAX];
|
char cmd[CMD_MAX];
|
||||||
char buf[BUF_MAX];
|
char buf[BUF_MAX];
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %f %f\n", __func__,
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %f %f\n", __func__,
|
||||||
az, el);
|
az, el);
|
||||||
|
|
||||||
len = snprintf(cmd, sizeof(cmd), "rotor move %d %d\n", (int)az, (int)el);
|
SNPRINTF(cmd, sizeof(cmd), "rotor move %d %d\n", (int)az, (int)el);
|
||||||
|
|
||||||
ret = ether_transaction(rot, cmd, len, buf);
|
ret = ether_transaction(rot, cmd, strlen(cmd), buf);
|
||||||
|
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
{
|
{
|
||||||
|
@ -156,16 +156,16 @@ static int ether_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||||
|
|
||||||
static int ether_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
static int ether_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
||||||
{
|
{
|
||||||
int ret, len, sval, speed, adv;
|
int ret, sval, speed, adv;
|
||||||
char cmd[CMD_MAX];
|
char cmd[CMD_MAX];
|
||||||
char buf[BUF_MAX];
|
char buf[BUF_MAX];
|
||||||
char mv[5];
|
char mv[5];
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
|
||||||
len = snprintf(cmd, sizeof(cmd), "rotor status\n");
|
SNPRINTF(cmd, sizeof(cmd), "rotor status\n");
|
||||||
|
|
||||||
ret = ether_transaction(rot, cmd, len, buf);
|
ret = ether_transaction(rot, cmd, strlen(cmd), buf);
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
|
@ -192,15 +192,15 @@ static int ether_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
||||||
*/
|
*/
|
||||||
static int ether_rot_stop(ROT *rot)
|
static int ether_rot_stop(ROT *rot)
|
||||||
{
|
{
|
||||||
int ret, len;
|
int ret;
|
||||||
char cmd[CMD_MAX];
|
char cmd[CMD_MAX];
|
||||||
char buf[BUF_MAX];
|
char buf[BUF_MAX];
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
|
||||||
len = snprintf(cmd, sizeof(cmd), "rotor stop\n");
|
SNPRINTF(cmd, sizeof(cmd), "rotor stop\n");
|
||||||
|
|
||||||
ret = ether_transaction(rot, cmd, len, buf);
|
ret = ether_transaction(rot, cmd, strlen(cmd), buf);
|
||||||
|
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
{
|
{
|
||||||
|
@ -218,15 +218,15 @@ static int ether_rot_stop(ROT *rot)
|
||||||
*/
|
*/
|
||||||
static int ether_rot_park(ROT *rot)
|
static int ether_rot_park(ROT *rot)
|
||||||
{
|
{
|
||||||
int ret, len;
|
int ret;
|
||||||
char cmd[CMD_MAX];
|
char cmd[CMD_MAX];
|
||||||
char buf[BUF_MAX];
|
char buf[BUF_MAX];
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
|
||||||
len = snprintf(cmd, sizeof(cmd), "rotor park\n");
|
SNPRINTF(cmd, sizeof(cmd), "rotor park\n");
|
||||||
|
|
||||||
ret = ether_transaction(rot, cmd, len, buf);
|
ret = ether_transaction(rot, cmd, strlen(cmd), buf);
|
||||||
|
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
{
|
{
|
||||||
|
@ -240,16 +240,15 @@ static int ether_rot_park(ROT *rot)
|
||||||
|
|
||||||
static int ether_rot_reset(ROT *rot, rot_reset_t reset)
|
static int ether_rot_reset(ROT *rot, rot_reset_t reset)
|
||||||
{
|
{
|
||||||
int ret, len;
|
int ret;
|
||||||
char cmd[CMD_MAX];
|
char cmd[CMD_MAX];
|
||||||
char buf[BUF_MAX];
|
char buf[BUF_MAX];
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
|
||||||
// orig len = snprintf(cmd, sizeof(cmd), "R %d\n", reset);
|
SNPRINTF(cmd, sizeof(cmd), "reset\n");
|
||||||
len = snprintf(cmd, sizeof(cmd), "reset\n");
|
|
||||||
|
|
||||||
ret = ether_transaction(rot, cmd, len, buf);
|
ret = ether_transaction(rot, cmd, strlen(cmd), buf);
|
||||||
|
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
{
|
{
|
||||||
|
@ -268,7 +267,7 @@ static int ether_rot_reset(ROT *rot, rot_reset_t reset)
|
||||||
static int ether_rot_move(ROT *rot, int direction, int speed)
|
static int ether_rot_move(ROT *rot, int direction, int speed)
|
||||||
{
|
{
|
||||||
struct rot_state *rs = &rot->state;
|
struct rot_state *rs = &rot->state;
|
||||||
int ret, len;
|
int ret;
|
||||||
char cmd[CMD_MAX];
|
char cmd[CMD_MAX];
|
||||||
char buf[BUF_MAX];
|
char buf[BUF_MAX];
|
||||||
int ether_speed;
|
int ether_speed;
|
||||||
|
@ -294,14 +293,14 @@ static int ether_rot_move(ROT *rot, int direction, int speed)
|
||||||
|
|
||||||
if (direction == 0)
|
if (direction == 0)
|
||||||
{
|
{
|
||||||
len = snprintf(cmd, sizeof(cmd), "rotor cw %d\n", ether_speed);
|
SNPRINTF(cmd, sizeof(cmd), "rotor cw %d\n", ether_speed);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
len = snprintf(cmd, sizeof(cmd), "rotor ccw %d\n", ether_speed);
|
SNPRINTF(cmd, sizeof(cmd), "rotor ccw %d\n", ether_speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ether_transaction(rot, cmd, len, buf);
|
ret = ether_transaction(rot, cmd, strlen(cmd), buf);
|
||||||
|
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -169,7 +169,7 @@ gs232_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||||
u_az = (unsigned)rint(az);
|
u_az = (unsigned)rint(az);
|
||||||
u_el = (unsigned)rint(el);
|
u_el = (unsigned)rint(el);
|
||||||
|
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "W%03u %03u" EOM, u_az, u_el);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "W%03u %03u" EOM, u_az, u_el);
|
||||||
retval = gs232_wo_transaction(rot, cmdstr, NULL, 0);
|
retval = gs232_wo_transaction(rot, cmdstr, NULL, 0);
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
if (retval != RIG_OK)
|
||||||
|
|
|
@ -177,7 +177,7 @@ gs232a_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||||
u_az = (unsigned)rint(az);
|
u_az = (unsigned)rint(az);
|
||||||
u_el = (unsigned)rint(el);
|
u_el = (unsigned)rint(el);
|
||||||
|
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "W%03u %03u" EOM, u_az, u_el);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "W%03u %03u" EOM, u_az, u_el);
|
||||||
retval = gs232a_transaction(rot, cmdstr, NULL, 0, 0);
|
retval = gs232a_transaction(rot, cmdstr, NULL, 0, 0);
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
if (retval != RIG_OK)
|
||||||
|
@ -283,7 +283,7 @@ static int gs232a_rot_set_level(ROT *rot, setting_t level, value_t val)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* between 1 (slowest) and 4 (fastest) */
|
/* between 1 (slowest) and 4 (fastest) */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "X%u" EOM, speed);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "X%u" EOM, speed);
|
||||||
retval = gs232a_transaction(rot, cmdstr, NULL, 0, 1);
|
retval = gs232a_transaction(rot, cmdstr, NULL, 0, 1);
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
if (retval != RIG_OK)
|
||||||
|
@ -335,19 +335,19 @@ static int gs232a_rot_move(ROT *rot, int direction, int speed)
|
||||||
switch (direction)
|
switch (direction)
|
||||||
{
|
{
|
||||||
case ROT_MOVE_UP: /* Elevation increase */
|
case ROT_MOVE_UP: /* Elevation increase */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "U" EOM);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "U" EOM);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ROT_MOVE_DOWN: /* Elevation decrease */
|
case ROT_MOVE_DOWN: /* Elevation decrease */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "D" EOM);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "D" EOM);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ROT_MOVE_LEFT: /* Azimuth decrease */
|
case ROT_MOVE_LEFT: /* Azimuth decrease */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "L" EOM);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "L" EOM);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ROT_MOVE_RIGHT: /* Azimuth increase */
|
case ROT_MOVE_RIGHT: /* Azimuth increase */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "R" EOM);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "R" EOM);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -194,7 +194,7 @@ gs232b_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||||
u_az = (unsigned) rint(az);
|
u_az = (unsigned) rint(az);
|
||||||
u_el = (unsigned) rint(el);
|
u_el = (unsigned) rint(el);
|
||||||
|
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "W%03u %03u" EOM, u_az, u_el);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "W%03u %03u" EOM, u_az, u_el);
|
||||||
#if 0 // do any GS232B models need a reply to the W command?
|
#if 0 // do any GS232B models need a reply to the W command?
|
||||||
retval = gs232b_transaction(rot, cmdstr, buf, sizeof(buf), 0);
|
retval = gs232b_transaction(rot, cmdstr, buf, sizeof(buf), 0);
|
||||||
#else
|
#else
|
||||||
|
@ -312,7 +312,7 @@ static int gs232b_rot_set_level(ROT *rot, setting_t level, value_t val)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* between 1 (slowest) and 4 (fastest) */
|
/* between 1 (slowest) and 4 (fastest) */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "X%u" EOM, speed);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "X%u" EOM, speed);
|
||||||
retval = gs232b_transaction(rot, cmdstr, NULL, 0, 1);
|
retval = gs232b_transaction(rot, cmdstr, NULL, 0, 1);
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
if (retval != RIG_OK)
|
||||||
|
@ -364,19 +364,19 @@ static int gs232b_rot_move(ROT *rot, int direction, int speed)
|
||||||
switch (direction)
|
switch (direction)
|
||||||
{
|
{
|
||||||
case ROT_MOVE_UP: /* Elevation increase */
|
case ROT_MOVE_UP: /* Elevation increase */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "U" EOM);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "U" EOM);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ROT_MOVE_DOWN: /* Elevation decrease */
|
case ROT_MOVE_DOWN: /* Elevation decrease */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "D" EOM);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "D" EOM);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ROT_MOVE_LEFT: /* Azimuth decrease */
|
case ROT_MOVE_LEFT: /* Azimuth decrease */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "L" EOM);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "L" EOM);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ROT_MOVE_RIGHT: /* Azimuth increase */
|
case ROT_MOVE_RIGHT: /* Azimuth increase */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "R" EOM);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "R" EOM);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -190,7 +190,7 @@ static int hd1780_rot_set_position(ROT *rot, azimuth_t azimuth,
|
||||||
|
|
||||||
if (azimuth < 0) { azimuth = azimuth + 360; }
|
if (azimuth < 0) { azimuth = azimuth + 360; }
|
||||||
|
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "%03.0f", azimuth); /* Target bearing */
|
SNPRINTF(cmdstr, sizeof(cmdstr), "%03.0f", azimuth); /* Target bearing */
|
||||||
err = hd1780_send_priv_cmd(rot, cmdstr);
|
err = hd1780_send_priv_cmd(rot, cmdstr);
|
||||||
|
|
||||||
if (err != RIG_OK)
|
if (err != RIG_OK)
|
||||||
|
|
|
@ -164,7 +164,7 @@ ioptron_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||||
faz = az * 360000;
|
faz = az * 360000;
|
||||||
fel = el * 360000;
|
fel = el * 360000;
|
||||||
/* set azmiuth, returns '1" if OK */
|
/* set azmiuth, returns '1" if OK */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), ":Sz%09.0f#", faz);
|
SNPRINTF(cmdstr, sizeof(cmdstr), ":Sz%09.0f#", faz);
|
||||||
retval = ioptron_transaction(rot, cmdstr, retbuf, sizeof(retbuf));
|
retval = ioptron_transaction(rot, cmdstr, retbuf, sizeof(retbuf));
|
||||||
|
|
||||||
if (retval != RIG_OK || retbuf[0] != ACK1)
|
if (retval != RIG_OK || retbuf[0] != ACK1)
|
||||||
|
@ -173,7 +173,7 @@ ioptron_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set altitude, returns '1" if OK */
|
/* set altitude, returns '1" if OK */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), ":Sa+%08.0f#", fel);
|
SNPRINTF(cmdstr, sizeof(cmdstr), ":Sa+%08.0f#", fel);
|
||||||
retval = ioptron_transaction(rot, cmdstr, retbuf, sizeof(retbuf));
|
retval = ioptron_transaction(rot, cmdstr, retbuf, sizeof(retbuf));
|
||||||
|
|
||||||
if (retval != RIG_OK || retbuf[0] != ACK1)
|
if (retval != RIG_OK || retbuf[0] != ACK1)
|
||||||
|
@ -182,7 +182,7 @@ ioptron_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* move to set target, V2 command, returns '1" if OK */
|
/* move to set target, V2 command, returns '1" if OK */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), ":MS#"); //
|
SNPRINTF(cmdstr, sizeof(cmdstr), ":MS#"); //
|
||||||
retval = ioptron_transaction(rot, cmdstr, retbuf, sizeof(retbuf));
|
retval = ioptron_transaction(rot, cmdstr, retbuf, sizeof(retbuf));
|
||||||
|
|
||||||
if (retval != RIG_OK || retbuf[0] != ACK1)
|
if (retval != RIG_OK || retbuf[0] != ACK1)
|
||||||
|
@ -191,7 +191,7 @@ ioptron_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stop tracking, V2 command, returns '1" if OK */
|
/* stop tracking, V2 command, returns '1" if OK */
|
||||||
snprintf(cmdstr, sizeof(cmdstr), ":ST0#");
|
SNPRINTF(cmdstr, sizeof(cmdstr), ":ST0#");
|
||||||
retval = ioptron_transaction(rot, cmdstr, retbuf, sizeof(retbuf));
|
retval = ioptron_transaction(rot, cmdstr, retbuf, sizeof(retbuf));
|
||||||
|
|
||||||
if (retval != RIG_OK || retbuf[0] != ACK1)
|
if (retval != RIG_OK || retbuf[0] != ACK1)
|
||||||
|
@ -284,7 +284,7 @@ ioptron_get_info(ROT *rot)
|
||||||
rig_debug(RIG_DEBUG_TRACE, "retval, RIG_OK str %d %d %str\n", retval, RIG_OK,
|
rig_debug(RIG_DEBUG_TRACE, "retval, RIG_OK str %d %d %str\n", retval, RIG_OK,
|
||||||
str);
|
str);
|
||||||
|
|
||||||
snprintf(info, sizeof(info), "MountInfo %s", str);
|
SNPRINTF(info, sizeof(info), "MountInfo %s", str);
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
|
@ -446,7 +446,7 @@ static const char *meade_get_info(ROT *rot)
|
||||||
struct meade_priv_data *priv = (struct meade_priv_data *)rot->state.priv;
|
struct meade_priv_data *priv = (struct meade_priv_data *)rot->state.priv;
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "Meade telescope rotator with LX200 protocol.\nModel: %s",
|
SNPRINTF(buf, sizeof(buf), "Meade telescope rotator with LX200 protocol.\nModel: %s",
|
||||||
priv->product_name);
|
priv->product_name);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ radant_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __func__, az, el);
|
rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __func__, az, el);
|
||||||
|
|
||||||
|
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "Q%.1f %1.f\r", az, el);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "Q%.1f %1.f\r", az, el);
|
||||||
|
|
||||||
retval = radant_transaction(rot, cmdstr, NULL, 0);
|
retval = radant_transaction(rot, cmdstr, NULL, 0);
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ radant_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
||||||
|
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "Y\r");
|
SNPRINTF(cmdstr, sizeof(cmdstr), "Y\r");
|
||||||
|
|
||||||
retval = radant_transaction(rot, cmdstr, ackbuf, sizeof(ackbuf));
|
retval = radant_transaction(rot, cmdstr, ackbuf, sizeof(ackbuf));
|
||||||
|
|
||||||
|
|
|
@ -436,7 +436,7 @@ static int rotorez_rot_set_position(ROT *rot, azimuth_t azimuth,
|
||||||
azimuth = 0;
|
azimuth = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "AP1%03.0f;", azimuth); /* Target bearing */
|
SNPRINTF(cmdstr, sizeof(cmdstr), "AP1%03.0f;", azimuth); /* Target bearing */
|
||||||
err = rotorez_send_priv_cmd(rot, cmdstr);
|
err = rotorez_send_priv_cmd(rot, cmdstr);
|
||||||
|
|
||||||
if (err != RIG_OK)
|
if (err != RIG_OK)
|
||||||
|
@ -481,7 +481,7 @@ static int rt21_rot_set_position(ROT *rot, azimuth_t azimuth,
|
||||||
return -RIG_EINVAL;
|
return -RIG_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "AP1%05.1f\r;", azimuth); /* Total field width of 5 chars */
|
SNPRINTF(cmdstr, sizeof(cmdstr), "AP1%05.1f\r;", azimuth); /* Total field width of 5 chars */
|
||||||
err = rotorez_send_priv_cmd(rot, cmdstr);
|
err = rotorez_send_priv_cmd(rot, cmdstr);
|
||||||
|
|
||||||
if (err != RIG_OK)
|
if (err != RIG_OK)
|
||||||
|
@ -491,7 +491,7 @@ static int rt21_rot_set_position(ROT *rot, azimuth_t azimuth,
|
||||||
|
|
||||||
if (rot->state.rotport2.pathname[0] != 0)
|
if (rot->state.rotport2.pathname[0] != 0)
|
||||||
{
|
{
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "AP1%05.1f\r;",
|
SNPRINTF(cmdstr, sizeof(cmdstr), "AP1%05.1f\r;",
|
||||||
elevation); /* Total field width of 5 chars */
|
elevation); /* Total field width of 5 chars */
|
||||||
|
|
||||||
err = rotorez_send_priv_cmd2(rot, cmdstr);
|
err = rotorez_send_priv_cmd2(rot, cmdstr);
|
||||||
|
@ -952,7 +952,7 @@ static int rotorez_rot_set_conf(ROT *rot, token_t token, const char *val)
|
||||||
}
|
}
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: c = %c, *val = %c\n", __func__, c, *val);
|
rig_debug(RIG_DEBUG_TRACE, "%s: c = %c, *val = %c\n", __func__, c, *val);
|
||||||
snprintf(cmdstr, sizeof(cmdstr), "%c", c);
|
SNPRINTF(cmdstr, sizeof(cmdstr), "%c", c);
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: cmdstr = %s, *val = %c\n",
|
rig_debug(RIG_DEBUG_TRACE, "%s: cmdstr = %s, *val = %c\n",
|
||||||
__func__, cmdstr, *val);
|
__func__, cmdstr, *val);
|
||||||
|
|
|
@ -104,7 +104,7 @@ static int sartek_rot_set_position(ROT *rot, azimuth_t azimuth,
|
||||||
elevation_t elevation)
|
elevation_t elevation)
|
||||||
{
|
{
|
||||||
char cmdstr[8];
|
char cmdstr[8];
|
||||||
int len, err;
|
int err;
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
||||||
|
|
||||||
|
@ -127,9 +127,9 @@ static int sartek_rot_set_position(ROT *rot, azimuth_t azimuth,
|
||||||
azimuth = 358;
|
azimuth = 358;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = snprintf(cmdstr, sizeof(cmdstr), "P%c", (int)((azimuth * 255) / 360));
|
SNPRINTF(cmdstr, sizeof(cmdstr), "P%c", (int)((azimuth * 255) / 360));
|
||||||
|
|
||||||
err = write_block(&rot->state.rotport, (unsigned char *) cmdstr, len);
|
err = write_block(&rot->state.rotport, (unsigned char *) cmdstr, strlen(cmdstr));
|
||||||
|
|
||||||
if (err != RIG_OK)
|
if (err != RIG_OK)
|
||||||
{
|
{
|
||||||
|
|
|
@ -315,7 +315,7 @@ static int satel_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(cmdbuf, BUF_SIZE, "p%d %d\r\n", (int)az, (int)el);
|
SNPRINTF(cmdbuf, BUF_SIZE, "p%d %d\r\n", (int)az, (int)el);
|
||||||
ret = satel_cmd(rot, cmdbuf, strlen(cmdbuf), NULL, 0);
|
ret = satel_cmd(rot, cmdbuf, strlen(cmdbuf), NULL, 0);
|
||||||
|
|
||||||
if (ret != RIG_OK)
|
if (ret != RIG_OK)
|
||||||
|
|
|
@ -112,11 +112,11 @@ static int spid_get_conf2(ROT *rot, token_t token, char *val, int val_len)
|
||||||
switch (token)
|
switch (token)
|
||||||
{
|
{
|
||||||
case TOK_AZRES:
|
case TOK_AZRES:
|
||||||
snprintf(val, val_len, "%d", priv->az_resolution);
|
SNPRINTF(val, val_len, "%d", priv->az_resolution);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_ELRES:
|
case TOK_ELRES:
|
||||||
snprintf(val, val_len, "%d", priv->el_resolution);
|
SNPRINTF(val, val_len, "%d", priv->el_resolution);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Ładowanie…
Reference in New Issue