kopia lustrzana https://github.com/Hamlib/Hamlib
Merge remote-tracking branch 'mdblack/master'
commit
a4295a224e
|
@ -2602,7 +2602,7 @@ int adat_transaction(RIG *pRig,
|
|||
|
||||
// sleep between cmds - ADAT needs time to act upoon cmds
|
||||
|
||||
usleep(ADAT_SLEEP_MICROSECONDS_BETWEEN_CMDS);
|
||||
hl_usleep(ADAT_SLEEP_MICROSECONDS_BETWEEN_CMDS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2884,6 +2884,10 @@ int adat_open(RIG *pRig)
|
|||
int adat_close(RIG *pRig)
|
||||
{
|
||||
int nRC = RIG_OK;
|
||||
adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv;
|
||||
|
||||
if (pPriv->pcCmd != NULL) free(pPriv->pcCmd);
|
||||
if (pPriv->pcResult != NULL) free(pPriv->pcResult);
|
||||
|
||||
gFnLevel++;
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ static int ar3030_transaction(RIG *rig, const char *cmd, int cmd_len,
|
|||
if (retval == -RIG_ETIMEOUT)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s:timeout retry=%d\n", __func__, retry);
|
||||
usleep(50000);
|
||||
hl_usleep(50000);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -259,7 +259,7 @@ static int ar3030_transaction(RIG *rig, const char *cmd, int cmd_len,
|
|||
}
|
||||
while ((retval <= 0) && (--retry > 0));
|
||||
|
||||
usleep(1000); // 1ms sleep per manual
|
||||
hl_usleep(1000); // 1ms sleep per manual
|
||||
|
||||
if (data_len != NULL && retval > 0)
|
||||
{
|
||||
|
|
32
ars/ars.c
32
ars/ars.c
|
@ -306,7 +306,7 @@ ars_move(ROT *rot, int direction, int speed)
|
|||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s need settling delay\n", __func__);
|
||||
|
||||
usleep(ARS_SETTLE_DELAY);
|
||||
hl_usleep(ARS_SETTLE_DELAY);
|
||||
}
|
||||
|
||||
priv->curr_move = direction;
|
||||
|
@ -337,7 +337,7 @@ ars_move(ROT *rot, int direction, int speed)
|
|||
}
|
||||
|
||||
priv->brake_off = 1;
|
||||
usleep(ARS_BRAKE_DELAY);
|
||||
hl_usleep(ARS_BRAKE_DELAY);
|
||||
}
|
||||
|
||||
|
||||
|
@ -437,7 +437,7 @@ static void *handle_set_position(void *arg)
|
|||
if (!priv->set_pos_active)
|
||||
{
|
||||
/* TODO: replace polling period by cond var */
|
||||
usleep(100 * 1000 - 1);
|
||||
hl_usleep(100 * 1000 - 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -448,7 +448,7 @@ static void *handle_set_position(void *arg)
|
|||
{
|
||||
rig_debug(RIG_DEBUG_WARN, "%s: ars_set_position_sync() failed: %s\n",
|
||||
__func__, rigerror(retcode));
|
||||
usleep(1000 * 1000);
|
||||
hl_usleep(1000 * 1000);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -535,7 +535,7 @@ ars_set_position_sync(ROT *rot, azimuth_t az, elevation_t el)
|
|||
}
|
||||
|
||||
/* wait a little */
|
||||
usleep(10 * 1000);
|
||||
hl_usleep(10 * 1000);
|
||||
|
||||
retval = ars_get_position(rot, &curr_az, &curr_el);
|
||||
|
||||
|
@ -621,22 +621,22 @@ ars_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
|||
|
||||
/* flush last sampled value, with a dummy read */
|
||||
CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CLK));
|
||||
usleep(PP_IO_PERIOD);
|
||||
hl_usleep(PP_IO_PERIOD);
|
||||
|
||||
CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CS));
|
||||
usleep(PP_IO_PERIOD);
|
||||
hl_usleep(PP_IO_PERIOD);
|
||||
|
||||
for (i = 0; i < priv->adc_res; i++)
|
||||
{
|
||||
CHKPPRET(ars_set_ctrl_pin(rot, CTL_PIN_CLK));
|
||||
usleep(PP_IO_PERIOD);
|
||||
hl_usleep(PP_IO_PERIOD);
|
||||
|
||||
CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CLK));
|
||||
usleep(PP_IO_PERIOD);
|
||||
hl_usleep(PP_IO_PERIOD);
|
||||
}
|
||||
|
||||
CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CLK));
|
||||
usleep(PP_IO_PERIOD);
|
||||
hl_usleep(PP_IO_PERIOD);
|
||||
|
||||
CHKPPRET(ars_set_ctrl_pin(rot, CTL_PIN_CS));
|
||||
/* end of dummy read */
|
||||
|
@ -646,12 +646,12 @@ ars_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
|||
|
||||
/* read ADC value TLC(1)549 (8/10 bits), by SPI bitbanging */
|
||||
|
||||
usleep(PP_IO_PERIOD);
|
||||
hl_usleep(PP_IO_PERIOD);
|
||||
CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CLK));
|
||||
usleep(PP_IO_PERIOD);
|
||||
hl_usleep(PP_IO_PERIOD);
|
||||
|
||||
CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CS));
|
||||
usleep(PP_IO_PERIOD);
|
||||
hl_usleep(PP_IO_PERIOD);
|
||||
|
||||
az_samples[num_sample] = 0;
|
||||
el_samples[num_sample] = 0;
|
||||
|
@ -659,7 +659,7 @@ ars_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
|||
for (i = 0; i < priv->adc_res; i++)
|
||||
{
|
||||
CHKPPRET(ars_set_ctrl_pin(rot, CTL_PIN_CLK));
|
||||
usleep(PP_IO_PERIOD);
|
||||
hl_usleep(PP_IO_PERIOD);
|
||||
|
||||
CHKPPRET(par_read_status(pport, &status));
|
||||
|
||||
|
@ -670,7 +670,7 @@ ars_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
|||
el_samples[num_sample] |= (status & STA_PIN_D1) ? 1 : 0;
|
||||
|
||||
CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CLK));
|
||||
usleep(PP_IO_PERIOD);
|
||||
hl_usleep(PP_IO_PERIOD);
|
||||
}
|
||||
|
||||
CHKPPRET(ars_set_ctrl_pin(rot, CTL_PIN_CS));
|
||||
|
@ -678,7 +678,7 @@ ars_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: raw samples: az %u, el %u\n",
|
||||
__func__, az_samples[num_sample], el_samples[num_sample]);
|
||||
|
||||
usleep(PP_IO_PERIOD);
|
||||
hl_usleep(PP_IO_PERIOD);
|
||||
}
|
||||
|
||||
par_unlock(pport);
|
||||
|
|
|
@ -489,7 +489,7 @@ int barrett_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
// we need a little extra time before we assert PTT
|
||||
// testing with rigctld worked, but from WSJT-X did not
|
||||
// WSJT-X is just a little faster without the network timing
|
||||
usleep(100 * 1000);
|
||||
hl_usleep(100 * 1000);
|
||||
sprintf(cmd_buf, "XP%d", ptt);
|
||||
response = NULL;
|
||||
retval = barrett_transaction(rig, cmd_buf, 0, &response);
|
||||
|
|
|
@ -442,7 +442,7 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
|
|||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: got %s\n", __func__, terminator);
|
||||
// Slow down just a bit -- not sure this is needed anymore but not a big deal here
|
||||
usleep(2 * 1000);
|
||||
hl_usleep(2 * 1000);
|
||||
retval = RIG_OK;
|
||||
}
|
||||
else
|
||||
|
@ -949,7 +949,7 @@ static int flrig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
if (strlen(value) == 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: retries=%d\n", __func__, retries);
|
||||
//usleep(10*1000);
|
||||
//hl_usleep(10*1000);
|
||||
}
|
||||
}
|
||||
while (--retries && strlen(value) == 0);
|
||||
|
|
|
@ -298,6 +298,7 @@ static int trxmanager_open(RIG *rig)
|
|||
{
|
||||
int retval;
|
||||
char *cmd;
|
||||
char *saveptr;
|
||||
char response[MAXCMDLEN] = "";
|
||||
struct rig_state *rs = &rig->state;
|
||||
struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
|
||||
|
@ -320,7 +321,7 @@ static int trxmanager_open(RIG *rig)
|
|||
}
|
||||
|
||||
// Should have rig info now
|
||||
strtok(response, ";\r\n");
|
||||
strtok_r(response, ";\r\n", &saveptr);
|
||||
strncpy(priv->info, &response[2], sizeof(priv->info));
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s connected to %s\n", __func__, priv->info);
|
||||
|
||||
|
@ -870,8 +871,9 @@ static int trxmanager_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
|
|||
|
||||
if (n != 1)
|
||||
{
|
||||
char *saveptr;
|
||||
rig_debug(RIG_DEBUG_ERR, "%s bandwidth scan failed '%s'\n", __func__,
|
||||
strtok(response, "\r\n"));
|
||||
strtok_r(response, "\r\n", &saveptr));
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
|
||||
|
|
|
@ -348,7 +348,7 @@ transaction_read:
|
|||
if (retry_read++ < rs->rigport.retry)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Retrying shortly\n", __func__);
|
||||
usleep(rig->caps->timeout * 1000);
|
||||
hl_usleep(rig->caps->timeout * 1000);
|
||||
goto transaction_read;
|
||||
}
|
||||
|
||||
|
@ -477,7 +477,7 @@ int elad_safe_transaction(RIG *rig, const char *cmd, char *buf,
|
|||
"expected = %d, got %d\n",
|
||||
__func__, cmd, (int)expected, (int)length);
|
||||
err = -RIG_EPROTO;
|
||||
usleep(rig->caps->timeout * 1000);
|
||||
hl_usleep(rig->caps->timeout * 1000);
|
||||
}
|
||||
}
|
||||
while (err != RIG_OK && ++retry < rig->state.rigport.retry);
|
||||
|
@ -3187,7 +3187,7 @@ int elad_send_morse(RIG *rig, vfo_t vfo, const char *msg)
|
|||
*/
|
||||
if (!strncmp(m2, "KY0", 3)) { break; }
|
||||
|
||||
if (!strncmp(m2, "KY1", 3)) { usleep(500000); }
|
||||
if (!strncmp(m2, "KY1", 3)) { hl_usleep(500000); }
|
||||
else { return -RIG_EINVAL; }
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ static int setDirection(hamlib_port_t *port, unsigned char outputvalue,
|
|||
|
||||
par_write_control(port, outputstatus ^ CP_ACTIVE_LOW_BITS);
|
||||
// and now the strobe impulse
|
||||
usleep(1);
|
||||
hl_usleep(1);
|
||||
|
||||
if (direction)
|
||||
{
|
||||
|
@ -82,7 +82,7 @@ static int setDirection(hamlib_port_t *port, unsigned char outputvalue,
|
|||
}
|
||||
|
||||
par_write_control(port, outputstatus ^ CP_ACTIVE_LOW_BITS);
|
||||
usleep(1);
|
||||
hl_usleep(1);
|
||||
|
||||
if (direction)
|
||||
{
|
||||
|
|
11
icom/frame.c
11
icom/frame.c
|
@ -166,7 +166,9 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd,
|
|||
Unhold_Decode(rig);
|
||||
return retval;
|
||||
}
|
||||
if (retval < 1) {
|
||||
|
||||
if (retval < 1)
|
||||
{
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
|
||||
|
@ -230,7 +232,9 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd,
|
|||
/* other error: return it */
|
||||
return frm_len;
|
||||
}
|
||||
if (frm_len < 1) {
|
||||
|
||||
if (frm_len < 1)
|
||||
{
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
|
||||
|
@ -466,6 +470,9 @@ void icom2rig_mode(RIG *rig, unsigned char md, int pd, rmode_t *mode,
|
|||
{
|
||||
*width = RIG_PASSBAND_NORMAL;
|
||||
|
||||
if (md == RIG_MODE_PKTUSB) { md = RIG_MODE_USB; }
|
||||
else if (md == RIG_MODE_PKTLSB) { md = RIG_MODE_LSB; }
|
||||
|
||||
switch (md)
|
||||
{
|
||||
case S_AM: if (rig->caps->rig_model == RIG_MODEL_ICR30 && pd == 0x02)
|
||||
|
|
19
icom/icom.c
19
icom/icom.c
|
@ -1192,7 +1192,6 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode,
|
|||
pbwidth_t width)
|
||||
{
|
||||
int retval;
|
||||
unsigned char datamode[2];
|
||||
unsigned char ackbuf[MAXFRAMELEN];
|
||||
int ack_len = sizeof(ackbuf);
|
||||
rmode_t icom_mode;
|
||||
|
@ -1230,6 +1229,7 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode,
|
|||
|
||||
if (RIG_OK == retval)
|
||||
{
|
||||
unsigned char datamode[2];
|
||||
switch (mode)
|
||||
{
|
||||
case RIG_MODE_PKTUSB:
|
||||
|
@ -1248,16 +1248,15 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode,
|
|||
}
|
||||
|
||||
if (filter_byte) { // then we need the width byte too
|
||||
unsigned char md;
|
||||
signed char pd;
|
||||
retval = rig2icom_mode(rig, mode, width, &md, &pd);
|
||||
if (retval == RIG_OK) {
|
||||
datamode[1] = pd;
|
||||
rmode_t mode2; // not used as it will map to USB/LSB
|
||||
pbwidth_t width2;
|
||||
icom2rig_mode(rig, mode, width, &mode2, &width2);
|
||||
// since width2 is 0-2 for rigs that need this here we have to make it 1-3
|
||||
datamode[1] = datamode[1] ? width2+1 : 0;
|
||||
retval =
|
||||
icom_transaction(rig, C_CTL_MEM, dm_sub_cmd, datamode, 2, ackbuf,
|
||||
&ack_len);
|
||||
}
|
||||
}
|
||||
else {
|
||||
retval =
|
||||
icom_transaction(rig, C_CTL_MEM, dm_sub_cmd, datamode, 1, ackbuf,
|
||||
|
@ -4958,9 +4957,9 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
|
|||
// 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
|
||||
retval = write_block(&rs->rigport, (char *) fe_buf, fe_max);
|
||||
write_block(&rs->rigport, (char *) fe_buf, fe_max);
|
||||
|
||||
usleep(100 * 1000);
|
||||
hl_usleep(100 * 1000);
|
||||
// we'll try 0x18 0x01 now -- should work on STBY rigs too
|
||||
pwr_sc = S_PWR_ON;
|
||||
fe_buf[0] = 0;
|
||||
|
@ -5937,7 +5936,6 @@ DECLARE_PROBERIG_BACKEND(icom)
|
|||
{
|
||||
unsigned char buf[MAXFRAMELEN], civ_addr, civ_id;
|
||||
int frm_len, i;
|
||||
int retval;
|
||||
rig_model_t model = RIG_MODEL_NONE;
|
||||
int rates[] = { 19200, 9600, 300, 0 };
|
||||
int rates_idx;
|
||||
|
@ -5962,6 +5960,7 @@ DECLARE_PROBERIG_BACKEND(icom)
|
|||
*/
|
||||
for (rates_idx = 0; rates[rates_idx]; rates_idx++)
|
||||
{
|
||||
int retval;
|
||||
port->parm.serial.rate = rates[rates_idx];
|
||||
port->timeout = 2 * 1000 / rates[rates_idx] + 40;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND_VER "0.19"
|
||||
#define BACKEND_VER "0.21"
|
||||
|
||||
/*
|
||||
* defines used by comp_cal_str in rig.c
|
||||
|
|
|
@ -832,7 +832,7 @@ static int optoscan_wait_timer(RIG *rig, pltstate_t *state)
|
|||
|
||||
if (usec_diff < settle_usec)
|
||||
{
|
||||
usleep(settle_usec - usec_diff); /* sleep balance of settle_time */
|
||||
hl_usleep(settle_usec - usec_diff); /* sleep balance of settle_time */
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
|
|
|
@ -2446,6 +2446,10 @@ extern HAMLIB_EXPORT(const char *) rig_copyright HAMLIB_PARAMS(());
|
|||
|
||||
HAMLIB_EXPORT(void) rig_no_restore_ai();
|
||||
|
||||
#include <unistd.h>
|
||||
#include <pthread.h> // so configure can pick up nanosleep on Win32
|
||||
extern HAMLIB_EXPORT(int) hl_usleep(useconds_t msec);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _RIG_H */
|
||||
|
|
|
@ -122,7 +122,7 @@ const struct rig_caps k2_caps =
|
|||
.rig_model = RIG_MODEL_K2,
|
||||
.model_name = "K2",
|
||||
.mfg_name = "Elecraft",
|
||||
.version = "20120615",
|
||||
.version = "20200107",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_BETA,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
@ -137,6 +137,7 @@ const struct rig_caps k2_caps =
|
|||
.serial_handshake = RIG_HANDSHAKE_NONE,
|
||||
.write_delay = 0, /* Timing between bytes */
|
||||
.post_write_delay = 100, /* Timing between command strings */
|
||||
// Note that 2000 timeout exceeds usleep but hl_usleep handles it
|
||||
.timeout = 2000, /* FA and FB make take up to 500 ms on band change */
|
||||
.retry = 10,
|
||||
|
||||
|
|
20
kenwood/k3.c
20
kenwood/k3.c
|
@ -179,7 +179,7 @@ const struct rig_caps k3_caps =
|
|||
.rig_model = RIG_MODEL_K3,
|
||||
.model_name = "K3",
|
||||
.mfg_name = "Elecraft",
|
||||
.version = "20190529",
|
||||
.version = "20200107",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_BETA,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
@ -912,20 +912,17 @@ int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
{
|
||||
case RIG_MODE_PKTLSB:
|
||||
mode = RIG_MODE_RTTY;
|
||||
strncpy(cmd_m, "DT1",
|
||||
4); /* AFSK A mode - AFSK on LSB optimised for RTTY, VFO dial is MARK */
|
||||
snprintf(cmd_m, sizeof(cmd_m), "DT1"); /* AFSK A mode - AFSK on LSB optimised for RTTY, VFO dial is MARK */
|
||||
break;
|
||||
|
||||
case RIG_MODE_PKTUSB:
|
||||
mode = RIG_MODE_RTTY;
|
||||
strncpy(cmd_m, "DT0",
|
||||
4); /* DATA A mode - AFSK on USB general, VFO dial is suppressed carrier QRG */
|
||||
snprintf(cmd_m, sizeof(cmd_m), "DT0"); /* DATA A mode - AFSK on USB general, VFO dial is suppressed carrier QRG */
|
||||
break;
|
||||
|
||||
case RIG_MODE_RTTY:
|
||||
case RIG_MODE_RTTYR:
|
||||
strncpy(cmd_m, "DT2",
|
||||
4); /* FSK D mode - direct FSK keying, LSB is "normal", VFO dial is MARK */
|
||||
snprintf(cmd_m, sizeof(cmd_m), "DT2"); /* FSK D mode - direct FSK keying, LSB is "normal", VFO dial is MARK */
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1218,20 +1215,17 @@ int k3_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width)
|
|||
{
|
||||
case RIG_MODE_PKTLSB:
|
||||
tx_mode = RIG_MODE_RTTY;
|
||||
strncpy(cmd_m, "DT1",
|
||||
4); /* AFSK A mode - AFSK on LSB optimised for RTTY, VFO dial is MARK */
|
||||
snprintf(cmd_m, sizeof(cmd_m), "DT1"); /* AFSK A mode - AFSK on LSB optimised for RTTY, VFO dial is MARK */
|
||||
break;
|
||||
|
||||
case RIG_MODE_PKTUSB:
|
||||
tx_mode = RIG_MODE_RTTY;
|
||||
strncpy(cmd_m, "DT0",
|
||||
4); /* DATA A mode - AFSK on USB general, VFO dial is suppressed carrier QRG */
|
||||
snprintf(cmd_m, sizeof(cmd_m), "DT0"); /* DATA A mode - AFSK on USB general, VFO dial is suppressed carrier QRG */
|
||||
break;
|
||||
|
||||
case RIG_MODE_RTTY:
|
||||
case RIG_MODE_RTTYR:
|
||||
strncpy(cmd_m, "DT2",
|
||||
4); /* FSK D mode - direct FSK keying, LSB is "normal", VFO dial is MARK */
|
||||
snprintf(cmd_m, sizeof(cmd_m), "DT2"); /* FSK D mode - direct FSK keying, LSB is "normal", VFO dial is MARK */
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -401,7 +401,7 @@ transaction_read:
|
|||
if (retry_read++ < rs->rigport.retry)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Retrying shortly\n", __func__);
|
||||
usleep(rig->caps->timeout * 1000);
|
||||
hl_usleep(rig->caps->timeout * 1000);
|
||||
goto transaction_read;
|
||||
}
|
||||
|
||||
|
@ -536,7 +536,7 @@ int kenwood_safe_transaction(RIG *rig, const char *cmd, char *buf,
|
|||
"%s: wrong answer; len for cmd %s: expected = %d, got %d\n",
|
||||
__func__, cmd, (int)expected, (int)length);
|
||||
err = -RIG_EPROTO;
|
||||
usleep(rig->caps->timeout * 1000);
|
||||
hl_usleep(rig->caps->timeout * 1000);
|
||||
}
|
||||
}
|
||||
while (err != RIG_OK && ++retry < rig->state.rigport.retry);
|
||||
|
@ -3488,7 +3488,7 @@ int kenwood_send_morse(RIG *rig, vfo_t vfo, const char *msg)
|
|||
*/
|
||||
if (!strncmp(m2, "KY0", 3)) { break; }
|
||||
|
||||
if (!strncmp(m2, "KY1", 3)) { usleep(500000); }
|
||||
if (!strncmp(m2, "KY1", 3)) { hl_usleep(500000); }
|
||||
else { return -RIG_EINVAL; }
|
||||
}
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ extern rmode_t kenwood_mode_table[KENWOOD_MODE_TABLE_MAX];
|
|||
extern const tone_t kenwood38_ctcss_list[];
|
||||
extern const tone_t kenwood42_ctcss_list[];
|
||||
|
||||
int kenwood_transaction(RIG *rig, const char *cmd, char *data, size_t data_len);
|
||||
int kenwood_transaction(RIG *rig, const char *cmdstr, char *data, size_t datasize);
|
||||
int kenwood_safe_transaction(RIG *rig, const char *cmd, char *buf,
|
||||
size_t buf_size, size_t expected);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
|
||||
// Some commands are very slow to process so we put a DELAY in those places
|
||||
#define DELAY usleep(300*1000)
|
||||
#define DELAY hl_usleep(300*1000)
|
||||
|
||||
#define THD72_MODES (RIG_MODE_FM|RIG_MODE_FMN|RIG_MODE_AM)
|
||||
#define THD72_MODES_TX (RIG_MODE_FM|RIG_MODE_FMN)
|
||||
|
@ -1502,7 +1502,7 @@ int thd72_get_chan_all_cb(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg)
|
|||
serial_setup(rp);
|
||||
|
||||
|
||||
usleep(100 * 1000); /* let the pcr settle */
|
||||
hl_usleep(100 * 1000); /* let the pcr settle */
|
||||
serial_flush(rp); /* flush any remaining data */
|
||||
ret = ser_set_rts(rp, 1); /* setRTS or Hardware flow control? */
|
||||
|
||||
|
|
|
@ -1513,7 +1513,7 @@ int thd74_get_chan_all_cb(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg)
|
|||
serial_setup(rp);
|
||||
|
||||
|
||||
usleep(100 * 1000); /* let the pcr settle */
|
||||
hl_usleep(100 * 1000); /* let the pcr settle */
|
||||
serial_flush(rp); /* flush any remaining data */
|
||||
ret = ser_set_rts(rp, 1); /* setRTS or Hardware flow control? */
|
||||
|
||||
|
|
|
@ -4,10 +4,6 @@
|
|||
|
||||
#if defined(WIN32) && !defined(HAVE_TERMIOS_H)
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h> /* usleep() */
|
||||
#endif
|
||||
|
||||
#undef DEBUG
|
||||
#undef TRACE
|
||||
|
||||
|
@ -1631,9 +1627,9 @@ int win32_serial_read(int fd, void *vb, int size)
|
|||
if (stat.cbInQue < index->ttyset->c_cc[VMIN])
|
||||
{
|
||||
/*
|
||||
usleep(50);
|
||||
hl_usleep(50);
|
||||
*/
|
||||
usleep(100); /* don't hog the CPU while waiting */
|
||||
hl_usleep(100); /* don't hog the CPU while waiting */
|
||||
|
||||
/* we should use -1 instead of 0 for disabled timeout */
|
||||
now = GetTickCount();
|
||||
|
@ -1665,7 +1661,7 @@ int win32_serial_read(int fd, void *vb, int size)
|
|||
do
|
||||
{
|
||||
ClearErrors(index, &stat);
|
||||
usleep(1000);
|
||||
hl_usleep(1000);
|
||||
}
|
||||
while (stat.cbInQue < index->ttyset->c_cc[VMIN] && c > clock());
|
||||
|
||||
|
@ -1700,7 +1696,7 @@ int win32_serial_read(int fd, void *vb, int size)
|
|||
|
||||
case ERROR_MORE_DATA:
|
||||
/*
|
||||
usleep(1000);
|
||||
hl_usleep(1000);
|
||||
*/
|
||||
report("ERROR_MORE_DATA\n");
|
||||
break;
|
||||
|
@ -1746,14 +1742,14 @@ int win32_serial_read(int fd, void *vb, int size)
|
|||
sprintf(message, "end nBytes=%ld] ", nBytes);
|
||||
report(message);
|
||||
/*
|
||||
usleep(1000);
|
||||
hl_usleep(1000);
|
||||
*/
|
||||
report("ERROR_IO_PENDING\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
/*
|
||||
usleep(1000);
|
||||
hl_usleep(1000);
|
||||
*/
|
||||
YACK();
|
||||
return -1;
|
||||
|
@ -1765,7 +1761,7 @@ int win32_serial_read(int fd, void *vb, int size)
|
|||
total += nBytes;
|
||||
|
||||
/*
|
||||
usleep(1000);
|
||||
hl_usleep(1000);
|
||||
*/
|
||||
ClearErrors(index, &stat);
|
||||
return (total);
|
||||
|
@ -1829,8 +1825,8 @@ int win32_serial_read(int fd, void *vb, int size)
|
|||
#endif /* DEBUG_VERBOSE */
|
||||
ClearErrors(index, &Stat);
|
||||
/*
|
||||
usleep(1000);
|
||||
usleep(50);
|
||||
hl_usleep(1000);
|
||||
hl_usleep(50);
|
||||
*/
|
||||
/* we should use -1 instead of 0 for disabled timeout */
|
||||
now = GetTickCount();
|
||||
|
@ -1863,7 +1859,7 @@ int win32_serial_read(int fd, void *vb, int size)
|
|||
do
|
||||
{
|
||||
error = ClearErrors(index, &Stat);
|
||||
usleep(1000);
|
||||
hl_usleep(1000);
|
||||
}
|
||||
while (c > clock());
|
||||
|
||||
|
@ -1898,7 +1894,7 @@ int win32_serial_read(int fd, void *vb, int size)
|
|||
|
||||
case ERROR_MORE_DATA:
|
||||
/*
|
||||
usleep(1000);
|
||||
hl_usleep(1000);
|
||||
*/
|
||||
report("ERROR_MORE_DATA\n");
|
||||
break;
|
||||
|
@ -1946,14 +1942,14 @@ int win32_serial_read(int fd, void *vb, int size)
|
|||
sprintf(message, "end nBytes=%ld] ", nBytes);
|
||||
report(message);
|
||||
/*
|
||||
usleep(1000);
|
||||
hl_usleep(1000);
|
||||
*/
|
||||
report("ERROR_IO_PENDING\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
/*
|
||||
usleep(1000);
|
||||
hl_usleep(1000);
|
||||
*/
|
||||
YACK();
|
||||
errno = EIO;
|
||||
|
@ -1967,7 +1963,7 @@ int win32_serial_read(int fd, void *vb, int size)
|
|||
total += nBytes;
|
||||
|
||||
/*
|
||||
usleep(1000);
|
||||
hl_usleep(1000);
|
||||
*/
|
||||
ClearErrors(index, &Stat);
|
||||
printf("7\n");
|
||||
|
@ -2876,7 +2872,7 @@ int tcsendbreak(int fd, int duration)
|
|||
}
|
||||
|
||||
/* 0.25 seconds == 250000 usec */
|
||||
usleep(duration * 250000);
|
||||
hl_usleep(duration * 250000);
|
||||
|
||||
if (!ClearCommBreak(index->hComm))
|
||||
{
|
||||
|
@ -3722,7 +3718,7 @@ static void termios_interrupt_event_loop(int fd, int flag)
|
|||
/*
|
||||
index->event_flag = 0;
|
||||
TRENT SetCommMask( index->hComm, index->event_flag );
|
||||
usleep(2000);
|
||||
hl_usleep(2000);
|
||||
tcdrain( index->fd );
|
||||
SetEvent( index->sol.hEvent );
|
||||
*/
|
||||
|
@ -3786,9 +3782,9 @@ int win32_serial_select(int n, fd_set *readfds, fd_set *writefds,
|
|||
things can fire up
|
||||
|
||||
this does happen. loops ~twice on a 350 Mzh with
|
||||
usleep(1000000)
|
||||
hl_usleep(1000000)
|
||||
*/
|
||||
/* usleep(10000); */
|
||||
/* hl_usleep(10000); */
|
||||
LEAVE("serial_uselect");
|
||||
return (0);
|
||||
}
|
||||
|
@ -3820,7 +3816,7 @@ int win32_serial_select(int n, fd_set *readfds, fd_set *writefds,
|
|||
goto end;
|
||||
}
|
||||
|
||||
usleep(10000);
|
||||
hl_usleep(10000);
|
||||
/* FIXME: not very accurate wrt process time */
|
||||
timeout_usec -= 10000;
|
||||
|
||||
|
@ -3885,7 +3881,7 @@ int win32_serial_select(int n, fd_set *readfds, fd_set *writefds,
|
|||
|
||||
end:
|
||||
/* You may want to chop this out for lower latency */
|
||||
/* usleep(1000); */
|
||||
/* hl_usleep(1000); */
|
||||
LEAVE("serial_select");
|
||||
return (1);
|
||||
timeout:
|
||||
|
@ -3913,7 +3909,7 @@ int win32_serial_select(int n, fd_set *readfds, fd_set *writefds,
|
|||
|
||||
if (fd <= 0)
|
||||
{
|
||||
/* usleep(1000); */
|
||||
/* hl_usleep(1000); */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3932,7 +3928,7 @@ int win32_serial_select(int n, fd_set *readfds, fd_set *writefds,
|
|||
|
||||
while (!index->event_flag)
|
||||
{
|
||||
/* usleep(1000); */
|
||||
/* hl_usleep(1000); */
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -4012,7 +4008,7 @@ int win32_serial_select(int n, fd_set *readfds, fd_set *writefds,
|
|||
|
||||
end:
|
||||
/*
|
||||
usleep(1000);
|
||||
hl_usleep(1000);
|
||||
*/
|
||||
LEAVE("serial_select");
|
||||
return (1);
|
||||
|
|
|
@ -247,7 +247,7 @@ rc2800_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
|||
retval1 = rc2800_transaction(rot, cmdstr, NULL, 0);
|
||||
|
||||
/* do not overwhelm the MCU? */
|
||||
usleep(200 * 1000);
|
||||
hl_usleep(200 * 1000);
|
||||
|
||||
num_sprintf(cmdstr, "E%3.1f"CR, el);
|
||||
retval2 = rc2800_transaction(rot, cmdstr, NULL, 0);
|
||||
|
@ -333,7 +333,7 @@ rc2800_rot_stop(ROT *rot)
|
|||
if (retval != RIG_OK) { rig_debug(RIG_DEBUG_VERBOSE, "%s: az S command failed?\n", __func__); }
|
||||
|
||||
/* do not overwhelm the MCU? */
|
||||
usleep(200 * 1000);
|
||||
hl_usleep(200 * 1000);
|
||||
|
||||
/* Stop EL*/
|
||||
retval = rc2800_transaction(rot, "E" CR, NULL, 0); /* select EL */
|
||||
|
|
|
@ -31,7 +31,7 @@ AC_CHECK_HEADERS([winioctl.h winbase.h], [], [], [
|
|||
#endif
|
||||
])
|
||||
|
||||
AC_CHECK_FUNCS([getopt getopt_long usleep sleep gettimeofday])
|
||||
AC_CHECK_FUNCS([getopt getopt_long usleep sleep nanosleep gettimeofday])
|
||||
AC_CHECK_TYPES([struct timezone, ssize_t],[],[],[
|
||||
#if HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
|
|
|
@ -580,15 +580,15 @@ pcr_open(RIG *rig)
|
|||
serial_setup(&rs->rigport);
|
||||
|
||||
/* let the pcr settle and flush any remaining data*/
|
||||
usleep(100 * 1000);
|
||||
hl_usleep(100 * 1000);
|
||||
serial_flush(&rs->rigport);
|
||||
|
||||
/* try powering on twice, sometimes the pcr answers H100 (off) */
|
||||
pcr_send(rig, "H101");
|
||||
usleep(100 * 250);
|
||||
hl_usleep(100 * 250);
|
||||
|
||||
pcr_send(rig, "H101");
|
||||
usleep(100 * 250);
|
||||
hl_usleep(100 * 250);
|
||||
|
||||
serial_flush(&rs->rigport);
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ int HAMLIB_API port_open(hamlib_port_t *p)
|
|||
*/
|
||||
if (want_state_delay)
|
||||
{
|
||||
usleep(100 * 1000);
|
||||
hl_usleep(100 * 1000);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -449,7 +449,7 @@ int HAMLIB_API write_block(hamlib_port_t *p, const char *txbuffer, size_t count)
|
|||
/*
|
||||
* optional delay after last write
|
||||
*/
|
||||
usleep(date_delay);
|
||||
hl_sleep(date_delay);
|
||||
}
|
||||
|
||||
p->post_write_date.tv_sec = 0;
|
||||
|
@ -477,7 +477,7 @@ int HAMLIB_API write_block(hamlib_port_t *p, const char *txbuffer, size_t count)
|
|||
return -RIG_EIO;
|
||||
}
|
||||
|
||||
usleep(p->write_delay * 1000);
|
||||
hl_usleep(p->write_delay * 1000);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -511,7 +511,7 @@ int HAMLIB_API write_block(hamlib_port_t *p, const char *txbuffer, size_t count)
|
|||
}
|
||||
else
|
||||
#endif
|
||||
usleep(p->post_write_delay * 1000); /* optional delay after last write */
|
||||
hl_usleep(p->post_write_delay * 1000); /* optional delay after last write */
|
||||
|
||||
/* otherwise some yaesu rigs get confused */
|
||||
/* with sequential fast writes*/
|
||||
|
|
31
src/sleep.c
31
src/sleep.c
|
@ -38,7 +38,32 @@
|
|||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
// In order to stop the usleep warnings in cppcheck we provide our own interface
|
||||
// So this will use system usleep or our usleep depending on availability of nanosleep
|
||||
// This version of usleep can handle > 1000000 usec values
|
||||
int hl_usleep(useconds_t usec)
|
||||
{
|
||||
int retval = 0;
|
||||
|
||||
while (usec > 1000000)
|
||||
{
|
||||
if (retval != 0) { return retval; }
|
||||
|
||||
retval = usleep(1000000);
|
||||
usec -= 1000000;
|
||||
}
|
||||
|
||||
return usleep(usec);
|
||||
}
|
||||
|
||||
#ifdef HAVE_NANOSLEEP
|
||||
unsigned int sleep(unsigned int secs)
|
||||
{
|
||||
int retval;
|
||||
|
@ -53,6 +78,7 @@ unsigned int sleep(unsigned int secs)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Does not have the same 1000000 limit as usleep
|
||||
int usleep(useconds_t usec)
|
||||
{
|
||||
|
@ -70,3 +96,8 @@ int usleep(useconds_t usec)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif // HAVE_NANOSLEEP
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -729,7 +729,7 @@ int tt565_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
}
|
||||
|
||||
/* Orion may need some time to "recover" from ?RxM before ?RxF */
|
||||
usleep(80000); // try 80 ms
|
||||
hl_usleep(80000); // try 80 ms
|
||||
/* Query passband width (filter) */
|
||||
cmd_len = sprintf(cmdbuf, "?R%cF" EOM, ttreceiver);
|
||||
resp_len = sizeof(respbuf);
|
||||
|
@ -1833,7 +1833,7 @@ int tt565_send_morse(RIG *rig, vfo_t vfo, const char *msg)
|
|||
}
|
||||
|
||||
keyer_set = TRUE;
|
||||
usleep(100000); /* 100 msec - guess */
|
||||
hl_usleep(100000); /* 100 msec - guess */
|
||||
}
|
||||
|
||||
msg_len = strlen(msg);
|
||||
|
|
|
@ -512,7 +512,7 @@ int main(int argc, char *argv[])
|
|||
do { // we'll try 5 times and sleep 200ms between tries
|
||||
retcode = rig_open(my_rig);
|
||||
if (retcode != RIG_OK) {
|
||||
usleep(200000);
|
||||
hl_usleep(200000);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: error opening rig, try#%d\n", __func__, i+1);
|
||||
}
|
||||
} while (retcode != RIG_OK && ++i < 5);
|
||||
|
|
|
@ -668,7 +668,7 @@ static int write_block2(void *func,
|
|||
size_t count)
|
||||
{
|
||||
int retval = write_block(p, txbuffer, count);
|
||||
usleep(5000);
|
||||
hl_usleep(5000);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
|
|
|
@ -366,7 +366,7 @@ int main(int argc, char *argv[])
|
|||
while (fabs(azimuth - rot->state.min_az) > 1.)
|
||||
{
|
||||
rot_get_position(rot, &azimuth, &elevation);
|
||||
usleep(step);
|
||||
hl_usleep(step);
|
||||
}
|
||||
|
||||
fprintf(stderr, "Now initiating full 360° rotation...\n");
|
||||
|
|
|
@ -321,7 +321,7 @@ int main(int argc, char *argv[])
|
|||
value_t swr;
|
||||
|
||||
rig_set_ptt(rig, RIG_VFO_CURR, RIG_PTT_ON);
|
||||
usleep(500000);
|
||||
hl_usleep(500000);
|
||||
rig_get_level(rig, RIG_VFO_CURR, RIG_LEVEL_SWR, &swr);
|
||||
rig_set_ptt(rig, RIG_VFO_CURR, RIG_PTT_OFF);
|
||||
|
||||
|
|
|
@ -324,7 +324,7 @@ static void read_7xxx_adc(int adc_result[NUM_CHANNELS][NUM_SAMPLES])
|
|||
//read more samples
|
||||
for (j = 0; j < NUM_SAMPLES; j++)
|
||||
{
|
||||
usleep(10000);
|
||||
hl_usleep(10000);
|
||||
adc_result[i][j] = read_channel(adc_page, cur_ch);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -327,7 +327,7 @@ static void read_7xxx_adc(int adc_result[NUM_CHANNELS][NUM_SAMPLES])
|
|||
//read more samples
|
||||
for (j = 0; j < NUM_SAMPLES; j++)
|
||||
{
|
||||
usleep(10000);
|
||||
hl_usleep(10000);
|
||||
adc_result[i][j] = read_channel(adc_page, cur_ch);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3339,7 +3339,7 @@ int ft1000d_send_static_cmd(RIG *rig, unsigned char ci)
|
|||
return err;
|
||||
}
|
||||
|
||||
usleep(rig_s->rigport.write_delay * 1000);
|
||||
hl_usleep(rig_s->rigport.write_delay * 1000);
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
@ -3402,7 +3402,7 @@ int ft1000d_send_dynamic_cmd(RIG *rig, unsigned char ci,
|
|||
return err;
|
||||
}
|
||||
|
||||
usleep(rig_s->rigport.write_delay * 1000);
|
||||
hl_usleep(rig_s->rigport.write_delay * 1000);
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
@ -3464,7 +3464,7 @@ int ft1000d_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
|
|||
return err;
|
||||
}
|
||||
|
||||
usleep(rig_s->rigport.write_delay * 1000);
|
||||
hl_usleep(rig_s->rigport.write_delay * 1000);
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
@ -3532,7 +3532,7 @@ int ft1000d_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
|
|||
return err;
|
||||
}
|
||||
|
||||
usleep(rig_s->rigport.write_delay * 1000);
|
||||
hl_usleep(rig_s->rigport.write_delay * 1000);
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -381,7 +381,6 @@ int ft757_cleanup(RIG *rig)
|
|||
int ft757_open(RIG *rig)
|
||||
{
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
|
@ -393,7 +392,7 @@ int ft757_open(RIG *rig)
|
|||
else
|
||||
{
|
||||
/* read back the 75 status bytes from FT757GXII */
|
||||
retval = ft757_get_update_data(rig);
|
||||
int retval = ft757_get_update_data(rig);
|
||||
|
||||
if (retval < 0)
|
||||
{
|
||||
|
@ -419,11 +418,6 @@ int ft757_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called. Freq=%"PRIfreq"\n", __func__, freq);
|
||||
|
||||
if (!rig)
|
||||
{
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
/* fill in first four bytes */
|
||||
to_bcd(cmd, freq / 10, BCD_LEN);
|
||||
|
||||
|
@ -482,11 +476,6 @@ int ft757_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
{
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
retval = ft757_get_update_data(rig); /* get whole shebang from rig */
|
||||
|
||||
if (retval < 0)
|
||||
|
@ -526,11 +515,6 @@ int ft757_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
{
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
retval = ft757_get_update_data(rig); /* get whole shebang from rig */
|
||||
|
||||
if (retval < 0)
|
||||
|
@ -573,11 +557,6 @@ int ft757_set_vfo(RIG *rig, vfo_t vfo)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
{
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
switch (vfo)
|
||||
{
|
||||
case RIG_VFO_CURR:
|
||||
|
@ -608,11 +587,6 @@ int ft757_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
{
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
retval = ft757_get_update_data(rig); /* get whole shebang from rig */
|
||||
|
||||
if (retval < 0)
|
||||
|
@ -644,11 +618,6 @@ int ft757_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
{
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
retval = ft757_get_update_data(rig); /* get whole shebang from rig */
|
||||
|
||||
if (retval < 0)
|
||||
|
@ -656,7 +625,7 @@ int ft757_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
|||
return retval;
|
||||
}
|
||||
|
||||
*ptt = priv->update_data[0] & 0x20 ? RIG_PTT_ON : RIG_PTT_OFF;
|
||||
*ptt = (priv->update_data[0] & 0x20) ? RIG_PTT_ON : RIG_PTT_OFF;
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
@ -753,7 +722,7 @@ int ft757_get_update_data(RIG *rig)
|
|||
__func__, retval, FT757GX_STATUS_UPDATE_DATA_LENGTH,
|
||||
nbtries, maxtries);
|
||||
/* The delay is quadratic. */
|
||||
usleep(nbtries * nbtries * 1000000);
|
||||
hl_usleep(nbtries * nbtries * 1000000);
|
||||
}
|
||||
|
||||
if (retval != FT757GX_STATUS_UPDATE_DATA_LENGTH)
|
||||
|
@ -895,7 +864,7 @@ int ft757gx_get_conf(RIG *rig, token_t token, char *val)
|
|||
break;
|
||||
|
||||
default:
|
||||
val = NULL;
|
||||
*val = 0;
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1006,7 +1006,7 @@ int ft817_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
|
||||
if (ptt_response != ptt)
|
||||
{
|
||||
usleep(1000l *
|
||||
hl_usleep(1000l *
|
||||
FT817_RETRY_DELAY); // Wait before next try. Helps with slower rigs cloning FT817 protocol (e.g. MCHF)
|
||||
}
|
||||
|
||||
|
@ -1297,7 +1297,7 @@ int ft817_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
|
|||
rig_force_cache_timeout(&((struct ft817_priv_data *)
|
||||
rig->state.priv)->fm_status_tv);
|
||||
n = ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_VFOAB);
|
||||
usleep(100 * 1000); // rig needs a little time to do this
|
||||
hl_usleep(100 * 1000); // rig needs a little time to do this
|
||||
return n;
|
||||
|
||||
default:
|
||||
|
|
|
@ -2263,7 +2263,7 @@ int newcat_set_powerstat(RIG *rig, powerstat_t status)
|
|||
// when powering on need a dummy byte to wake it up
|
||||
// then sleep from 1 to 2 seconds so we'll do 1.5 secs
|
||||
write_block(&state->rigport, "\n", 1);
|
||||
usleep(1500000);
|
||||
hl_usleep(1500000);
|
||||
break;
|
||||
|
||||
case RIG_POWER_OFF:
|
||||
|
|
Ładowanie…
Reference in New Issue