kopia lustrzana https://github.com/Hamlib/Hamlib
Fit FT890S kenwood_get_power_minmax for AM mode
https://github.com/Hamlib/Hamlib/issues/399pull/425/head
rodzic
042b55a5f5
commit
88bda82a7d
|
@ -2255,15 +2255,27 @@ static int kenwood_get_power_minmax(RIG *rig, int *power_now, int *power_min,
|
||||||
// we set back to 0 for safety and if restore is true we restore power_min
|
// we set back to 0 for safety and if restore is true we restore power_min
|
||||||
// otherwise we expect calling routine to be setting new power level
|
// otherwise we expect calling routine to be setting new power level
|
||||||
// we batch these commands together for speed
|
// we batch these commands together for speed
|
||||||
char *cmd = "PC;PC000;PC;PC255;PC;PC000;";
|
char *cmd;
|
||||||
int n;
|
int n;
|
||||||
struct rig_state *rs = &rig->state;
|
struct rig_state *rs = &rig->state;
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||||
|
|
||||||
if (RIG_IS_TS890S || RIG_IS_TS990S || RIG_IS_TS950S)
|
switch (rig->caps->rig_model)
|
||||||
{
|
{
|
||||||
cmd = "PC;PC005;PC;PC255;PC;PC005;";
|
// TS890S can't take power levels outside 5-100 and 5-50
|
||||||
|
// So all we'll do is read power_now
|
||||||
|
case RIG_MODEL_TS890S:
|
||||||
|
rig->state.power_min = *power_min = 5;
|
||||||
|
rig->state.power_max = *power_max = 100;
|
||||||
|
|
||||||
|
if (rig->state.current_mode == RIG_MODE_AM) { *power_max = 50; }
|
||||||
|
|
||||||
|
cmd = "PC;";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
cmd = "PC;PC000;PC;PC255;PC;PC000;";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't do this if PTT is on...don't want to max out power!!
|
// Don't do this if PTT is on...don't want to max out power!!
|
||||||
|
@ -2288,25 +2300,39 @@ static int kenwood_get_power_minmax(RIG *rig, int *power_now, int *power_min,
|
||||||
|
|
||||||
if (retval != 18)
|
if (retval != 18)
|
||||||
{
|
{
|
||||||
rig_debug(RIG_DEBUG_ERR, "%s: expected 19, got %d in '%s'\n", __func__, retval,
|
rig_debug(RIG_DEBUG_ERR, "%s: expected 18, got %d in '%s'\n", __func__, retval,
|
||||||
levelbuf);
|
levelbuf);
|
||||||
return -RIG_EPROTO;
|
return -RIG_EPROTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = sscanf(levelbuf, "PC%d;PC%d;PC%d", power_now, power_min, power_max);
|
if (RIG_IS_TS890S)
|
||||||
|
|
||||||
if (n != 3)
|
|
||||||
{
|
{
|
||||||
rig_debug(RIG_DEBUG_ERR, "%s: count not parse 3 values from '%s'\n", __func__,
|
n = sscanf(levelbuf, "PC%d;", power_now);
|
||||||
levelbuf);
|
|
||||||
return -RIG_EPROTO;
|
if (n != 1)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: count not parse 1 value from '%s'\n", __func__,
|
||||||
|
levelbuf);
|
||||||
|
return -RIG_EPROTO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (restore)
|
|
||||||
{
|
{
|
||||||
snprintf(levelbuf, sizeof(levelbuf), "PC%03d;", *power_now);
|
n = sscanf(levelbuf, "PC%d;PC%d;PC%d", power_now, power_min, power_max);
|
||||||
retval = kenwood_transaction(rig, levelbuf, NULL, 0);
|
|
||||||
return retval;
|
if (n != 3)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: count not parse 3 values from '%s'\n", __func__,
|
||||||
|
levelbuf);
|
||||||
|
return -RIG_EPROTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (restore) // only need to restore if 3-value cmd is done
|
||||||
|
{
|
||||||
|
snprintf(levelbuf, sizeof(levelbuf), "PC%03d;", *power_now);
|
||||||
|
retval = kenwood_transaction(rig, levelbuf, NULL, 0);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: returning now=%d, min=%d, max=%d\n", __func__,
|
rig_debug(RIG_DEBUG_TRACE, "%s: returning now=%d, min=%d, max=%d\n", __func__,
|
||||||
|
|
Ładowanie…
Reference in New Issue