kopia lustrzana https://github.com/Hamlib/Hamlib
Force K22 mode on Elecraft rigs to get PC power level in .1W intervals for low power operations
https://github.com/Hamlib/Hamlib/issues/1205pull/1215/head
rodzic
eb904148b5
commit
7978d74750
|
@ -165,6 +165,18 @@ int elecraft_open(RIG *rig)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rig->caps->rig_model != RIG_MODEL_XG3) // XG3 doesn't have extended
|
||||||
|
{
|
||||||
|
// turn on k2 extended to get PC values in more resolution
|
||||||
|
err = kenwood_transaction(rig, "K22;", NULL, 0);
|
||||||
|
|
||||||
|
if (err != RIG_OK)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: error setting K22='%s'...continuing\n", __func__,
|
||||||
|
rigerror(err));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (rig->caps->rig_model)
|
switch (rig->caps->rig_model)
|
||||||
{
|
{
|
||||||
case RIG_MODEL_K2:
|
case RIG_MODEL_K2:
|
||||||
|
@ -310,8 +322,8 @@ int elecraft_open(RIG *rig)
|
||||||
kenwood_get_trn(rig, &priv->trn_state); /* ignore errors */
|
kenwood_get_trn(rig, &priv->trn_state); /* ignore errors */
|
||||||
/* Currently we cannot cope with AI mode so turn it off in
|
/* Currently we cannot cope with AI mode so turn it off in
|
||||||
case last client left it on */
|
case last client left it on */
|
||||||
kenwood_set_trn(rig, RIG_TRN_OFF); /* ignore status in case
|
kenwood_set_trn(rig,
|
||||||
it's not supported */
|
RIG_TRN_OFF); /* ignore status in case it's not supported */
|
||||||
}
|
}
|
||||||
|
|
||||||
// For rigs like K3X vfo emulation need to set VFO_A to start
|
// For rigs like K3X vfo emulation need to set VFO_A to start
|
||||||
|
|
|
@ -160,7 +160,8 @@ int kx3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val);
|
||||||
int kx3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
|
int kx3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
|
||||||
int k3_set_func(RIG *rig, vfo_t vfo, setting_t func, int status);
|
int k3_set_func(RIG *rig, vfo_t vfo, setting_t func, int status);
|
||||||
int k3_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status);
|
int k3_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status);
|
||||||
int k3_power2mW(RIG *rig, unsigned int *mwpower, float power, freq_t freq, rmode_t mode);
|
int k3_power2mW(RIG *rig, unsigned int *mwpower, float power, freq_t freq,
|
||||||
|
rmode_t mode);
|
||||||
|
|
||||||
/* Private helper functions */
|
/* Private helper functions */
|
||||||
int set_rit_xit(RIG *rig, shortfreq_t rit);
|
int set_rit_xit(RIG *rig, shortfreq_t rit);
|
||||||
|
@ -1825,6 +1826,7 @@ static int k3_get_maxpower(RIG *rig)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: maxpower=%d\n", __func__, maxpower);
|
rig_debug(RIG_DEBUG_TRACE, "%s: maxpower=%d\n", __func__, maxpower);
|
||||||
|
@ -1944,8 +1946,9 @@ int k3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RIG_LEVEL_RFPOWER:
|
case RIG_LEVEL_RFPOWER:
|
||||||
SNPRINTF(levelbuf, sizeof(levelbuf), "PC%03d",
|
kenwood_val = (int)(val.f * k3_get_maxpower(rig));
|
||||||
(int)(val.f * k3_get_maxpower(rig)));
|
SNPRINTF(levelbuf, sizeof(levelbuf), "PC%03d%s", kenwood_val,
|
||||||
|
kenwood_val > 15 ? "1" : "0");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -2247,7 +2250,15 @@ int k3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
||||||
return RIG_EPROTO;
|
return RIG_EPROTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
val->f = (float) lvl / k3_get_maxpower(rig);
|
// extended K22 format PCnnnx where 0=.1W units and 1=1W units
|
||||||
|
if (len == 6 && levelbuf[5] == '0')
|
||||||
|
{
|
||||||
|
val->f = (float) lvl / 10.0 / k3_get_maxpower(rig);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
val->f = (float) lvl / k3_get_maxpower(rig);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,8 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
printf("%s\n", buf);
|
printf("%s\n", buf);
|
||||||
usleep(50 * 1000);
|
usleep(50 * 1000);
|
||||||
pbuf = "IF059014200000+000000700000;";
|
//pbuf = "IF059014200000+000000700000;";
|
||||||
|
pbuf = "IF00007230000 -000000 0001000001 ;" ;
|
||||||
n = write(fd, pbuf, strlen(pbuf));
|
n = write(fd, pbuf, strlen(pbuf));
|
||||||
printf("n=%d\n", n);
|
printf("n=%d\n", n);
|
||||||
|
|
||||||
|
@ -280,7 +281,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
else if (strncmp(buf, "PC;", 3) == 0)
|
else if (strncmp(buf, "PC;", 3) == 0)
|
||||||
{
|
{
|
||||||
SNPRINTF(buf, sizeof(buf), "PC005;");
|
SNPRINTF(buf, sizeof(buf), "PC0150;");
|
||||||
n = write(fd, buf, strlen(buf));
|
n = write(fd, buf, strlen(buf));
|
||||||
}
|
}
|
||||||
else if (strlen(buf) > 0)
|
else if (strlen(buf) > 0)
|
||||||
|
|
Ładowanie…
Reference in New Issue