Fix ANT get/set for IC756Pro series

https://github.com/Hamlib/Hamlib/issues/774
pull/788/head
Mike Black W9MDB 2021-08-22 16:40:48 -05:00 zatwierdzone przez Wouter van Gulik
rodzic 82b0a8a84e
commit 19c5e3e0a7
4 zmienionych plików z 30 dodań i 9 usunięć

Wyświetl plik

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

Wyświetl plik

@ -7601,7 +7601,6 @@ int icom_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
RETURNFUNC(retval); RETURNFUNC(retval);
} }
antopt_len = 0;
rig_debug(RIG_DEBUG_TRACE, rig_debug(RIG_DEBUG_TRACE,
"%s: antack_len=%d so antopt_len=%d, antopt=0x%02x\n", "%s: antack_len=%d so antopt_len=%d, antopt=0x%02x\n",
__func__, priv_caps->antack_len, antopt_len, antopt[0]); __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__, rig_debug(RIG_DEBUG_ERR, "%s: ackbuf= 0x%02x 0x%02x 0x%02x\n", __func__,
ackbuf[0], ackbuf[1], ackbuf[2]); 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] // 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 // Hopefully any ack_len=3 can fit in the option field
if (ack_len == 3) if (ack_len == 3)
{ {
option->i = ackbuf[2]; option->i = ackbuf[2];
*ant_rx = rig_idx2setting(ackbuf[2]);
} }
RETURNFUNC(RIG_OK); RETURNFUNC(RIG_OK);

Wyświetl plik

@ -30,7 +30,7 @@
#include <sys/time.h> #include <sys/time.h>
#endif #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_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) #define ICOM_GET_VFO_NUMBER(vfo) (ICOM_IS_SECONDARY_VFO(vfo) ? 0x01 : 0x00)

Wyświetl plik

@ -27,6 +27,8 @@ mode_t modeA = RIG_MODE_CW;
mode_t modeB = RIG_MODE_USB; mode_t modeB = RIG_MODE_USB;
pbwidth_t widthA = 0; pbwidth_t widthA = 0;
pbwidth_t widthB = 1; pbwidth_t widthB = 1;
ant_t ant_curr = 0;
int ant_option = 0;
void dumphex(unsigned char *buf, int n) void dumphex(unsigned char *buf, int n)
{ {
@ -159,6 +161,25 @@ void frameParse(int fd, unsigned char *frame, int len)
write(fd, frame, 6); write(fd, frame, 6);
break; 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 case 0x1a: // miscellaneous things
switch (frame[5]) switch (frame[5])
{ {
@ -173,7 +194,7 @@ void frameParse(int fd, unsigned char *frame, int len)
break; break;
#if 0 #if 1
case 0x25: case 0x25:
if (frame[6] == 0xfd) if (frame[6] == 0xfd)
{ {