kopia lustrzana https://github.com/Hamlib/Hamlib
Change rigctl Y and y commands to be 1-based
Added simulation of 4 antennas to dummy device Examples testing 4 antennas with option value=ant# Rig command: y 0 Antenna: 1 Option: 0 Rig command: Y 1 1 Rig command: Y 2 2 Rig command: Y 3 3 Rig command: Y 4 4 Rig command: Y 5 5 set_ant: error = Invalid parameter Rig command: y 0 Antenna: 4 Option: 4 Rig command: Y 1 1 Rig command: y 0 Antenna: 1 Option: 1 Rig command: y 1 Antenna: 1 Option: 1 Rig command: y 2 Antenna: 2 Option: 2pull/224/head
rodzic
b90d6daca8
commit
feba5ac89a
|
@ -56,7 +56,7 @@ struct dummy_priv_data
|
||||||
powerstat_t powerstat;
|
powerstat_t powerstat;
|
||||||
int bank;
|
int bank;
|
||||||
value_t parms[RIG_SETTING_MAX];
|
value_t parms[RIG_SETTING_MAX];
|
||||||
int ant_option;
|
int ant_option[4]; /* simulate 4 antennas */
|
||||||
|
|
||||||
channel_t *curr; /* points to vfo_a, vfo_b or mem[] */
|
channel_t *curr; /* points to vfo_a, vfo_b or mem[] */
|
||||||
|
|
||||||
|
@ -1338,9 +1338,22 @@ static int dummy_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
|
||||||
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
||||||
channel_t *curr = priv->curr;
|
channel_t *curr = priv->curr;
|
||||||
|
|
||||||
|
switch(ant) {
|
||||||
|
case RIG_ANT_CURR:
|
||||||
|
break;
|
||||||
|
case RIG_ANT_1:
|
||||||
|
case RIG_ANT_2:
|
||||||
|
case RIG_ANT_3:
|
||||||
|
case RIG_ANT_4:
|
||||||
curr->ant = ant;
|
curr->ant = ant;
|
||||||
priv->ant_option = option.i;
|
break;
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called ant=%d, option=%d\n", __func__, ant, option.i);
|
default:
|
||||||
|
rig_debug(RIG_DEBUG_ERR,"%s: unknown antenna requested=0x%02x\n",__func__, ant);
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
priv->ant_option[rig_setting2idx(curr->ant)] = option.i;
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called ant=0x%02x, option=%d, curr->ant=0x%02x\n", __func__, ant, option.i, curr->ant);
|
||||||
|
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
@ -1352,8 +1365,23 @@ static int dummy_get_ant(RIG *rig, vfo_t vfo, ant_t ant, ant_t *ant_curr, value_
|
||||||
channel_t *curr = priv->curr;
|
channel_t *curr = priv->curr;
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called, ant=0x%02x\n", __func__, ant);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called, ant=0x%02x\n", __func__, ant);
|
||||||
|
|
||||||
|
switch(ant) {
|
||||||
|
case RIG_ANT_CURR:
|
||||||
*ant_curr = curr->ant;
|
*ant_curr = curr->ant;
|
||||||
option->i = priv->ant_option;
|
break;
|
||||||
|
case RIG_ANT_1:
|
||||||
|
case RIG_ANT_2:
|
||||||
|
case RIG_ANT_3:
|
||||||
|
case RIG_ANT_4:
|
||||||
|
*ant_curr = ant;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rig_debug(RIG_DEBUG_ERR,"%s: unknown antenna requested=0x%02x\n",__func__, ant);
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
}
|
||||||
|
rig_debug(RIG_DEBUG_TRACE,"%s: ant_curr=0x%02x, idx=%d\n",__func__, *ant_curr, rig_setting2idx(*ant_curr));
|
||||||
|
option->i = priv->ant_option[rig_setting2idx(*ant_curr)];
|
||||||
|
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
@ -1827,7 +1855,7 @@ const struct rig_caps dummy_caps =
|
||||||
.rig_model = RIG_MODEL_DUMMY,
|
.rig_model = RIG_MODEL_DUMMY,
|
||||||
.model_name = "Dummy",
|
.model_name = "Dummy",
|
||||||
.mfg_name = "Hamlib",
|
.mfg_name = "Hamlib",
|
||||||
.version = "0.5",
|
.version = "0.6",
|
||||||
.copyright = "LGPL",
|
.copyright = "LGPL",
|
||||||
.status = RIG_STATUS_BETA,
|
.status = RIG_STATUS_BETA,
|
||||||
.rig_type = RIG_TYPE_OTHER,
|
.rig_type = RIG_TYPE_OTHER,
|
||||||
|
|
|
@ -3943,7 +3943,7 @@ declare_proto_rig(set_ant)
|
||||||
CHKSCN1ARG(sscanf(arg1, "%d", &ant));
|
CHKSCN1ARG(sscanf(arg1, "%d", &ant));
|
||||||
CHKSCN1ARG(sscanf(arg2, "%d", &option.i)); // assuming they are integer values
|
CHKSCN1ARG(sscanf(arg2, "%d", &option.i)); // assuming they are integer values
|
||||||
|
|
||||||
return rig_set_ant(rig, vfo, rig_idx2setting(ant), option);
|
return rig_set_ant(rig, vfo, rig_idx2setting(ant-1), option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3956,7 +3956,14 @@ declare_proto_rig(get_ant)
|
||||||
|
|
||||||
CHKSCN1ARG(sscanf(arg1, "%d", &ant));
|
CHKSCN1ARG(sscanf(arg1, "%d", &ant));
|
||||||
|
|
||||||
status = rig_get_ant(rig, vfo, rig_idx2setting(ant), &ant_curr, &option);
|
if (ant == 0) // then we want the current antenna info
|
||||||
|
{
|
||||||
|
status = rig_get_ant(rig, vfo, RIG_ANT_CURR, &ant_curr, &option);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = rig_get_ant(rig, vfo, rig_idx2setting(ant-1), &ant_curr, &option);
|
||||||
|
}
|
||||||
|
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
{
|
{
|
||||||
|
@ -3967,7 +3974,7 @@ declare_proto_rig(get_ant)
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(fout, "%d%c", rig_setting2idx(ant_curr), resp_sep);
|
fprintf(fout, "%d%c", rig_setting2idx(ant_curr)+1, resp_sep);
|
||||||
|
|
||||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
{
|
{
|
||||||
|
|
Ładowanie…
Reference in New Issue