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/900
pull/910/head
Mike Black W9MDB 2021-12-22 09:16:17 -06:00
rodzic e602e7da54
commit 8c5816c53c
3 zmienionych plików z 12 dodań i 4 usunięć

Wyświetl plik

@ -199,6 +199,16 @@ int icom_one_transaction(RIG *rig, unsigned char cmd, int subcmd,
set_transaction_inactive(rig);
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])
{

Wyświetl plik

@ -22,7 +22,8 @@
#ifndef _FRAME_H
#define _FRAME_H 1
#define MAXFRAMELEN 80
// Has to be big enough for 0xfe sequence to wake up rig
#define MAXFRAMELEN 200
/*
* helper functions

Wyświetl plik

@ -7762,8 +7762,6 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
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); // short sleep
rig_flush(&rs->rigport); // flush any echo of 0xFE
// we'll try 0x18 0x01 now -- should work on STBY rigs too
pwr_sc = S_PWR_ON;
@ -7771,7 +7769,6 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
priv->serial_USB_echo_off = 1;
retval =
icom_transaction(rig, C_SET_PWR, pwr_sc, NULL, 0, ackbuf, &ack_len);
hl_usleep(4000 * 1000); // give some time to wake up
break;