kopia lustrzana https://github.com/Hamlib/Hamlib
Merge pull request #1680 from gereta/patch-2
Update skywatcher.c - park rotator, improved rotator movementHamlib-4.6.2
commit
c5d4baef53
|
@ -58,9 +58,10 @@ static int skywatcher_cmd(ROT *rot, const char *cmd, char *response,
|
||||||
rig_flush(port);
|
rig_flush(port);
|
||||||
size_t cmd_len = strlen(cmd);
|
size_t cmd_len = strlen(cmd);
|
||||||
ERROR_CHECK(write_block(port, (unsigned char *) cmd, cmd_len));
|
ERROR_CHECK(write_block(port, (unsigned char *) cmd, cmd_len));
|
||||||
// echo from the device
|
|
||||||
int code = read_string(port, (unsigned char *) response, response_len, "\r", 1,
|
// the actual response
|
||||||
0, 1);
|
int code = read_string(port, (unsigned char *) response, response_len, "\r", 1, 0,
|
||||||
|
1);
|
||||||
|
|
||||||
if (code < 0)
|
if (code < 0)
|
||||||
{
|
{
|
||||||
|
@ -212,7 +213,19 @@ int skywatcher_set_motor_position(ROT *rot, int motor_index, float angle)
|
||||||
|
|
||||||
if (!stopped)
|
if (!stopped)
|
||||||
{
|
{
|
||||||
return RIG_EPROTO;
|
// ignore instructions to move the motor as long as it is moving
|
||||||
|
rig_debug(RIG_DEBUG_TRACE, "%s called: motor:%d angle:%f but the motor is moving - ignoring \n", __func__, motor_index, angle);
|
||||||
|
// pretend it's OK
|
||||||
|
return RIG_OK;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Changed behavior for incoming requests to change position.
|
||||||
|
If the motor is moving, the requests are silently ignored.
|
||||||
|
Stopping the motor movement before each request to change position caused the movement from point A to point B to take a very long time
|
||||||
|
because tracking applications send the dynamic position of the tracked object (e.g. satellite) in regular short intervals and in case
|
||||||
|
the rotator was on the opposite side, by the time the rotator reached the position of the object,
|
||||||
|
the object had traveled a considerable distance. gereta @ 10.Mar.2025
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
SNPRINTF(req, sizeof(req), ":G%d00\r", motor_index);
|
SNPRINTF(req, sizeof(req), ":G%d00\r", motor_index);
|
||||||
|
@ -234,9 +247,7 @@ int skywatcher_set_motor_position(ROT *rot, int motor_index, float angle)
|
||||||
static int skywatcher_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
static int skywatcher_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);
|
||||||
ERROR_CHECK(skywatcher_stop(rot));
|
|
||||||
// stop is called for 1 then for 2 motor. do motor position in reverse because it awaits "stop motor" state.
|
|
||||||
// potentially saving 1 call to :f
|
|
||||||
ERROR_CHECK(skywatcher_set_motor_position(rot, 2, el));
|
ERROR_CHECK(skywatcher_set_motor_position(rot, 2, el));
|
||||||
ERROR_CHECK(skywatcher_set_motor_position(rot, 1, az));
|
ERROR_CHECK(skywatcher_set_motor_position(rot, 1, az));
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
|
@ -270,6 +281,16 @@ static int skywatcher_cleanup(ROT *rot)
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int skywatcher_park(ROT *rot)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_TRACE, "%s called: %d %d\n", __func__, 0, 0);
|
||||||
|
|
||||||
|
ERROR_CHECK(skywatcher_set_motor_position(rot, 1, 0));
|
||||||
|
ERROR_CHECK(skywatcher_set_motor_position(rot, 2, 0));
|
||||||
|
|
||||||
|
return RIG_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
/*
|
/*
|
||||||
* Protocol documentation:
|
* Protocol documentation:
|
||||||
|
@ -280,7 +301,7 @@ const struct rot_caps skywatcher_rot_caps =
|
||||||
ROT_MODEL(ROT_MODEL_SKYWATCHER),
|
ROT_MODEL(ROT_MODEL_SKYWATCHER),
|
||||||
.model_name = "Sky-Watcher",
|
.model_name = "Sky-Watcher",
|
||||||
.mfg_name = "Sky-Watcher",
|
.mfg_name = "Sky-Watcher",
|
||||||
.version = "20240825.0",
|
.version = "20250310.0",
|
||||||
.copyright = "LGPL",
|
.copyright = "LGPL",
|
||||||
.status = RIG_STATUS_STABLE,
|
.status = RIG_STATUS_STABLE,
|
||||||
.rot_type = ROT_TYPE_AZEL,
|
.rot_type = ROT_TYPE_AZEL,
|
||||||
|
@ -307,6 +328,7 @@ const struct rot_caps skywatcher_rot_caps =
|
||||||
.set_position = skywatcher_set_position,
|
.set_position = skywatcher_set_position,
|
||||||
.stop = skywatcher_stop,
|
.stop = skywatcher_stop,
|
||||||
.get_info = skywatcher_get_info,
|
.get_info = skywatcher_get_info,
|
||||||
|
.park = skywatcher_park,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue