Round watt values to whole number >= 10 and 1 decimal place < 10

pull/1513/head
Mike Black W9MDB 2024-02-13 16:39:59 -06:00
rodzic 2b22a42e73
commit 972d792a4f
2 zmienionych plików z 19 dodań i 8 usunięć

Wyświetl plik

@ -1035,6 +1035,8 @@ static int ts590_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
if (level == RIG_LEVEL_RFPOWER_METER_WATTS)
{
val->f *= 100;
if (val->f >= 10) val->f = roundf(val->f);
else val->f = roundf(val->f*10.0)/10.0;
}
break;
@ -1701,7 +1703,7 @@ struct rig_caps ts590_caps =
RIG_MODEL(RIG_MODEL_TS590S),
.model_name = "TS-590S",
.mfg_name = "Kenwood",
.version = BACKEND_VER ".14",
.version = BACKEND_VER ".15",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,

Wyświetl plik

@ -318,11 +318,13 @@ int kenwood_ts890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
/* Make sure we're asking the right question */
kenwood_get_ptt(rig, vfo, &ptt);
if ((ptt == RIG_PTT_OFF) != (level == RIG_LEVEL_STRENGTH))
{
/* We're sorry, the number you have dialed is not in service */
return -RIG_ENAVAIL;
}
/* Find out which meter type is in use */
retval = kenwood_safe_transaction(rig, "EX00011", ackbuf, sizeof(ackbuf), 11);
@ -356,10 +358,17 @@ int kenwood_ts890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
sscanf(ackbuf + 2, "%d", &val->i);
if (level == RIG_LEVEL_RFPOWER_METER_WATTS)
{
if (val->f >= 10)
{
val->f = roundf(rig_raw2val(val->i, &power_meter));
}
else
{
val->f = roundf(rig_raw2val(val->i, &power_meter) * 10.0) / 10.0;
}
}
else
{
/* Convert reading back to dB (rounded) */
val->i = (int)floorf(rig_raw2val_float(val->i, table) + 0.5f);
@ -480,7 +489,7 @@ struct rig_caps ts890s_caps =
RIG_MODEL(RIG_MODEL_TS890S),
.model_name = "TS-890S",
.mfg_name = "Kenwood",
.version = BACKEND_VER ".13",
.version = BACKEND_VER ".14",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,