From de63680912a9df69e7e3be11320f3fee9a20b7ee Mon Sep 17 00:00:00 2001 From: Malcolm Herring Date: Mon, 24 Dec 2018 18:33:11 +0000 Subject: [PATCH] commands 00-15 --- icom/icom.c | 27 ++++++++++++++++++--------- icom/icom.h | 1 + icom/icom_defs.h | 1 + icom/icr30.c | 23 +++++++++++++++++------ 4 files changed, 37 insertions(+), 15 deletions(-) diff --git a/icom/icom.c b/icom/icom.c index 229a3a2d1..1299b0baa 100644 --- a/icom/icom.c +++ b/icom/icom.c @@ -1743,6 +1743,10 @@ int icom_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift) */ int icom_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t rptr_offs) { + const struct icom_priv_caps *priv_caps; + priv_caps = (const struct icom_priv_caps*)rig->caps->priv; + int offs_len = (priv_caps->offs_len) ? priv_caps->offs_len : OFFS_LEN; + unsigned char offsbuf[MAXFRAMELEN],ackbuf[MAXFRAMELEN]; int ack_len=sizeof(ackbuf), retval; @@ -1750,9 +1754,9 @@ int icom_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t rptr_offs) /* * Icoms are using a 100Hz unit (at least on 706MKIIg) -- SF */ - to_bcd(offsbuf, rptr_offs/100, OFFS_LEN*2); + to_bcd(offsbuf, rptr_offs/100, offs_len*2); - retval = icom_transaction (rig, C_SET_OFFS, -1, offsbuf, OFFS_LEN, + retval = icom_transaction (rig, C_SET_OFFS, -1, offsbuf, offs_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -1773,29 +1777,33 @@ int icom_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t rptr_offs) */ int icom_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs) { + const struct icom_priv_caps *priv_caps; + priv_caps = (const struct icom_priv_caps*)rig->caps->priv; + int offs_len = (priv_caps->offs_len) ? priv_caps->offs_len : OFFS_LEN; + unsigned char offsbuf[MAXFRAMELEN]; - int offs_len, retval; + int buf_len, retval; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); retval = icom_transaction (rig, C_RD_OFFS, -1, NULL, 0, - offsbuf, &offs_len); + offsbuf, &buf_len); if (retval != RIG_OK) return retval; /* * offsbuf should contain Cn */ - offs_len--; - if (offs_len != OFFS_LEN) { + buf_len--; + if (buf_len != offs_len) { rig_debug(RIG_DEBUG_ERR,"icom_get_rptr_offs: " - "wrong frame len=%d\n", offs_len); + "wrong frame len=%d\n", buf_len); return -RIG_ERJCTED; } /* * Icoms are using a 100Hz unit (at least on 706MKIIg) -- SF */ - *rptr_offs = from_bcd(offsbuf+1, offs_len*2)*100; + *rptr_offs = from_bcd(offsbuf+1, buf_len*2)*100; return RIG_OK; } @@ -3361,7 +3369,8 @@ int icom_set_ant(RIG * rig, vfo_t vfo, ant_t ant) } antarg = 0; - ant_len = ((rig->caps->rig_model == RIG_MODEL_ICR75) || (rig->caps->rig_model == RIG_MODEL_ICR8600) || (rig->caps->rig_model == RIG_MODEL_ICR6))? 0 : 1; + ant_len = ((rig->caps->rig_model == RIG_MODEL_ICR75) || (rig->caps->rig_model == RIG_MODEL_ICR8600) || + (rig->caps->rig_model == RIG_MODEL_ICR6) || (rig->caps->rig_model == RIG_MODEL_ICR30))? 0 : 1; retval = icom_transaction (rig, C_CTL_ANT, i_ant, &antarg, ant_len, ackbuf, &ack_len); if (retval != RIG_OK) diff --git a/icom/icom.h b/icom/icom.h index 176dfc7fa..9671edf66 100644 --- a/icom/icom.h +++ b/icom/icom.h @@ -112,6 +112,7 @@ struct icom_priv_caps { mode */ int serial_full_duplex; /*!< Whether RXD&TXD are not tied together */ unsigned char civ_version; // default to 0, 1=IC7200,IC7300,etc differences + int offs_len; /* Number of bytes in offset frequency field. 0 defaults to 3 */ }; diff --git a/icom/icom_defs.h b/icom/icom_defs.h index 7090fb0fe..6b481a71f 100644 --- a/icom/icom_defs.h +++ b/icom/icom_defs.h @@ -262,6 +262,7 @@ */ #define S_SQL 0x01 /* Read squelch condition */ #define S_SML 0x02 /* Read S-meter level */ +#define S_CSQL 0x05 /* Read combined squelch conditions */ #define S_RFML 0x11 /* Read RF-meter level */ #define S_SWR 0x12 /* Read SWR-meter level */ #define S_ALC 0x13 /* Read ALC-meter level */ diff --git a/icom/icr30.c b/icom/icr30.c index 26cd715ce..77875aff5 100644 --- a/icom/icr30.c +++ b/icom/icr30.c @@ -84,7 +84,8 @@ static const struct icom_priv_caps icr30_priv_caps = { 0, /* 731 mode */ 0, /* no XCHG */ r8500_ts_sc_list, /* wrong, but don't have set_ts anyway */ - .r2i_mode = icr30_r2i_mode + .r2i_mode = icr30_r2i_mode, + .offs_len = 4 }; const struct rig_caps icr30_caps = { @@ -121,7 +122,7 @@ const struct rig_caps icr30_caps = { .ctcss_list = common_ctcss_list, .dcs_list = common_dcs_list, .preamp = { RIG_DBLST_END, }, -.attenuator = { RIG_DBLST_END, }, +.attenuator = { 15, 30, 35, RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), @@ -152,8 +153,14 @@ const struct rig_caps icr30_caps = { .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { + {ICR30_MODES,Hz(10)}, + {ICR30_MODES,Hz(100)}, + {ICR30_MODES,Hz(1000)}, + {ICR30_MODES,Hz(3125)}, {ICR30_MODES,Hz(5000)}, {ICR30_MODES,Hz(6250)}, + {ICR30_MODES,Hz(8330)}, + {ICR30_MODES,Hz(9000)}, {ICR30_MODES,Hz(10000)}, {ICR30_MODES,Hz(12500)}, {ICR30_MODES,kHz(15)}, @@ -162,10 +169,8 @@ const struct rig_caps icr30_caps = { {ICR30_MODES,kHz(30)}, {ICR30_MODES,kHz(50)}, {ICR30_MODES,kHz(100)}, - /* Air band only */ - {ICR30_MODES,Hz(8330)}, - /* AM broadcast band only */ - {ICR30_MODES,Hz(9000)}, + {ICR30_MODES,kHz(125)}, + {ICR30_MODES,kHz(200)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ @@ -194,6 +199,12 @@ const struct rig_caps icr30_caps = { .get_mode = icom_get_mode, .vfo_op = icom_vfo_op, .set_vfo = icom_set_vfo, +.set_rptr_offs = icom_set_rptr_offs, +.get_rptr_offs = icom_get_rptr_offs, +.set_rptr_shift = icom_set_rptr_shift, +.get_rptr_shift = icom_get_rptr_shift, +.set_ts = icom_set_ts, +.get_ts = icom_get_ts, .set_ant = icom_set_ant, .get_ant = icom_get_ant, .set_bank = icom_set_bank,