kopia lustrzana https://github.com/Hamlib/Hamlib
Add ability to read TX drive level
rodzic
f29ee3e908
commit
d228548b38
|
@ -38,6 +38,8 @@
|
|||
|
||||
#define RSHFIQ_INIT_RETRY 5
|
||||
|
||||
#define RSHFIQ_LEVEL_ALL (RIG_LEVEL_RFPOWER_METER)
|
||||
|
||||
static int rshfiq_open(RIG *rig)
|
||||
{
|
||||
int retval;
|
||||
|
@ -166,6 +168,8 @@ static int rshfiq_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
return retval;
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: reply = %s\n", __func__, cmdstr);
|
||||
|
||||
cmdstr[retval] = 0;
|
||||
*freq = atoi(cmdstr);
|
||||
|
||||
|
@ -202,24 +206,77 @@ static int rshfiq_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
return retval;
|
||||
}
|
||||
|
||||
static int rsfhiq_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
||||
static int rshfiq_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
||||
{
|
||||
switch (level)
|
||||
{
|
||||
case RIG_LEVEL_TEMP_METER:
|
||||
return -RIG_ENIMPL;
|
||||
break;
|
||||
}
|
||||
return -RIG_ENIMPL;
|
||||
}
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called. level type =%qd\n", __func__, level);
|
||||
|
||||
char cmdstr[15];
|
||||
char stopset[2];
|
||||
int retval;
|
||||
|
||||
if (!val)
|
||||
{
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
switch (level)
|
||||
{
|
||||
//Requires RS-HFIQ firmware version 4 or later
|
||||
case RIG_LEVEL_RFPOWER_METER:
|
||||
|
||||
rig_flush(&rig->state.rigport);
|
||||
|
||||
snprintf(cmdstr, sizeof(cmdstr), "*L\r");
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "RIG_LEVEL_RFPOWER_METER command=%s\n", cmdstr);
|
||||
|
||||
retval = write_block(&rig->state.rigport, cmdstr, strlen(cmdstr));
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
stopset[0] = '\r';
|
||||
stopset[1] = '\n';
|
||||
|
||||
retval = read_string(&rig->state.rigport, cmdstr, 9, stopset, 2);
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "RIG_LEVEL_RFPOWER_METER reply=%s\n", cmdstr);
|
||||
|
||||
if (retval <= 0)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
cmdstr[retval] = 0;
|
||||
|
||||
//Range is 0-110. Unit is percent
|
||||
val->i = atoi(cmdstr);
|
||||
val->f = (float)(val->i) / 100;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "RIG_LEVEL_RFPOWER_METER val=%f\n", val->f);
|
||||
|
||||
return RIG_OK;
|
||||
break;
|
||||
|
||||
case RIG_LEVEL_TEMP_METER:
|
||||
return -RIG_ENIMPL;
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: Unrecognized RIG_LEVEL_* enum: %qu\n", __func__, level);
|
||||
break;
|
||||
}
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
const struct rig_caps rshfiq_caps =
|
||||
{
|
||||
RIG_MODEL(RIG_MODEL_RSHFIQ),
|
||||
.model_name = "RS-HFIQ",
|
||||
.mfg_name = "HobbyPCB",
|
||||
.version = "20210802.0",
|
||||
.version = "20210803.0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
@ -237,6 +294,8 @@ const struct rig_caps rshfiq_caps =
|
|||
.timeout = 1000,
|
||||
.retry = 3,
|
||||
|
||||
.has_get_level = RSHFIQ_LEVEL_ALL,
|
||||
|
||||
.rx_range_list1 = { {.startf = kHz(3500), .endf = MHz(30), .modes = RIG_MODE_NONE, .low_power = -1, .high_power = -1, RIG_VFO_A},
|
||||
RIG_FRNG_END,
|
||||
},
|
||||
|
@ -258,8 +317,7 @@ const struct rig_caps rshfiq_caps =
|
|||
.get_freq = rshfiq_get_freq,
|
||||
.set_freq = rshfiq_set_freq,
|
||||
.set_ptt = rshfiq_set_ptt,
|
||||
.has_get_level = RIG_LEVEL_TEMP_METER,
|
||||
.get_level = rsfhiq_get_level,
|
||||
.get_level= rshfiq_get_level,
|
||||
|
||||
};
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue