mirror of
https://github.com/Hamlib/Hamlib.git
synced 2024-09-21 10:27:18 +00:00
Use macros/pointers for rot->state references
This commit is contained in:
parent
105a411c74
commit
c28caa7a9c
@ -34,6 +34,7 @@ static int
|
||||
if100_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||
{
|
||||
hamlib_port_t *port = ROTPORT(rot);
|
||||
struct rot_state *rs = ROTSTATE(rot);
|
||||
int retval;
|
||||
int az_i;
|
||||
int el_i;
|
||||
@ -42,10 +43,10 @@ if100_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __func__, az, el);
|
||||
|
||||
az_scale = 255. / (rot->state.max_az - rot->state.min_az);
|
||||
az_scale = 255. / (rs->max_az - rs->min_az);
|
||||
el_scale = 255. / 180;
|
||||
|
||||
az_i = (int)round((az - rot->state.min_az) * az_scale);
|
||||
az_i = (int)round((az - rs->min_az) * az_scale);
|
||||
el_i = (int)round(el * el_scale);
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s output az: %d el: %d\n", __func__, az_i, el_i);
|
||||
|
@ -49,7 +49,7 @@ androidsensor_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __func__, az, el);
|
||||
// cppcheck-suppress cstyleCast
|
||||
struct androidsensor_rot_priv_data *priv = (struct androidsensor_rot_priv_data *)rot->state.priv;
|
||||
struct androidsensor_rot_priv_data *priv = (struct androidsensor_rot_priv_data *)ROTSTATE(rot)->priv;
|
||||
|
||||
priv->target_az = az;
|
||||
priv->target_el = el;
|
||||
@ -61,7 +61,7 @@ androidsensor_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called: ", __func__);
|
||||
// cppcheck-suppress cstyleCast
|
||||
struct androidsensor_rot_priv_data *priv = (struct androidsensor_rot_priv_data *)rot->state.priv;
|
||||
struct androidsensor_rot_priv_data *priv = (struct androidsensor_rot_priv_data *)ROTSTATE(rot)->priv;
|
||||
|
||||
priv->imu->update();
|
||||
|
||||
@ -87,11 +87,11 @@ androidsensor_rot_init(ROT *rot)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called, make new NdkImu\n", __func__);
|
||||
// cppcheck-suppress cstyleCast
|
||||
rot->state.priv = (struct androidsensor_rot_priv_data *)malloc(sizeof(struct androidsensor_rot_priv_data));
|
||||
ROTSTATE(rot)->priv = (struct androidsensor_rot_priv_data *)malloc(sizeof(struct androidsensor_rot_priv_data));
|
||||
// cppcheck-suppress cstyleCast
|
||||
struct androidsensor_rot_priv_data *priv = (struct androidsensor_rot_priv_data *)rot->state.priv;
|
||||
struct androidsensor_rot_priv_data *priv = (struct androidsensor_rot_priv_data *)ROTSTATE(rot)->priv;
|
||||
|
||||
if (!rot->state.priv)
|
||||
if (!ROTSTATE(rot)->priv)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
@ -107,10 +107,11 @@ androidsensor_rot_cleanup(ROT *rot)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called, delete imu\n", __func__);
|
||||
// cppcheck-suppress cstyleCast
|
||||
struct androidsensor_rot_priv_data *priv = (struct androidsensor_rot_priv_data *)rot->state.priv;
|
||||
struct androidsensor_rot_priv_data *priv = (struct androidsensor_rot_priv_data *)ROTSTATE(rot)->priv;
|
||||
|
||||
delete priv->imu;
|
||||
free(rot->state.priv);
|
||||
free(ROTSTATE(rot)->priv);
|
||||
ROTSTATE(rot) = NULL;
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ static void *handle_set_position(void *);
|
||||
static int ars_clear_ctrl_pin(ROT *rot, unsigned char pin)
|
||||
{
|
||||
hamlib_port_t *pport = ROTPORT(rot);
|
||||
struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv;
|
||||
struct ars_priv_data *priv = (struct ars_priv_data *)ROTSTATE(rot)->priv;
|
||||
|
||||
priv->pp_control &= ~pin;
|
||||
|
||||
@ -102,7 +102,7 @@ static int ars_clear_ctrl_pin(ROT *rot, unsigned char pin)
|
||||
static int ars_set_ctrl_pin(ROT *rot, unsigned char pin)
|
||||
{
|
||||
hamlib_port_t *pport = ROTPORT(rot);
|
||||
struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv;
|
||||
struct ars_priv_data *priv = (struct ars_priv_data *)ROTSTATE(rot)->priv;
|
||||
|
||||
priv->pp_control |= pin;
|
||||
|
||||
@ -112,7 +112,7 @@ static int ars_set_ctrl_pin(ROT *rot, unsigned char pin)
|
||||
static int ars_clear_data_pin(ROT *rot, unsigned char pin)
|
||||
{
|
||||
hamlib_port_t *pport = ROTPORT(rot);
|
||||
struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv;
|
||||
struct ars_priv_data *priv = (struct ars_priv_data *)ROTSTATE(rot)->priv;
|
||||
|
||||
priv->pp_data &= ~pin;
|
||||
|
||||
@ -122,7 +122,7 @@ static int ars_clear_data_pin(ROT *rot, unsigned char pin)
|
||||
static int ars_set_data_pin(ROT *rot, unsigned char pin)
|
||||
{
|
||||
hamlib_port_t *pport = ROTPORT(rot);
|
||||
struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv;
|
||||
struct ars_priv_data *priv = (struct ars_priv_data *)ROTSTATE(rot)->priv;
|
||||
|
||||
priv->pp_data |= pin;
|
||||
|
||||
@ -146,16 +146,16 @@ ars_init(ROT *rot)
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
rot->state.priv = (struct ars_priv_data *)calloc(1,
|
||||
ROTSTATE(rot)->priv = (struct ars_priv_data *)calloc(1,
|
||||
sizeof(struct ars_priv_data));
|
||||
|
||||
if (!rot->state.priv)
|
||||
if (!ROTSTATE(rot)->priv)
|
||||
{
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rot->state.priv;
|
||||
priv = ROTSTATE(rot)->priv;
|
||||
|
||||
priv->pp_control = 0;
|
||||
priv->pp_data = 0;
|
||||
@ -177,10 +177,10 @@ ars_cleanup(ROT *rot)
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (rot->state.priv)
|
||||
if (ROTSTATE(rot)->priv)
|
||||
{
|
||||
free(rot->state.priv);
|
||||
rot->state.priv = NULL;
|
||||
free(ROTSTATE(rot)->priv);
|
||||
ROTSTATE(rot)->priv = NULL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
@ -194,7 +194,7 @@ ars_open(ROT *rot)
|
||||
|
||||
#ifdef HAVE_PTHREAD
|
||||
{
|
||||
struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv;
|
||||
struct ars_priv_data *priv = (struct ars_priv_data *)ROTSTATE(rot)->priv;
|
||||
pthread_attr_t attr;
|
||||
int retcode;
|
||||
|
||||
@ -220,7 +220,7 @@ int
|
||||
ars_close(ROT *rot)
|
||||
{
|
||||
#ifdef HAVE_PTHREAD
|
||||
struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv;
|
||||
struct ars_priv_data *priv = (struct ars_priv_data *)ROTSTATE(rot)->priv;
|
||||
|
||||
pthread_cancel(priv->thread);
|
||||
#endif
|
||||
@ -234,7 +234,7 @@ ars_close(ROT *rot)
|
||||
int
|
||||
ars_stop(ROT *rot)
|
||||
{
|
||||
struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv;
|
||||
struct ars_priv_data *priv = (struct ars_priv_data *)ROTSTATE(rot)->priv;
|
||||
hamlib_port_t *pport = ROTPORT(rot);
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called, brake was %s\n", __func__,
|
||||
@ -264,7 +264,7 @@ ars_stop(ROT *rot)
|
||||
int
|
||||
ars_move(ROT *rot, int direction, int speed)
|
||||
{
|
||||
struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv;
|
||||
struct ars_priv_data *priv = (struct ars_priv_data *)ROTSTATE(rot)->priv;
|
||||
hamlib_port_t *pport = ROTPORT(rot);
|
||||
int need_settle_delay = 0;
|
||||
|
||||
@ -425,7 +425,7 @@ static int angle_in_range(float angle, float angle_base, float range)
|
||||
static void *handle_set_position(void *arg)
|
||||
{
|
||||
ROT *rot = (ROT *) arg;
|
||||
struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv;
|
||||
struct ars_priv_data *priv = (struct ars_priv_data *)ROTSTATE(rot)->priv;
|
||||
int retcode;
|
||||
|
||||
while (1)
|
||||
@ -583,7 +583,7 @@ int
|
||||
ars_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||
{
|
||||
#ifdef HAVE_PTHREAD
|
||||
struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv;
|
||||
struct ars_priv_data *priv = (struct ars_priv_data *)ROTSTATE(rot)->priv;
|
||||
|
||||
/* will be picked by handle_set_position() next polling tick */
|
||||
priv->target_az = az;
|
||||
@ -606,8 +606,8 @@ static int comparunsigned(const void *a, const void *b)
|
||||
int
|
||||
ars_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
||||
{
|
||||
const struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv;
|
||||
struct rot_state *rs = &rot->state;
|
||||
const struct ars_priv_data *priv = (struct ars_priv_data *)ROTSTATE(rot)->priv;
|
||||
struct rot_state *rs = ROTSTATE(rot);
|
||||
hamlib_port_t *pport = ROTPORT(rot);
|
||||
int i, num_sample;
|
||||
unsigned az_samples[NUM_SAMPLES], az_value;
|
||||
|
@ -273,7 +273,7 @@ easycomm_rot_move(ROT *rot, int direction, int speed)
|
||||
|
||||
static int easycomm_rot_move_velocity(ROT *rot, int direction, int speed)
|
||||
{
|
||||
struct rot_state *rs = &rot->state;
|
||||
struct rot_state *rs = ROTSTATE(rot);
|
||||
char cmdstr[24];
|
||||
int retval;
|
||||
int easycomm_speed;
|
||||
@ -334,7 +334,7 @@ static int easycomm_rot_move_velocity(ROT *rot, int direction, int speed)
|
||||
|
||||
static int easycomm_rot_get_level(ROT *rot, setting_t level, value_t *val)
|
||||
{
|
||||
const struct rot_state *rs = &rot->state;
|
||||
const struct rot_state *rs = ROTSTATE(rot);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level));
|
||||
|
||||
@ -354,7 +354,7 @@ static int easycomm_rot_get_level(ROT *rot, setting_t level, value_t *val)
|
||||
|
||||
static int easycomm_rot_set_level(ROT *rot, setting_t level, value_t val)
|
||||
{
|
||||
struct rot_state *rs = &rot->state;
|
||||
struct rot_state *rs = ROTSTATE(rot);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level));
|
||||
|
||||
@ -528,7 +528,7 @@ static int easycomm_rot_set_conf(ROT *rot, hamlib_token_t token, const char *val
|
||||
|
||||
static int easycomm_rot_init(ROT *rot)
|
||||
{
|
||||
struct rot_state *rs = &rot->state;
|
||||
struct rot_state *rs = ROTSTATE(rot);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
@ -85,7 +85,7 @@ static int ether_rot_open(ROT *rot)
|
||||
int ret;
|
||||
int sval;
|
||||
float min_az, max_az, min_el, max_el;
|
||||
struct rot_state *rs = &rot->state;
|
||||
struct rot_state *rs = ROTSTATE(rot);
|
||||
|
||||
char cmd[CMD_MAX];
|
||||
char buf[BUF_MAX];
|
||||
@ -259,7 +259,7 @@ static int ether_rot_reset(ROT *rot, rot_reset_t reset)
|
||||
*/
|
||||
static int ether_rot_move(ROT *rot, int direction, int speed)
|
||||
{
|
||||
struct rot_state *rs = &rot->state;
|
||||
struct rot_state *rs = ROTSTATE(rot);
|
||||
int ret;
|
||||
char cmd[CMD_MAX];
|
||||
char buf[BUF_MAX];
|
||||
@ -308,7 +308,7 @@ static int ether_rot_move(ROT *rot, int direction, int speed)
|
||||
|
||||
static int ether_rot_get_level(ROT *rot, setting_t level, value_t *val)
|
||||
{
|
||||
const struct rot_state *rs = &rot->state;
|
||||
const struct rot_state *rs = ROTSTATE(rot);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level));
|
||||
|
||||
@ -328,7 +328,7 @@ static int ether_rot_get_level(ROT *rot, setting_t level, value_t *val)
|
||||
|
||||
static int ether_rot_set_level(ROT *rot, setting_t level, value_t val)
|
||||
{
|
||||
struct rot_state *rs = &rot->state;
|
||||
struct rot_state *rs = ROTSTATE(rot);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level));
|
||||
|
||||
@ -370,7 +370,7 @@ static const char *ether_rot_get_info(ROT *rot)
|
||||
|
||||
static int ether_rot_init(ROT *rot)
|
||||
{
|
||||
struct rot_state *rs = &rot->state;
|
||||
struct rot_state *rs = ROTSTATE(rot);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
@ -134,15 +134,15 @@ static int flir_init(ROT *rot)
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
rot->state.priv = (struct flir_priv_data *)
|
||||
ROTSTATE(rot)->priv = (struct flir_priv_data *)
|
||||
calloc(1, sizeof(struct flir_priv_data));
|
||||
|
||||
if (!rot->state.priv)
|
||||
if (!ROTSTATE(rot)->priv)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rot->state.priv;
|
||||
priv = ROTSTATE(rot)->priv;
|
||||
|
||||
priv->az = priv->el = 0;
|
||||
|
||||
@ -159,7 +159,7 @@ static int flir_init(ROT *rot)
|
||||
static int flir_cleanup(ROT *rot)
|
||||
{
|
||||
struct flir_priv_data *priv = (struct flir_priv_data *)
|
||||
rot->state.priv;
|
||||
ROTSTATE(rot)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
@ -167,9 +167,9 @@ static int flir_cleanup(ROT *rot)
|
||||
free(priv->ext_levels);
|
||||
free(priv->ext_parms);
|
||||
free(priv->magic_conf);
|
||||
free(rot->state.priv);
|
||||
free(ROTSTATE(rot)->priv);
|
||||
|
||||
rot->state.priv = NULL;
|
||||
ROTSTATE(rot)->priv = NULL;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
@ -183,7 +183,7 @@ static int flir_open(ROT *rot)
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
priv = rot->state.priv;
|
||||
priv = ROTSTATE(rot)->priv;
|
||||
|
||||
// Disable ECHO
|
||||
return_value = flir_request(rot, "ED\n", NULL, MAXBUF);
|
||||
@ -255,7 +255,7 @@ static int flir_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||
char return_str[MAXBUF];
|
||||
char cmd_str[MAXBUF];
|
||||
struct flir_priv_data *priv = (struct flir_priv_data *)
|
||||
rot->state.priv;
|
||||
ROTSTATE(rot)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %.2f %.2f\n", __func__,
|
||||
az, el);
|
||||
@ -281,7 +281,7 @@ static int flir_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
||||
int32_t pan_positions, tilt_positions;
|
||||
|
||||
struct flir_priv_data *priv = (struct flir_priv_data *)
|
||||
rot->state.priv;
|
||||
ROTSTATE(rot)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
@ -320,7 +320,7 @@ static int flir_stop(ROT *rot)
|
||||
int return_value = RIG_OK;
|
||||
|
||||
struct flir_priv_data *priv = (struct flir_priv_data *)
|
||||
rot->state.priv;
|
||||
ROTSTATE(rot)->priv;
|
||||
azimuth_t az;
|
||||
elevation_t el;
|
||||
|
||||
@ -384,7 +384,7 @@ static int flir_reset(ROT *rot, rot_reset_t reset)
|
||||
static int flir_move(ROT *rot, int direction, int speed)
|
||||
{
|
||||
struct flir_priv_data *priv = (struct flir_priv_data *)
|
||||
rot->state.priv;
|
||||
ROTSTATE(rot)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: Direction = %d, Speed = %d\n", __func__,
|
||||
@ -417,7 +417,7 @@ static const char *flir_get_info(ROT *rot)
|
||||
char info_str[101];
|
||||
|
||||
struct flir_priv_data *priv = (struct flir_priv_data *)
|
||||
rot->state.priv;
|
||||
ROTSTATE(rot)->priv;
|
||||
|
||||
sprintf(priv->info, "No Info");
|
||||
|
||||
@ -503,7 +503,7 @@ static int flir_get_ext_parm(ROT *rot, hamlib_token_t token, value_t *val)
|
||||
static int flir_get_status(ROT *rot, rot_status_t *status)
|
||||
{
|
||||
const struct flir_priv_data *priv = (struct flir_priv_data *)
|
||||
rot->state.priv;
|
||||
ROTSTATE(rot)->priv;
|
||||
*status = priv->status;
|
||||
|
||||
return RIG_OK;
|
||||
|
@ -146,14 +146,14 @@ fodtrack_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||
|
||||
pport = ROTPORT(rot);
|
||||
|
||||
retval = setDirection(pport, el / (float)rot->state.max_el * 255.0, 0);
|
||||
retval = setDirection(pport, el / (float)ROTSTATE(rot)->max_el * 255.0, 0);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
retval = setDirection(pport, az / (float)rot->state.max_az * 255.0, 1);
|
||||
retval = setDirection(pport, az / (float)ROTSTATE(rot)->max_az * 255.0, 1);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
|
@ -234,7 +234,7 @@ gs232a_rot_stop(ROT *rot)
|
||||
|
||||
static int gs232a_rot_get_level(ROT *rot, setting_t level, value_t *val)
|
||||
{
|
||||
const struct rot_state *rs = &rot->state;
|
||||
const struct rot_state *rs = ROTSTATE(rot);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level));
|
||||
|
||||
@ -254,7 +254,7 @@ static int gs232a_rot_get_level(ROT *rot, setting_t level, value_t *val)
|
||||
|
||||
static int gs232a_rot_set_level(ROT *rot, setting_t level, value_t val)
|
||||
{
|
||||
struct rot_state *rs = &rot->state;
|
||||
struct rot_state *rs = ROTSTATE(rot);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level));
|
||||
|
||||
@ -362,7 +362,7 @@ static int gs232a_rot_move(ROT *rot, int direction, int speed)
|
||||
|
||||
static int gs232a_rot_init(ROT *rot)
|
||||
{
|
||||
struct rot_state *rs = &rot->state;
|
||||
struct rot_state *rs = ROTSTATE(rot);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
@ -265,7 +265,7 @@ gs232b_rot_stop(ROT *rot)
|
||||
|
||||
static int gs232b_rot_get_level(ROT *rot, setting_t level, value_t *val)
|
||||
{
|
||||
const struct rot_state *rs = &rot->state;
|
||||
const struct rot_state *rs = ROTSTATE(rot);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level));
|
||||
|
||||
@ -285,7 +285,7 @@ static int gs232b_rot_get_level(ROT *rot, setting_t level, value_t *val)
|
||||
|
||||
static int gs232b_rot_set_level(ROT *rot, setting_t level, value_t val)
|
||||
{
|
||||
struct rot_state *rs = &rot->state;
|
||||
struct rot_state *rs = ROTSTATE(rot);
|
||||
char cmdstr[24];
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level));
|
||||
@ -394,7 +394,7 @@ static int gs232b_rot_move(ROT *rot, int direction, int speed)
|
||||
|
||||
static int gs232b_rot_init(ROT *rot)
|
||||
{
|
||||
struct rot_state *rs = &rot->state;
|
||||
struct rot_state *rs = ROTSTATE(rot);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
@ -115,15 +115,15 @@ static int hd1780_rot_init(ROT *rot)
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
rot->state.priv = (struct hd1780_rot_priv_data *)
|
||||
ROTSTATE(rot)->priv = (struct hd1780_rot_priv_data *)
|
||||
calloc(1, sizeof(struct hd1780_rot_priv_data));
|
||||
|
||||
if (!rot->state.priv)
|
||||
if (!ROTSTATE(rot)->priv)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rot->state.priv;
|
||||
priv = ROTSTATE(rot)->priv;
|
||||
|
||||
ROTPORT(rot)->type.rig = RIG_PORT_SERIAL;
|
||||
|
||||
@ -146,12 +146,12 @@ static int hd1780_rot_cleanup(ROT *rot)
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (rot->state.priv)
|
||||
if (ROTSTATE(rot)->priv)
|
||||
{
|
||||
free(rot->state.priv);
|
||||
free(ROTSTATE(rot)->priv);
|
||||
}
|
||||
|
||||
rot->state.priv = NULL;
|
||||
ROTSTATE(rot)->priv = NULL;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -159,15 +159,15 @@ static int meade_init(ROT *rot)
|
||||
{
|
||||
struct meade_priv_data *priv;
|
||||
|
||||
rot->state.priv = (struct meade_priv_data *)
|
||||
ROTSTATE(rot)->priv = (struct meade_priv_data *)
|
||||
calloc(1, sizeof(struct meade_priv_data));
|
||||
|
||||
if (!rot->state.priv)
|
||||
if (!ROTSTATE(rot)->priv)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rot->state.priv;
|
||||
priv = ROTSTATE(rot)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called version %s\n", __func__,
|
||||
rot->caps->version);
|
||||
@ -187,12 +187,12 @@ static int meade_cleanup(ROT *rot)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
if (rot->state.priv)
|
||||
if (ROTSTATE(rot)->priv)
|
||||
{
|
||||
free(rot->state.priv);
|
||||
free(ROTSTATE(rot)->priv);
|
||||
}
|
||||
|
||||
rot->state.priv = NULL;
|
||||
ROTSTATE(rot)->priv = NULL;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
@ -204,7 +204,7 @@ static int meade_open(ROT *rot)
|
||||
{
|
||||
char return_str[BUFSIZE];
|
||||
size_t return_str_size = 0;
|
||||
struct meade_priv_data *priv = (struct meade_priv_data *)rot->state.priv;
|
||||
struct meade_priv_data *priv = (struct meade_priv_data *)ROTSTATE(rot)->priv;
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
@ -257,7 +257,7 @@ static int meade_close(ROT *rot)
|
||||
*/
|
||||
static int meade_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||
{
|
||||
struct meade_priv_data *priv = (struct meade_priv_data *)rot->state.priv;
|
||||
struct meade_priv_data *priv = (struct meade_priv_data *)ROTSTATE(rot)->priv;
|
||||
char cmd_str[BUFSIZE];
|
||||
char return_str[BUFSIZE];
|
||||
size_t return_str_size;
|
||||
@ -363,7 +363,7 @@ static int meade_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
||||
*/
|
||||
static int meade_stop(ROT *rot)
|
||||
{
|
||||
struct meade_priv_data *priv = (struct meade_priv_data *)rot->state.priv;
|
||||
struct meade_priv_data *priv = (struct meade_priv_data *)ROTSTATE(rot)->priv;
|
||||
azimuth_t az;
|
||||
elevation_t el;
|
||||
|
||||
@ -407,7 +407,7 @@ static int meade_reset(ROT *rot, rot_reset_t reset)
|
||||
*/
|
||||
static int meade_move(ROT *rot, int direction, int speed)
|
||||
{
|
||||
const struct meade_priv_data *priv = (struct meade_priv_data *)rot->state.priv;
|
||||
const struct meade_priv_data *priv = (struct meade_priv_data *)ROTSTATE(rot)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: Direction = %d, Speed = %d\n", __func__,
|
||||
@ -437,7 +437,7 @@ static int meade_move(ROT *rot, int direction, int speed)
|
||||
static const char *meade_get_info(ROT *rot)
|
||||
{
|
||||
static char buf[256]; // this is not thread-safe but not important either
|
||||
const struct meade_priv_data *priv = (struct meade_priv_data *)rot->state.priv;
|
||||
const struct meade_priv_data *priv = (struct meade_priv_data *)ROTSTATE(rot)->priv;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
SNPRINTF(buf, sizeof(buf),
|
||||
|
@ -415,17 +415,17 @@ static int rotorez_rot_init(ROT *rot)
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
rot->state.priv = (struct rotorez_rot_priv_data *)
|
||||
ROTSTATE(rot)->priv = (struct rotorez_rot_priv_data *)
|
||||
calloc(1, sizeof(struct rotorez_rot_priv_data));
|
||||
|
||||
if (!rot->state.priv)
|
||||
if (!ROTSTATE(rot)->priv)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
ROTPORT(rot)->type.rig = RIG_PORT_SERIAL;
|
||||
|
||||
((struct rotorez_rot_priv_data *)rot->state.priv)->az = 0;
|
||||
((struct rotorez_rot_priv_data *)ROTSTATE(rot)->priv)->az = 0;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
@ -444,12 +444,12 @@ static int rotorez_rot_cleanup(ROT *rot)
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (rot->state.priv)
|
||||
if (ROTSTATE(rot)->priv)
|
||||
{
|
||||
free(rot->state.priv);
|
||||
free(ROTSTATE(rot)->priv);
|
||||
}
|
||||
|
||||
rot->state.priv = NULL;
|
||||
ROTSTATE(rot)->priv = NULL;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ static int spid_rot_init(ROT *rot)
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
rot->state.priv = (void *)priv;
|
||||
ROTSTATE(rot)->priv = (void *)priv;
|
||||
|
||||
priv->az_resolution = 0;
|
||||
priv->el_resolution = 0;
|
||||
@ -229,13 +229,13 @@ static int spid_rot_cleanup(ROT *rot)
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (rot->state.priv && (rot->caps->rot_model == ROT_MODEL_SPID_ROT2PROG ||
|
||||
if (ROTSTATE(rot)->priv && (rot->caps->rot_model == ROT_MODEL_SPID_ROT2PROG ||
|
||||
rot->caps->rot_model == ROT_MODEL_SPID_MD01_ROT2PROG))
|
||||
{
|
||||
free(rot->state.priv);
|
||||
free(ROTSTATE(rot)->priv);
|
||||
}
|
||||
|
||||
rot->state.priv = NULL;
|
||||
ROTSTATE(rot)->priv = NULL;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
@ -244,7 +244,7 @@ static int spid_get_conf2(ROT *rot, hamlib_token_t token, char *val,
|
||||
int val_len)
|
||||
{
|
||||
const struct spid_rot2prog_priv_data *priv = (struct spid_rot2prog_priv_data *)
|
||||
rot->state.priv;
|
||||
ROTSTATE(rot)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called %d\n", __func__, (int)token);
|
||||
|
||||
@ -279,7 +279,7 @@ static int spid_get_conf(ROT *rot, hamlib_token_t token, char *val)
|
||||
static int spid_set_conf(ROT *rot, hamlib_token_t token, const char *val)
|
||||
{
|
||||
struct spid_rot2prog_priv_data *priv = (struct spid_rot2prog_priv_data *)
|
||||
rot->state.priv;
|
||||
ROTSTATE(rot)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: called %d=%s\n", __func__, (int)token, val);
|
||||
|
||||
@ -344,7 +344,7 @@ static int spid_rot1prog_rot_set_position(ROT *rot, azimuth_t az,
|
||||
static int spid_rot2prog_rot_set_position(ROT *rot, azimuth_t az,
|
||||
elevation_t el)
|
||||
{
|
||||
struct rot_state *rs = &rot->state;
|
||||
struct rot_state *rs = ROTSTATE(rot);
|
||||
hamlib_port_t *rotp = ROTPORT(rot);
|
||||
const struct spid_rot2prog_priv_data *priv = (struct spid_rot2prog_priv_data *)
|
||||
rs->priv;
|
||||
@ -498,7 +498,7 @@ static int spid_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
||||
static int spid_rot_stop(ROT *rot)
|
||||
{
|
||||
struct spid_rot2prog_priv_data *priv = (struct spid_rot2prog_priv_data *)
|
||||
rot->state.priv;
|
||||
ROTSTATE(rot)->priv;
|
||||
hamlib_port_t *rotp = ROTPORT(rot);
|
||||
int retval;
|
||||
int retry_read = 0;
|
||||
@ -543,7 +543,7 @@ static int spid_rot_stop(ROT *rot)
|
||||
static int spid_md01_rot2prog_rot_move(ROT *rot, int direction, int speed)
|
||||
{
|
||||
struct spid_rot2prog_priv_data *priv = (struct spid_rot2prog_priv_data *)
|
||||
rot->state.priv;
|
||||
ROTSTATE(rot)->priv;
|
||||
char dir = 0x00;
|
||||
int retval;
|
||||
char cmdstr[13];
|
||||
|
@ -49,15 +49,15 @@ static int ts7400_rot_init(ROT *rot)
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
rot->state.priv = (struct ts7400_rot_priv_data *)
|
||||
ROTSTATE(rot)->priv = (struct ts7400_rot_priv_data *)
|
||||
calloc(1, sizeof(struct ts7400_rot_priv_data));
|
||||
|
||||
if (!rot->state.priv)
|
||||
if (!ROTSTATE(rot)->priv)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rot->state.priv;
|
||||
priv = ROTSTATE(rot)->priv;
|
||||
|
||||
ROTPORT(rot)->type.rig = RIG_PORT_NONE;
|
||||
|
||||
@ -72,12 +72,12 @@ static int ts7400_rot_cleanup(ROT *rot)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
if (rot->state.priv)
|
||||
if (ROTSTATE(rot)->priv)
|
||||
{
|
||||
free(rot->state.priv);
|
||||
free(ROTSTATE(rot)->priv);
|
||||
}
|
||||
|
||||
rot->state.priv = NULL;
|
||||
ROTSTATE(rot)->priv = NULL;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
@ -99,7 +99,7 @@ static int ts7400_rot_close(ROT *rot)
|
||||
static int ts7400_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||
{
|
||||
struct ts7400_rot_priv_data *priv = (struct ts7400_rot_priv_data *)
|
||||
rot->state.priv;
|
||||
ROTSTATE(rot)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %.2f %.2f\n", __func__,
|
||||
az, el);
|
||||
@ -119,7 +119,7 @@ static int ts7400_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||
static int ts7400_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
||||
{
|
||||
struct ts7400_rot_priv_data *priv = (struct ts7400_rot_priv_data *)
|
||||
rot->state.priv;
|
||||
ROTSTATE(rot)->priv;
|
||||
struct timeval tv;
|
||||
unsigned elapsed; /* ms */
|
||||
|
||||
@ -189,7 +189,7 @@ static int ts7400_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
||||
static int ts7400_rot_stop(ROT *rot)
|
||||
{
|
||||
struct ts7400_rot_priv_data *priv = (struct ts7400_rot_priv_data *)
|
||||
rot->state.priv;
|
||||
ROTSTATE(rot)->priv;
|
||||
azimuth_t az;
|
||||
elevation_t el;
|
||||
|
||||
@ -224,7 +224,7 @@ static int ts7400_rot_reset(ROT *rot, rot_reset_t reset)
|
||||
static int ts7400_rot_move(ROT *rot, int direction, int speed)
|
||||
{
|
||||
struct ts7400_rot_priv_data const *priv = (struct ts7400_rot_priv_data *)
|
||||
rot->state.priv;
|
||||
ROTSTATE(rot)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: Direction = %d, Speed = %d\n", __func__,
|
||||
|
Loading…
Reference in New Issue
Block a user