kopia lustrzana https://github.com/Hamlib/Hamlib
astyle files getting ready for WSJT-x-2.7.0rc1
rodzic
f55e7b8348
commit
dad55ef148
|
@ -83,7 +83,7 @@ int expert_init(AMP *amp)
|
|||
|
||||
int expert_open(AMP *amp)
|
||||
{
|
||||
unsigned char cmd=0x80;
|
||||
unsigned char cmd = 0x80;
|
||||
unsigned char response[256];
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: entered\n", __func__);
|
||||
|
@ -96,7 +96,7 @@ int expert_open(AMP *amp)
|
|||
int expert_close(AMP *amp)
|
||||
{
|
||||
|
||||
unsigned char cmd=0x81;
|
||||
unsigned char cmd = 0x81;
|
||||
unsigned char response[256];
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
@ -120,14 +120,15 @@ int expert_flushbuffer(AMP *amp)
|
|||
return rig_flush(&rs->ampport);
|
||||
}
|
||||
|
||||
int expert_transaction(AMP *amp, const unsigned char *cmd, int cmd_len, unsigned char *response, int response_len)
|
||||
int expert_transaction(AMP *amp, const unsigned char *cmd, int cmd_len,
|
||||
unsigned char *response, int response_len)
|
||||
{
|
||||
struct amp_state *rs;
|
||||
int err;
|
||||
int len = 0;
|
||||
int loop;
|
||||
char cmdbuf[64];
|
||||
int checksum=0;
|
||||
int checksum = 0;
|
||||
int bytes = 0;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called, cmd=%s\n", __func__, cmd);
|
||||
|
@ -139,14 +140,16 @@ int expert_transaction(AMP *amp, const unsigned char *cmd, int cmd_len, unsigned
|
|||
rs = &->state;
|
||||
|
||||
cmdbuf[0] = cmdbuf[1] = cmdbuf[2] = 0x55;
|
||||
for(int i=0;i<cmd_len;++i) checksum += cmd[i];
|
||||
|
||||
for (int i = 0; i < cmd_len; ++i) { checksum += cmd[i]; }
|
||||
|
||||
checksum = checksum % 256;
|
||||
cmdbuf[3] = cmd_len;
|
||||
memcpy(&cmdbuf[4],cmd,cmd_len);
|
||||
cmdbuf[3+cmd_len+1] = checksum;
|
||||
memcpy(&cmdbuf[4], cmd, cmd_len);
|
||||
cmdbuf[3 + cmd_len + 1] = checksum;
|
||||
|
||||
// Now send our command
|
||||
err = write_block(&rs->ampport, (unsigned char *) cmdbuf, 3+cmd_len+2);
|
||||
err = write_block(&rs->ampport, (unsigned char *) cmdbuf, 3 + cmd_len + 2);
|
||||
|
||||
if (err != RIG_OK) { return err; }
|
||||
|
||||
|
@ -155,7 +158,8 @@ int expert_transaction(AMP *amp, const unsigned char *cmd, int cmd_len, unsigned
|
|||
response[0] = 0;
|
||||
// read the 4-byte header x55x55x55xXX where XX is the hex # of bytes
|
||||
len = read_block_direct(&rs->ampport, (unsigned char *) response, 4);
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: len=%d, bytes=%02x\n", __func__, len, response[3]);
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: len=%d, bytes=%02x\n", __func__, len,
|
||||
response[3]);
|
||||
|
||||
if (len < 0)
|
||||
{
|
||||
|
@ -163,10 +167,12 @@ int expert_transaction(AMP *amp, const unsigned char *cmd, int cmd_len, unsigned
|
|||
rigerror(len));
|
||||
return len;
|
||||
}
|
||||
if (len == 4) bytes = response[3];
|
||||
|
||||
if (len == 4) { bytes = response[3]; }
|
||||
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: bytes=%d\n", __func__, bytes);
|
||||
len = read_block_direct(&rs->ampport, (unsigned char *) response, bytes-3 );
|
||||
dump_hex(response,len);
|
||||
len = read_block_direct(&rs->ampport, (unsigned char *) response, bytes - 3);
|
||||
dump_hex(response, len);
|
||||
}
|
||||
else // if no response expected try to get one
|
||||
{
|
||||
|
@ -221,7 +227,7 @@ int expert_get_freq(AMP *amp, freq_t *freq)
|
|||
|
||||
if (!amp) { return -RIG_EINVAL; }
|
||||
|
||||
retval = expert_transaction(amp, NULL,0, NULL, sizeof(responsebuf));
|
||||
retval = expert_transaction(amp, NULL, 0, NULL, sizeof(responsebuf));
|
||||
|
||||
if (retval != RIG_OK) { return retval; }
|
||||
|
||||
|
@ -357,6 +363,7 @@ int expert_get_level(AMP *amp, setting_t level, value_t *val)
|
|||
switch (level)
|
||||
{
|
||||
case AMP_LEVEL_SWR:
|
||||
|
||||
//nargs = sscanf(responsebuf, "^SW%f", &float_value);
|
||||
|
||||
if (nargs != 1)
|
||||
|
@ -371,6 +378,7 @@ int expert_get_level(AMP *amp, setting_t level, value_t *val)
|
|||
|
||||
case AMP_LEVEL_NH:
|
||||
case AMP_LEVEL_PF:
|
||||
|
||||
//nargs = sscanf(responsebuf, "^DF%d,%d", &int_value, &int_value2);
|
||||
|
||||
if (nargs != 2)
|
||||
|
|
|
@ -295,7 +295,7 @@ static int aclog_transaction(RIG *rig, char *cmd, char *value,
|
|||
// we get an unknown response if function does not exist
|
||||
if (strstr(xml, "UNKNOWN")) { set_transaction_inactive(rig); RETURNFUNC(RIG_ENAVAIL); }
|
||||
|
||||
if (value) strncpy(value, xml, value_len);
|
||||
if (value) { strncpy(value, xml, value_len); }
|
||||
|
||||
}
|
||||
while (((value && strlen(value) == 0))
|
||||
|
|
|
@ -2052,10 +2052,12 @@ static int netrigctl_get_powerstat(RIG *rig, powerstat_t *status)
|
|||
|
||||
if (ret > 0)
|
||||
{
|
||||
int offset=0;
|
||||
int offset = 0;
|
||||
|
||||
// see if there is a RPRT answer to make SDR++ happy
|
||||
if (strstr(buf,"RPRT")) offset=4;
|
||||
*status = atoi(&buf[offset]);
|
||||
if (strstr(buf, "RPRT")) { offset = 4; }
|
||||
|
||||
*status = atoi(&buf[offset]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2066,13 +2068,13 @@ static int netrigctl_get_powerstat(RIG *rig, powerstat_t *status)
|
|||
if (ret != RIG_ETIMEOUT)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE,
|
||||
"%s: PS command failed (ret=%d) so returning RIG_POWER_ON\n", __func__, ret);
|
||||
"%s: PS command failed (ret=%d) so returning RIG_POWER_ON\n", __func__, ret);
|
||||
*status = RIG_POWER_ON;
|
||||
}
|
||||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE,
|
||||
"%s: PS command failed (ret=%d) so returning RIG_POWER_OFF\n", __func__, ret);
|
||||
"%s: PS command failed (ret=%d) so returning RIG_POWER_OFF\n", __func__, ret);
|
||||
*status = RIG_POWER_OFF;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -224,14 +224,18 @@ collision_retry:
|
|||
switch (buf[retval - 1])
|
||||
{
|
||||
case COL:
|
||||
|
||||
/* Collision */
|
||||
// IC746 for example responds 0xfc when tuning is active so we will retry
|
||||
if (collision_retry++ < 20)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: collision retry#%d\n", __func__, collision_retry);
|
||||
hl_usleep(500*1000); // 500ms 20 times for ~15 second max before we back out for a retry if needed
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: collision retry#%d\n", __func__,
|
||||
collision_retry);
|
||||
hl_usleep(500 *
|
||||
1000); // 500ms 20 times for ~15 second max before we back out for a retry if needed
|
||||
goto collision_retry;
|
||||
}
|
||||
|
||||
set_transaction_inactive(rig);
|
||||
RETURNFUNC(-RIG_BUSBUSY);
|
||||
|
||||
|
|
|
@ -1653,9 +1653,11 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
if (priv->x25cmdfails < 0) priv->x25cmdfails = 1;
|
||||
if (priv->x25cmdfails < 0) { priv->x25cmdfails = 1; }
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE,
|
||||
"%s: rig probe shows 0x25 CI-V cmd not available for this rig/firmware\n", __func__);
|
||||
"%s: rig probe shows 0x25 CI-V cmd not available for this rig/firmware\n",
|
||||
__func__);
|
||||
}
|
||||
|
||||
freq_len--; // 0x25 cmd is 1 byte longer than 0x03 cmd
|
||||
|
@ -1682,7 +1684,7 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
|
||||
#if 0
|
||||
else if (priv->x25cmdfail == 0)
|
||||
&& (vfo & (RIG_VFO_A | RIG_VFO_MAIN | RIG_VFO_MAIN_A | RIG_VFO_SUB_A)))
|
||||
&& (vfo & (RIG_VFO_A | RIG_VFO_MAIN | RIG_VFO_MAIN_A | RIG_VFO_SUB_A)))
|
||||
{
|
||||
// we can use the 0x03 command for the default VFO
|
||||
retval = icom_transaction(rig, cmd, subcmd, NULL, 0, freqbuf, &freq_len);
|
||||
|
@ -1691,8 +1693,8 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
#endif
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
if (vfo == RIG_VFO_MEM && civ_731_mode) { priv->civ_731_mode = 1; }
|
||||
{
|
||||
if (vfo == RIG_VFO_MEM && civ_731_mode) { priv->civ_731_mode = 1; }
|
||||
|
||||
RETURNFUNC(retval);
|
||||
}
|
||||
|
@ -1721,9 +1723,9 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
"%s: 3-byte ID5100/4100 length - turn off XONXOFF flow control\n", __func__);
|
||||
}
|
||||
else if (freq_len != 4 && freq_len != 5)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: wrong frame len=%d\n",
|
||||
__func__, freq_len);
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: wrong frame len=%d\n",
|
||||
__func__, freq_len);
|
||||
|
||||
if (vfo == RIG_VFO_MEM && civ_731_mode) { priv->civ_731_mode = 1; }
|
||||
|
||||
|
@ -1743,36 +1745,36 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
|
||||
if (freq_len == 3) { *freq *= 10000; } // 3-byte freq for ID5100 is in 10000Hz units so convert to Hz
|
||||
|
||||
if (vfo == RIG_VFO_MEM && civ_731_mode) { priv->civ_731_mode = 1; }
|
||||
if (vfo == RIG_VFO_MEM && civ_731_mode) { priv->civ_731_mode = 1; }
|
||||
|
||||
switch (vfo)
|
||||
{
|
||||
case RIG_VFO_A: priv->vfoa_freq = *freq; break;
|
||||
switch (vfo)
|
||||
{
|
||||
case RIG_VFO_A: priv->vfoa_freq = *freq; break;
|
||||
|
||||
case RIG_VFO_MAIN_A: priv->maina_freq = *freq; break;
|
||||
case RIG_VFO_MAIN_A: priv->maina_freq = *freq; break;
|
||||
|
||||
case RIG_VFO_SUB_A: priv->suba_freq = *freq; break;
|
||||
case RIG_VFO_SUB_A: priv->suba_freq = *freq; break;
|
||||
|
||||
case RIG_VFO_B: priv->vfob_freq = *freq; break;
|
||||
case RIG_VFO_B: priv->vfob_freq = *freq; break;
|
||||
|
||||
case RIG_VFO_MAIN_B: priv->mainb_freq = *freq; break;
|
||||
case RIG_VFO_MAIN_B: priv->mainb_freq = *freq; break;
|
||||
|
||||
case RIG_VFO_SUB_B: priv->subb_freq = *freq; break;
|
||||
case RIG_VFO_SUB_B: priv->subb_freq = *freq; break;
|
||||
|
||||
case RIG_VFO_MAIN: priv->main_freq = *freq; break;
|
||||
case RIG_VFO_MAIN: priv->main_freq = *freq; break;
|
||||
|
||||
case RIG_VFO_SUB: priv->sub_freq = *freq; break;
|
||||
case RIG_VFO_SUB: priv->sub_freq = *freq; break;
|
||||
|
||||
case RIG_VFO_OTHER: priv->other_freq = *freq; break;
|
||||
case RIG_VFO_OTHER: priv->other_freq = *freq; break;
|
||||
|
||||
case RIG_VFO_NONE: // VFO_NONE will become VFO_CURR
|
||||
rig->state.current_vfo = RIG_VFO_CURR;
|
||||
case RIG_VFO_NONE: // VFO_NONE will become VFO_CURR
|
||||
rig->state.current_vfo = RIG_VFO_CURR;
|
||||
|
||||
case RIG_VFO_CURR: priv->curr_freq = *freq; break;
|
||||
case RIG_VFO_CURR: priv->curr_freq = *freq; break;
|
||||
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unknown VFO? VFO=%s\n", __func__,
|
||||
rig_strvfo(vfo));
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unknown VFO? VFO=%s\n", __func__,
|
||||
rig_strvfo(vfo));
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s exit vfo=%s, curr_vfo=%s\n", __func__,
|
||||
|
@ -5069,14 +5071,16 @@ int icom_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
|||
{
|
||||
unsigned char pttbuf[MAXFRAMELEN];
|
||||
int ptt_len, retval;
|
||||
int retry=5;
|
||||
int retry = 5;
|
||||
|
||||
ENTERFUNC;
|
||||
|
||||
do {
|
||||
do
|
||||
{
|
||||
retval = icom_transaction(rig, C_CTL_PTT, S_PTT, NULL, 0,
|
||||
pttbuf, &ptt_len);
|
||||
} while(--retry >0 && retval != RIG_OK);
|
||||
pttbuf, &ptt_len);
|
||||
}
|
||||
while (--retry > 0 && retval != RIG_OK);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
|
|
|
@ -144,30 +144,39 @@ int id5100_set_vfo(RIG *rig, vfo_t vfo)
|
|||
//struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
|
||||
|
||||
ENTERFUNC;
|
||||
if (vfo == RIG_VFO_CURR) vfo = rig->state.current_vfo;
|
||||
|
||||
if (vfo == RIG_VFO_CURR) { vfo = rig->state.current_vfo; }
|
||||
|
||||
if (vfo == RIG_VFO_A || vfo == RIG_VFO_B)
|
||||
{
|
||||
// then we need to turn off dual watch
|
||||
|
||||
if (RIG_OK != (retval = icom_set_func(rig, RIG_VFO_CURR, RIG_FUNC_DUAL_WATCH, 0)))
|
||||
|
||||
if (RIG_OK != (retval = icom_set_func(rig, RIG_VFO_CURR, RIG_FUNC_DUAL_WATCH,
|
||||
0)))
|
||||
{
|
||||
RETURNFUNC2(retval);
|
||||
}
|
||||
}
|
||||
else if (vfo == RIG_VFO_MAIN || vfo == RIG_VFO_SUB)
|
||||
if (RIG_OK != (retval = icom_set_func(rig, RIG_VFO_CURR, RIG_FUNC_DUAL_WATCH, 1)))
|
||||
if (RIG_OK != (retval = icom_set_func(rig, RIG_VFO_CURR, RIG_FUNC_DUAL_WATCH,
|
||||
1)))
|
||||
{
|
||||
RETURNFUNC2(retval);
|
||||
}
|
||||
|
||||
int myvfo = S_MAIN;
|
||||
|
||||
if (vfo == RIG_VFO_B || vfo == RIG_VFO_SUB)
|
||||
{
|
||||
myvfo = S_SUB;
|
||||
}
|
||||
if (RIG_OK != (retval = icom_transaction(rig, C_SET_VFO, myvfo, NULL, 0, ackbuf, &ack_len)))
|
||||
|
||||
if (RIG_OK != (retval = icom_transaction(rig, C_SET_VFO, myvfo, NULL, 0, ackbuf,
|
||||
&ack_len)))
|
||||
{
|
||||
RETURNFUNC2(retval);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -182,7 +191,10 @@ int id5100_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
|||
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s\n", __func__, rig_strvfo(vfo));
|
||||
|
||||
if (vfo == RIG_VFO_CURR || vfo == RIG_VFO_A || vfo == RIG_VFO_B)
|
||||
return icom_set_vfo(rig,vfo);
|
||||
{
|
||||
return icom_set_vfo(rig, vfo);
|
||||
}
|
||||
|
||||
if (vfo == RIG_VFO_MAIN)
|
||||
{
|
||||
retval = RIG_OK;
|
||||
|
@ -191,6 +203,7 @@ int id5100_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
|||
{
|
||||
retval = RIG_OK;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
|
@ -374,7 +374,7 @@ static int jst145_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
struct jst145_priv_data *priv = rig->state.priv;
|
||||
vfo_t save_vfo = rig->state.current_vfo;
|
||||
|
||||
if (vfo == RIG_VFO_CURR) vfo = save_vfo;
|
||||
if (vfo == RIG_VFO_CURR) { vfo = save_vfo; }
|
||||
|
||||
SNPRINTF(freqbuf, sizeof(freqbuf), "F%08u%c\r", (unsigned)(freq),
|
||||
vfo == RIG_VFO_A ? 'A' : 'B');
|
||||
|
@ -421,7 +421,7 @@ static int jst145_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s curr_vfo=%s\n", __func__,
|
||||
rig_strvfo(vfo), rig_strvfo(save_vfo));
|
||||
|
||||
if (vfo == RIG_VFO_CURR) vfo = save_vfo;
|
||||
if (vfo == RIG_VFO_CURR) { vfo = save_vfo; }
|
||||
|
||||
if (save_vfo != vfo)
|
||||
{
|
||||
|
|
|
@ -175,6 +175,7 @@ int elecraft_open(RIG *rig)
|
|||
}
|
||||
|
||||
priv->save_k2_ext_lvl = -1; // so we don't restore if not neeede
|
||||
|
||||
if (rig->caps->rig_model != RIG_MODEL_XG3) // XG3 doesn't have extended
|
||||
{
|
||||
err = elecraft_get_extension_level(rig, "K2", &priv->save_k2_ext_lvl);
|
||||
|
@ -185,6 +186,7 @@ int elecraft_open(RIG *rig)
|
|||
rigerror(err));
|
||||
return err;
|
||||
}
|
||||
|
||||
// turn on k2 extended to get PC values in more resolution
|
||||
err = kenwood_transaction(rig, "K22;", NULL, 0);
|
||||
|
||||
|
|
|
@ -549,8 +549,9 @@ int ic10_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
|||
/* QRP QDX should be 37 bytes but used only 1 byte for p14 instead of 2 bytes */
|
||||
/* 12345678901234567890123456789012345678 */
|
||||
offset = 5;
|
||||
if (iflen == 36) offset = 8; // QRP QDX gets completely bogus length
|
||||
else if (iflen == 37) offset = 9; // just in case somebody does this add p13/p14x2/p15
|
||||
|
||||
if (iflen == 36) { offset = 8; } // QRP QDX gets completely bogus length
|
||||
else if (iflen == 37) { offset = 9; } // just in case somebody does this add p13/p14x2/p15
|
||||
|
||||
*ptt = infobuf[iflen - offset] == '0' ? RIG_PTT_OFF : RIG_PTT_ON;
|
||||
|
||||
|
|
|
@ -358,7 +358,7 @@ transaction_write:
|
|||
|
||||
if (skip)
|
||||
{
|
||||
hl_usleep(200*1000); // give little settle time for these commands
|
||||
hl_usleep(200 * 1000); // give little settle time for these commands
|
||||
goto transaction_quit;
|
||||
}
|
||||
}
|
||||
|
@ -504,7 +504,8 @@ transaction_read:
|
|||
*/
|
||||
if (priv->question_mark_response_means_rejected)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Command rejected by the rig (get): '%s'\n", __func__,cmdstr);
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Command rejected by the rig (get): '%s'\n",
|
||||
__func__, cmdstr);
|
||||
RETURNFUNC(-RIG_ERJCTED);
|
||||
}
|
||||
|
||||
|
@ -544,6 +545,7 @@ transaction_read:
|
|||
if (datasize)
|
||||
{
|
||||
char *ps_cmd;
|
||||
|
||||
if (priv->ps_cmd_wakeup_data)
|
||||
{
|
||||
ps_cmd = ";;;;PS";
|
||||
|
@ -5123,6 +5125,7 @@ int kenwood_get_powerstat(RIG *rig, powerstat_t *status)
|
|||
}
|
||||
|
||||
char *ps_cmd;
|
||||
|
||||
if (priv->ps_cmd_wakeup_data)
|
||||
{
|
||||
ps_cmd = ";;;;PS";
|
||||
|
|
|
@ -409,6 +409,7 @@ static int ts2000_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
break;
|
||||
|
||||
case RIG_LEVEL_AGC:
|
||||
|
||||
/* Possible values for TS-2000 are 0(=off)-020(=slow) */
|
||||
|
||||
switch (val.i)
|
||||
|
@ -813,24 +814,29 @@ static int ts2000_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
int *value;
|
||||
int alc;
|
||||
|
||||
switch (level) {
|
||||
case RIG_LEVEL_SWR:
|
||||
meter = 1;
|
||||
value = &swr;
|
||||
break;
|
||||
case RIG_LEVEL_COMP_METER:
|
||||
meter = 2;
|
||||
value = ∁
|
||||
break;
|
||||
case RIG_LEVEL_ALC:
|
||||
meter = 3;
|
||||
value = &alc;
|
||||
break;
|
||||
default:
|
||||
RETURNFUNC(-RIG_EINVAL);
|
||||
switch (level)
|
||||
{
|
||||
case RIG_LEVEL_SWR:
|
||||
meter = 1;
|
||||
value = &swr;
|
||||
break;
|
||||
|
||||
case RIG_LEVEL_COMP_METER:
|
||||
meter = 2;
|
||||
value = ∁
|
||||
break;
|
||||
|
||||
case RIG_LEVEL_ALC:
|
||||
meter = 3;
|
||||
value = &alc;
|
||||
break;
|
||||
|
||||
default:
|
||||
RETURNFUNC(-RIG_EINVAL);
|
||||
}
|
||||
|
||||
retval = ts2000_read_meter(rig, meter, value);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
RETURNFUNC(retval);
|
||||
|
@ -896,6 +902,7 @@ static int ts2000_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
{
|
||||
val->f = (float) raw_value / 30.0f;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1138,7 +1145,8 @@ static int ts2000_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val)
|
|||
RETURNFUNC(retval);
|
||||
}
|
||||
|
||||
static int ts2000_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val)
|
||||
static int ts2000_get_ext_level(RIG *rig, vfo_t vfo, token_t token,
|
||||
value_t *val)
|
||||
{
|
||||
int retval;
|
||||
int value;
|
||||
|
|
|
@ -252,7 +252,8 @@ static int ts590_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
|
|||
RETURNFUNC(kenwood_transaction(rig, buf, NULL, 0));
|
||||
|
||||
case RIG_FUNC_TUNER:
|
||||
SNPRINTF(buf, sizeof(buf), "AC%c%c0", (status == 0) ? '0' : '1', (status == 0) ? '0' : '1');
|
||||
SNPRINTF(buf, sizeof(buf), "AC%c%c0", (status == 0) ? '0' : '1',
|
||||
(status == 0) ? '0' : '1');
|
||||
RETURNFUNC(kenwood_transaction(rig, buf, NULL, 0));
|
||||
|
||||
default:
|
||||
|
@ -339,6 +340,7 @@ static int ts590_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
break;
|
||||
|
||||
case RIG_LEVEL_AGC:
|
||||
|
||||
/* Possible values for TS-2000 are 0(=off)-020(=slow) */
|
||||
|
||||
switch (val.i)
|
||||
|
@ -380,6 +382,7 @@ static int ts590_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
{
|
||||
kenwood_val = val.f * 20.0f;
|
||||
}
|
||||
|
||||
SNPRINTF(levelbuf, sizeof(levelbuf), "ML%03d", kenwood_val);
|
||||
break;
|
||||
|
||||
|
@ -642,6 +645,7 @@ static int ts590_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
{
|
||||
val->f = (float) raw_value / 20.0f;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -972,6 +976,7 @@ static int ts590_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val)
|
|||
{
|
||||
retval = ts590_set_ex_menu(rig, 37, 1, val.i);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case TOK_LEVEL_DSP_TX_EQUALIZER:
|
||||
|
@ -988,6 +993,7 @@ static int ts590_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val)
|
|||
{
|
||||
retval = ts590_set_ex_menu(rig, 36, 1, val.i);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case TOK_LEVEL_DSP_TX_SSB_AM_LOW_CUT_FILTER:
|
||||
|
@ -1004,6 +1010,7 @@ static int ts590_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val)
|
|||
{
|
||||
retval = ts590_set_ex_menu(rig, 31, 1, val.i);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case TOK_LEVEL_DSP_TX_SSB_AM_HIGH_CUT_FILTER:
|
||||
|
@ -1020,6 +1027,7 @@ static int ts590_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val)
|
|||
{
|
||||
retval = ts590_set_ex_menu(rig, 32, 1, val.i);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case TOK_LEVEL_DSP_TX_SSB_DATA_LOW_CUT_FILTER:
|
||||
|
@ -1036,6 +1044,7 @@ static int ts590_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val)
|
|||
{
|
||||
retval = ts590_set_ex_menu(rig, 33, 1, val.i);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case TOK_LEVEL_DSP_TX_SSB_DATA_HIGH_CUT_FILTER:
|
||||
|
@ -1052,6 +1061,7 @@ static int ts590_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val)
|
|||
{
|
||||
retval = ts590_set_ex_menu(rig, 34, 1, val.i);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case TOK_LEVEL_BEEP_VOLUME:
|
||||
|
@ -1068,6 +1078,7 @@ static int ts590_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val)
|
|||
{
|
||||
retval = ts590_set_ex_menu(rig, 5, 2, (int) val.f);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case TOK_LEVEL_TX_SIDETONE_VOLUME:
|
||||
|
@ -1084,6 +1095,7 @@ static int ts590_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val)
|
|||
{
|
||||
retval = ts590_set_ex_menu(rig, 6, 2, (int) val.f);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case TOK_LEVEL_ACC2_AUDIO_INPUT_LEVEL:
|
||||
|
@ -1100,6 +1112,7 @@ static int ts590_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val)
|
|||
{
|
||||
retval = ts590_set_ex_menu(rig, 73, 1, (int) val.f);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case TOK_LEVEL_ACC2_AUDIO_OUTPUT_LEVEL:
|
||||
|
@ -1116,6 +1129,7 @@ static int ts590_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val)
|
|||
{
|
||||
retval = ts590_set_ex_menu(rig, 74, 1, (int) val.f);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case TOK_LEVEL_USB_AUDIO_INPUT_LEVEL:
|
||||
|
@ -1132,6 +1146,7 @@ static int ts590_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val)
|
|||
{
|
||||
retval = ts590_set_ex_menu(rig, 71, 1, (int) val.f);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case TOK_LEVEL_USB_AUDIO_OUTPUT_LEVEL:
|
||||
|
@ -1148,6 +1163,7 @@ static int ts590_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val)
|
|||
{
|
||||
retval = ts590_set_ex_menu(rig, 72, 1, (int) val.f);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1175,6 +1191,7 @@ static int ts590_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val)
|
|||
{
|
||||
retval = ts590_get_ex_menu(rig, 37, 1, &value);
|
||||
}
|
||||
|
||||
val->i = value;
|
||||
break;
|
||||
|
||||
|
@ -1187,6 +1204,7 @@ static int ts590_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val)
|
|||
{
|
||||
retval = ts590_get_ex_menu(rig, 36, 1, &value);
|
||||
}
|
||||
|
||||
val->i = value;
|
||||
break;
|
||||
|
||||
|
@ -1199,6 +1217,7 @@ static int ts590_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val)
|
|||
{
|
||||
retval = ts590_get_ex_menu(rig, 31, 1, &value);
|
||||
}
|
||||
|
||||
val->i = value;
|
||||
break;
|
||||
|
||||
|
@ -1211,6 +1230,7 @@ static int ts590_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val)
|
|||
{
|
||||
retval = ts590_get_ex_menu(rig, 32, 1, &value);
|
||||
}
|
||||
|
||||
val->i = value;
|
||||
break;
|
||||
|
||||
|
@ -1223,6 +1243,7 @@ static int ts590_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val)
|
|||
{
|
||||
retval = ts590_get_ex_menu(rig, 33, 1, &value);
|
||||
}
|
||||
|
||||
val->i = value;
|
||||
break;
|
||||
|
||||
|
@ -1235,6 +1256,7 @@ static int ts590_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val)
|
|||
{
|
||||
retval = ts590_get_ex_menu(rig, 34, 1, &value);
|
||||
}
|
||||
|
||||
val->i = value;
|
||||
break;
|
||||
|
||||
|
@ -1247,6 +1269,7 @@ static int ts590_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val)
|
|||
{
|
||||
retval = ts590_get_ex_menu(rig, 5, 2, &value);
|
||||
}
|
||||
|
||||
val->f = value;
|
||||
break;
|
||||
|
||||
|
@ -1259,6 +1282,7 @@ static int ts590_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val)
|
|||
{
|
||||
retval = ts590_get_ex_menu(rig, 6, 2, &value);
|
||||
}
|
||||
|
||||
val->f = value;
|
||||
break;
|
||||
|
||||
|
@ -1271,6 +1295,7 @@ static int ts590_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val)
|
|||
{
|
||||
retval = ts590_get_ex_menu(rig, 73, 1, &value);
|
||||
}
|
||||
|
||||
val->f = value;
|
||||
break;
|
||||
|
||||
|
@ -1283,6 +1308,7 @@ static int ts590_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val)
|
|||
{
|
||||
retval = ts590_get_ex_menu(rig, 74, 1, &value);
|
||||
}
|
||||
|
||||
val->f = value;
|
||||
break;
|
||||
|
||||
|
@ -1295,6 +1321,7 @@ static int ts590_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val)
|
|||
{
|
||||
retval = ts590_get_ex_menu(rig, 71, 1, &value);
|
||||
}
|
||||
|
||||
val->f = value;
|
||||
break;
|
||||
|
||||
|
@ -1307,6 +1334,7 @@ static int ts590_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val)
|
|||
{
|
||||
retval = ts590_get_ex_menu(rig, 72, 1, &value);
|
||||
}
|
||||
|
||||
val->f = value;
|
||||
break;
|
||||
|
||||
|
@ -1520,8 +1548,8 @@ const struct rig_caps ts590_caps =
|
|||
.level_gran =
|
||||
{
|
||||
#include "level_gran_kenwood.h"
|
||||
[LVL_RF] = { .min = { .f = 0 }, .max = { .f = 1.0 }, .step = { .f = 1.0f/100.0f } },
|
||||
[LVL_AF] = { .min = { .f = 0 }, .max = { .f = 1.0 }, .step = { .f = 1.0f/100.0f } },
|
||||
[LVL_RF] = { .min = { .f = 0 }, .max = { .f = 1.0 }, .step = { .f = 1.0f / 100.0f } },
|
||||
[LVL_AF] = { .min = { .f = 0 }, .max = { .f = 1.0 }, .step = { .f = 1.0f / 100.0f } },
|
||||
[LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } },
|
||||
[LVL_VOXDELAY] = { .min = { .i = 0 }, .max = { .i = 30 }, .step = { .i = 1 } },
|
||||
[LVL_KEYSPD] = {.min = {.i = 4}, .max = {.i = 60}, .step = {.i = 1}},
|
||||
|
@ -1717,8 +1745,8 @@ const struct rig_caps ts590sg_caps =
|
|||
},
|
||||
.level_gran = {
|
||||
#include "level_gran_kenwood.h"
|
||||
[LVL_RF] = { .min = { .f = 0 }, .max = { .f = 1.0 }, .step = { .f = 1.0f/100.0f } },
|
||||
[LVL_AF] = { .min = { .f = 0 }, .max = { .f = 1.0 }, .step = { .f = 1.0f/100.0f } },
|
||||
[LVL_RF] = { .min = { .f = 0 }, .max = { .f = 1.0 }, .step = { .f = 1.0f / 100.0f } },
|
||||
[LVL_AF] = { .min = { .f = 0 }, .max = { .f = 1.0 }, .step = { .f = 1.0f / 100.0f } },
|
||||
[LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } },
|
||||
[LVL_VOXDELAY] = { .min = { .i = 0 }, .max = { .i = 30 }, .step = { .i = 1 } },
|
||||
[LVL_KEYSPD] = {.min = {.i = 4}, .max = {.i = 60}, .step = {.i = 1}},
|
||||
|
|
|
@ -128,7 +128,7 @@ const struct rig_caps ts850_caps =
|
|||
.level_gran =
|
||||
{
|
||||
#include "level_gran_kenwood.h"
|
||||
[LVL_CWPITCH] = { .min = { .i = 400 }, .max = { .i = 1000 }, .step = { .i = 50 } },
|
||||
[LVL_CWPITCH] = { .min = { .i = 400 }, .max = { .i = 1000 }, .step = { .i = 50 } },
|
||||
},
|
||||
.parm_gran = {},
|
||||
.extparms = ts850_ext_parms,
|
||||
|
|
|
@ -362,18 +362,20 @@ int kenwood_ts890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
*/
|
||||
/* Meter Type 1 - Kenwood specific, factory default */
|
||||
static cal_table_float_t meter_type1 =
|
||||
{
|
||||
{
|
||||
9, { { 0, -28.4f}, { 3, -26}, {11, -19.5f},
|
||||
{19, -13}, {27, -6.5f}, {35, 0},
|
||||
{48, 20}, {59, 40}, {70, 60}
|
||||
} };
|
||||
/* Meter Type 2 - IARU recommended */
|
||||
}
|
||||
};
|
||||
/* Meter Type 2 - IARU recommended */
|
||||
static cal_table_float_t meter_type2 =
|
||||
{
|
||||
9, { { 0, -54}, { 3, -48}, {11, -36},
|
||||
{19, -24}, {27, -12}, {35, 0},
|
||||
{48, 20}, {59, 40}, {70, 60}
|
||||
} };
|
||||
}
|
||||
};
|
||||
/* Find out which meter type is in use */
|
||||
retval = kenwood_safe_transaction(rig, "EX00011", ackbuf, sizeof(ackbuf), 11);
|
||||
|
||||
|
@ -381,6 +383,7 @@ int kenwood_ts890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (strncmp(ackbuf + 8, "000", 3) == 0)
|
||||
{
|
||||
table = &meter_type1;
|
||||
|
@ -389,20 +392,22 @@ int kenwood_ts890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
{
|
||||
table = &meter_type2;
|
||||
}
|
||||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unexpected meter type: %s\n",
|
||||
__func__, ackbuf);
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unexpected meter type: %s\n",
|
||||
__func__, ackbuf);
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
|
||||
retval = kenwood_safe_transaction(rig, "SM", ackbuf, 10, 6);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
sscanf(ackbuf + 2, "%d", &val->i);
|
||||
/* Convert reading back to dB (rounded) */
|
||||
/* Convert reading back to dB (rounded) */
|
||||
val->i = (int)floorf(rig_raw2val_float(val->i, table) + 0.5f);
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -591,7 +596,7 @@ const struct rig_caps ts890s_caps =
|
|||
#include "level_gran_kenwood.h"
|
||||
[LVL_ATT] = { .min = { .i = 0 }, .max = { .i = 18 }, .step = { .i = 6 } },
|
||||
[LVL_CWPITCH] = { .min = { .i = 300 }, .max = { .i = 1100 }, .step = { .i = 5 } },
|
||||
[LVL_SQL] = { .min = { .f = 0 }, .max = { .f = 1.0f }, .step = { .f = 1.0/255.0 } },
|
||||
[LVL_SQL] = { .min = { .f = 0 }, .max = { .f = 1.0f }, .step = { .f = 1.0 / 255.0 } },
|
||||
},
|
||||
.has_get_func = TS890_FUNC_ALL,
|
||||
.has_set_func = TS890_FUNC_ALL,
|
||||
|
|
|
@ -148,8 +148,8 @@ const struct rig_caps ts990s_caps =
|
|||
.level_gran =
|
||||
{
|
||||
#include "level_gran_kenwood.h"
|
||||
[LVL_ATT] = { .min = { .i = 0 }, .max = { .i = 18 }, .step = { .i = 6 } },
|
||||
[LVL_CWPITCH] = { .min = { .i = 300 }, .max = { .i = 1100 }, .step = { .i = 10 } },
|
||||
[LVL_ATT] = { .min = { .i = 0 }, .max = { .i = 18 }, .step = { .i = 6 } },
|
||||
[LVL_CWPITCH] = { .min = { .i = 300 }, .max = { .i = 1100 }, .step = { .i = 10 } },
|
||||
},
|
||||
.parm_gran = {},
|
||||
.vfo_ops = TS990S_VFO_OP,
|
||||
|
|
|
@ -38,71 +38,80 @@ void serial_num(char *s)
|
|||
else { modem = "19200"; }
|
||||
|
||||
if (s[9] == '0')
|
||||
{
|
||||
diagnostics = "None";
|
||||
}
|
||||
else
|
||||
{
|
||||
diagnostics = "Non-Intrusive";
|
||||
}
|
||||
|
||||
if (s[10] == '1') { bandwidth = "12.5KHz"; }
|
||||
else { bandwidth = "25KHz"; }
|
||||
|
||||
if (s[14] == 'N')
|
||||
{
|
||||
agency = "N/A";
|
||||
else
|
||||
agency = "FCC/IC";
|
||||
|
||||
/*
|
||||
/ 01234567890123456
|
||||
9710AXN1B11C00FFA
|
||||
5 = X/N Base/Remote
|
||||
6 = N Non-redundant
|
||||
7 = Input voltage (1=10.5 to 16VDC)
|
||||
8 = Modem (B=9600 C=19200)
|
||||
9 = Diagnostics (0=None, 1=Non-Intrusive)
|
||||
10 = Bandwidth (1=12.5 2=25)
|
||||
11 = Rx Freq (A=800-860, B=860-900, C=900-960)
|
||||
12 = Tx Freq (1=800-880, 2=880-960)
|
||||
13 = 0 = Full
|
||||
14 = Agency (N=N/A F=FCC/IC)
|
||||
*/
|
||||
|
||||
if (s[0] == '9')
|
||||
{
|
||||
switch (s[11])
|
||||
}
|
||||
else
|
||||
{
|
||||
case 'A':
|
||||
rxfreq = "800-850MHz";
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
rxfreq = "860-899MHz";
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
rxfreq = "900-960MHz";
|
||||
break;
|
||||
|
||||
default:
|
||||
rxfreq = "Unknown!!";
|
||||
agency = "FCC/IC";
|
||||
}
|
||||
|
||||
switch (s[12])
|
||||
/*
|
||||
/ 01234567890123456
|
||||
9710AXN1B11C00FFA
|
||||
5 = X/N Base/Remote
|
||||
6 = N Non-redundant
|
||||
7 = Input voltage (1=10.5 to 16VDC)
|
||||
8 = Modem (B=9600 C=19200)
|
||||
9 = Diagnostics (0=None, 1=Non-Intrusive)
|
||||
10 = Bandwidth (1=12.5 2=25)
|
||||
11 = Rx Freq (A=800-860, B=860-900, C=900-960)
|
||||
12 = Tx Freq (1=800-880, 2=880-960)
|
||||
13 = 0 = Full
|
||||
14 = Agency (N=N/A F=FCC/IC)
|
||||
*/
|
||||
|
||||
if (s[0] == '9')
|
||||
{
|
||||
case '1':
|
||||
txfreq = "800-880MHz";
|
||||
break;
|
||||
switch (s[11])
|
||||
{
|
||||
case 'A':
|
||||
rxfreq = "800-850MHz";
|
||||
break;
|
||||
|
||||
case '2':
|
||||
txfreq = "880-960MHz";
|
||||
break;
|
||||
case 'B':
|
||||
rxfreq = "860-899MHz";
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
rxfreq = "900-960MHz";
|
||||
break;
|
||||
|
||||
default:
|
||||
rxfreq = "Unknown!!";
|
||||
}
|
||||
|
||||
switch (s[12])
|
||||
{
|
||||
case '1':
|
||||
txfreq = "800-880MHz";
|
||||
break;
|
||||
|
||||
case '2':
|
||||
txfreq = "880-960MHz";
|
||||
break;
|
||||
|
||||
default:
|
||||
txfreq = "Unknown!!";
|
||||
}
|
||||
|
||||
default:
|
||||
txfreq = "Unknown!!";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
printf("Model %s %s Modem(%s) Rx(%s) Tx(%s) Bandwidth(%s) Agency=%s Diagnostics=%s\n",
|
||||
model, operation,
|
||||
modem, rxfreq, txfreq, bandwidth, agency, diagnostics);
|
||||
printf("Model %s %s Modem(%s) Rx(%s) Tx(%s) Bandwidth(%s) Agency=%s Diagnostics=%s\n",
|
||||
model, operation,
|
||||
modem, rxfreq, txfreq, bandwidth, agency, diagnostics);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -449,7 +449,7 @@ int tt538_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
bytes[3] = ((unsigned int) freq >> 24) & 0xff;
|
||||
bytes[2] = ((unsigned int) freq >> 16) & 0xff;
|
||||
bytes[1] = ((unsigned int) freq >> 8) & 0xff;
|
||||
bytes[0] = ((unsigned int) freq ) & 0xff;
|
||||
bytes[0] = ((unsigned int) freq) & 0xff;
|
||||
|
||||
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "*%c%c%c%c%c" EOM,
|
||||
which_vfo(rig, vfo),
|
||||
|
|
|
@ -623,7 +623,8 @@ static int ft817_cleanup(RIG *rig)
|
|||
static int ft817_open(RIG *rig)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
|
||||
hl_usleep(1500*1000); // rig needs a bit to allow commands to come through on startup
|
||||
hl_usleep(1500 *
|
||||
1000); // rig needs a bit to allow commands to come through on startup
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -705,7 +706,8 @@ static int ft817_read_eeprom(RIG *rig, unsigned short addr, unsigned char *out)
|
|||
*out = data[addr % 2];
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: data[0]=%02x, data[1]=%02x, out=%02x\n", __func__, data[0], data[1], *out);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: data[0]=%02x, data[1]=%02x, out=%02x\n",
|
||||
__func__, data[0], data[1], *out);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -1442,8 +1444,10 @@ static int ft817_set_vfo(RIG *rig, vfo_t vfo)
|
|||
{
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
retval = ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_VFOAB);
|
||||
hl_usleep(50 * 1000); // can take a little while for vfo swap to happen -- otherwise we get errors trying to read eeprom to quickly
|
||||
hl_usleep(50 *
|
||||
1000); // can take a little while for vfo swap to happen -- otherwise we get errors trying to read eeprom to quickly
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -616,6 +616,7 @@ int ft857_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
*vfo = rig->state.cache.vfo;
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
if (ft857_read_eeprom(rig, 0x0068, &c) < 0) /* get vfo status */
|
||||
{
|
||||
ignore = 1;
|
||||
|
|
|
@ -621,6 +621,7 @@ int newcat_open(RIG *rig)
|
|||
|
||||
retry_save = rig->state.rigport.retry;
|
||||
rig->state.rigport.retry = 0;
|
||||
|
||||
if (set_only)
|
||||
{
|
||||
err = newcat_set_cmd(rig);
|
||||
|
@ -629,11 +630,12 @@ int newcat_open(RIG *rig)
|
|||
{
|
||||
err = newcat_get_cmd(rig);
|
||||
}
|
||||
|
||||
rig->state.rigport.retry = retry_save;
|
||||
|
||||
if (err != RIG_OK)
|
||||
{
|
||||
// if we can an err we just ignore the failure -- Win4Yaesu was not recognizing EX032 command
|
||||
// if we can an err we just ignore the failure -- Win4Yaesu was not recognizing EX032 command
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10850,17 +10852,18 @@ int newcat_set_cmd_validate(RIG *rig)
|
|||
// we can use a single ; to get a response of ?; for some rigs
|
||||
// this list can be expanded as we get more testing
|
||||
// seems newer rigs have this older ones time out
|
||||
switch(rig->caps->rig_model)
|
||||
switch (rig->caps->rig_model)
|
||||
{
|
||||
case RIG_MODEL_FT991:
|
||||
case RIG_MODEL_FTDX101MP:
|
||||
case RIG_MODEL_FTDX3000:
|
||||
strcpy(valcmd, ";");
|
||||
break;
|
||||
// these models do not work with a single ;
|
||||
case RIG_MODEL_FT897:
|
||||
default:
|
||||
break;
|
||||
case RIG_MODEL_FT991:
|
||||
case RIG_MODEL_FTDX101MP:
|
||||
case RIG_MODEL_FTDX3000:
|
||||
strcpy(valcmd, ";");
|
||||
break;
|
||||
|
||||
// these models do not work with a single ;
|
||||
case RIG_MODEL_FT897:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
SNPRINTF(cmd, sizeof(cmd), "%s", valcmd);
|
||||
|
|
|
@ -46,7 +46,8 @@
|
|||
* (output) Number of bytes read.
|
||||
*/
|
||||
static int
|
||||
saebrtrack_transaction(ROT *rot, const char *cmdstr, char *data, size_t data_len)
|
||||
saebrtrack_transaction(ROT *rot, const char *cmdstr, char *data,
|
||||
size_t data_len)
|
||||
{
|
||||
struct rot_state *rs;
|
||||
int retval;
|
||||
|
@ -101,7 +102,8 @@ saebrtrack_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __func__, az, el);
|
||||
|
||||
/* Non Easycom standard */
|
||||
SNPRINTF(cmdstr, sizeof(cmdstr), "AZ%05.1f EL%05.1f UP000 XXX DN000 XXX\n", az, el);
|
||||
SNPRINTF(cmdstr, sizeof(cmdstr), "AZ%05.1f EL%05.1f UP000 XXX DN000 XXX\n", az,
|
||||
el);
|
||||
|
||||
retval = saebrtrack_transaction(rot, cmdstr, NULL, 0);
|
||||
|
||||
|
|
|
@ -151,8 +151,8 @@ again:
|
|||
buf[4] = 0x03; n = write(fd, buf, 5);
|
||||
break;
|
||||
|
||||
case 0xbb:
|
||||
buf[0] = 80;buf[1] = 0; printf("READ EPROM\n");
|
||||
case 0xbb:
|
||||
buf[0] = 80; buf[1] = 0; printf("READ EPROM\n");
|
||||
n = write(fd, buf, 2);
|
||||
break;
|
||||
|
||||
|
|
|
@ -273,7 +273,7 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
sscanf(buf, "EX039%d", &ex039);
|
||||
}
|
||||
else if (strcmp(buf,"PS;") == 0)
|
||||
else if (strcmp(buf, "PS;") == 0)
|
||||
{
|
||||
SNPRINTF(buf, sizeof(buf), "PS1;");
|
||||
n = write(fd, buf, strlen(buf));
|
||||
|
|
|
@ -240,7 +240,7 @@ void frameParse(int fd, unsigned char *frame, int len)
|
|||
if (frame[6] != 0xfd)
|
||||
{
|
||||
frame[6] = 0xfb;
|
||||
dumphex(frame,7);
|
||||
dumphex(frame, 7);
|
||||
n = write(fd, frame, 7);
|
||||
printf("ACK x14 x08\n");
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ void frameParse(int fd, unsigned char *frame, int len)
|
|||
{
|
||||
to_bcd(&frame[6], (long long)128, 2);
|
||||
frame[8] = 0xfb;
|
||||
dumphex(frame,9);
|
||||
dumphex(frame, 9);
|
||||
n = write(fd, frame, 9);
|
||||
printf("SEND x14 x08\n");
|
||||
}
|
||||
|
@ -488,14 +488,14 @@ void frameParse(int fd, unsigned char *frame, int len)
|
|||
#else
|
||||
|
||||
case 0x25:
|
||||
printf("x25 send nak\n");
|
||||
printf("x25 send nak\n");
|
||||
frame[4] = 0xfa;
|
||||
frame[5] = 0xfd;
|
||||
n = write(fd, frame, 6);
|
||||
break;
|
||||
|
||||
case 0x26:
|
||||
printf("x26 send nak\n");
|
||||
printf("x26 send nak\n");
|
||||
frame[4] = 0xfa;
|
||||
frame[5] = 0xfd;
|
||||
n = write(fd, frame, 6);
|
||||
|
|
|
@ -108,23 +108,24 @@ void frameParse(int fd, unsigned char *frame, int len)
|
|||
freqA = freq;
|
||||
printf("freq=%lf\n", freqA);
|
||||
break;
|
||||
|
||||
case 0x03:
|
||||
|
||||
//from_bcd(frameackbuf[2], (civ_731_mode ? 4 : 5) * 2);
|
||||
if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN)
|
||||
{
|
||||
printf("get_freqA\n");
|
||||
to_bcd(&frame[5], (long long)freqA/10000, 3 * 2);
|
||||
dump_hex(frame,11);
|
||||
to_bcd(&frame[5], (long long)freqA / 10000, 3 * 2);
|
||||
dump_hex(frame, 11);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("get_freqB\n");
|
||||
to_bcd(&frame[5], (long long)freqB/10000, 3 * 2);
|
||||
to_bcd(&frame[5], (long long)freqB / 10000, 3 * 2);
|
||||
}
|
||||
|
||||
frame[8] = 0xfd;
|
||||
dump_hex(frame,9);
|
||||
dump_hex(frame, 9);
|
||||
|
||||
n = write(fd, frame, 9);
|
||||
|
||||
|
|
|
@ -106,8 +106,9 @@ again:
|
|||
|
||||
switch (buf[0])
|
||||
{
|
||||
case '?': printf("Query %c\n", buf[1]);break;
|
||||
case '*': printf("Set %c\n", buf[1]);break;
|
||||
case '?': printf("Query %c\n", buf[1]); break;
|
||||
|
||||
case '*': printf("Set %c\n", buf[1]); break;
|
||||
|
||||
default: printf("Unknown cmd=%02x\n", buf[4]);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,8 @@ getmyline(int fd, char *buf)
|
|||
|
||||
while (read(fd, &c, 1) > 0)
|
||||
{
|
||||
if (c == 0x0d) return strlen(buf);
|
||||
if (c == 0x0d) { return strlen(buf); }
|
||||
|
||||
buf[i++] = c;
|
||||
}
|
||||
|
||||
|
@ -126,7 +127,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
else if (strncmp(buf, "BC ", 3) == 0)
|
||||
{
|
||||
sscanf(buf,"BC %d,%d",&band,&control);
|
||||
sscanf(buf, "BC %d,%d", &band, &control);
|
||||
SNPRINTF(buf, sizeof(buf), "BC %d,%d\r", band, control);
|
||||
n = write(fd, buf, strlen(buf));
|
||||
}
|
||||
|
@ -145,9 +146,9 @@ int main(int argc, char *argv[])
|
|||
SNPRINTF(buf, sizeof(buf), "FQ %011.0f,0\r", freqA);
|
||||
n = write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strncmp(buf, "FQ ", 3)==0)
|
||||
else if (strncmp(buf, "FQ ", 3) == 0)
|
||||
{
|
||||
sscanf(buf,"FQ %lf,0", &freqA);
|
||||
sscanf(buf, "FQ %lf,0", &freqA);
|
||||
SNPRINTF(buf, sizeof(buf), "FQ %011.0f,0\r", freqA);
|
||||
n = write(fd, buf, strlen(buf));
|
||||
}
|
||||
|
|
|
@ -379,7 +379,8 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
|||
case TOK_HANDSHAKE:
|
||||
if (rs->rigport.type.rig != RIG_PORT_SERIAL)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: setting handshake is invalid for non-serial port rig type\n",
|
||||
rig_debug(RIG_DEBUG_ERR,
|
||||
"%s: setting handshake is invalid for non-serial port rig type\n",
|
||||
__func__);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
@ -873,7 +874,8 @@ static int frontend_get_conf2(RIG *rig, token_t token, char *val, int val_len)
|
|||
case TOK_HANDSHAKE:
|
||||
if (rs->rigport.type.rig != RIG_PORT_SERIAL)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: getting handshake is invalid for non-serial port rig type\n",
|
||||
rig_debug(RIG_DEBUG_ERR,
|
||||
"%s: getting handshake is invalid for non-serial port rig type\n",
|
||||
__func__);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
@ -1295,7 +1297,8 @@ int HAMLIB_API rig_set_conf(RIG *rig, token_t token, const char *val)
|
|||
// Some parameters can be ignored
|
||||
if (token == TOK_HANDSHAKE && (rs->rigport.type.rig != RIG_PORT_SERIAL))
|
||||
{
|
||||
rig_debug(RIG_DEBUG_WARN, "%s: handshake is not valid for non-serial port rig\n", __func__);
|
||||
rig_debug(RIG_DEBUG_WARN,
|
||||
"%s: handshake is not valid for non-serial port rig\n", __func__);
|
||||
return RIG_OK; // this allows rigctld to continue and just print a warning instead of error
|
||||
}
|
||||
|
||||
|
|
|
@ -1284,6 +1284,7 @@ static int read_string_generic(hamlib_port_t *p,
|
|||
memset(rxbuffer, 0, rxmax);
|
||||
|
||||
int flag = 0; // we will allow one timeout
|
||||
|
||||
while (total_count < rxmax - 1) // allow 1 byte for end-of-string
|
||||
{
|
||||
ssize_t rd_count = 0;
|
||||
|
@ -1294,12 +1295,14 @@ static int read_string_generic(hamlib_port_t *p,
|
|||
if (result == -RIG_ETIMEOUT)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_CACHE, "%s: flag=%d\n", __func__, flag);
|
||||
if (flag==0)
|
||||
|
||||
if (flag == 0)
|
||||
{
|
||||
flag = 1;
|
||||
hl_usleep(50*1000);
|
||||
hl_usleep(50 * 1000);
|
||||
continue;
|
||||
}
|
||||
|
||||
// a timeout is a timeout no matter how many bytes
|
||||
//if (0 == total_count)
|
||||
{
|
||||
|
|
51
src/misc.c
51
src/misc.c
|
@ -974,34 +974,39 @@ int check_level_param(RIG *rig, setting_t level, value_t val, gran_t **gran)
|
|||
gran_t *this_gran;
|
||||
|
||||
this_gran = &rig->caps->level_gran[rig_setting2idx(level)];
|
||||
|
||||
if (gran)
|
||||
{
|
||||
*gran = this_gran;
|
||||
}
|
||||
{
|
||||
*gran = this_gran;
|
||||
}
|
||||
|
||||
if (RIG_LEVEL_IS_FLOAT(level))
|
||||
{
|
||||
/* If min==max==0, all values are OK here but may be checked later */
|
||||
if (this_gran->min.f == 0.0f && this_gran->max.f == 0.0f)
|
||||
{
|
||||
/* If min==max==0, all values are OK here but may be checked later */
|
||||
if (this_gran->min.f == 0.0f && this_gran->max.f == 0.0f)
|
||||
{
|
||||
return RIG_OK;
|
||||
}
|
||||
if (val.f < this_gran->min.f || val.f > this_gran->max.f)
|
||||
{
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
}
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
if (val.f < this_gran->min.f || val.f > this_gran->max.f)
|
||||
{
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If min==max==0, all values are OK here but may be checked later */
|
||||
if (this_gran->min.i == 0 && this_gran->max.i == 0)
|
||||
{
|
||||
/* If min==max==0, all values are OK here but may be checked later */
|
||||
if (this_gran->min.i == 0 && this_gran->max.i == 0)
|
||||
{
|
||||
return RIG_OK;
|
||||
}
|
||||
if (val.i < this_gran->min.i || val.i > this_gran->max.i)
|
||||
{
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
}
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
if (val.i < this_gran->min.i || val.i > this_gran->max.i)
|
||||
{
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -236,14 +236,15 @@ void *multicast_thread(void *vrig)
|
|||
multicast_status_changed(rig);
|
||||
multicast_send_json(rig);
|
||||
loopcount = 4;
|
||||
freqsave = freq;
|
||||
freqsave = freq;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
WSACleanup();
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -279,7 +280,7 @@ int multicast_init(RIG *rig, char *addr, int port)
|
|||
if (rig->state.multicast->sock < 0)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
int err = WSAGetLastError();
|
||||
int err = WSAGetLastError();
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: socket: WSAGetLastError=%d\n", __func__, err);
|
||||
#else
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: socket: %s\n", __func__, strerror(errno));
|
||||
|
@ -290,7 +291,8 @@ int multicast_init(RIG *rig, char *addr, int port)
|
|||
// Set the SO_REUSEADDR option to allow multiple processes to use the same address
|
||||
int optval = 1;
|
||||
|
||||
if (setsockopt(rig->state.multicast->sock, SOL_SOCKET, SO_REUSEADDR, (char*)&optval,
|
||||
if (setsockopt(rig->state.multicast->sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(char *)&optval,
|
||||
sizeof(optval)) < 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: setsockopt: %s\n", __func__, strerror(errno));
|
||||
|
@ -327,7 +329,7 @@ int multicast_init(RIG *rig, char *addr, int port)
|
|||
|
||||
// Join the multicast group
|
||||
if (setsockopt(rig->state.multicast->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP,
|
||||
(char*)&rig->state.multicast->mreq, sizeof(rig->state.multicast->mreq)) < 0)
|
||||
(char *)&rig->state.multicast->mreq, sizeof(rig->state.multicast->mreq)) < 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: setsockopt: %s\n", __func__, strerror(errno));
|
||||
return -RIG_EIO;
|
||||
|
@ -354,7 +356,7 @@ void multicast_close(RIG *rig)
|
|||
|
||||
// Leave the multicast group
|
||||
if ((retval = setsockopt(rig->state.multicast->sock, IPPROTO_IP,
|
||||
IP_DROP_MEMBERSHIP, (char*)&rig->state.multicast->mreq,
|
||||
IP_DROP_MEMBERSHIP, (char *)&rig->state.multicast->mreq,
|
||||
sizeof(rig->state.multicast->mreq))) < 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: setsockopt: %s\n", __func__, strerror(errno));
|
||||
|
|
25
src/rig.c
25
src/rig.c
|
@ -509,7 +509,8 @@ RIG *HAMLIB_API rig_init(rig_model_t rig_model)
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: rig_model=%s %s %s\n", __func__, caps->mfg_name,
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: rig_model=%s %s %s\n", __func__,
|
||||
caps->mfg_name,
|
||||
caps->model_name, caps->version);
|
||||
|
||||
if (caps->hamlib_check_rig_caps != NULL)
|
||||
|
@ -1280,11 +1281,14 @@ int HAMLIB_API rig_open(RIG *rig)
|
|||
powerstat_t powerflag;
|
||||
status = rig_get_powerstat(rig, &powerflag);
|
||||
|
||||
if (status == RIG_OK && powerflag == RIG_POWER_OFF && rig->state.auto_power_on == 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: rig power is off, use --set-conf=auto_power_on=1 if power on is wanted\n", __func__);
|
||||
if (status == RIG_OK && powerflag == RIG_POWER_OFF
|
||||
&& rig->state.auto_power_on == 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR,
|
||||
"%s: rig power is off, use --set-conf=auto_power_on=1 if power on is wanted\n",
|
||||
__func__);
|
||||
|
||||
return (-RIG_EPOWER);
|
||||
return (-RIG_EPOWER);
|
||||
}
|
||||
|
||||
// don't need auto_power_on if power is already on
|
||||
|
@ -1781,8 +1785,9 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, freq=%.0f\n", __func__,
|
||||
rig_strvfo(vfo), freq);
|
||||
#endif
|
||||
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN) freq += rig->state.offset_vfoa;
|
||||
else if (vfo == RIG_VFO_B || vfo == RIG_VFO_SUB) freq += rig->state.offset_vfob;
|
||||
|
||||
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN) { freq += rig->state.offset_vfoa; }
|
||||
else if (vfo == RIG_VFO_B || vfo == RIG_VFO_SUB) { freq += rig->state.offset_vfob; }
|
||||
|
||||
if (CHECK_RIG_ARG(rig))
|
||||
{
|
||||
|
@ -3469,6 +3474,7 @@ int HAMLIB_API rig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
|||
ELAPSED2;
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (strcmp(rs->pttport.pathname, rs->rigport.pathname)
|
||||
|
@ -3504,6 +3510,7 @@ int HAMLIB_API rig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
|||
ELAPSED2;
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (strcmp(rs->pttport.pathname, rs->rigport.pathname)
|
||||
|
@ -6130,7 +6137,7 @@ int HAMLIB_API rig_get_powerstat(RIG *rig, powerstat_t *status)
|
|||
HAMLIB_TRACE;
|
||||
retcode = rig->caps->get_powerstat(rig, status);
|
||||
|
||||
if(retcode == RIG_EIO)
|
||||
if (retcode == RIG_EIO)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: hard error, reopening rig\n", __func__);
|
||||
rig_close(rig);
|
||||
|
@ -6139,7 +6146,7 @@ int HAMLIB_API rig_get_powerstat(RIG *rig, powerstat_t *status)
|
|||
|
||||
if (retcode != RIG_OK) { *status = RIG_POWER_ON; } // if failed assume power is on
|
||||
|
||||
if (*status == RIG_POWER_OFF && rig->state.auto_power_on) rig->caps->set_powerstat(rig, RIG_POWER_ON);
|
||||
if (*status == RIG_POWER_OFF && rig->state.auto_power_on) { rig->caps->set_powerstat(rig, RIG_POWER_ON); }
|
||||
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
|
|
@ -269,11 +269,16 @@ ROT *HAMLIB_API rot_init(rot_model_t rot_model)
|
|||
{
|
||||
case RIG_PORT_SERIAL:
|
||||
strncpy(rs->rotport.pathname, DEFAULT_SERIAL_PORT, HAMLIB_FILPATHLEN - 1);
|
||||
rs->rotport.parm.serial.rate = rs->rotport2.parm.serial.rate = caps->serial_rate_max; /* fastest ! */
|
||||
rs->rotport.parm.serial.data_bits = rs->rotport2.parm.serial.data_bits = caps->serial_data_bits;
|
||||
rs->rotport.parm.serial.stop_bits = rs->rotport2.parm.serial.stop_bits = caps->serial_stop_bits;
|
||||
rs->rotport.parm.serial.parity = rs->rotport2.parm.serial.parity = caps->serial_parity;
|
||||
rs->rotport.parm.serial.handshake = rs->rotport2.parm.serial.handshake = caps->serial_handshake;
|
||||
rs->rotport.parm.serial.rate = rs->rotport2.parm.serial.rate =
|
||||
caps->serial_rate_max; /* fastest ! */
|
||||
rs->rotport.parm.serial.data_bits = rs->rotport2.parm.serial.data_bits =
|
||||
caps->serial_data_bits;
|
||||
rs->rotport.parm.serial.stop_bits = rs->rotport2.parm.serial.stop_bits =
|
||||
caps->serial_stop_bits;
|
||||
rs->rotport.parm.serial.parity = rs->rotport2.parm.serial.parity =
|
||||
caps->serial_parity;
|
||||
rs->rotport.parm.serial.handshake = rs->rotport2.parm.serial.handshake =
|
||||
caps->serial_handshake;
|
||||
break;
|
||||
|
||||
case RIG_PORT_PARALLEL:
|
||||
|
@ -389,6 +394,7 @@ int HAMLIB_API rot_open(ROT *rot)
|
|||
rs->rotport.pathname);
|
||||
rs->rotport.type.rig = RIG_PORT_NETWORK;
|
||||
}
|
||||
|
||||
if (sscanf(rs->rotport2.pathname, "%d.%d.%d.%d:%d", &net1, &net2, &net3, &net4,
|
||||
&port) == 5)
|
||||
{
|
||||
|
@ -411,12 +417,12 @@ int HAMLIB_API rot_open(ROT *rot)
|
|||
// so if a 2nd pathname is provided we'll open it
|
||||
if (rot->caps->rot_model == ROT_MODEL_RT21 && rs->rotport2.pathname[0] != 0)
|
||||
{
|
||||
status = serial_open(&rs->rotport2);
|
||||
status = serial_open(&rs->rotport2);
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
return status;
|
||||
}
|
||||
if (status != 0)
|
||||
{
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -795,7 +795,8 @@ int HAMLIB_API serial_flush(hamlib_port_t *p)
|
|||
|
||||
p->timeout = timeout_save;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "tcflush%s\n", "");
|
||||
tcflush(p->fd, TCIFLUSH); // we also do this flush https://github.com/Hamlib/Hamlib/issues/1241
|
||||
tcflush(p->fd,
|
||||
TCIFLUSH); // we also do this flush https://github.com/Hamlib/Hamlib/issues/1241
|
||||
return (RIG_OK);
|
||||
}
|
||||
|
||||
|
|
|
@ -1479,6 +1479,7 @@ void usage_amp(FILE *fout)
|
|||
{
|
||||
nbspaces -= fprintf(fout, ", %s", test_list[i].arg4);
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: nbspace left=%d\n", __func__, nbspaces);
|
||||
|
||||
fprintf(fout, ")\n");
|
||||
|
|
|
@ -958,6 +958,7 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc,
|
|||
{
|
||||
*nl = '\0'; /* chomp */
|
||||
}
|
||||
|
||||
/* skip a space arg if first arg...happens parsing rigctld commands */
|
||||
{
|
||||
p1 = arg1[0] == ' ' ? arg1 + 1 : arg1;
|
||||
|
@ -2048,14 +2049,15 @@ int set_conf(RIG *my_rig, char *conf_parms)
|
|||
}
|
||||
|
||||
token = rig_token_lookup(my_rig, p);
|
||||
|
||||
if (token != 0)
|
||||
{
|
||||
ret = rig_set_conf(my_rig, rig_token_lookup(my_rig, p), q);
|
||||
ret = rig_set_conf(my_rig, rig_token_lookup(my_rig, p), q);
|
||||
|
||||
if (ret != RIG_OK)
|
||||
{
|
||||
return (ret);
|
||||
}
|
||||
if (ret != RIG_OK)
|
||||
{
|
||||
return (ret);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1324,7 +1324,8 @@ void *handle_socket(void *arg)
|
|||
else
|
||||
{
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: reply(%d bytes)='%s'\n", __func__, retcode, reply);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: reply(%d bytes)='%s'\n", __func__, retcode,
|
||||
reply);
|
||||
fwrite(reply, 1, retcode, fsockout);
|
||||
fflush(fsockout);
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (rig == NULL)
|
||||
{
|
||||
printf("Error in rig_init\n");
|
||||
return 1;
|
||||
printf("Error in rig_init\n");
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ int main()
|
|||
// Set the SO_REUSEADDR option to allow multiple processes to use the same address
|
||||
int optval = 1;
|
||||
|
||||
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char*)&optval,
|
||||
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&optval,
|
||||
sizeof(optval)) < 0)
|
||||
{
|
||||
//rig_debug(RIG_DEBUG_ERR, "%s: setsockopt: %s\n", __func__, strerror(errno));
|
||||
|
|
|
@ -356,8 +356,11 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
/* FIXME: bound checking and port type == serial */
|
||||
my_rot->state.rotport2.parm.serial.rate = my_rot->state.rotport2.parm.serial.rate;
|
||||
my_rot->state.rotport2.parm.serial.data_bits = my_rot->state.rotport2.parm.serial.data_bits;
|
||||
my_rot->state.rotport2.parm.serial.rate =
|
||||
my_rot->state.rotport2.parm.serial.rate;
|
||||
my_rot->state.rotport2.parm.serial.data_bits =
|
||||
my_rot->state.rotport2.parm.serial.data_bits;
|
||||
|
||||
if (serial_rate != 0)
|
||||
{
|
||||
my_rot->state.rotport.parm.serial.rate = serial_rate;
|
||||
|
|
|
@ -78,7 +78,8 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
char val[256];
|
||||
retcode = rig_get_conf2(my_rig, rig_token_lookup(my_rig, "write_delay"), val, sizeof(val));
|
||||
retcode = rig_get_conf2(my_rig, rig_token_lookup(my_rig, "write_delay"), val,
|
||||
sizeof(val));
|
||||
printf("write_delay=%s\n", val);
|
||||
|
||||
// printf("Port %s opened ok\n", SERIAL_PORT);
|
||||
|
|
Ładowanie…
Reference in New Issue