kopia lustrzana https://github.com/Hamlib/Hamlib
rodzic
28237deeb0
commit
eaeb367af9
|
@ -1963,7 +1963,7 @@ static int flrig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: val.i='%s'(%d)\n", __func__, value, val->i);
|
||||
|
||||
case RIG_LEVEL_RFPOWER_METER:
|
||||
val->f = atof(value)/100.0;
|
||||
val->f = atof(value) / 100.0;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: val.f='%s'(%g)\n", __func__, value, val->f);
|
||||
break;
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ static int dummy_rot_init(ROT *rot)
|
|||
static int dummy_rot_cleanup(ROT *rot)
|
||||
{
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)
|
||||
rot->state.priv;
|
||||
rot->state.priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
@ -261,7 +261,7 @@ static int dummy_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
|||
|
||||
static void dummy_rot_simulate_rotation(ROT *rot)
|
||||
{
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)
|
||||
rot->state.priv;
|
||||
struct timeval tv;
|
||||
unsigned elapsed; /* ms */
|
||||
|
@ -280,7 +280,8 @@ static void dummy_rot_simulate_rotation(ROT *rot)
|
|||
{
|
||||
/* target reached */
|
||||
priv->az = priv->target_az;
|
||||
priv->status &= ~(ROT_STATUS_MOVING_AZ | ROT_STATUS_MOVING_LEFT | ROT_STATUS_MOVING_RIGHT);
|
||||
priv->status &= ~(ROT_STATUS_MOVING_AZ | ROT_STATUS_MOVING_LEFT |
|
||||
ROT_STATUS_MOVING_RIGHT);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -300,7 +301,8 @@ static void dummy_rot_simulate_rotation(ROT *rot)
|
|||
{
|
||||
/* target reached */
|
||||
priv->el = priv->target_el;
|
||||
priv->status &= ~(ROT_STATUS_MOVING_EL | ROT_STATUS_MOVING_UP | ROT_STATUS_MOVING_DOWN);
|
||||
priv->status &= ~(ROT_STATUS_MOVING_EL | ROT_STATUS_MOVING_UP |
|
||||
ROT_STATUS_MOVING_DOWN);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -316,9 +318,12 @@ static void dummy_rot_simulate_rotation(ROT *rot)
|
|||
}
|
||||
}
|
||||
|
||||
if (priv->status & (ROT_STATUS_MOVING_AZ | ROT_STATUS_MOVING_EL)) {
|
||||
if (priv->status & (ROT_STATUS_MOVING_AZ | ROT_STATUS_MOVING_EL))
|
||||
{
|
||||
priv->status |= ROT_STATUS_MOVING;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->status &= ~(ROT_STATUS_MOVING);
|
||||
}
|
||||
|
||||
|
@ -427,7 +432,8 @@ static const char *dummy_rot_get_info(ROT *rot)
|
|||
|
||||
static int dummy_set_func(ROT *rot, setting_t func, int status)
|
||||
{
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv;
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)
|
||||
rot->state.priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s %d\n", __func__,
|
||||
rot_strfunc(func), status);
|
||||
|
@ -447,7 +453,8 @@ static int dummy_set_func(ROT *rot, setting_t func, int status)
|
|||
|
||||
static int dummy_get_func(ROT *rot, setting_t func, int *status)
|
||||
{
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv;
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)
|
||||
rot->state.priv;
|
||||
|
||||
*status = (priv->funcs & func) ? 1 : 0;
|
||||
|
||||
|
@ -460,7 +467,8 @@ static int dummy_get_func(ROT *rot, setting_t func, int *status)
|
|||
|
||||
static int dummy_set_level(ROT *rot, setting_t level, value_t val)
|
||||
{
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv;
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)
|
||||
rot->state.priv;
|
||||
int idx;
|
||||
char lstr[32];
|
||||
|
||||
|
@ -491,7 +499,8 @@ static int dummy_set_level(ROT *rot, setting_t level, value_t val)
|
|||
|
||||
static int dummy_get_level(ROT *rot, setting_t level, value_t *val)
|
||||
{
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv;
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)
|
||||
rot->state.priv;
|
||||
int idx;
|
||||
|
||||
idx = rig_setting2idx(level);
|
||||
|
@ -511,7 +520,8 @@ static int dummy_get_level(ROT *rot, setting_t level, value_t *val)
|
|||
|
||||
static int dummy_set_ext_level(ROT *rot, token_t token, value_t val)
|
||||
{
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv;
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)
|
||||
rot->state.priv;
|
||||
char lstr[64];
|
||||
const struct confparams *cfp;
|
||||
struct ext_list *elp;
|
||||
|
@ -579,7 +589,8 @@ static int dummy_set_ext_level(ROT *rot, token_t token, value_t val)
|
|||
|
||||
static int dummy_get_ext_level(ROT *rot, token_t token, value_t *val)
|
||||
{
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv;
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)
|
||||
rot->state.priv;
|
||||
const struct confparams *cfp;
|
||||
struct ext_list *elp;
|
||||
|
||||
|
@ -621,7 +632,8 @@ static int dummy_get_ext_level(ROT *rot, token_t token, value_t *val)
|
|||
|
||||
static int dummy_set_ext_func(ROT *rot, token_t token, int status)
|
||||
{
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv;
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)
|
||||
rot->state.priv;
|
||||
const struct confparams *cfp;
|
||||
struct ext_list *elp;
|
||||
|
||||
|
@ -672,7 +684,8 @@ static int dummy_set_ext_func(ROT *rot, token_t token, int status)
|
|||
|
||||
static int dummy_get_ext_func(ROT *rot, token_t token, int *status)
|
||||
{
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv;
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)
|
||||
rot->state.priv;
|
||||
const struct confparams *cfp;
|
||||
struct ext_list *elp;
|
||||
|
||||
|
@ -711,7 +724,8 @@ static int dummy_get_ext_func(ROT *rot, token_t token, int *status)
|
|||
|
||||
static int dummy_set_parm(ROT *rot, setting_t parm, value_t val)
|
||||
{
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv;
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)
|
||||
rot->state.priv;
|
||||
int idx;
|
||||
char pstr[32];
|
||||
|
||||
|
@ -742,7 +756,8 @@ static int dummy_set_parm(ROT *rot, setting_t parm, value_t val)
|
|||
|
||||
static int dummy_get_parm(ROT *rot, setting_t parm, value_t *val)
|
||||
{
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv;
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)
|
||||
rot->state.priv;
|
||||
int idx;
|
||||
|
||||
idx = rig_setting2idx(parm);
|
||||
|
@ -762,7 +777,8 @@ static int dummy_get_parm(ROT *rot, setting_t parm, value_t *val)
|
|||
|
||||
static int dummy_set_ext_parm(ROT *rot, token_t token, value_t val)
|
||||
{
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv;
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)
|
||||
rot->state.priv;
|
||||
char lstr[64];
|
||||
const struct confparams *cfp;
|
||||
struct ext_list *epp;
|
||||
|
@ -827,7 +843,8 @@ static int dummy_set_ext_parm(ROT *rot, token_t token, value_t val)
|
|||
|
||||
static int dummy_get_ext_parm(ROT *rot, token_t token, value_t *val)
|
||||
{
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv;
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)
|
||||
rot->state.priv;
|
||||
const struct confparams *cfp;
|
||||
struct ext_list *epp;
|
||||
|
||||
|
@ -866,7 +883,8 @@ static int dummy_get_ext_parm(ROT *rot, token_t token, value_t *val)
|
|||
|
||||
static int dummy_rot_get_status(ROT *rot, rot_status_t *status)
|
||||
{
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv;
|
||||
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)
|
||||
rot->state.priv;
|
||||
|
||||
dummy_rot_simulate_rotation(rot);
|
||||
|
||||
|
|
|
@ -490,6 +490,7 @@ int rig2icom_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width,
|
|||
icmode_ext = PD_WIDE_3; /* default to Wide */
|
||||
}
|
||||
}
|
||||
|
||||
*pd = icmode_ext;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1604,7 +1604,8 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode,
|
|||
break;
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s mode=%d, width=%d\n", __func__, (int)icom_mode, (int)width);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s mode=%d, width=%d\n", __func__, (int)icom_mode,
|
||||
(int)width);
|
||||
retval = icom_set_mode(rig, vfo, icom_mode, width);
|
||||
|
||||
if (RIG_OK == retval)
|
||||
|
@ -1627,6 +1628,7 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode,
|
|||
datamode[0] = 0x00;
|
||||
break;
|
||||
}
|
||||
|
||||
if (width != RIG_PASSBAND_NOCHANGE)
|
||||
{
|
||||
if (filter_byte) // then we need the width byte too
|
||||
|
@ -1704,7 +1706,8 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
{
|
||||
err = rig2icom_mode(rig, vfo, mode, width, &icmode, &icmode_ext);
|
||||
}
|
||||
if (width == RIG_PASSBAND_NOCHANGE) icmode_ext = priv_data->filter;
|
||||
|
||||
if (width == RIG_PASSBAND_NOCHANGE) { icmode_ext = priv_data->filter; }
|
||||
|
||||
if (err < 0)
|
||||
{
|
||||
|
@ -1712,7 +1715,9 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
return err;
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: icmode=%d, icmode_ext=%d\n", __func__, icmode, icmode_ext);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: icmode=%d, icmode_ext=%d\n", __func__, icmode,
|
||||
icmode_ext);
|
||||
|
||||
/* IC-731, IC-735, IC-7000 don't support passband data */
|
||||
/* IC-726 & IC-475A/E also limited support - only on CW */
|
||||
/* TODO: G4WJS CW wide/narrow are possible with above two radios */
|
||||
|
@ -1724,7 +1729,8 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
icmode_ext = -1;
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: #2 icmode=%d, icmode_ext=%d\n", __func__, icmode, icmode_ext);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: #2 icmode=%d, icmode_ext=%d\n", __func__,
|
||||
icmode, icmode_ext);
|
||||
retval = icom_transaction(rig, C_SET_MODE, icmode,
|
||||
(unsigned char *) &icmode_ext,
|
||||
(icmode_ext == -1 ? 0 : 1), ackbuf, &ack_len);
|
||||
|
@ -1775,6 +1781,7 @@ int icom_get_mode_with_data(RIG *rig, vfo_t vfo, rmode_t *mode,
|
|||
retval = icom_get_mode(rig, vfo, mode, width);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s mode=%d\n", __func__, (int)*mode);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
|
@ -1820,7 +1827,9 @@ int icom_get_mode_with_data(RIG *rig, vfo_t vfo, rmode_t *mode,
|
|||
return -RIG_ERJCTED;
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s databuf[2]=%d, mode=%d\n", __func__, (int)databuf[2], (int)*mode);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s databuf[2]=%d, mode=%d\n", __func__,
|
||||
(int)databuf[2], (int)*mode);
|
||||
|
||||
if (databuf[2]) /* 0x01/0x02/0x03 -> data mode, 0x00 -> not data mode */
|
||||
{
|
||||
switch (*mode)
|
||||
|
@ -3084,16 +3093,17 @@ int icom_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
break;
|
||||
|
||||
case RIG_LEVEL_RFPOWER_METER_WATTS:
|
||||
|
||||
// eventually we should change all the Icom tables to watts
|
||||
if (rig->caps->rfpower_meter_cal.size == 0)
|
||||
{
|
||||
val->f =
|
||||
rig_raw2val_float(icom_val, &icom_default_rfpower_meter_cal)*100;
|
||||
rig_raw2val_float(icom_val, &icom_default_rfpower_meter_cal) * 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
val->f =
|
||||
rig_raw2val_float(icom_val, &rig->caps->rfpower_meter_cal)*100;
|
||||
rig_raw2val_float(icom_val, &rig->caps->rfpower_meter_cal) * 100;
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -774,10 +774,13 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
case RIG_LEVEL_RFPOWER_METER:
|
||||
case RIG_LEVEL_RFPOWER_METER_WATTS:
|
||||
flex6k_get_ptt(rig, vfo, &ptt);
|
||||
if (!ptt) {
|
||||
|
||||
if (!ptt)
|
||||
{
|
||||
val->f = 0;
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
cmd = "ZZRM5";
|
||||
len = 5;
|
||||
ans = 3;
|
||||
|
@ -844,6 +847,7 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
case RIG_LEVEL_RFPOWER_METER:
|
||||
case RIG_LEVEL_RFPOWER_METER_WATTS:
|
||||
n = sscanf(lvlbuf, "ZZRM%f", &val->f);
|
||||
|
||||
if (n != 1)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Error parsing value from lvlbuf='%s'\n",
|
||||
|
@ -851,10 +855,12 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
val->f = 0;
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
|
||||
if (level != RIG_LEVEL_RFPOWER_METER_WATTS)
|
||||
{
|
||||
val->f /= 100;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RIG_LEVEL_RF:
|
||||
|
|
|
@ -1864,10 +1864,12 @@ int k3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
}
|
||||
|
||||
val->f = pwr;
|
||||
|
||||
if (level == RIG_LEVEL_RFPOWER_METER_WATTS)
|
||||
{
|
||||
val->f *= 100;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -2398,8 +2398,11 @@ int kenwood_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
|
||||
// https://github.com/Hamlib/Hamlib/issues/465
|
||||
kenwood_val = val.f * power_max;
|
||||
if (kenwood_val < power_min) kenwood_val = power_min;
|
||||
if (kenwood_val > power_max) kenwood_val = power_max;
|
||||
|
||||
if (kenwood_val < power_min) { kenwood_val = power_min; }
|
||||
|
||||
if (kenwood_val > power_max) { kenwood_val = power_max; }
|
||||
|
||||
snprintf(levelbuf, sizeof(levelbuf), "PC%03d", kenwood_val);
|
||||
break;
|
||||
}
|
||||
|
@ -3888,8 +3891,8 @@ int kenwood_set_powerstat(RIG *rig, powerstat_t status)
|
|||
sleep(1);
|
||||
retval = rig_get_freq(rig, RIG_VFO_A, &freq);
|
||||
|
||||
if (retval == RIG_OK)
|
||||
{
|
||||
if (retval == RIG_OK)
|
||||
{
|
||||
rig->state.rigport.retry = retry_save;
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -185,12 +185,12 @@ const struct rig_caps ft2000_caps =
|
|||
|
||||
/* mode/filter list, .remember = order matters! */
|
||||
.filters = {
|
||||
{RIG_MODE_CW|RIG_MODE_CWR, Hz(500)}, /* Normal CW, RTTY, PKT/USER */
|
||||
{RIG_MODE_CW|RIG_MODE_CWR, Hz(200)}, /* Narrow CW, RTTY, PKT/USER */
|
||||
{RIG_MODE_CW|RIG_MODE_CWR, Hz(2400)}, /* Wide CW, RTTY, PKT/USER */
|
||||
{RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(500)}, /* Normal RTTY */
|
||||
{RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(300)}, /* Narrow RTTY */
|
||||
{RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(2400)}, /* Wide RTTY */
|
||||
{RIG_MODE_CW | RIG_MODE_CWR, Hz(500)}, /* Normal CW, RTTY, PKT/USER */
|
||||
{RIG_MODE_CW | RIG_MODE_CWR, Hz(200)}, /* Narrow CW, RTTY, PKT/USER */
|
||||
{RIG_MODE_CW | RIG_MODE_CWR, Hz(2400)}, /* Wide CW, RTTY, PKT/USER */
|
||||
{RIG_MODE_RTTY | RIG_MODE_RTTYR, Hz(500)}, /* Normal RTTY */
|
||||
{RIG_MODE_RTTY | RIG_MODE_RTTYR, Hz(300)}, /* Narrow RTTY */
|
||||
{RIG_MODE_RTTY | RIG_MODE_RTTYR, Hz(2400)}, /* Wide RTTY */
|
||||
{RIG_MODE_SSB, Hz(2400)}, /* Normal SSB */
|
||||
{RIG_MODE_SSB, Hz(1800)}, /* Narrow SSB */
|
||||
{RIG_MODE_SSB, Hz(3000)}, /* Wide SSB */
|
||||
|
|
|
@ -534,11 +534,14 @@ int newcat_open(RIG *rig)
|
|||
(void)newcat_get_rigid(rig);
|
||||
|
||||
if (priv->rig_id == NC_RIGID_FT2000)
|
||||
{ // then we need to readjust rfpowermeter cal table in half
|
||||
{
|
||||
// then we need to readjust rfpowermeter cal table in half
|
||||
int i;
|
||||
for(i=0;i<rig->caps->rfpower_meter_cal.size; ++i)
|
||||
{ // we may need a table for the FT2000 instead of this
|
||||
rig->caps->rfpower_meter_cal.table[i].raw/=2;
|
||||
|
||||
for (i = 0; i < rig->caps->rfpower_meter_cal.size; ++i)
|
||||
{
|
||||
// we may need a table for the FT2000 instead of this
|
||||
rig->caps->rfpower_meter_cal.table[i].raw /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2884,7 +2887,7 @@ int newcat_set_powerstat(RIG *rig, powerstat_t status)
|
|||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "PS%c%c", ps, cat_term);
|
||||
|
||||
retval = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str));
|
||||
|
||||
|
||||
retry_save = rig->state.rigport.retry;
|
||||
rig->state.rigport.retry = 0;
|
||||
|
||||
|
@ -2896,10 +2899,11 @@ int newcat_set_powerstat(RIG *rig, powerstat_t status)
|
|||
hl_usleep(1000000);
|
||||
retval = rig_get_freq(rig, RIG_VFO_A, &freq);
|
||||
|
||||
if (retval == RIG_OK) {
|
||||
if (retval == RIG_OK)
|
||||
{
|
||||
rig->state.rigport.retry = retry_save;
|
||||
return retval;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: Wait #%d for power up\n", __func__, i + 1);
|
||||
}
|
||||
|
@ -4182,6 +4186,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
{
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM5%c", cat_term);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RIG_LEVEL_COMP_METER:
|
||||
|
@ -4383,26 +4388,36 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
case RIG_LEVEL_RFPOWER_METER:
|
||||
case RIG_LEVEL_RFPOWER_METER_WATTS:
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: RFPOWER_METER retlvl=%s\n", __func__, retlvl);
|
||||
|
||||
if (retlvl_len > 3)
|
||||
{
|
||||
// Some rigs like FTDX101 have 6-byte return so we just truncate
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: retlvl of %s getting truncated\n", __func__, retlvl);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: retlvl of %s getting truncated\n", __func__,
|
||||
retlvl);
|
||||
retlvl[3] = 0;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: retlvl truncated to %s\n", __func__, retlvl);
|
||||
}
|
||||
|
||||
if (rig->caps->rfpower_meter_cal.size == 0)
|
||||
{
|
||||
val->f = rig_raw2val_float(atoi(retlvl), &yaesu_default_rfpower_meter_cal)/(level == RIG_LEVEL_RFPOWER_METER_WATTS?1.0:100.0);
|
||||
val->f = rig_raw2val_float(atoi(retlvl),
|
||||
&yaesu_default_rfpower_meter_cal) / (level == RIG_LEVEL_RFPOWER_METER_WATTS ?
|
||||
1.0 : 100.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
val->f = rig_raw2val_float(atoi(retlvl), &rig->caps->rfpower_meter_cal)/(level == RIG_LEVEL_RFPOWER_METER_WATTS?1.0:100.0);
|
||||
val->f = rig_raw2val_float(atoi(retlvl),
|
||||
&rig->caps->rfpower_meter_cal) / (level == RIG_LEVEL_RFPOWER_METER_WATTS ? 1.0 :
|
||||
100.0);
|
||||
}
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: RFPOWER_METER=%s, converted to %f\n", __func__, retlvl, val->f);
|
||||
if (level == RIG_LEVEL_RFPOWER_METER && val->f > 1.0)
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: RFPOWER_METER=%s, converted to %f\n",
|
||||
__func__, retlvl, val->f);
|
||||
|
||||
if (level == RIG_LEVEL_RFPOWER_METER && val->f > 1.0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: val->f(%f) clipped at 1.0\n", __func__, val->f);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: val->f(%f) clipped at 1.0\n", __func__,
|
||||
val->f);
|
||||
val->f = 1.0;
|
||||
}
|
||||
|
||||
|
@ -4417,11 +4432,11 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
|
||||
if (rig->caps->comp_meter_cal.size == 0)
|
||||
{
|
||||
val->f = rig_raw2val_float(atoi(retlvl), &yaesu_default_comp_meter_cal)/100;
|
||||
val->f = rig_raw2val_float(atoi(retlvl), &yaesu_default_comp_meter_cal) / 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
val->f = rig_raw2val_float(atoi(retlvl), &rig->caps->comp_meter_cal)/100;
|
||||
val->f = rig_raw2val_float(atoi(retlvl), &rig->caps->comp_meter_cal) / 100;
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -7656,11 +7671,14 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width)
|
|||
|
||||
|
||||
w = 0; // use default in case of error
|
||||
|
||||
if (strlen(priv->ret_data) == 7)
|
||||
{
|
||||
int on;
|
||||
int n = sscanf(priv->ret_data, "SH0%1d%3d", &on, &w);
|
||||
if (n == 2) {
|
||||
|
||||
if (n == 2)
|
||||
{
|
||||
if (!on) { w = 0; }
|
||||
}
|
||||
else
|
||||
|
@ -7671,14 +7689,15 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width)
|
|||
else if (strlen(priv->ret_data) == 6)
|
||||
{
|
||||
int n = sscanf(priv->ret_data, "SH%3d", &w);
|
||||
if (n != 1) err = -RIG_EPROTO;
|
||||
|
||||
if (n != 1) { err = -RIG_EPROTO; }
|
||||
}
|
||||
else
|
||||
{
|
||||
err = -RIG_EPROTO;
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: w=%d\n", __func__, w);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: w=%d\n", __func__, w);
|
||||
|
||||
if (err != RIG_OK)
|
||||
{
|
||||
|
@ -7878,7 +7897,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width)
|
|||
|
||||
case 17: *width = 3000; break;
|
||||
|
||||
default:
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unknown w=%d\n", __func__, w);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
@ -7933,7 +7952,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width)
|
|||
|
||||
case 21: *width = 3200; break;
|
||||
|
||||
default:
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unknown mode=%s\n", __func__, rig_strrmode(mode));
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
@ -8565,6 +8584,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width)
|
|||
{
|
||||
*width = 3000;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RIG_MODE_PKTUSB:
|
||||
|
@ -8581,6 +8601,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width)
|
|||
{
|
||||
*width = 2400;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RIG_MODE_RTTY:
|
||||
|
@ -8597,6 +8618,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width)
|
|||
{
|
||||
*width = 2400;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RIG_MODE_LSB:
|
||||
|
@ -8617,6 +8639,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width)
|
|||
{
|
||||
*width = 4000;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RIG_MODE_AM:
|
||||
|
@ -8665,6 +8688,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width)
|
|||
{
|
||||
*width = rig_passband_normal(rig, mode);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RIG_MODE_AM:
|
||||
|
@ -9074,7 +9098,7 @@ int newcat_get_cmd(RIG *rig)
|
|||
*/
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Command rejected by the rig: '%s'\n", __func__,
|
||||
priv->cmd_str);
|
||||
// return -RIG_ERJCTED;
|
||||
// return -RIG_ERJCTED;
|
||||
}
|
||||
|
||||
continue;
|
||||
|
|
|
@ -259,13 +259,16 @@ static int easycomm_rot_move_velocity(ROT *rot, int direction, int speed)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
||||
|
||||
if (speed == ROT_SPEED_NOCHANGE) {
|
||||
if (speed == ROT_SPEED_NOCHANGE)
|
||||
{
|
||||
easycomm_speed = rs->current_speed;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (speed < 1 || speed > 100)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Invalid speed value (1-100)! (%d)\n", __func__,
|
||||
speed);
|
||||
speed);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
|
@ -314,12 +317,14 @@ static int easycomm_rot_get_level(ROT *rot, setting_t level, value_t *val)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level));
|
||||
|
||||
switch (level) {
|
||||
case ROT_LEVEL_SPEED:
|
||||
val->i = rs->current_speed;
|
||||
break;
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
switch (level)
|
||||
{
|
||||
case ROT_LEVEL_SPEED:
|
||||
val->i = rs->current_speed;
|
||||
break;
|
||||
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
|
@ -332,20 +337,27 @@ static int easycomm_rot_set_level(ROT *rot, setting_t level, value_t val)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level));
|
||||
|
||||
switch (level) {
|
||||
case ROT_LEVEL_SPEED: {
|
||||
int speed = val.i;
|
||||
if (speed < 0) {
|
||||
speed = 0;
|
||||
} else if (speed > 9999) {
|
||||
speed = 9999;
|
||||
}
|
||||
switch (level)
|
||||
{
|
||||
case ROT_LEVEL_SPEED:
|
||||
{
|
||||
int speed = val.i;
|
||||
|
||||
rs->current_speed = speed;
|
||||
break;
|
||||
if (speed < 0)
|
||||
{
|
||||
speed = 0;
|
||||
}
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
else if (speed > 9999)
|
||||
{
|
||||
speed = 9999;
|
||||
}
|
||||
|
||||
rs->current_speed = speed;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
|
|
|
@ -274,12 +274,16 @@ static int ether_rot_move(ROT *rot, int direction, int speed)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
if (speed == ROT_SPEED_NOCHANGE) {
|
||||
if (speed == ROT_SPEED_NOCHANGE)
|
||||
{
|
||||
ether_speed = rs->current_speed;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (speed < 1 || speed > 100)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Invalid speed value (1-100)! (%d)\n", __func__, speed);
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Invalid speed value (1-100)! (%d)\n", __func__,
|
||||
speed);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
|
@ -315,12 +319,14 @@ static int ether_rot_get_level(ROT *rot, setting_t level, value_t *val)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level));
|
||||
|
||||
switch (level) {
|
||||
case ROT_LEVEL_SPEED:
|
||||
val->i = rs->current_speed;
|
||||
break;
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
switch (level)
|
||||
{
|
||||
case ROT_LEVEL_SPEED:
|
||||
val->i = rs->current_speed;
|
||||
break;
|
||||
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
|
@ -333,20 +339,27 @@ static int ether_rot_set_level(ROT *rot, setting_t level, value_t val)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level));
|
||||
|
||||
switch (level) {
|
||||
case ROT_LEVEL_SPEED: {
|
||||
int speed = val.i;
|
||||
if (speed < 1) {
|
||||
speed = 1;
|
||||
} else if (speed > 100) {
|
||||
speed = 100;
|
||||
}
|
||||
switch (level)
|
||||
{
|
||||
case ROT_LEVEL_SPEED:
|
||||
{
|
||||
int speed = val.i;
|
||||
|
||||
rs->current_speed = speed;
|
||||
break;
|
||||
if (speed < 1)
|
||||
{
|
||||
speed = 1;
|
||||
}
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
else if (speed > 100)
|
||||
{
|
||||
speed = 100;
|
||||
}
|
||||
|
||||
rs->current_speed = speed;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
|
|
|
@ -245,12 +245,14 @@ static int gs232a_rot_get_level(ROT *rot, setting_t level, value_t *val)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level));
|
||||
|
||||
switch (level) {
|
||||
case ROT_LEVEL_SPEED:
|
||||
val->i = rs->current_speed;
|
||||
break;
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
switch (level)
|
||||
{
|
||||
case ROT_LEVEL_SPEED:
|
||||
val->i = rs->current_speed;
|
||||
break;
|
||||
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
|
@ -265,28 +267,36 @@ static int gs232a_rot_set_level(ROT *rot, setting_t level, value_t val)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level));
|
||||
|
||||
switch (level) {
|
||||
case ROT_LEVEL_SPEED: {
|
||||
int speed = val.i;
|
||||
if (speed < 1) {
|
||||
speed = 1;
|
||||
} else if (speed > 4) {
|
||||
speed = 4;
|
||||
}
|
||||
switch (level)
|
||||
{
|
||||
case ROT_LEVEL_SPEED:
|
||||
{
|
||||
int speed = val.i;
|
||||
|
||||
/* between 1 (slowest) and 4 (fastest) */
|
||||
sprintf(cmdstr, "X%u" EOM, speed);
|
||||
retval = gs232a_transaction(rot, cmdstr, NULL, 0, 1);
|
||||
|
||||
if (retval != RIG_OK) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
rs->current_speed = speed;
|
||||
break;
|
||||
if (speed < 1)
|
||||
{
|
||||
speed = 1;
|
||||
}
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
else if (speed > 4)
|
||||
{
|
||||
speed = 4;
|
||||
}
|
||||
|
||||
/* between 1 (slowest) and 4 (fastest) */
|
||||
sprintf(cmdstr, "X%u" EOM, speed);
|
||||
retval = gs232a_transaction(rot, cmdstr, NULL, 0, 1);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
rs->current_speed = speed;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
|
@ -301,12 +311,14 @@ static int gs232a_rot_move(ROT *rot, int direction, int speed)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s called %d %d\n", __func__,
|
||||
direction, speed);
|
||||
|
||||
if (speed != ROT_SPEED_NOCHANGE) {
|
||||
if (speed != ROT_SPEED_NOCHANGE)
|
||||
{
|
||||
value_t gs232a_speed;
|
||||
|
||||
if (speed < 1 || speed > 100)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Invalid speed value (1-100)! (%d)\n", __func__, speed);
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Invalid speed value (1-100)! (%d)\n", __func__,
|
||||
speed);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ transaction_write:
|
|||
if (strncmp(data, "\r\n", 2) == 0 || strchr(data, '>'))
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Invalid response for '%s': '%s' (length=%d)\n",
|
||||
__func__, cmdstr, data, (int) strlen(data));
|
||||
__func__, cmdstr, data, (int) strlen(data));
|
||||
dump_hex((unsigned char *)data, strlen(data));
|
||||
retval = -RIG_EPROTO; // force retry
|
||||
}
|
||||
|
@ -274,12 +274,14 @@ static int gs232b_rot_get_level(ROT *rot, setting_t level, value_t *val)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level));
|
||||
|
||||
switch (level) {
|
||||
case ROT_LEVEL_SPEED:
|
||||
val->i = rs->current_speed;
|
||||
break;
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
switch (level)
|
||||
{
|
||||
case ROT_LEVEL_SPEED:
|
||||
val->i = rs->current_speed;
|
||||
break;
|
||||
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
|
@ -294,28 +296,36 @@ static int gs232b_rot_set_level(ROT *rot, setting_t level, value_t val)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level));
|
||||
|
||||
switch (level) {
|
||||
case ROT_LEVEL_SPEED: {
|
||||
int speed = val.i;
|
||||
if (speed < 1) {
|
||||
speed = 1;
|
||||
} else if (speed > 4) {
|
||||
speed = 4;
|
||||
}
|
||||
switch (level)
|
||||
{
|
||||
case ROT_LEVEL_SPEED:
|
||||
{
|
||||
int speed = val.i;
|
||||
|
||||
/* between 1 (slowest) and 4 (fastest) */
|
||||
sprintf(cmdstr, "X%u" EOM, speed);
|
||||
retval = gs232b_transaction(rot, cmdstr, NULL, 0, 1);
|
||||
|
||||
if (retval != RIG_OK) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
rs->current_speed = speed;
|
||||
break;
|
||||
if (speed < 1)
|
||||
{
|
||||
speed = 1;
|
||||
}
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
else if (speed > 4)
|
||||
{
|
||||
speed = 4;
|
||||
}
|
||||
|
||||
/* between 1 (slowest) and 4 (fastest) */
|
||||
sprintf(cmdstr, "X%u" EOM, speed);
|
||||
retval = gs232b_transaction(rot, cmdstr, NULL, 0, 1);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
rs->current_speed = speed;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
|
@ -330,12 +340,14 @@ static int gs232b_rot_move(ROT *rot, int direction, int speed)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s called %d %d\n", __func__,
|
||||
direction, speed);
|
||||
|
||||
if (speed != ROT_SPEED_NOCHANGE) {
|
||||
if (speed != ROT_SPEED_NOCHANGE)
|
||||
{
|
||||
value_t gs232b_speed;
|
||||
|
||||
if (speed < 1 || speed > 100)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Invalid speed value (1-100)! (%d)\n", __func__, speed);
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Invalid speed value (1-100)! (%d)\n", __func__,
|
||||
speed);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ transaction_quit:
|
|||
static int prosistel_rot_open(ROT *rot)
|
||||
{
|
||||
struct prosistel_rot_priv_caps *priv_caps =
|
||||
(struct prosistel_rot_priv_caps *) rot->caps->priv;
|
||||
(struct prosistel_rot_priv_caps *) rot->caps->priv;
|
||||
char cmdstr[64];
|
||||
int retval;
|
||||
|
||||
|
@ -144,10 +144,12 @@ static int prosistel_rot_open(ROT *rot)
|
|||
// The rotator controller sends position data continuously when CPM is enabled
|
||||
|
||||
// Disable CPM for azimuth if the rotator has an azimuth rotator
|
||||
if (rot->caps->rot_type == ROT_TYPE_AZIMUTH || rot->caps->rot_type == ROT_TYPE_AZEL)
|
||||
if (rot->caps->rot_type == ROT_TYPE_AZIMUTH
|
||||
|| rot->caps->rot_type == ROT_TYPE_AZEL)
|
||||
{
|
||||
num_sprintf(cmdstr, STX"%cS"CR, priv_caps->azimuth_id);
|
||||
retval = prosistel_transaction(rot, cmdstr, NULL, 0);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
|
@ -155,10 +157,12 @@ static int prosistel_rot_open(ROT *rot)
|
|||
}
|
||||
|
||||
// Disable CPM for elevation if the rotator has an elevation rotator
|
||||
if (rot->caps->rot_type == ROT_TYPE_ELEVATION || rot->caps->rot_type == ROT_TYPE_AZEL)
|
||||
if (rot->caps->rot_type == ROT_TYPE_ELEVATION
|
||||
|| rot->caps->rot_type == ROT_TYPE_AZEL)
|
||||
{
|
||||
num_sprintf(cmdstr, STX"%cS"CR, priv_caps->elevation_id);
|
||||
retval = prosistel_transaction(rot, cmdstr, NULL, 0);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
|
@ -172,7 +176,7 @@ static int prosistel_rot_open(ROT *rot)
|
|||
static int prosistel_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||
{
|
||||
struct prosistel_rot_priv_caps *priv_caps =
|
||||
(struct prosistel_rot_priv_caps *) rot->caps->priv;
|
||||
(struct prosistel_rot_priv_caps *) rot->caps->priv;
|
||||
char cmdstr[64];
|
||||
int retval;
|
||||
|
||||
|
@ -182,9 +186,11 @@ static int prosistel_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
|||
|
||||
// Set azimuth only if the rotator has the capability to do so
|
||||
// It is an error to set azimuth if it's not supported by the rotator controller
|
||||
if (rot->caps->rot_type == ROT_TYPE_AZIMUTH || rot->caps->rot_type == ROT_TYPE_AZEL)
|
||||
if (rot->caps->rot_type == ROT_TYPE_AZIMUTH
|
||||
|| rot->caps->rot_type == ROT_TYPE_AZEL)
|
||||
{
|
||||
num_sprintf(cmdstr, STX"%cG%.0f"CR, priv_caps->azimuth_id, az * priv_caps->angle_multiplier);
|
||||
num_sprintf(cmdstr, STX"%cG%.0f"CR, priv_caps->azimuth_id,
|
||||
az * priv_caps->angle_multiplier);
|
||||
retval = prosistel_transaction(rot, cmdstr, NULL, 0);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
|
@ -195,9 +201,11 @@ static int prosistel_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
|||
|
||||
// Set elevation only if the rotator has the capability to do so
|
||||
// It is an error to set elevation if it's not supported by the rotator controller
|
||||
if (rot->caps->rot_type == ROT_TYPE_ELEVATION || rot->caps->rot_type == ROT_TYPE_AZEL)
|
||||
if (rot->caps->rot_type == ROT_TYPE_ELEVATION
|
||||
|| rot->caps->rot_type == ROT_TYPE_AZEL)
|
||||
{
|
||||
num_sprintf(cmdstr, STX"%cG%.0f"CR, priv_caps->elevation_id, el * priv_caps->angle_multiplier);
|
||||
num_sprintf(cmdstr, STX"%cG%.0f"CR, priv_caps->elevation_id,
|
||||
el * priv_caps->angle_multiplier);
|
||||
retval = prosistel_transaction(rot, cmdstr, NULL, 0);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
|
@ -213,7 +221,7 @@ static int prosistel_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
|||
static int prosistel_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
||||
{
|
||||
struct prosistel_rot_priv_caps *priv_caps =
|
||||
(struct prosistel_rot_priv_caps *) rot->caps->priv;
|
||||
(struct prosistel_rot_priv_caps *) rot->caps->priv;
|
||||
char cmdstr[64];
|
||||
char data[20];
|
||||
float posval;
|
||||
|
@ -222,12 +230,14 @@ static int prosistel_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
|||
|
||||
// Query azimuth only if the rotator has the capability to do so
|
||||
// It is an error to query for azimuth if it's not supported by the rotator controller
|
||||
if (rot->caps->rot_type == ROT_TYPE_AZIMUTH || rot->caps->rot_type == ROT_TYPE_AZEL)
|
||||
if (rot->caps->rot_type == ROT_TYPE_AZIMUTH
|
||||
|| rot->caps->rot_type == ROT_TYPE_AZEL)
|
||||
{
|
||||
char rot_id;
|
||||
|
||||
num_sprintf(cmdstr, STX"%c?"CR, priv_caps->azimuth_id);
|
||||
retval = prosistel_transaction(rot, cmdstr, data, sizeof(data));
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
|
@ -248,7 +258,7 @@ static int prosistel_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
|||
posval /= priv_caps->angle_multiplier;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s got position from '%s' converted to %f\n",
|
||||
__func__, data, posval);
|
||||
__func__, data, posval);
|
||||
|
||||
*az = (azimuth_t) posval;
|
||||
}
|
||||
|
@ -259,12 +269,14 @@ static int prosistel_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
|||
|
||||
// Query elevation only if the rotator has the capability to do so
|
||||
// It is an error to query for elevation if it's not supported by the rotator controller
|
||||
if (rot->caps->rot_type == ROT_TYPE_ELEVATION || rot->caps->rot_type == ROT_TYPE_AZEL)
|
||||
if (rot->caps->rot_type == ROT_TYPE_ELEVATION
|
||||
|| rot->caps->rot_type == ROT_TYPE_AZEL)
|
||||
{
|
||||
char rot_id;
|
||||
|
||||
num_sprintf(cmdstr, STX"%c?"CR, priv_caps->elevation_id);
|
||||
retval = prosistel_transaction(rot, cmdstr, data, sizeof(data));
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
|
@ -285,7 +297,7 @@ static int prosistel_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
|||
posval /= priv_caps->angle_multiplier;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s got position from '%s' converted to %f\n",
|
||||
__func__, data, posval);
|
||||
__func__, data, posval);
|
||||
|
||||
*el = (elevation_t) posval;
|
||||
}
|
||||
|
@ -301,14 +313,15 @@ static int prosistel_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
|||
static int prosistel_rot_stop(ROT *rot)
|
||||
{
|
||||
struct prosistel_rot_priv_caps *priv_caps =
|
||||
(struct prosistel_rot_priv_caps *) rot->caps->priv;
|
||||
(struct prosistel_rot_priv_caps *) rot->caps->priv;
|
||||
char cmdstr[64];
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
// Stop azimuth only if the rotator has the capability to do so
|
||||
if (rot->caps->rot_type == ROT_TYPE_AZIMUTH || rot->caps->rot_type == ROT_TYPE_AZEL)
|
||||
if (rot->caps->rot_type == ROT_TYPE_AZIMUTH
|
||||
|| rot->caps->rot_type == ROT_TYPE_AZEL)
|
||||
{
|
||||
num_sprintf(cmdstr, STX"%cG%d"CR, priv_caps->azimuth_id, priv_caps->stop_angle);
|
||||
retval = prosistel_transaction(rot, cmdstr, NULL, 0);
|
||||
|
@ -320,9 +333,11 @@ static int prosistel_rot_stop(ROT *rot)
|
|||
}
|
||||
|
||||
// Stop elevation only if the rotator has the capability to do so
|
||||
if (rot->caps->rot_type == ROT_TYPE_ELEVATION || rot->caps->rot_type == ROT_TYPE_AZEL)
|
||||
if (rot->caps->rot_type == ROT_TYPE_ELEVATION
|
||||
|| rot->caps->rot_type == ROT_TYPE_AZEL)
|
||||
{
|
||||
num_sprintf(cmdstr, STX"%cG%d"CR, priv_caps->elevation_id, priv_caps->stop_angle);
|
||||
num_sprintf(cmdstr, STX"%cG%d"CR, priv_caps->elevation_id,
|
||||
priv_caps->stop_angle);
|
||||
retval = prosistel_transaction(rot, cmdstr, NULL, 0);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
|
|
Ładowanie…
Reference in New Issue