kopia lustrzana https://github.com/Hamlib/Hamlib
commit
c0be98aea9
|
@ -66,10 +66,10 @@ int kpa_init(AMP *amp)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
amp->state.priv = (struct kpa_priv_data *)
|
||||
AMPSTATE(amp)->priv = (struct kpa_priv_data *)
|
||||
calloc(1, sizeof(struct kpa_priv_data));
|
||||
|
||||
if (!amp->state.priv)
|
||||
if (!AMPSTATE(amp)->priv)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
@ -83,9 +83,9 @@ int kpa_close(AMP *amp)
|
|||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
if (amp->state.priv) { free(amp->state.priv); }
|
||||
if (AMPSTATE(amp)->priv) { free(AMPSTATE(amp)->priv); }
|
||||
|
||||
amp->state.priv = NULL;
|
||||
AMPSTATE(amp)->priv = NULL;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ int kpa_get_level(AMP *amp, setting_t level, value_t *val)
|
|||
int pwrinput;
|
||||
float float_value = 0;
|
||||
int int_value = 0, int_value2 = 0;
|
||||
struct kpa_priv_data *priv = amp->state.priv;
|
||||
struct kpa_priv_data *priv = AMPSTATE(amp)->priv;
|
||||
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
|
|
@ -68,10 +68,10 @@ int expert_init(AMP *amp)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
amp->state.priv = (struct expert_priv_data *)
|
||||
AMPSTATE(amp)->priv = (struct expert_priv_data *)
|
||||
calloc(1, sizeof(struct expert_priv_data));
|
||||
|
||||
if (!amp->state.priv)
|
||||
if (!AMPSTATE(amp)->priv)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
@ -102,9 +102,9 @@ int expert_close(AMP *amp)
|
|||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
expert_transaction(amp, &cmd, 1, response, 4);
|
||||
|
||||
if (amp->state.priv) { free(amp->state.priv); }
|
||||
if (AMPSTATE(amp)->priv) { free(AMPSTATE(amp)->priv); }
|
||||
|
||||
amp->state.priv = NULL;
|
||||
AMPSTATE(amp)->priv = NULL;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ int expert_get_level(AMP *amp, setting_t level, value_t *val)
|
|||
int pwrinput;
|
||||
float float_value = 0;
|
||||
int int_value = 0, int_value2 = 0;
|
||||
struct expert_priv_data *priv = amp->state.priv;
|
||||
struct expert_priv_data *priv = AMPSTATE(amp)->priv;
|
||||
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
|
|
@ -45,10 +45,10 @@ int gemini_init(AMP *amp)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
amp->state.priv = (struct gemini_priv_data *)
|
||||
AMPSTATE(amp)->priv = (struct gemini_priv_data *)
|
||||
calloc(1, sizeof(struct gemini_priv_data));
|
||||
|
||||
if (!amp->state.priv)
|
||||
if (!AMPSTATE(amp)->priv)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
@ -62,9 +62,9 @@ int gemini_close(AMP *amp)
|
|||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
if (amp->state.priv) { free(amp->state.priv); }
|
||||
if (AMPSTATE(amp)->priv) { free(AMPSTATE(amp)->priv); }
|
||||
|
||||
amp->state.priv = NULL;
|
||||
AMPSTATE(amp)->priv = NULL;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ int gemini_status_parse(AMP *amp)
|
|||
int retval, n = 0;
|
||||
char *p;
|
||||
char responsebuf[GEMINIBUFSZ];
|
||||
struct gemini_priv_data *priv = amp->state.priv;
|
||||
struct gemini_priv_data *priv = AMPSTATE(amp)->priv;
|
||||
|
||||
retval = gemini_transaction(amp, "S\n", responsebuf, sizeof(responsebuf));
|
||||
|
||||
|
@ -189,7 +189,7 @@ int gemini_get_freq(AMP *amp, freq_t *freq)
|
|||
|
||||
if (!amp) { return -RIG_EINVAL; }
|
||||
|
||||
priv = amp->state.priv;
|
||||
priv = AMPSTATE(amp)->priv;
|
||||
|
||||
retval = gemini_status_parse(amp);
|
||||
|
||||
|
@ -228,7 +228,7 @@ int gemini_set_freq(AMP *amp, freq_t freq)
|
|||
int gemini_get_level(AMP *amp, setting_t level, value_t *val)
|
||||
{
|
||||
int retval;
|
||||
struct gemini_priv_data *priv = amp->state.priv;
|
||||
struct gemini_priv_data *priv = AMPSTATE(amp)->priv;
|
||||
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
|
|
@ -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__,
|
||||
|
|
16
src/conf.c
16
src/conf.c
|
@ -865,11 +865,11 @@ static int frontend_set_conf(RIG *rig, hamlib_token_t token, const char *val)
|
|||
case TOK_CLIENT:
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: Client claims to be %s\n", __func__, val);
|
||||
|
||||
if (strcasecmp(val, "WSJTX") == 0) { rig->state.client = RIG_CLIENT_WSJTX; }
|
||||
else if (strcasecmp(val, "GPREDICT") == 0) { rig->state.client = RIG_CLIENT_GPREDICT; }
|
||||
if (strcasecmp(val, "WSJTX") == 0) { rs->client = RIG_CLIENT_WSJTX; }
|
||||
else if (strcasecmp(val, "GPREDICT") == 0) { rs->client = RIG_CLIENT_GPREDICT; }
|
||||
else
|
||||
{
|
||||
rig->state.client = RIG_CLIENT_UNKNOWN;
|
||||
rs->client = RIG_CLIENT_UNKNOWN;
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unknown client=%s\n", __func__, val);
|
||||
}
|
||||
|
||||
|
@ -926,11 +926,11 @@ static int frontend_get_conf2(RIG *rig, hamlib_token_t token, char *val,
|
|||
|
||||
case TOK_CLIENT:
|
||||
{
|
||||
char *client;
|
||||
char *client = "UNKNOWN";
|
||||
|
||||
switch (rig->state.client)
|
||||
switch (rs->client)
|
||||
{
|
||||
case RIG_CLIENT_UNKNOWN: client = "UNKNOWN"; break;
|
||||
case RIG_CLIENT_UNKNOWN: break;
|
||||
|
||||
case RIG_CLIENT_WSJTX: client = "WSJTX"; break;
|
||||
|
||||
|
@ -938,8 +938,8 @@ static int frontend_get_conf2(RIG *rig, hamlib_token_t token, char *val,
|
|||
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unknown client=%d\n", __func__,
|
||||
rig->state.client);
|
||||
rig->state.client = RIG_CLIENT_UNKNOWN;
|
||||
rs->client);
|
||||
rs->client = RIG_CLIENT_UNKNOWN;
|
||||
}
|
||||
|
||||
SNPRINTF(val, val_len, "%s", client);
|
||||
|
|
|
@ -329,7 +329,7 @@ int main(int argc, char *argv[])
|
|||
if (amp_file)
|
||||
{
|
||||
strncpy(AMPPORT(my_amp)->pathname, amp_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(my_amp->state.ampport_deprecated.pathname, amp_file,
|
||||
strncpy(AMPSTATE(my_amp)->ampport_deprecated.pathname, amp_file,
|
||||
HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@ int main(int argc, char *argv[])
|
|||
if (serial_rate != 0)
|
||||
{
|
||||
AMPPORT(my_amp)->parm.serial.rate = serial_rate;
|
||||
my_amp->state.ampport_deprecated.parm.serial.rate = serial_rate;
|
||||
AMPSTATE(my_amp)->ampport_deprecated.parm.serial.rate = serial_rate;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1697,7 +1697,7 @@ declare_proto_amp(set_level)
|
|||
if (!strcmp(arg1, "?"))
|
||||
{
|
||||
char s[SPRINTF_MAX_SIZE];
|
||||
rig_sprintf_level(s, sizeof(s), amp->state.has_set_level);
|
||||
rig_sprintf_level(s, sizeof(s), AMPSTATE(amp)->has_set_level);
|
||||
fputs(s, fout);
|
||||
|
||||
if (amp->caps->set_ext_level)
|
||||
|
@ -1777,7 +1777,7 @@ declare_proto_amp(get_level)
|
|||
if (!strcmp(arg1, "?"))
|
||||
{
|
||||
char s[SPRINTF_MAX_SIZE];
|
||||
amp_sprintf_level(s, sizeof(s), amp->state.has_get_level);
|
||||
amp_sprintf_level(s, sizeof(s), AMPSTATE(amp)->has_get_level);
|
||||
|
||||
fputs(s, fout);
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ static int print_ext(RIG *rig, const struct confparams *cfp, rig_ptr_t ptr)
|
|||
int dumpcaps(RIG *rig, FILE *fout)
|
||||
{
|
||||
const struct rig_caps *caps;
|
||||
struct rig_state *rs;
|
||||
int status, i;
|
||||
int can_esplit, can_echannel;
|
||||
char freqbuf[20];
|
||||
|
@ -89,6 +90,7 @@ int dumpcaps(RIG *rig, FILE *fout)
|
|||
}
|
||||
|
||||
caps = rig->caps;
|
||||
rs = STATE(rig);
|
||||
|
||||
fprintf(fout, "Caps dump for model: %u\n", caps->rig_model);
|
||||
fprintf(fout, "Model name:\t%s\n", caps->model_name);
|
||||
|
@ -439,10 +441,9 @@ int dumpcaps(RIG *rig, FILE *fout)
|
|||
fprintf(fout, "Extra parameters:\n");
|
||||
rig_ext_parm_foreach(rig, print_ext, fout);
|
||||
|
||||
|
||||
if (rig->state.mode_list != 0)
|
||||
if (rs->mode_list != 0)
|
||||
{
|
||||
rig_sprintf_mode(prntbuf, sizeof(prntbuf), rig->state.mode_list);
|
||||
rig_sprintf_mode(prntbuf, sizeof(prntbuf), rs->mode_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -453,9 +454,9 @@ int dumpcaps(RIG *rig, FILE *fout)
|
|||
|
||||
fprintf(fout, "Mode list: %s\n", prntbuf);
|
||||
|
||||
if (rig->state.vfo_list != 0)
|
||||
if (rs->vfo_list != 0)
|
||||
{
|
||||
rig_sprintf_vfo(prntbuf, sizeof(prntbuf), rig->state.vfo_list);
|
||||
rig_sprintf_vfo(prntbuf, sizeof(prntbuf), rs->vfo_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -922,7 +923,7 @@ int dumpcaps(RIG *rig, FILE *fout)
|
|||
|
||||
can_echannel = caps->set_mem
|
||||
&& ((caps->set_vfo
|
||||
&& ((rig->state.vfo_list & RIG_VFO_MEM) == RIG_VFO_MEM))
|
||||
&& ((rs->vfo_list & RIG_VFO_MEM) == RIG_VFO_MEM))
|
||||
|| (caps->vfo_op
|
||||
&& rig_has_vfo_op(rig, RIG_OP_TO_VFO | RIG_OP_FROM_VFO)));
|
||||
|
||||
|
|
|
@ -141,9 +141,9 @@ int dumpcaps_rot(ROT *rot, FILE *fout)
|
|||
"Post write delay:\t%dms\n",
|
||||
caps->post_write_delay);
|
||||
|
||||
if (rot->state.has_status != 0)
|
||||
if (ROTSTATE(rot)->has_status != 0)
|
||||
{
|
||||
rot_sprintf_status(prntbuf, sizeof(prntbuf), rot->state.has_status);
|
||||
rot_sprintf_status(prntbuf, sizeof(prntbuf), ROTSTATE(rot)->has_status);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -281,6 +281,7 @@ int main(int argc, char *argv[])
|
|||
int vfo_mode = 0; /* vfo_mode=0 means target VFO is current VFO */
|
||||
int i;
|
||||
extern int is_rigctld;
|
||||
struct rig_state *rs;
|
||||
|
||||
is_rigctld = 1;
|
||||
|
||||
|
@ -689,12 +690,13 @@ int main(int argc, char *argv[])
|
|||
strncpy(RIGPORT(my_rig)->pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
my_rig->state.twiddle_timeout = twiddle_timeout;
|
||||
my_rig->state.twiddle_rit = twiddle_rit;
|
||||
my_rig->state.uplink = uplink;
|
||||
rs = STATE(my_rig);
|
||||
rs->twiddle_timeout = twiddle_timeout;
|
||||
rs->twiddle_rit = twiddle_rit;
|
||||
rs->uplink = uplink;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: twiddle=%d, uplink=%d, twiddle_rit=%d\n",
|
||||
__func__,
|
||||
my_rig->state.twiddle_timeout, my_rig->state.uplink, my_rig->state.twiddle_rit);
|
||||
rs->twiddle_timeout, rs->uplink, rs->twiddle_rit);
|
||||
|
||||
/*
|
||||
* ex: RIG_PTT_PARALLEL and /dev/parport0
|
||||
|
@ -702,29 +704,29 @@ int main(int argc, char *argv[])
|
|||
if (ptt_type != RIG_PTT_NONE)
|
||||
{
|
||||
PTTPORT(my_rig)->type.ptt = ptt_type;
|
||||
my_rig->state.pttport_deprecated.type.ptt = ptt_type;
|
||||
rs->pttport_deprecated.type.ptt = ptt_type;
|
||||
// This causes segfault since backend rig_caps are const
|
||||
// rigctld will use the rig->state version of this for clients
|
||||
// rigctld will use the STATE(rig) version of this for clients
|
||||
//my_rig->caps->ptt_type = ptt_type;
|
||||
}
|
||||
|
||||
if (dcd_type != RIG_DCD_NONE)
|
||||
{
|
||||
DCDPORT(my_rig)->type.dcd = dcd_type;
|
||||
my_rig->state.dcdport_deprecated.type.dcd = dcd_type;
|
||||
rs->dcdport_deprecated.type.dcd = dcd_type;
|
||||
}
|
||||
|
||||
if (ptt_file)
|
||||
{
|
||||
strncpy(PTTPORT(my_rig)->pathname, ptt_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(my_rig->state.pttport_deprecated.pathname, ptt_file,
|
||||
strncpy(rs->pttport_deprecated.pathname, ptt_file,
|
||||
HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
if (dcd_file)
|
||||
{
|
||||
strncpy(DCDPORT(my_rig)->pathname, dcd_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(my_rig->state.dcdport_deprecated.pathname, dcd_file,
|
||||
strncpy(rs->dcdport_deprecated.pathname, dcd_file,
|
||||
HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
|
@ -732,7 +734,7 @@ int main(int argc, char *argv[])
|
|||
if (serial_rate != 0)
|
||||
{
|
||||
RIGPORT(my_rig)->parm.serial.rate = serial_rate;
|
||||
my_rig->state.rigport_deprecated.parm.serial.rate = serial_rate;
|
||||
rs->rigport_deprecated.parm.serial.rate = serial_rate;
|
||||
}
|
||||
|
||||
if (civaddr)
|
||||
|
@ -1229,7 +1231,7 @@ void *handle_socket(void *arg)
|
|||
mutex_rigctld(1);
|
||||
rig_get_powerstat(my_rig, &rig_powerstat);
|
||||
mutex_rigctld(0);
|
||||
my_rig->state.powerstat = rig_powerstat;
|
||||
STATE(my_rig)->powerstat = rig_powerstat;
|
||||
}
|
||||
|
||||
do
|
||||
|
|
|
@ -365,24 +365,24 @@ int main(int argc, char *argv[])
|
|||
step = atof(argv[optind]) * 1e6;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Setting rotator to azimuth %.1f°\n", rot->state.min_az);
|
||||
rot_set_position(rot, rot->state.min_az, 0);
|
||||
fprintf(stderr, "Setting rotator to azimuth %.1f°\n", ROTSTATE(rot)->min_az);
|
||||
rot_set_position(rot, ROTSTATE(rot)->min_az, 0);
|
||||
fprintf(stderr, "Wait for rotator to move...\n");
|
||||
rot_get_position(rot, &azimuth, &elevation);
|
||||
|
||||
while (fabs(azimuth - rot->state.min_az) > 1.)
|
||||
while (fabs(azimuth - ROTSTATE(rot)->min_az) > 1.)
|
||||
{
|
||||
rot_get_position(rot, &azimuth, &elevation);
|
||||
hl_usleep(step);
|
||||
}
|
||||
|
||||
fprintf(stderr, "Now initiating full 360° rotation...\n");
|
||||
rot_set_position(rot, rot->state.max_az, 0);
|
||||
rot_set_position(rot, ROTSTATE(rot)->max_az, 0);
|
||||
|
||||
/* TODO: check CW or CCW */
|
||||
/* disable AGC? */
|
||||
|
||||
while (fabs(rot->state.max_az - azimuth) > 1.)
|
||||
while (fabs(ROTSTATE(rot)->max_az - azimuth) > 1.)
|
||||
{
|
||||
value_t strength;
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@ int main(int argc, const char *argv[])
|
|||
// disabled until we change this to the other multicast capability
|
||||
#if 0
|
||||
multicast_init(rig, "224.0.0.1", 4532);
|
||||
printf("threadid=%lld\n", (long long)rig->state.multicast->threadid);
|
||||
pthread_join(rig->state.multicast->threadid, NULL);
|
||||
printf("threadid=%lld\n", (long long)STATE(rig)->multicast->threadid);
|
||||
pthread_join(STATE(rig)->multicast->threadid, NULL);
|
||||
pthread_exit(NULL);
|
||||
#endif
|
||||
return 0;
|
||||
|
|
|
@ -417,8 +417,8 @@ int main(int argc, char *argv[])
|
|||
exit(0);
|
||||
}
|
||||
|
||||
my_rot->state.az_offset = az_offset;
|
||||
my_rot->state.el_offset = el_offset;
|
||||
ROTSTATE(my_rot)->az_offset = az_offset;
|
||||
ROTSTATE(my_rot)->el_offset = el_offset;
|
||||
|
||||
if (verbose > 0)
|
||||
{
|
||||
|
|
|
@ -1934,7 +1934,7 @@ declare_proto_rot(set_level)
|
|||
if (!strcmp(arg1, "?"))
|
||||
{
|
||||
char s[SPRINTF_MAX_SIZE];
|
||||
rot_sprintf_level(s, sizeof(s), rot->state.has_set_level);
|
||||
rot_sprintf_level(s, sizeof(s), ROTSTATE(rot)->has_set_level);
|
||||
fputs(s, fout);
|
||||
|
||||
if (rot->caps->set_ext_level)
|
||||
|
@ -2010,7 +2010,7 @@ declare_proto_rot(get_level)
|
|||
if (!strcmp(arg1, "?"))
|
||||
{
|
||||
char s[SPRINTF_MAX_SIZE];
|
||||
rot_sprintf_level(s, sizeof(s), rot->state.has_get_level);
|
||||
rot_sprintf_level(s, sizeof(s), ROTSTATE(rot)->has_get_level);
|
||||
fputs(s, fout);
|
||||
|
||||
if (rot->caps->get_ext_level)
|
||||
|
@ -2108,7 +2108,7 @@ declare_proto_rot(set_func)
|
|||
if (!strcmp(arg1, "?"))
|
||||
{
|
||||
char s[SPRINTF_MAX_SIZE];
|
||||
rot_sprintf_func(s, sizeof(s), rot->state.has_set_func);
|
||||
rot_sprintf_func(s, sizeof(s), ROTSTATE(rot)->has_set_func);
|
||||
fprintf(fout, "%s\n", s);
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -2146,7 +2146,7 @@ declare_proto_rot(get_func)
|
|||
if (!strcmp(arg1, "?"))
|
||||
{
|
||||
char s[SPRINTF_MAX_SIZE];
|
||||
rot_sprintf_func(s, sizeof(s), rot->state.has_get_func);
|
||||
rot_sprintf_func(s, sizeof(s), ROTSTATE(rot)->has_get_func);
|
||||
fprintf(fout, "%s\n", s);
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -2208,7 +2208,7 @@ declare_proto_rot(set_parm)
|
|||
if (!strcmp(arg1, "?"))
|
||||
{
|
||||
char s[SPRINTF_MAX_SIZE];
|
||||
rot_sprintf_parm(s, sizeof(s), rot->state.has_set_parm);
|
||||
rot_sprintf_parm(s, sizeof(s), ROTSTATE(rot)->has_set_parm);
|
||||
fprintf(fout, "%s\n", s);
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -2281,7 +2281,7 @@ declare_proto_rot(get_parm)
|
|||
if (!strcmp(arg1, "?"))
|
||||
{
|
||||
char s[SPRINTF_MAX_SIZE];
|
||||
rot_sprintf_parm(s, sizeof(s), rot->state.has_get_parm);
|
||||
rot_sprintf_parm(s, sizeof(s), ROTSTATE(rot)->has_get_parm);
|
||||
fprintf(fout, "%s\n", s);
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -2426,7 +2426,7 @@ declare_proto_rot(dump_conf)
|
|||
*/
|
||||
declare_proto_rot(dump_state)
|
||||
{
|
||||
struct rot_state *rs = &rot->state;
|
||||
struct rot_state *rs = ROTSTATE(rot);
|
||||
char *tag;
|
||||
|
||||
/*
|
||||
|
@ -2455,7 +2455,7 @@ declare_proto_rot(dump_state)
|
|||
tag = "Minimum Azimuth: ";
|
||||
}
|
||||
|
||||
fprintf(fout, "%s%lf%c", tag, rs->min_az + rot->state.az_offset, resp_sep);
|
||||
fprintf(fout, "%s%lf%c", tag, rs->min_az + rs->az_offset, resp_sep);
|
||||
|
||||
tag = "max_az=";
|
||||
|
||||
|
@ -2464,7 +2464,7 @@ declare_proto_rot(dump_state)
|
|||
tag = "Maximum Azimuth: ";
|
||||
}
|
||||
|
||||
fprintf(fout, "%s%lf%c", tag, rs->max_az + rot->state.az_offset, resp_sep);
|
||||
fprintf(fout, "%s%lf%c", tag, rs->max_az + rs->az_offset, resp_sep);
|
||||
|
||||
tag = "min_el=";
|
||||
|
||||
|
@ -2473,7 +2473,7 @@ declare_proto_rot(dump_state)
|
|||
tag = "Minimum Elevation: ";
|
||||
}
|
||||
|
||||
fprintf(fout, "%s%lf%c", tag, rs->min_el + rot->state.el_offset, resp_sep);
|
||||
fprintf(fout, "%s%lf%c", tag, rs->min_el + rs->el_offset, resp_sep);
|
||||
|
||||
tag = "max_el=";
|
||||
|
||||
|
@ -2482,7 +2482,7 @@ declare_proto_rot(dump_state)
|
|||
tag = "Maximum Elevation: ";
|
||||
}
|
||||
|
||||
fprintf(fout, "%s%lf%c", tag, rs->max_el + rot->state.el_offset, resp_sep);
|
||||
fprintf(fout, "%s%lf%c", tag, rs->max_el + rs->el_offset, resp_sep);
|
||||
|
||||
tag = "south_zero=";
|
||||
|
||||
|
|
|
@ -417,8 +417,8 @@ int main(int argc, char *argv[])
|
|||
exit(2);
|
||||
}
|
||||
|
||||
my_rot->state.az_offset = az_offset;
|
||||
my_rot->state.el_offset = el_offset;
|
||||
ROTSTATE(my_rot)->az_offset = az_offset;
|
||||
ROTSTATE(my_rot)->el_offset = el_offset;
|
||||
|
||||
if (verbose > 0)
|
||||
{
|
||||
|
|
Ładowanie…
Reference in New Issue