pull/1191/head
Mike Black W9MDB 2022-12-08 22:37:22 -06:00
rodzic 9eddf62687
commit aa50482c83
1 zmienionych plików z 67 dodań i 51 usunięć

Wyświetl plik

@ -82,20 +82,24 @@ static int flir_request(ROT *rot, char *request, char *response,
{
return_value = write_block(&rot->state.rotport, (unsigned char *)request,
strlen(request));
if (return_value != RIG_OK)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s request not OK\n", __func__);
return return_value;
}
}
//Is a direct response expected?
if (response != NULL)
{
while (retry_read < rot->state.rotport.retry)
{
memset(response, 0, (size_t)resp_size);
read_char = read_string(&rot->state.rotport, (unsigned char *)response, resp_size,
read_char = read_string(&rot->state.rotport, (unsigned char *)response,
resp_size,
"\r\n", sizeof("\r\n"), 0, 1);
if (read_char > 0)
{
if (response[0] == '*')
@ -110,8 +114,10 @@ static int flir_request(ROT *rot, char *request, char *response,
}
}
retry_read++;
}
response = "";
rig_debug(RIG_DEBUG_VERBOSE, "timeout for command %s\n", request);
return -RIG_ETIMEOUT;
@ -191,18 +197,21 @@ static int flir_open(ROT *rot)
if (flir_request(rot, "PR\n", return_str, MAXBUF) == RIG_OK)
{
sscanf(return_str, "* %f", &resolution_pp);
rig_debug(RIG_DEBUG_VERBOSE, "PAN resolution: %f arcsecs per position\n", resolution_pp);
rig_debug(RIG_DEBUG_VERBOSE, "PAN resolution: %f arcsecs per position\n",
resolution_pp);
priv->resolution_pp = resolution_pp;
}
else
{
return_value = -RIG_EPROTO;
}
// Get TILT resolution in arcsecs
if (flir_request(rot, "TR\n", return_str, MAXBUF) == RIG_OK)
{
sscanf(return_str, "* %f", &resolution_tp);
rig_debug(RIG_DEBUG_VERBOSE, "TILT resolution: %f arcsecs per position\n", resolution_tp);
rig_debug(RIG_DEBUG_VERBOSE, "TILT resolution: %f arcsecs per position\n",
resolution_tp);
priv->resolution_tp = resolution_tp;
}
else
@ -333,15 +342,18 @@ static int flir_reset(ROT *rot, rot_reset_t reset)
{
int return_value = RIG_OK;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (reset != 0)
{
return_value = flir_request(rot, "r\n", NULL, 0);
// After Reset: Disable Hard Limits
if (return_value == RIG_OK)
{
return_value = flir_request(rot, "LD\n", NULL, MAXBUF);
}
}
return return_value;
}
@ -386,15 +398,19 @@ static const char *flir_get_info(ROT *rot)
sprintf(priv->info, "No Info");
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (flir_request(rot, "V\n", firmware_str, 120) != RIG_OK)
{
return "No Info available";
}
hl_usleep(500000);
if (flir_request(rot, "O\n", info_str, 100) != RIG_OK)
{
return "No Info available";
}
sprintf(priv->info, "Firmware: %s\nPower: %s", firmware_str, info_str);
return priv->info;