Fix ANT get/set for IC756Pro series

https://github.com/Hamlib/Hamlib/issues/774
This commit is contained in:
Mike Black W9MDB 2021-08-22 16:40:48 -05:00
parent b2acf0b6f5
commit 547bd0fb55
4 changed files with 30 additions and 9 deletions

View File

@ -127,7 +127,7 @@ static const struct icom_priv_caps ic756_priv_caps =
0, /* 731 mode */
0, /* no XCHG */
ic756_ts_sc_list,
.antack_len = 2,
.antack_len = 3,
.ant_count = 2,
.r2i_mode = r2i_mode,
.agc_levels_present = 1,
@ -291,7 +291,7 @@ static const struct icom_priv_caps ic756pro_priv_caps =
0, /* 731 mode */
0, /* no XCHG */
ic756pro_ts_sc_list,
.antack_len = 2,
.antack_len = 3,
.ant_count = 2,
.agc_levels_present = 1,
.agc_levels = {
@ -461,7 +461,7 @@ static const struct icom_priv_caps ic756pro2_priv_caps =
0, /* 731 mode */
0, /* no XCHG */
ic756pro_ts_sc_list,
.antack_len = 2,
.antack_len = 3,
.ant_count = 2,
.agc_levels_present = 1,
.agc_levels = {
@ -890,7 +890,7 @@ static const struct icom_priv_caps ic756pro3_priv_caps =
0, /* 731 mode */
0, /* no XCHG */
ic756pro_ts_sc_list,
.antack_len = 2,
.antack_len = 3,
.ant_count = 2,
.agc_levels_present = 1,
.agc_levels = {
@ -976,7 +976,7 @@ const struct rig_caps ic756pro3_caps =
RIG_MODEL(RIG_MODEL_IC756PROIII),
.model_name = "IC-756PROIII",
.mfg_name = "Icom",
.version = BACKEND_VER ".0",
.version = BACKEND_VER ".1",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,

View File

@ -7601,7 +7601,6 @@ int icom_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
RETURNFUNC(retval);
}
antopt_len = 0;
rig_debug(RIG_DEBUG_TRACE,
"%s: antack_len=%d so antopt_len=%d, antopt=0x%02x\n",
__func__, priv_caps->antack_len, antopt_len, antopt[0]);
@ -7729,13 +7728,14 @@ int icom_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
rig_debug(RIG_DEBUG_ERR, "%s: ackbuf= 0x%02x 0x%02x 0x%02x\n", __func__,
ackbuf[0], ackbuf[1], ackbuf[2]);
*ant_curr = rig_idx2setting(ackbuf[1]);
*ant_curr = *ant_tx = *ant_rx = rig_idx2setting(ackbuf[1]);
// Note: with IC756/IC-756Pro/IC-7800 and more, ackbuf[2] deals with [RX ANT]
// Hopefully any ack_len=3 can fit in the option field
if (ack_len == 3)
{
option->i = ackbuf[2];
*ant_rx = rig_idx2setting(ackbuf[2]);
}
RETURNFUNC(RIG_OK);

View File

@ -30,7 +30,7 @@
#include <sys/time.h>
#endif
#define BACKEND_VER "20210812"
#define BACKEND_VER "20210822"
#define ICOM_IS_SECONDARY_VFO(vfo) ((vfo) & (RIG_VFO_B | RIG_VFO_SUB | RIG_VFO_SUB_B | RIG_VFO_MAIN_B))
#define ICOM_GET_VFO_NUMBER(vfo) (ICOM_IS_SECONDARY_VFO(vfo) ? 0x01 : 0x00)

View File

@ -27,6 +27,8 @@ mode_t modeA = RIG_MODE_CW;
mode_t modeB = RIG_MODE_USB;
pbwidth_t widthA = 0;
pbwidth_t widthB = 1;
ant_t ant_curr = 0;
int ant_option = 0;
void dumphex(unsigned char *buf, int n)
{
@ -159,6 +161,25 @@ void frameParse(int fd, unsigned char *frame, int len)
write(fd, frame, 6);
break;
case 0x12: // we're simulating the 3-byte version -- not the 2-byte
if (frame[5] != 0xfd)
{
printf("Set ant %d\n", -1);
ant_curr = frame[5];
ant_option = frame[6];
dump_hex(frame,8);
}
else {
printf("Get ant\n");
}
frame[5] = ant_curr;
frame[6] = ant_option;
frame[7]=0xfd;
printf("write 8 bytes\n");
dump_hex(frame,8);
write(fd, frame, 8);
break;
case 0x1a: // miscellaneous things
switch (frame[5])
{
@ -173,7 +194,7 @@ void frameParse(int fd, unsigned char *frame, int len)
break;
#if 0
#if 1
case 0x25:
if (frame[6] == 0xfd)
{