Don't set bandwidth on TS590 when RIG_PASSBAND_NOCHANGE is the width

https://github.com/Hamlib/Hamlib/issues/1505
pull/1506/head
Mike Black W9MDB 2024-02-03 11:05:12 -06:00
rodzic cff4faba53
commit ade62105a3
1 zmienionych plików z 69 dodań i 62 usunięć

Wyświetl plik

@ -250,69 +250,72 @@ static int ts590_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return kenwood_set_mode(rig, vfo, mode, width);
}
if (mode == RIG_MODE_CW || mode == RIG_MODE_CWR)
if (width != RIG_PASSBAND_NOCHANGE)
{
const int cw_table[] = { 50, 80, 100, 150, 200, 250, 300, 400, 500, 600, 1000, 1500, 2000, 2500 };
int twidth = 2500; // maximum
for (int i = 0; i < sizeof(cw_table) / sizeof(int); ++i)
if (mode == RIG_MODE_CW || mode == RIG_MODE_CWR)
{
if (cw_table[i] >= width) { twidth = cw_table[i]; break; }
const int cw_table[] = { 50, 80, 100, 150, 200, 250, 300, 400, 500, 600, 1000, 1500, 2000, 2500 };
int twidth = 2500; // maximum
for (int i = 0; i < sizeof(cw_table) / sizeof(int); ++i)
{
if (cw_table[i] >= width) { twidth = cw_table[i]; break; }
}
SNPRINTF(cmd, sizeof(cmd), "FW%04d;", twidth);
retval = kenwood_transaction(rig, cmd, NULL, 0);
return retval;
}
else if (mode == RIG_MODE_RTTY || mode == RIG_MODE_RTTYR)
{
const int cw_table[] = { 250, 500, 1000, 1500 };
int twidth = 1500; // maximum
for (int i = 0; i < sizeof(cw_table) / sizeof(int); ++i)
{
if (cw_table[i] >= width) { twidth = cw_table[i]; break; }
}
SNPRINTF(cmd, sizeof(cmd), "FW%04d;", twidth);
retval = kenwood_transaction(rig, cmd, NULL, 0);
return retval;
}
else if (mode == RIG_MODE_PKTUSB || mode == RIG_MODE_PKTLSB)
{
const int pkt_htable[] = { 1000, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600, 2800, 3000, 3400, 4000, 5000 };
// not setting SL since no API for it yet
// we will just set SH based on requested bandwidth not taking SL into account
//const int ssb_ltable[] = { 0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
for (int i = 0; i < sizeof(pkt_htable) / sizeof(int); ++i)
{
if (pkt_htable[i] >= width) { hwidth = i; break; }
}
}
else if (mode == RIG_MODE_AM || mode == RIG_MODE_PKTAM)
{
const int am_htable[] = { 2500, 3000, 4000, 5000 };
//const int am_ltable[] = { 0, 100, 200, 300 };
for (int i = 0; i < sizeof(am_htable) / sizeof(int); ++i)
{
if (am_htable[i] >= width) { hwidth = i; break; }
}
}
else if (mode == RIG_MODE_SSB || mode == RIG_MODE_LSB || mode == RIG_MODE_USB)
{
const int ssb_htable[] = { 1000, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600, 2800, 3000, 3400, 4000, 5000 };
//const int ssb_ltable[] = { 0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
for (int i = 0; i < sizeof(ssb_htable) / sizeof(int); ++i)
{
if (ssb_htable[i] >= width) { hwidth = i; break; }
}
}
SNPRINTF(cmd, sizeof(cmd), "FW%04d;", twidth);
SNPRINTF(cmd, sizeof(cmd), "SH%02d;", hwidth);
retval = kenwood_transaction(rig, cmd, NULL, 0);
return retval;
}
else if (mode == RIG_MODE_RTTY || mode == RIG_MODE_RTTYR)
{
const int cw_table[] = { 250, 500, 1000, 1500 };
int twidth = 1500; // maximum
for (int i = 0; i < sizeof(cw_table) / sizeof(int); ++i)
{
if (cw_table[i] >= width) { twidth = cw_table[i]; break; }
}
SNPRINTF(cmd, sizeof(cmd), "FW%04d;", twidth);
retval = kenwood_transaction(rig, cmd, NULL, 0);
return retval;
}
else if (mode == RIG_MODE_PKTUSB || mode == RIG_MODE_PKTLSB)
{
const int pkt_htable[] = { 1000, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600, 2800, 3000, 3400, 4000, 5000 };
// not setting SL since no API for it yet
// we will just set SH based on requested bandwidth not taking SL into account
//const int ssb_ltable[] = { 0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
for (int i = 0; i < sizeof(pkt_htable) / sizeof(int); ++i)
{
if (pkt_htable[i] >= width) { hwidth = i; break; }
}
}
else if (mode == RIG_MODE_AM || mode == RIG_MODE_PKTAM)
{
const int am_htable[] = { 2500, 3000, 4000, 5000 };
//const int am_ltable[] = { 0, 100, 200, 300 };
for (int i = 0; i < sizeof(am_htable) / sizeof(int); ++i)
{
if (am_htable[i] >= width) { hwidth = i; break; }
}
}
else if (mode == RIG_MODE_SSB || mode == RIG_MODE_LSB || mode == RIG_MODE_USB)
{
const int ssb_htable[] = { 1000, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600, 2800, 3000, 3400, 4000, 5000 };
//const int ssb_ltable[] = { 0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
for (int i = 0; i < sizeof(ssb_htable) / sizeof(int); ++i)
{
if (ssb_htable[i] >= width) { hwidth = i; break; }
}
}
SNPRINTF(cmd, sizeof(cmd), "SH%02d;", hwidth);
retval = kenwood_transaction(rig, cmd, NULL, 0);
return retval;
}
@ -1157,7 +1160,8 @@ static int ts590_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
RETURNFUNC(RIG_OK);
}
static int ts590_set_ext_func(RIG *rig, vfo_t vfo, hamlib_token_t token, int status)
static int ts590_set_ext_func(RIG *rig, vfo_t vfo, hamlib_token_t token,
int status)
{
char cmdbuf[20];
int retval;
@ -1183,7 +1187,8 @@ static int ts590_set_ext_func(RIG *rig, vfo_t vfo, hamlib_token_t token, int sta
RETURNFUNC(retval);
}
static int ts590_get_ext_func(RIG *rig, vfo_t vfo, hamlib_token_t token, int *status)
static int ts590_get_ext_func(RIG *rig, vfo_t vfo, hamlib_token_t token,
int *status)
{
int retval;
@ -1216,7 +1221,8 @@ static int ts590_get_ext_func(RIG *rig, vfo_t vfo, hamlib_token_t token, int *st
RETURNFUNC(retval);
}
static int ts590_set_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t val)
static int ts590_set_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token,
value_t val)
{
int retval;
@ -1435,7 +1441,8 @@ static int ts590_set_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_
RETURNFUNC(retval);
}
static int ts590_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t *val)
static int ts590_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token,
value_t *val)
{
int retval;
int value;
@ -1694,7 +1701,7 @@ struct rig_caps ts590_caps =
RIG_MODEL(RIG_MODEL_TS590S),
.model_name = "TS-590S",
.mfg_name = "Kenwood",
.version = BACKEND_VER ".13",
.version = BACKEND_VER ".14",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,