Change rigctl_powerstat message to only show when powerstat shows off and promote to error

pull/1161/head
Mike Black W9MDB 2022-11-26 16:13:41 -06:00
rodzic 58f2549a99
commit 6995986880
1 zmienionych plików z 19 dodań i 12 usunięć

Wyświetl plik

@ -371,7 +371,7 @@ static struct test_table test_list[] =
{ 0xa1, "get_separator", ACTION(get_separator), ARG_NOVFO, "Separator" },
{ 0xa2, "set_lock_mode", ACTION(set_lock_mode), ARG_IN | ARG_NOVFO, "Locked" },
{ 0xa3, "get_lock_mode", ACTION(get_lock_mode), ARG_NOVFO, "Locked" },
{ 0xa4, "send_raw", ACTION(send_raw), ARG_NOVFO | ARG_IN1 | ARG_IN2 | ARG_OUT3, "Terminator", "Command","Send raw answer" },
{ 0xa4, "send_raw", ACTION(send_raw), ARG_NOVFO | ARG_IN1 | ARG_IN2 | ARG_OUT3, "Terminator", "Command", "Send raw answer" },
{ 0x00, "", NULL },
};
@ -1728,15 +1728,18 @@ readline_repeat:
else
{
if (my_rig->caps->set_powerstat && (rig_powerstat == RIG_POWER_OFF || rig_powerstat == RIG_POWER_STANDBY))
if (my_rig->caps->set_powerstat && (rig_powerstat == RIG_POWER_OFF
|| rig_powerstat == RIG_POWER_STANDBY))
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: rig_powerstat is not on = %d\n", __func__,
rig_powerstat);
// Update power status
powerstat_t stat = RIG_POWER_ON;
retcode = rig_get_powerstat(my_rig, &stat);
if (retcode == RIG_OK) { rig_powerstat = stat; }
if (rig_powerstat != RIG_POWER_ON) { rig_debug(RIG_DEBUG_ERR,
"%s: rig_powerstat is not on = %d\n", __func__,
rig_powerstat); }
}
// Allow only certain commands when the rig is powered off
@ -5378,15 +5381,19 @@ declare_proto_rig(send_raw)
int buf_len = sizeof(buf);
int val = 0;
if (strcmp(arg1, ";")==0) term[0] = ';';
else if (strcasecmp(arg1, "CR")) term[0] = 0x0d;
else if (strcasecmp(arg1, "LF")) term[0] = 0x0a;
else if (strcasecmp(arg1, "ICOM")) term[0] = 0xfd;
else if (sscanf(arg1,"%d",&val)==1) { term[0]=0; buf_len = val;}
else {
rig_debug(RIG_DEBUG_ERR, "%s: unknown arg1 val=%s, expected ';' 'CR' 'LF' 'ICOM' or # of bytes where 0 means no reply and -1 means unknown", __func__, arg1);
if (strcmp(arg1, ";") == 0) { term[0] = ';'; }
else if (strcasecmp(arg1, "CR")) { term[0] = 0x0d; }
else if (strcasecmp(arg1, "LF")) { term[0] = 0x0a; }
else if (strcasecmp(arg1, "ICOM")) { term[0] = 0xfd; }
else if (sscanf(arg1, "%d", &val) == 1) { term[0] = 0; buf_len = val;}
else
{
rig_debug(RIG_DEBUG_ERR,
"%s: unknown arg1 val=%s, expected ';' 'CR' 'LF' 'ICOM' or # of bytes where 0 means no reply and -1 means unknown",
__func__, arg1);
return -RIG_EINVAL;
}
if (strncmp(arg2, "0x", 2) == 0)
{
arg2_len = parse_hex(arg2, send, sizeof(send));
@ -5397,7 +5404,7 @@ declare_proto_rig(send_raw)
rig_debug(RIG_DEBUG_TRACE, "%s:\n", __func__);
reply_len = rig_send_raw(rig, (unsigned char *)sendp, arg2_len, buf,
buf_len, term);
buf[buf_len+1] = 0; // null terminate in case it's a string
buf[buf_len + 1] = 0; // null terminate in case it's a string
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
{