Merge pull request #1330 from mikaelnousiainen/fix-power-status-and-serial-port-issues

Fix power status and serial port issues
pull/1332/head
Michael Black 2023-07-08 11:51:31 -05:00 zatwierdzone przez GitHub
commit ebf054f4cc
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 43 dodań i 9 usunięć

Wyświetl plik

@ -904,16 +904,27 @@ static int netrigctl_open(RIG *rig)
}
while (1);
if (rs->auto_power_on)
{
rig_set_powerstat(rig, 1);
}
RETURNFUNC(RIG_OK);
}
static int netrigctl_close(RIG *rig)
{
struct rig_state *rs = &rig->state;
int ret;
char buf[BUF_MAX];
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (rs->auto_power_off && rs->comm_state)
{
rig_set_powerstat(rig, 0);
}
ret = netrigctl_transaction(rig, "q\n", 2, buf);
if (ret != RIG_OK)

Wyświetl plik

@ -8080,6 +8080,7 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
unsigned char fe_buf[fe_max]; // for FE's to power up
int i;
int retry, retry_save;
short timeout_retry_save;
struct rig_state *rs = &rig->state;
struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
@ -8089,19 +8090,21 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
// elimininate retries to speed this up
// especially important when rig is not turned on
retry_save = rs->rigport.retry;
timeout_retry_save = rs->rigport.timeout_retry;
rs->rigport.retry = 0;
rs->rigport.timeout_retry = 0;
switch (status)
{
case RIG_POWER_ON:
// ic7300 manual says ~150 for 115,200
// we'll just send a few more to be sure for all speeds
memset(fe_buf, 0xfe, fe_max);
// sending more than enough 0xfe's to wake up the rs232
write_block(&rs->rigport, fe_buf, fe_max);
hl_usleep(200 *
1000); // need to wait a bit for RigPI and others to queue the echo
// need to wait a bit for RigPI and others to queue the echo
hl_usleep(200 * 1000);
// we'll try 0x18 0x01 now -- should work on STBY rigs too
pwr_sc = S_PWR_ON;
@ -8126,11 +8129,18 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
{
retval = icom_get_usb_echo_off(rig);
if (retval != RIG_OK) { sleep(1); }
if (retval != RIG_OK)
{
sleep(1);
}
}
if (retval == RIG_OK)
{
priv->poweron = 1;
}
if (retval == RIG_OK) { priv->poweron = 1; }
rs->rigport.retry = retry_save;
rs->rigport.retry = timeout_retry_save;
return RIG_OK;
}
@ -8169,6 +8179,8 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
if (retval == RIG_OK)
{
rig->state.current_vfo = icom_current_vfo(rig);
rs->rigport.retry = retry_save;
rs->rigport.retry = timeout_retry_save;
RETURNFUNC2(retval);
}
else
@ -8183,6 +8195,7 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
}
rs->rigport.retry = retry_save;
rs->rigport.retry = timeout_retry_save;
if (i == retry)
{
@ -8249,19 +8262,29 @@ int icom_get_powerstat(RIG *rig, powerstat_t *status)
}
if (RIG_IS_IC2730
|| RIG_IS_IC705
|| RIG_IS_IC7100
|| RIG_IS_IC7300
|| RIG_IS_IC7600
|| RIG_IS_IC7610
|| RIG_IS_IC7700
|| RIG_IS_IC7800
|| RIG_IS_IC785X
|| RIG_IS_IC9700
|| RIG_IS_IC905)
{
freq_t freq;
int retrysave = rig->caps->retry;
short retry_save = rig->state.rigport.retry;
short timeout_retry_save = rig->state.rigport.timeout_retry;
rig->state.rigport.retry = 0;
int retval = rig_get_freq(rig, RIG_VFO_A, &freq);
rig->state.rigport.retry = retrysave;
rig->state.rigport.timeout_retry = 0;
retval = rig_get_freq(rig, RIG_VFO_A, &freq);
rig->state.rigport.retry = retry_save;
rig->state.rigport.timeout_retry = timeout_retry_save;
*status = retval == RIG_OK ? RIG_POWER_ON : RIG_POWER_OFF;
return retval;
}