Improve Icom set_powerstat=1

Original 2023-07-16T09:28:43.323319-0600:    4:rig_set_powerstat: elapsed=10236ms
IC-7300  2023-07-16T09:46:48.814844-0600:    4:rig_set_powerstat: elapsed=4020ms
IC-9700  2023-07-16T10:36:27.239828-0600:    4:rig_set_powerstat: elapsed=5717ms
The goal is to tweak each rig for fastest result but need more testers for that
Slowest right now is IC-9700 which is the default value
Total timeout will be just over 10.5 seconds to allow rig to power on
https://github.com/Hamlib/Hamlib/issues/1325
pull/1347/head
Mike Black W9MDB 2023-07-16 10:38:59 -05:00
rodzic 932cca4c84
commit 902cfd708f
3 zmienionych plików z 15 dodań i 14 usunięć

Wyświetl plik

@ -8073,7 +8073,7 @@ int icom_get_dcs_sql(RIG *rig, vfo_t vfo, tone_t *code)
int icom_set_powerstat(RIG *rig, powerstat_t status)
{
unsigned char ackbuf[200];
int ack_len = sizeof(ackbuf), retval = RIG_OK;
int ack_len = sizeof(ackbuf), retval = RIG_OK, echo_status;
int pwr_sc;
// so we'll do up to 175 for 115,200
int fe_max = 175;
@ -8113,28 +8113,27 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
retval =
icom_transaction(rig, C_SET_PWR, pwr_sc, NULL, 0, ackbuf, &ack_len);
if (RIG_IS_IC7300)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: waiting 5 seconds for rig to wake up\n",
__func__);
sleep(5); // IC7300 is slow to start up -- may need to add more rigs
}
float sec_wait = 5.5; // 5.5 worked for IC-9700 -- we default to worst-case-found
if (RIG_IS_IC7300) sec_wait = 3.8;
rig_debug(RIG_DEBUG_VERBOSE, "%s: waiting %g seconds for rig to wake up\n",
__func__, sec_wait);
hl_usleep(sec_wait * 1000 * 1000); // some are slow to start up -- may need to add more rigs
// poweron == 0 means never powered -- == 2 means CAT turned off
if (priv->poweron == 0 || priv->poweron == 2)
{
retval = -1;
echo_status = -1;
for (i = 0; i < 5 && retval != RIG_OK; ++i)
for (i = 0; i < 10 && echo_status < 0; ++i)
{
retval = icom_get_usb_echo_off(rig);
echo_status = icom_get_usb_echo_off(rig);
if (retval != RIG_OK)
if (echo_status < 0)
{
sleep(1);
hl_usleep(500*1000);
}
}
if (retval == RIG_OK)
if (echo_status >= 0)
{
priv->poweron = 1;
}

Wyświetl plik

@ -35,7 +35,7 @@
#include <sys/time.h>
#endif
#define BACKEND_VER "20230707"
#define BACKEND_VER "20230716"
#define ICOM_IS_ID31 rig_is_model(rig, RIG_MODEL_ID31)
#define ICOM_IS_ID51 rig_is_model(rig, RIG_MODEL_ID51)

Wyświetl plik

@ -6254,6 +6254,7 @@ int HAMLIB_API rig_set_powerstat(RIG *rig, powerstat_t status)
ENTERFUNC;
rig_debug(RIG_DEBUG_VERBOSE, "%s called status=%d\n", __func__, status);
ELAPSED1;
if (CHECK_RIG_ARG(rig))
{
@ -6276,6 +6277,7 @@ int HAMLIB_API rig_set_powerstat(RIG *rig, powerstat_t status)
// if anything is queued up flush it
rig_flush_force(&rig->state.rigport, 1);
ELAPSED2;
RETURNFUNC(retcode);
}