kopia lustrzana https://github.com/Hamlib/Hamlib
FT-817 status queries honour retries and timeout
This is to help with owners of Arduino boards like the ubitx that emulate an FT-817 but respond badly to a DTR signal glitch which is inevitable when opening a Linux serial port. The glitch triggers the Arduino boot-loader which must be allowed to time out before the FT-817 emulation starts.pull/2/head
rodzic
7806e467fb
commit
09e6ab6ef1
|
@ -177,7 +177,7 @@ const struct rig_caps ft817_caps = {
|
||||||
.write_delay = FT817_WRITE_DELAY,
|
.write_delay = FT817_WRITE_DELAY,
|
||||||
.post_write_delay = FT817_POST_WRITE_DELAY,
|
.post_write_delay = FT817_POST_WRITE_DELAY,
|
||||||
.timeout = FT817_TIMEOUT,
|
.timeout = FT817_TIMEOUT,
|
||||||
.retry = 0,
|
.retry = 3,
|
||||||
.has_get_func = RIG_FUNC_NONE,
|
.has_get_func = RIG_FUNC_NONE,
|
||||||
.has_set_func = RIG_FUNC_LOCK | RIG_FUNC_TONE | RIG_FUNC_TSQL,
|
.has_set_func = RIG_FUNC_LOCK | RIG_FUNC_TONE | RIG_FUNC_TSQL,
|
||||||
.has_get_level = RIG_LEVEL_STRENGTH | RIG_LEVEL_RAWSTR | RIG_LEVEL_RFPOWER,
|
.has_get_level = RIG_LEVEL_STRENGTH | RIG_LEVEL_RAWSTR | RIG_LEVEL_RFPOWER,
|
||||||
|
@ -402,6 +402,7 @@ static int ft817_get_status(RIG *rig, int status)
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
int len;
|
int len;
|
||||||
int n;
|
int n;
|
||||||
|
int retries = rig->state.rigport.retry;
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case FT817_NATIVE_CAT_GET_FREQ_MODE_STATUS:
|
case FT817_NATIVE_CAT_GET_FREQ_MODE_STATUS:
|
||||||
|
@ -424,13 +425,16 @@ static int ft817_get_status(RIG *rig, int status)
|
||||||
return -RIG_EINTERNAL;
|
return -RIG_EINTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_flush(&rig->state.rigport);
|
do
|
||||||
|
{
|
||||||
|
serial_flush(&rig->state.rigport);
|
||||||
|
write_block(&rig->state.rigport, (char *) p->pcs[status].nseq, YAESU_CMD_LENGTH);
|
||||||
|
n = read_block(&rig->state.rigport, (char *) data, len);
|
||||||
|
}
|
||||||
|
while (retries-- && n < 0);
|
||||||
|
|
||||||
write_block(&rig->state.rigport, (char *) p->pcs[status].nseq, YAESU_CMD_LENGTH);
|
if (n < 0)
|
||||||
|
|
||||||
if ((n = read_block(&rig->state.rigport, (char *) data, len)) < 0)
|
|
||||||
return n;
|
return n;
|
||||||
|
|
||||||
if (n != len)
|
if (n != len)
|
||||||
return -RIG_EIO;
|
return -RIG_EIO;
|
||||||
|
|
||||||
|
@ -1153,4 +1157,3 @@ int ft817_mW2power (RIG *rig, float *power, unsigned int mwpower,
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
/*
|
/*
|
||||||
* Read timeout.
|
* Read timeout.
|
||||||
*/
|
*/
|
||||||
#define FT817_TIMEOUT 200
|
#define FT817_TIMEOUT 1000
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The time the TX, RX and FREQ/MODE status are cached (in millisec).
|
* The time the TX, RX and FREQ/MODE status are cached (in millisec).
|
||||||
|
@ -161,10 +161,3 @@ static int ft817_mW2power (RIG *rig, float *power, unsigned int mwpower,
|
||||||
freq_t freq, rmode_t mode);
|
freq_t freq, rmode_t mode);
|
||||||
|
|
||||||
#endif /* _FT817_H */
|
#endif /* _FT817_H */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue