kopia lustrzana https://github.com/Hamlib/Hamlib
astyle flir.c
rodzic
9eddf62687
commit
aa50482c83
|
@ -82,23 +82,27 @@ 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)
|
||||
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 (read_char > 0)
|
||||
{
|
||||
if(response[0] == '*')
|
||||
if (response[0] == '*')
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "accepted command %s\n", request);
|
||||
return RIG_OK;
|
||||
|
@ -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;
|
||||
|
@ -188,21 +194,24 @@ static int flir_open(ROT *rot)
|
|||
return_value = flir_request(rot, "FT\n", return_str, MAXBUF);
|
||||
|
||||
// Get PAN resolution in arcsecs
|
||||
if(flir_request(rot, "PR\n", return_str, MAXBUF) == RIG_OK)
|
||||
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)
|
||||
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
|
||||
|
@ -267,7 +276,7 @@ static int flir_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
|||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
||||
if(flir_request(rot, "PP\n", return_str, MAXBUF) == RIG_OK)
|
||||
if (flir_request(rot, "PP\n", return_str, MAXBUF) == RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "PP Return String: %s\n", return_str);
|
||||
sscanf(return_str, "* %d", &pan_positions);
|
||||
|
@ -280,7 +289,7 @@ static int flir_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
|||
return_value = -RIG_EPROTO;
|
||||
}
|
||||
|
||||
if(flir_request(rot, "TP\n", return_str, MAXBUF) == RIG_OK)
|
||||
if (flir_request(rot, "TP\n", return_str, MAXBUF) == RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "TP Return String: %s\n", return_str);
|
||||
sscanf(return_str, "* %d", &tilt_positions);
|
||||
|
@ -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)
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
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;
|
||||
|
|
Ładowanie…
Reference in New Issue