Allow 2nd rotator port for RT-21 Az/El model

https://github.com/Hamlib/Hamlib/issues/747
pull/759/head
Mike Black W9MDB 2021-08-01 12:14:17 -05:00
rodzic 592ca86fc6
commit 046f3c448d
1 zmienionych plików z 35 dodań i 1 usunięć

Wyświetl plik

@ -90,6 +90,7 @@ struct rotorez_rot_priv_data
*/
static int rotorez_send_priv_cmd(ROT *rot, const char *cmd);
static int rotorez_send_priv_cmd2(ROT *rot, const char *cmd);
static int rotorez_flush_buffer(ROT *rot);
/*
@ -309,7 +310,7 @@ const struct rot_caps rt21_rot_caps =
ROT_MODEL(ROT_MODEL_RT21),
.model_name = "RT-21",
.mfg_name = "Green Heron",
.version = "20210723.0",
.version = "20210801.0",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rot_type = ROT_TYPE_OTHER,
@ -488,6 +489,15 @@ static int rt21_rot_set_position(ROT *rot, azimuth_t azimuth,
return err;
}
if (rot->state.rotport2.pathname[0] != 0)
sprintf(cmdstr, "AP1%05.1f\r;", elevation); /* Total field width of 5 chars */
err = rotorez_send_priv_cmd2(rot, cmdstr);
if (err != RIG_OK)
{
return err;
}
return RIG_OK;
}
@ -1003,6 +1013,30 @@ static int rotorez_send_priv_cmd(ROT *rot, const char *cmdstr)
return RIG_OK;
}
// send command to 2nd rotator port
static int rotorez_send_priv_cmd2(ROT *rot, const char *cmdstr)
{
struct rot_state *rs;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!rot)
{
return -RIG_EINVAL;
}
rs = &rot->state;
err = write_block(&rs->rotport2, cmdstr, strlen(cmdstr));
if (err != RIG_OK)
{
return err;
}
return RIG_OK;
}
/*
* Flush the serial input buffer