kopia lustrzana https://github.com/Hamlib/Hamlib
During icom power on 0xfe may get echoed after power on so ensure we look for it and remove it
https://github.com/Hamlib/Hamlib/issues/900pull/910/head
rodzic
e602e7da54
commit
8c5816c53c
|
@ -199,6 +199,16 @@ int icom_one_transaction(RIG *rig, unsigned char cmd, int subcmd,
|
||||||
set_transaction_inactive(rig);
|
set_transaction_inactive(rig);
|
||||||
RETURNFUNC(-RIG_EPROTO);
|
RETURNFUNC(-RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
// we might have 0xfe string during rig wakeup
|
||||||
|
if (retval != frm_len && cmd == C_SET_PWR)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_TRACE, "%s: removing 0xfe power up echo, len=%d", __func__, frm_len);
|
||||||
|
while(buf[2] == 0xfe)
|
||||||
|
{
|
||||||
|
memmove(buf,&buf[1],frm_len--);
|
||||||
|
}
|
||||||
|
dump_hex(buf,frm_len);
|
||||||
|
}
|
||||||
|
|
||||||
switch (buf[retval - 1])
|
switch (buf[retval - 1])
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
#ifndef _FRAME_H
|
#ifndef _FRAME_H
|
||||||
#define _FRAME_H 1
|
#define _FRAME_H 1
|
||||||
|
|
||||||
#define MAXFRAMELEN 80
|
// Has to be big enough for 0xfe sequence to wake up rig
|
||||||
|
#define MAXFRAMELEN 200
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* helper functions
|
* helper functions
|
||||||
|
|
|
@ -7762,8 +7762,6 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
|
||||||
memset(fe_buf, 0xfe, fe_max);
|
memset(fe_buf, 0xfe, fe_max);
|
||||||
// sending more than enough 0xfe's to wake up the rs232
|
// sending more than enough 0xfe's to wake up the rs232
|
||||||
write_block(&rs->rigport, fe_buf, fe_max);
|
write_block(&rs->rigport, fe_buf, fe_max);
|
||||||
hl_usleep(200*1000); // short sleep
|
|
||||||
rig_flush(&rs->rigport); // flush any echo of 0xFE
|
|
||||||
|
|
||||||
// we'll try 0x18 0x01 now -- should work on STBY rigs too
|
// we'll try 0x18 0x01 now -- should work on STBY rigs too
|
||||||
pwr_sc = S_PWR_ON;
|
pwr_sc = S_PWR_ON;
|
||||||
|
@ -7771,7 +7769,6 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
|
||||||
priv->serial_USB_echo_off = 1;
|
priv->serial_USB_echo_off = 1;
|
||||||
retval =
|
retval =
|
||||||
icom_transaction(rig, C_SET_PWR, pwr_sc, NULL, 0, ackbuf, &ack_len);
|
icom_transaction(rig, C_SET_PWR, pwr_sc, NULL, 0, ackbuf, &ack_len);
|
||||||
hl_usleep(4000 * 1000); // give some time to wake up
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue