kopia lustrzana https://github.com/Hamlib/Hamlib
Add offset_vfoa and offset_vfob configuraiton parameters for adding freq offsets to VFOA/Main and VFOB/Sub
rodzic
1edb21a38d
commit
3d38f8b214
1
NEWS
1
NEWS
|
@ -13,6 +13,7 @@ Version 5.x -- future
|
||||||
* Change FT1000MP Mark V model names to align with FT1000MP
|
* Change FT1000MP Mark V model names to align with FT1000MP
|
||||||
|
|
||||||
Version 4.6
|
Version 4.6
|
||||||
|
* Add offset_vfoa and offset_vfob applying to rig_set_freq
|
||||||
* Fix K4 to put it in K40 mode when requesting ID
|
* Fix K4 to put it in K40 mode when requesting ID
|
||||||
* 2023-11-XX -- Planned for Nov 2023
|
* 2023-11-XX -- Planned for Nov 2023
|
||||||
* Fixes for M2 Rotors
|
* Fixes for M2 Rotors
|
||||||
|
|
|
@ -2592,6 +2592,8 @@ struct rig_state {
|
||||||
powerstat_t powerstat; /*<! power status */
|
powerstat_t powerstat; /*<! power status */
|
||||||
char *tuner_control_pathname; /*<! Path to external tuner control program that get 0/1 (Off/On) argument */
|
char *tuner_control_pathname; /*<! Path to external tuner control program that get 0/1 (Off/On) argument */
|
||||||
char client_version[32]; /*<! Allow client to report version for compatility checks/capability */
|
char client_version[32]; /*<! Allow client to report version for compatility checks/capability */
|
||||||
|
freq_t offset_vfoa; /*<! Offset to apply to VFOA/Main set_freq */
|
||||||
|
freq_t offset_vfob; /*<! Offset to apply to VFOB/Sub set_freq */
|
||||||
};
|
};
|
||||||
|
|
||||||
//! @cond Doxygen_Suppress
|
//! @cond Doxygen_Suppress
|
||||||
|
|
69
src/conf.c
69
src/conf.c
|
@ -175,6 +175,16 @@ static const struct confparams frontend_cfg_params[] =
|
||||||
"Path name to a script/program to control a tuner with 1 argument of 0/1 for Tuner Off/On",
|
"Path name to a script/program to control a tuner with 1 argument of 0/1 for Tuner Off/On",
|
||||||
"hamlib_tuner_control", RIG_CONF_STRING,
|
"hamlib_tuner_control", RIG_CONF_STRING,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
TOK_OFFSET_VFOA, "offset_vfoa", "Offset value in Hz",
|
||||||
|
"Add Hz to VFOA/Main frequency set",
|
||||||
|
"0", RIG_CONF_NUMERIC, { .n = {0, 1e12, 1}}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
TOK_OFFSET_VFOB, "offset_vfob", "Offset value in Hz",
|
||||||
|
"Add Hz to VFOB/Sub frequency set",
|
||||||
|
"0", RIG_CONF_NUMERIC, { .n = {0, 1e12, 1}}
|
||||||
|
},
|
||||||
|
|
||||||
{ RIG_CONF_END, NULL, }
|
{ RIG_CONF_END, NULL, }
|
||||||
};
|
};
|
||||||
|
@ -231,7 +241,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
{
|
{
|
||||||
const struct rig_caps *caps;
|
const struct rig_caps *caps;
|
||||||
struct rig_state *rs;
|
struct rig_state *rs;
|
||||||
int val_i;
|
long val_i;
|
||||||
|
|
||||||
caps = rig->caps;
|
caps = rig->caps;
|
||||||
rs = &rig->state;
|
rs = &rig->state;
|
||||||
|
@ -244,7 +254,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_WRITE_DELAY:
|
case TOK_WRITE_DELAY:
|
||||||
if (1 != sscanf(val, "%d", &val_i))
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
{
|
{
|
||||||
return -RIG_EINVAL;//value format error
|
return -RIG_EINVAL;//value format error
|
||||||
}
|
}
|
||||||
|
@ -254,7 +264,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_POST_WRITE_DELAY:
|
case TOK_POST_WRITE_DELAY:
|
||||||
if (1 != sscanf(val, "%d", &val_i))
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
{
|
{
|
||||||
return -RIG_EINVAL;//value format error
|
return -RIG_EINVAL;//value format error
|
||||||
}
|
}
|
||||||
|
@ -264,7 +274,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_TIMEOUT:
|
case TOK_TIMEOUT:
|
||||||
if (1 != sscanf(val, "%d", &val_i))
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
{
|
{
|
||||||
return -RIG_EINVAL;//value format error
|
return -RIG_EINVAL;//value format error
|
||||||
}
|
}
|
||||||
|
@ -274,7 +284,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_RETRY:
|
case TOK_RETRY:
|
||||||
if (1 != sscanf(val, "%d", &val_i))
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
{
|
{
|
||||||
return -RIG_EINVAL;//value format error
|
return -RIG_EINVAL;//value format error
|
||||||
}
|
}
|
||||||
|
@ -289,7 +299,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
return -RIG_EINVAL;
|
return -RIG_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 != sscanf(val, "%d", &val_i))
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
{
|
{
|
||||||
return -RIG_EINVAL;//value format error
|
return -RIG_EINVAL;//value format error
|
||||||
}
|
}
|
||||||
|
@ -304,7 +314,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
return -RIG_EINVAL;
|
return -RIG_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 != sscanf(val, "%d", &val_i))
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
{
|
{
|
||||||
return -RIG_EINVAL;//value format error
|
return -RIG_EINVAL;//value format error
|
||||||
}
|
}
|
||||||
|
@ -319,7 +329,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
return -RIG_EINVAL;
|
return -RIG_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 != sscanf(val, "%d", &val_i))
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
{
|
{
|
||||||
return -RIG_EINVAL;//value format error
|
return -RIG_EINVAL;//value format error
|
||||||
}
|
}
|
||||||
|
@ -453,7 +463,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_RANGE_SELECTED:
|
case TOK_RANGE_SELECTED:
|
||||||
if (1 != sscanf(val, "%d", &val_i))
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
{
|
{
|
||||||
return -RIG_EINVAL;//value format error
|
return -RIG_EINVAL;//value format error
|
||||||
}
|
}
|
||||||
|
@ -555,7 +565,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_PTT_BITNUM:
|
case TOK_PTT_BITNUM:
|
||||||
if (1 != sscanf(val, "%d", &val_i))
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
{
|
{
|
||||||
return -RIG_EINVAL;//value format error
|
return -RIG_EINVAL;//value format error
|
||||||
}
|
}
|
||||||
|
@ -643,7 +653,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_AUTO_POWER_ON:
|
case TOK_AUTO_POWER_ON:
|
||||||
if (1 != sscanf(val, "%d", &val_i))
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
{
|
{
|
||||||
return -RIG_EINVAL; //value format error
|
return -RIG_EINVAL; //value format error
|
||||||
}
|
}
|
||||||
|
@ -652,7 +662,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_AUTO_POWER_OFF:
|
case TOK_AUTO_POWER_OFF:
|
||||||
if (1 != sscanf(val, "%d", &val_i))
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
{
|
{
|
||||||
return -RIG_EINVAL; //value format error
|
return -RIG_EINVAL; //value format error
|
||||||
}
|
}
|
||||||
|
@ -661,7 +671,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_AUTO_DISABLE_SCREENSAVER:
|
case TOK_AUTO_DISABLE_SCREENSAVER:
|
||||||
if (1 != sscanf(val, "%d", &val_i))
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
{
|
{
|
||||||
return -RIG_EINVAL; //value format error
|
return -RIG_EINVAL; //value format error
|
||||||
}
|
}
|
||||||
|
@ -670,7 +680,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_DISABLE_YAESU_BANDSELECT:
|
case TOK_DISABLE_YAESU_BANDSELECT:
|
||||||
if (1 != sscanf(val, "%d", &val_i))
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
{
|
{
|
||||||
return -RIG_EINVAL; //value format error
|
return -RIG_EINVAL; //value format error
|
||||||
}
|
}
|
||||||
|
@ -679,7 +689,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_PTT_SHARE:
|
case TOK_PTT_SHARE:
|
||||||
if (1 != sscanf(val, "%d", &val_i))
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
{
|
{
|
||||||
return -RIG_EINVAL; //value format error
|
return -RIG_EINVAL; //value format error
|
||||||
}
|
}
|
||||||
|
@ -688,7 +698,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_FLUSHX:
|
case TOK_FLUSHX:
|
||||||
if (1 != sscanf(val, "%d", &val_i))
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
{
|
{
|
||||||
return -RIG_EINVAL; //value format error
|
return -RIG_EINVAL; //value format error
|
||||||
}
|
}
|
||||||
|
@ -697,7 +707,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_TWIDDLE_TIMEOUT:
|
case TOK_TWIDDLE_TIMEOUT:
|
||||||
if (1 != sscanf(val, "%d", &val_i))
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
{
|
{
|
||||||
return -RIG_EINVAL; //value format error
|
return -RIG_EINVAL; //value format error
|
||||||
}
|
}
|
||||||
|
@ -706,7 +716,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_TWIDDLE_RIT:
|
case TOK_TWIDDLE_RIT:
|
||||||
if (1 != sscanf(val, "%d", &val_i))
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
{
|
{
|
||||||
return -RIG_EINVAL; //value format error
|
return -RIG_EINVAL; //value format error
|
||||||
}
|
}
|
||||||
|
@ -715,7 +725,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_ASYNC:
|
case TOK_ASYNC:
|
||||||
if (1 != sscanf(val, "%d", &val_i))
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
{
|
{
|
||||||
return -RIG_EINVAL; //value format error
|
return -RIG_EINVAL; //value format error
|
||||||
}
|
}
|
||||||
|
@ -727,6 +737,27 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
rs->tuner_control_pathname = strdup(val); // yeah -- need to free it
|
rs->tuner_control_pathname = strdup(val); // yeah -- need to free it
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TOK_OFFSET_VFOA:
|
||||||
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
|
{
|
||||||
|
return -RIG_EINVAL; //value format error
|
||||||
|
}
|
||||||
|
|
||||||
|
rs->offset_vfoa = val_i;
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: offset_vfoa=%ld\n", __func__, val_i);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TOK_OFFSET_VFOB:
|
||||||
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
|
{
|
||||||
|
return -RIG_EINVAL; //value format error
|
||||||
|
}
|
||||||
|
|
||||||
|
rs->offset_vfob = val_i;
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: offset_vfob=%ld\n", __func__, val_i);
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -RIG_EINVAL;
|
return -RIG_EINVAL;
|
||||||
|
|
|
@ -1778,6 +1778,8 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, freq=%.0f\n", __func__,
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, freq=%.0f\n", __func__,
|
||||||
rig_strvfo(vfo), freq);
|
rig_strvfo(vfo), freq);
|
||||||
#endif
|
#endif
|
||||||
|
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN) freq += rig->state.offset_vfoa;
|
||||||
|
else if (vfo == RIG_VFO_B || vfo == RIG_VFO_SUB) freq += rig->state.offset_vfob;
|
||||||
|
|
||||||
if (CHECK_RIG_ARG(rig))
|
if (CHECK_RIG_ARG(rig))
|
||||||
{
|
{
|
||||||
|
@ -2055,7 +2057,8 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||||
|
|
||||||
// we ignore get_freq for the uplink VFO for gpredict to behave better
|
// we ignore get_freq for the uplink VFO for gpredict to behave better
|
||||||
if ((rig->state.uplink == 1 && vfo == RIG_VFO_SUB)
|
if ((rig->state.uplink == 1 && vfo == RIG_VFO_SUB)
|
||||||
|| (rig->state.uplink == 2 && vfo == RIG_VFO_MAIN))
|
|| (rig->state.uplink == 2 && vfo == RIG_VFO_MAIN)
|
||||||
|
|| (vfo == RIG_VFO_TX && rig->state.cache.ptt == 0))
|
||||||
{
|
{
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: uplink=%d, ignoring get_freq\n", __func__,
|
rig_debug(RIG_DEBUG_TRACE, "%s: uplink=%d, ignoring get_freq\n", __func__,
|
||||||
rig->state.uplink);
|
rig->state.uplink);
|
||||||
|
|
|
@ -125,6 +125,8 @@
|
||||||
#define TOK_TWIDDLE_TIMEOUT TOKEN_FRONTEND(128)
|
#define TOK_TWIDDLE_TIMEOUT TOKEN_FRONTEND(128)
|
||||||
/** \brief rig: Supporess get_freq on VFOB for satellite RIT tuning */
|
/** \brief rig: Supporess get_freq on VFOB for satellite RIT tuning */
|
||||||
#define TOK_TWIDDLE_RIT TOKEN_FRONTEND(129)
|
#define TOK_TWIDDLE_RIT TOKEN_FRONTEND(129)
|
||||||
|
#define TOK_OFFSET_VFOA TOKEN_FRONTEND(130)
|
||||||
|
#define TOK_OFFSET_VFOB TOKEN_FRONTEND(131)
|
||||||
/*
|
/*
|
||||||
* rotator specific tokens
|
* rotator specific tokens
|
||||||
* (strictly, should be documented as rotator_internal)
|
* (strictly, should be documented as rotator_internal)
|
||||||
|
|
Ładowanie…
Reference in New Issue