kopia lustrzana https://github.com/Hamlib/Hamlib
FT817/FT818 Drop pcs and use ncmd direct
rodzic
01ac8022e1
commit
485612008f
|
@ -73,8 +73,6 @@
|
|||
|
||||
struct ft817_priv_data
|
||||
{
|
||||
yaesu_cmd_set_t pcs[FT817_NATIVE_SIZE]; /* TODO: why? */
|
||||
|
||||
/* rx status */
|
||||
struct timeval rx_status_tv;
|
||||
unsigned char rx_status;
|
||||
|
@ -497,8 +495,6 @@ const struct rig_caps ft818_caps =
|
|||
|
||||
int ft817_init(RIG *rig)
|
||||
{
|
||||
struct ft817_priv_data *priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called, version %s\n", __func__,
|
||||
rig->caps->version);
|
||||
|
||||
|
@ -509,9 +505,6 @@ int ft817_init(RIG *rig)
|
|||
|
||||
priv = rig->state.priv;
|
||||
|
||||
/* Copy complete native cmd set to private cmd storage area */
|
||||
memcpy(priv->pcs, ncmd, sizeof(ncmd));
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
@ -582,12 +575,11 @@ static int check_cache_timeout(struct timeval *tv)
|
|||
|
||||
static int ft817_read_eeprom(RIG *rig, unsigned short addr, unsigned char *out)
|
||||
{
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
|
||||
unsigned char data[YAESU_CMD_LENGTH];
|
||||
int n;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
memcpy(data, (char *)p->pcs[FT817_NATIVE_CAT_EEPROM_READ].nseq,
|
||||
memcpy(data, ncmd[FT817_NATIVE_CAT_EEPROM_READ].nseq,
|
||||
YAESU_CMD_LENGTH);
|
||||
|
||||
data[0] = addr >> 8;
|
||||
|
@ -649,7 +641,7 @@ static int ft817_get_status(RIG *rig, int status)
|
|||
do
|
||||
{
|
||||
rig_flush(&rig->state.rigport);
|
||||
write_block(&rig->state.rigport, (char *) p->pcs[status].nseq,
|
||||
write_block(&rig->state.rigport, (char *) ncmd[status].nseq,
|
||||
YAESU_CMD_LENGTH);
|
||||
n = read_block(&rig->state.rigport, (char *) data, len);
|
||||
}
|
||||
|
@ -1082,18 +1074,16 @@ int ft817_read_ack(RIG *rig)
|
|||
*/
|
||||
static int ft817_send_cmd(RIG *rig, int index)
|
||||
{
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
|
||||
if (p->pcs[index].ncomp == 0)
|
||||
if (ncmd[index].ncomp == 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: Incomplete sequence\n", __func__);
|
||||
return -RIG_EINTERNAL;
|
||||
}
|
||||
|
||||
rig_flush(&rig->state.rigport);
|
||||
write_block(&rig->state.rigport, (char *) p->pcs[index].nseq, YAESU_CMD_LENGTH);
|
||||
write_block(&rig->state.rigport, (char *) ncmd[index].nseq, YAESU_CMD_LENGTH);
|
||||
return ft817_read_ack(rig);
|
||||
}
|
||||
|
||||
|
@ -1102,18 +1092,17 @@ static int ft817_send_cmd(RIG *rig, int index)
|
|||
*/
|
||||
static int ft817_send_icmd(RIG *rig, int index, unsigned char *data)
|
||||
{
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
|
||||
unsigned char cmd[YAESU_CMD_LENGTH];
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
|
||||
if (p->pcs[index].ncomp == 1)
|
||||
if (ncmd[index].ncomp == 1)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: Complete sequence\n", __func__);
|
||||
return -RIG_EINTERNAL;
|
||||
}
|
||||
|
||||
cmd[YAESU_CMD_LENGTH - 1] = p->pcs[index].nseq[YAESU_CMD_LENGTH - 1];
|
||||
cmd[YAESU_CMD_LENGTH - 1] = ncmd[index].nseq[YAESU_CMD_LENGTH - 1];
|
||||
memcpy(cmd, data, YAESU_CMD_LENGTH - 1);
|
||||
|
||||
write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH);
|
||||
|
@ -1512,8 +1501,6 @@ int ft817_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
|
|||
|
||||
int ft817_set_powerstat(RIG *rig, powerstat_t status)
|
||||
{
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
|
||||
switch (status)
|
||||
|
@ -1524,9 +1511,9 @@ int ft817_set_powerstat(RIG *rig, powerstat_t status)
|
|||
case RIG_POWER_ON:
|
||||
// send 5 bytes first, snooze a bit, then PWR_ON
|
||||
write_block(&rig->state.rigport,
|
||||
(char *) p->pcs[FT817_NATIVE_CAT_PWR_WAKE].nseq, YAESU_CMD_LENGTH);
|
||||
(char *) ncmd[FT817_NATIVE_CAT_PWR_WAKE].nseq, YAESU_CMD_LENGTH);
|
||||
hl_usleep(200 * 1000);
|
||||
write_block(&rig->state.rigport, (char *) p->pcs[FT817_NATIVE_CAT_PWR_ON].nseq,
|
||||
write_block(&rig->state.rigport, (char *) ncmd[FT817_NATIVE_CAT_PWR_ON].nseq,
|
||||
YAESU_CMD_LENGTH);
|
||||
return RIG_OK;
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue