kopia lustrzana https://github.com/Hamlib/Hamlib
Turns out M2 has two different protcols
So we now have RC2800, RC2800_EARLY_AZ, and RC2800_EARLY_AZEL RC2800_EARLY_AZ is azimuth only Update rotctl man page for move keywords https://github.com/Hamlib/Hamlib/issues/451pull/453/head
rodzic
7e5d08319f
commit
dd3ed134dd
|
@ -384,8 +384,8 @@ are returned as double precision floating point values.
|
||||||
Move the rotator in a specific direction at the given rate.
|
Move the rotator in a specific direction at the given rate.
|
||||||
.IP
|
.IP
|
||||||
.RI \(aq Direction \(aq
|
.RI \(aq Direction \(aq
|
||||||
is an integer defined as \(oq2\(cq = Up, \(oq4\(cq = Down, \(oq8\(cq = Left,
|
is an integer or keyword defined as \(oq2\(cq = UP, \(oq4\(cq = DOWN, \(oq8\(cq = LEFT or CCW
|
||||||
and \(oq16\(cq = Right.
|
and \(oq16\(cq = RIGHT or CW
|
||||||
.IP
|
.IP
|
||||||
.RI \(aq Speed \(aq
|
.RI \(aq Speed \(aq
|
||||||
is an integer between 1 and 100.
|
is an integer between 1 and 100.
|
||||||
|
|
|
@ -325,7 +325,8 @@
|
||||||
#define ROT_BACKEND_M2 "m2"
|
#define ROT_BACKEND_M2 "m2"
|
||||||
//! @endcond
|
//! @endcond
|
||||||
#define ROT_MODEL_RC2800 ROT_MAKE_MODEL(ROT_M2, 1)
|
#define ROT_MODEL_RC2800 ROT_MAKE_MODEL(ROT_M2, 1)
|
||||||
#define ROT_MODEL_RC2800AZ ROT_MAKE_MODEL(ROT_M2, 2)
|
#define ROT_MODEL_RC2800_EARLY_AZ ROT_MAKE_MODEL(ROT_M2, 2)
|
||||||
|
#define ROT_MODEL_RC2800_EARLY_AZEL ROT_MAKE_MODEL(ROT_M2, 3)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
|
|
||||||
#define CR "\r"
|
#define CR "\r"
|
||||||
#define LF "\x0a"
|
#define LF "\x0a"
|
||||||
#define LFCR "\x0a\r"
|
|
||||||
|
|
||||||
#define BUFSZ 128
|
#define BUFSZ 128
|
||||||
|
|
||||||
|
@ -248,21 +247,45 @@ rc2800_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);
|
||||||
|
|
||||||
num_sprintf(cmdstr, "A%3.0f"LFCR, az);
|
if (rot->caps->rot_model == ROT_MODEL_RC2800_EARLY_AZ)
|
||||||
|
{
|
||||||
|
// we only do azimuth and this is the old protocol
|
||||||
|
// we have to switch modes and then send azimuth
|
||||||
|
// an extra CR gives us a response to expect
|
||||||
|
num_sprintf(cmdstr, "A\r%.0f\r\r", az);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// does the new protocol use decimal points?
|
||||||
|
// we'll assume no for now
|
||||||
|
num_sprintf(cmdstr, "A%0f"CR, az);
|
||||||
|
}
|
||||||
retval1 = rc2800_transaction(rot, cmdstr, NULL, 0);
|
retval1 = rc2800_transaction(rot, cmdstr, NULL, 0);
|
||||||
|
|
||||||
if (rot->caps->rot_model == ROT_MODEL_RC2800)
|
if (rot->caps->rot_type == ROT_TYPE_AZIMUTH)
|
||||||
{
|
{
|
||||||
/* do not overwhelm the MCU? */
|
return retval1;
|
||||||
hl_usleep(200 * 1000);
|
}
|
||||||
|
|
||||||
num_sprintf(cmdstr, "E%3.0f"LFCR, el);
|
/* do not overwhelm the MCU? */
|
||||||
retval2 = rc2800_transaction(rot, cmdstr, NULL, 0);
|
hl_usleep(200 * 1000);
|
||||||
|
|
||||||
if (retval1 == retval2)
|
if (rot->caps->rot_model == ROT_MODEL_RC2800_EARLY_AZEL)
|
||||||
{
|
{
|
||||||
return retval1;
|
// this is the old protocol
|
||||||
}
|
// we have to switch modes and then send azimuth
|
||||||
|
// an extra CR gives us a response to expect
|
||||||
|
num_sprintf(cmdstr, "E\r%.0f\r\r", el);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
num_sprintf(cmdstr, "E%.0f"CR, el);
|
||||||
|
}
|
||||||
|
retval2 = rc2800_transaction(rot, cmdstr, NULL, 0);
|
||||||
|
|
||||||
|
if (retval1 == retval2)
|
||||||
|
{
|
||||||
|
return retval1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (retval1 != RIG_OK ? retval1 : retval2);
|
return (retval1 != RIG_OK ? retval1 : retval2);
|
||||||
|
@ -278,6 +301,8 @@ rc2800_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__);
|
||||||
|
|
||||||
|
*el = 0;
|
||||||
|
|
||||||
retval = rc2800_transaction(rot, "A" CR, posbuf, sizeof(posbuf));
|
retval = rc2800_transaction(rot, "A" CR, posbuf, sizeof(posbuf));
|
||||||
|
|
||||||
if (retval != RIG_OK || strlen(posbuf) < 5)
|
if (retval != RIG_OK || strlen(posbuf) < 5)
|
||||||
|
@ -349,6 +374,11 @@ rc2800_rot_stop(ROT *rot)
|
||||||
|
|
||||||
if (retval != RIG_OK) { rig_debug(RIG_DEBUG_VERBOSE, "%s: az S command failed?\n", __func__); }
|
if (retval != RIG_OK) { rig_debug(RIG_DEBUG_VERBOSE, "%s: az S command failed?\n", __func__); }
|
||||||
|
|
||||||
|
if (rot->caps->rot_type == ROT_TYPE_AZIMUTH)
|
||||||
|
{
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
/* do not overwhelm the MCU? */
|
/* do not overwhelm the MCU? */
|
||||||
hl_usleep(200 * 1000);
|
hl_usleep(200 * 1000);
|
||||||
|
|
||||||
|
@ -383,7 +413,7 @@ const struct rot_caps rc2800_rot_caps =
|
||||||
.mfg_name = "M2",
|
.mfg_name = "M2",
|
||||||
.version = "20201130",
|
.version = "20201130",
|
||||||
.copyright = "LGPL",
|
.copyright = "LGPL",
|
||||||
.status = RIG_STATUS_STABLE,
|
.status = RIG_STATUS_BETA,
|
||||||
.rot_type = ROT_TYPE_AZEL,
|
.rot_type = ROT_TYPE_AZEL,
|
||||||
.port_type = RIG_PORT_SERIAL,
|
.port_type = RIG_PORT_SERIAL,
|
||||||
.serial_rate_min = 9600,
|
.serial_rate_min = 9600,
|
||||||
|
@ -407,10 +437,11 @@ const struct rot_caps rc2800_rot_caps =
|
||||||
.stop = rc2800_rot_stop,
|
.stop = rc2800_rot_stop,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// below tested on RC2800P-A
|
||||||
const struct rot_caps rc2800az_rot_caps =
|
const struct rot_caps rc2800az_rot_caps =
|
||||||
{
|
{
|
||||||
ROT_MODEL(ROT_MODEL_RC2800AZ),
|
ROT_MODEL(ROT_MODEL_RC2800_EARLY_AZ),
|
||||||
.model_name = "RC2800AZ",
|
.model_name = "RC2800_EARLY_AZ",
|
||||||
.mfg_name = "M2",
|
.mfg_name = "M2",
|
||||||
.version = "20201130",
|
.version = "20201130",
|
||||||
.copyright = "LGPL",
|
.copyright = "LGPL",
|
||||||
|
@ -438,6 +469,37 @@ const struct rot_caps rc2800az_rot_caps =
|
||||||
.stop = rc2800_rot_stop,
|
.stop = rc2800_rot_stop,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const struct rot_caps rc2800azel_rot_caps =
|
||||||
|
{
|
||||||
|
ROT_MODEL(ROT_MODEL_RC2800_EARLY_AZEL),
|
||||||
|
.model_name = "RC2800_EARLY_AZEL",
|
||||||
|
.mfg_name = "M2",
|
||||||
|
.version = "20201130",
|
||||||
|
.copyright = "LGPL",
|
||||||
|
.status = RIG_STATUS_STABLE,
|
||||||
|
.rot_type = ROT_TYPE_AZEL,
|
||||||
|
.port_type = RIG_PORT_SERIAL,
|
||||||
|
.serial_rate_min = 9600,
|
||||||
|
.serial_rate_max = 9600,
|
||||||
|
.serial_data_bits = 8,
|
||||||
|
.serial_stop_bits = 1,
|
||||||
|
.serial_parity = RIG_PARITY_NONE,
|
||||||
|
.serial_handshake = RIG_HANDSHAKE_NONE,
|
||||||
|
.write_delay = 0,
|
||||||
|
.post_write_delay = 0,
|
||||||
|
.timeout = 1000,
|
||||||
|
.retry = 3,
|
||||||
|
|
||||||
|
.min_az = 0.0,
|
||||||
|
.max_az = 360.0,
|
||||||
|
.min_el = 0.0,
|
||||||
|
.max_el = 180.0,
|
||||||
|
|
||||||
|
.get_position = rc2800_rot_get_position,
|
||||||
|
.set_position = rc2800_rot_set_position,
|
||||||
|
.stop = rc2800_rot_stop,
|
||||||
|
};
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
||||||
DECLARE_INITROT_BACKEND(m2)
|
DECLARE_INITROT_BACKEND(m2)
|
||||||
|
@ -446,6 +508,7 @@ DECLARE_INITROT_BACKEND(m2)
|
||||||
|
|
||||||
rot_register(&rc2800_rot_caps);
|
rot_register(&rc2800_rot_caps);
|
||||||
rot_register(&rc2800az_rot_caps);
|
rot_register(&rc2800az_rot_caps);
|
||||||
|
rot_register(&rc2800azel_rot_caps);
|
||||||
|
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue