Add RTS/DTR capability to rotctl and ampctl

pull/1347/head
Mike Black W9MDB 2023-07-20 11:58:26 -05:00
rodzic 2f838f2264
commit 2da6c400f7
5 zmienionych plików z 143 dodań i 7 usunięć

Wyświetl plik

@ -268,6 +268,64 @@ int frontamp_set_conf(AMP *amp, token_t token, const char *val)
}
break;
case TOK_RTS_STATE:
if (rs->ampport.type.rig != RIG_PORT_SERIAL)
{
return -RIG_EINVAL;
}
if (!strcmp(val, "Unset"))
{
rs->ampport.parm.serial.rts_state = RIG_SIGNAL_UNSET;
rs->ampport_deprecated.parm.serial.rts_state = RIG_SIGNAL_UNSET;
}
else if (!strcmp(val, "ON"))
{
rs->ampport.parm.serial.rts_state = RIG_SIGNAL_ON;
rs->ampport_deprecated.parm.serial.rts_state = RIG_SIGNAL_ON;
}
else if (!strcmp(val, "OFF"))
{
rs->ampport.parm.serial.rts_state = RIG_SIGNAL_OFF;
rs->ampport_deprecated.parm.serial.rts_state = RIG_SIGNAL_OFF;
}
else
{
return -RIG_EINVAL;
}
break;
case TOK_DTR_STATE:
if (rs->ampport.type.rig != RIG_PORT_SERIAL)
{
return -RIG_EINVAL;
}
if (!strcmp(val, "Unset"))
{
rs->ampport.parm.serial.dtr_state = RIG_SIGNAL_UNSET;
rs->ampport_deprecated.parm.serial.dtr_state = RIG_SIGNAL_UNSET;
}
else if (!strcmp(val, "ON"))
{
rs->ampport.parm.serial.dtr_state = RIG_SIGNAL_ON;
rs->ampport_deprecated.parm.serial.dtr_state = RIG_SIGNAL_ON;
}
else if (!strcmp(val, "OFF"))
{
rs->ampport.parm.serial.dtr_state = RIG_SIGNAL_OFF;
rs->ampport_deprecated.parm.serial.dtr_state = RIG_SIGNAL_OFF;
}
else
{
return -RIG_EINVAL;
}
break;
#if 0

Wyświetl plik

@ -328,6 +328,64 @@ int frontrot_set_conf(ROT *rot, token_t token, const char *val)
rs->south_zero = atoi(val);
break;
case TOK_RTS_STATE:
if (rs->rotport.type.rig != RIG_PORT_SERIAL)
{
return -RIG_EINVAL;
}
if (!strcmp(val, "Unset"))
{
rs->rotport.parm.serial.rts_state = RIG_SIGNAL_UNSET;
rs->rotport_deprecated.parm.serial.rts_state = RIG_SIGNAL_UNSET;
}
else if (!strcmp(val, "ON"))
{
rs->rotport.parm.serial.rts_state = RIG_SIGNAL_ON;
rs->rotport_deprecated.parm.serial.rts_state = RIG_SIGNAL_ON;
}
else if (!strcmp(val, "OFF"))
{
rs->rotport.parm.serial.rts_state = RIG_SIGNAL_OFF;
rs->rotport_deprecated.parm.serial.rts_state = RIG_SIGNAL_OFF;
}
else
{
return -RIG_EINVAL;
}
break;
case TOK_DTR_STATE:
if (rs->rotport.type.rig != RIG_PORT_SERIAL)
{
return -RIG_EINVAL;
}
if (!strcmp(val, "Unset"))
{
rs->rotport.parm.serial.dtr_state = RIG_SIGNAL_UNSET;
rs->rotport_deprecated.parm.serial.dtr_state = RIG_SIGNAL_UNSET;
}
else if (!strcmp(val, "ON"))
{
rs->rotport.parm.serial.dtr_state = RIG_SIGNAL_ON;
rs->rotport_deprecated.parm.serial.dtr_state = RIG_SIGNAL_ON;
}
else if (!strcmp(val, "OFF"))
{
rs->rotport.parm.serial.dtr_state = RIG_SIGNAL_OFF;
rs->rotport_deprecated.parm.serial.dtr_state = RIG_SIGNAL_OFF;
}
else
{
return -RIG_EINVAL;
}
break;
default:
return -RIG_EINVAL;
}

Wyświetl plik

@ -1593,7 +1593,9 @@ void list_models()
int set_conf(AMP *my_amp, char *conf_parms)
{
char *p, *n;
int token;
amp_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
p = conf_parms;
while (p && *p != '\0')
@ -1616,11 +1618,19 @@ int set_conf(AMP *my_amp, char *conf_parms)
*n++ = '\0';
}
ret = amp_set_conf(my_amp, amp_token_lookup(my_amp, p), q);
token = amp_token_lookup(my_amp, p);
if (ret != RIG_OK)
if (token != 0)
{
return ret;
ret = amp_set_conf(my_amp, token, q);
if (ret != RIG_OK)
{
return ret;
}
}
else
{
rig_debug(RIG_DEBUG_WARN, "%s: invalid token %s for this rig\n", __func__, p);
}
p = n;

Wyświetl plik

@ -2031,6 +2031,7 @@ int set_conf(RIG *my_rig, char *conf_parms)
char *p, *n;
int token;
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
p = conf_parms;
while (p && *p != '\0')

Wyświetl plik

@ -1664,6 +1664,7 @@ void list_models()
int set_conf(ROT *my_rot, char *conf_parms)
{
char *p;
int token;
rot_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
p = conf_parms;
@ -1688,12 +1689,20 @@ int set_conf(ROT *my_rot, char *conf_parms)
*n++ = '\0';
}
rig_debug(RIG_DEBUG_TRACE, "%s: token=%s, val=%s\n", __func__, p, q);
ret = rot_set_conf(my_rot, rot_token_lookup(my_rot, p), q);
token = rot_token_lookup(my_rot, p);
if (ret != RIG_OK)
if (token != 0)
{
return ret;
ret = rot_set_conf(my_rot, token, q);
if (ret != RIG_OK)
{
return ret;
}
}
else
{
rig_debug(RIG_DEBUG_WARN, "%s: invalid token %s for this rig\n", __func__, p);
}
p = n;