[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. b05a1638a858ea94228f8
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Michael B. <mdb...@us...> - 2021-02-07 21:04:17
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Hamlib -- Ham radio control libraries". The branch, master has been updated via b05a1638a858ea94228f8017750537573845ee7f (commit) via e0e743ee9043ba8f11a6a953e15aa84d7204118e (commit) via 418e963c863cc009d0459ab345005f41a4327d02 (commit) via 3a25f54f744341c58cdf8a85f9f9e63cacad84ec (commit) via ed25ac943dab61e4a83e74354cbf8d79233e92f4 (commit) from 1caa4ca328d98ff3071a508ff25ae9084d291869 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b05a1638a858ea94228f8017750537573845ee7f Author: Michael Black W9MDB <mdb...@ya...> Date: Sun Feb 7 15:03:43 2021 -0600 Add caching of MEM and MAINC vfos diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index af26c134..508fd2c3 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -2080,6 +2080,7 @@ struct rig_cache { freq_t freqMainC; // VFO_C, VFO_MAINC freq_t freqSubA; // VFO_SUBA -- only for rigs with dual Sub VFOs freq_t freqSubB; // VFO_SUBB -- only for rigs with dual Sub VFOs + freq_t freqMem; // VFO_MEM -- last MEM channel #if 0 // future freq_t freqSubC; // VFO_SUBC -- only for rigs with 3 Sub VFOs #endif @@ -2095,6 +2096,7 @@ struct rig_cache { struct timespec time_freqMainC; struct timespec time_freqSubA; struct timespec time_freqSubB; + struct timespec time_freqMem; struct timespec time_vfo; struct timespec time_mode; struct timespec time_ptt; diff --git a/src/rig.c b/src/rig.c index c11f6437..4629f781 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1394,13 +1394,10 @@ static int set_cache_freq(RIG *rig, vfo_t vfo, freq_t freq) elapsed_ms(&rig->state.cache.time_freqMainB, HAMLIB_ELAPSED_SET); break; -#if 0 - case RIG_VFO_C: // is there a MainC/SubC we need to cover? rig->state.cache.freqMainC = freq; elapsed_ms(&rig->state.cache.time_freqMainC, HAMLIB_ELAPSED_SET); break; -#endif case RIG_VFO_SUB_A: rig->state.cache.freqSubA = freq; @@ -1412,6 +1409,11 @@ static int set_cache_freq(RIG *rig, vfo_t vfo, freq_t freq) elapsed_ms(&rig->state.cache.time_freqSubB, HAMLIB_ELAPSED_SET); break; + case RIG_VFO_MEM: + rig->state.cache.freqMem = freq; + elapsed_ms(&rig->state.cache.time_freqMem, HAMLIB_ELAPSED_SET); + break; + default: rig_debug(RIG_DEBUG_ERR, "%s: unknown vfo?, vfo=%s\n", __func__, rig_strvfo(vfo)); @@ -1460,20 +1462,24 @@ static int get_cache_freq(RIG *rig, vfo_t vfo, freq_t *freq, int *cache_ms) *cache_ms = elapsed_ms(&rig->state.cache.time_freqSubB, HAMLIB_ELAPSED_GET); break; -#if 0 // future - case RIG_VFO_C: - case RIG_VFO_MAINC: + //case RIG_VFO_MAINC: // not used by any rig yet *freq = rig->state.cache.freqMainC; - *cache_ms = rig->state.cache.time_freqMainC; + *cache_ms = elapsed_ms(&rig->state.cache.time_freqMainC, HAMLIB_ELAPSED_GET); break; +#if 0 // no known rigs use this yet case RIG_VFO_SUBC: *freq = rig->state.cache.freqSubC; *cache_ms = rig->state.cache.time_freqSubC; break; #endif + case RIG_VFO_MEM: + *freq = rig->state.cache.freqMem; + *cache_ms = elapsed_ms(&rig->state.cache.time_freqMem, HAMLIB_ELAPSED_GET); + break; + default: rig_debug(RIG_DEBUG_ERR, "%s: unknown vfo?, vfo=%s\n", __func__, rig_strvfo(vfo)); commit e0e743ee9043ba8f11a6a953e15aa84d7204118e Author: Michael Black W9MDB <mdb...@ya...> Date: Sun Feb 7 14:58:33 2021 -0600 Update rig.c docs diff --git a/src/rig.c b/src/rig.c index c85ac212..c11f6437 100644 --- a/src/rig.c +++ b/src/rig.c @@ -5554,6 +5554,9 @@ const char *HAMLIB_API rig_get_info(RIG *rig) * \brief get freq/mode/width for requested VFO * \param rig The rig handle * \param vfo The VFO to get + * \param *freq frequency answer + * \param *mode mode answer + * \param *width bandwidth answer * * Gets the current VFO information. The VFO can be RIG_VFO_A, RIG_VFO_B, RIG_VFO_C * for VFOA, VFOB, VFOC respectively or RIG_VFO_MEM for Memory mode. commit 418e963c863cc009d0459ab345005f41a4327d02 Author: Michael Black W9MDB <mdb...@ya...> Date: Sun Feb 7 12:45:59 2021 -0600 Add \get_vfo_info to rigctl and rigctld to allow geting freq/mode/width by vfo in one call Overcomes limitation of f command where vfo swapping is needed if not in --vfo mode rig_get_vfo_info function added Log4OM should be able to get VFOB frequency on most rigs https://github.com/Hamlib/Hamlib/issues/530 diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 276a872e..af26c134 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -1966,7 +1966,7 @@ enum rig_caps_cptr_e { * */ //! @cond Doxygen_Suppress -extern int rig_get_caps_int(rig_model_t rig_model, enum rig_caps_int_e rig_caps); +extern long rig_get_caps_int(rig_model_t rig_model, enum rig_caps_int_e rig_caps); /** * \brief Function to return char pointer value from rig->caps @@ -2308,6 +2308,10 @@ extern HAMLIB_EXPORT(int) rig_get_vfo HAMLIB_PARAMS((RIG *rig, vfo_t *vfo)); +extern HAMLIB_EXPORT(int) +rig_get_vfo_info HAMLIB_PARAMS((RIG *rig, + vfo_t vfo, freq_t *freq, rmode_t *mode, pbwidth_t *width)); + extern HAMLIB_EXPORT(int) netrigctl_get_vfo_mode HAMLIB_PARAMS((RIG *rig)); @@ -2783,6 +2787,11 @@ rig_set_vfo_callback HAMLIB_PARAMS((RIG *, vfo_cb_t, rig_ptr_t)); +extern HAMLIB_EXPORT(int) +rig_get_vfo_info_callback HAMLIB_PARAMS((RIG *, + vfo_cb_t, + rig_ptr_t)); + extern HAMLIB_EXPORT(int) rig_set_ptt_callback HAMLIB_PARAMS((RIG *, ptt_cb_t, @@ -2944,6 +2953,7 @@ extern HAMLIB_EXPORT(int) rig_get_cache_timeout_ms(RIG *rig, hamlib_cache_t sele extern HAMLIB_EXPORT(int) rig_set_cache_timeout_ms(RIG *rig, hamlib_cache_t selection, int ms); extern HAMLIB_EXPORT(int) rig_set_vfo_opt(RIG *rig, int status); +extern HAMLIB_EXPORT(int) rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, pbwidth_t *width); typedef unsigned long rig_useconds_t; diff --git a/src/misc.c b/src/misc.c index b8c2a66e..45619c6f 100644 --- a/src/misc.c +++ b/src/misc.c @@ -2140,8 +2140,13 @@ void *rig_get_function_ptr(rig_model_t rig_model, } // negative return indicates error -// watch out for integer values that may be negative -int rig_get_caps_int(rig_model_t rig_model, enum rig_caps_int_e rig_caps) +/** + * \brief Get integer/long instead of using rig->caps + * watch out for integer values that may be negative -- if needed must change hamlib + * \param RIG* and rig_caps_int_e + * \return the corresponding long value -- -RIG_EINVAL is the only error possible + */ +long rig_get_caps_int(rig_model_t rig_model, enum rig_caps_int_e rig_caps) { const struct rig_caps *caps = rig_get_caps(rig_model); diff --git a/src/rig.c b/src/rig.c index 65b594b4..c85ac212 100644 --- a/src/rig.c +++ b/src/rig.c @@ -5550,6 +5550,37 @@ const char *HAMLIB_API rig_get_info(RIG *rig) RETURNFUNC(rig->caps->get_info(rig)); } +/** + * \brief get freq/mode/width for requested VFO + * \param rig The rig handle + * \param vfo The VFO to get + * + * Gets the current VFO information. The VFO can be RIG_VFO_A, RIG_VFO_B, RIG_VFO_C + * for VFOA, VFOB, VFOC respectively or RIG_VFO_MEM for Memory mode. + * Supported VFOs depends on rig capabilities. + * + * \RETURNFUNC(RIG_OK) if the operation has been successful, otherwise + * a negative value if an error occurred (in which case use rigerror(return) + * for error message). + * + */ +int HAMLIB_API rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, pbwidth_t *width) +{ + int retcode; + + ENTERFUNC; + rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s\n", __func__, rig_strvfo(vfo)); + + if (CHECK_RIG_ARG(rig)) + { + RETURNFUNC(-RIG_EINVAL); + } + + retcode = rig_get_freq(rig,vfo,freq); + if (retcode != RIG_OK) RETURNFUNC(retcode); + retcode = rig_get_mode(rig,vfo,mode,width); + RETURNFUNC(retcode); +} /** * \brief get the Hamlib license diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 2b39527b..363500e4 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -166,6 +166,7 @@ declare_proto_rig(set_mode); declare_proto_rig(get_mode); declare_proto_rig(set_vfo); declare_proto_rig(get_vfo); +declare_proto_rig(get_vfo_info); declare_proto_rig(set_ptt); declare_proto_rig(get_ptt); declare_proto_rig(get_ptt); @@ -330,6 +331,7 @@ static struct test_table test_list[] = { 0x8f, "dump_state", ACTION(dump_state), ARG_OUT | ARG_NOVFO }, { 0xf0, "chk_vfo", ACTION(chk_vfo), ARG_NOVFO, "ChkVFO" }, /* rigctld only--check for VFO mode */ { 0xf2, "set_vfo_opt", ACTION(set_vfo_opt), ARG_NOVFO | ARG_IN, "Status" }, /* turn vfo option on/off */ + { 0xf3, "get_vfo_info", ACTION(get_vfo_info), ARG_NOVFO | ARG_IN1 | ARG_OUT3, "VFO", "Freq", "Mode", "Width" }, /* turn vfo option on/off */ { 0xf1, "halt", ACTION(halt), ARG_NOVFO }, /* rigctld only--halt the daemon */ { 0x8c, "pause", ACTION(pause), ARG_IN, "Seconds" }, { 0x00, "", NULL }, @@ -2180,6 +2182,40 @@ declare_proto_rig(get_vfo) return status; } +/* '\get_vfo_info' */ +declare_proto_rig(get_vfo_info) +{ + int retval; + + ENTERFUNC; + if (!strcmp(arg1, "?")) + { + char s[SPRINTF_MAX_SIZE]; + rig_sprintf_vfo(s, rig->state.vfo_list); + fprintf(fout, "%s\n", s); + return RIG_OK; + } + + vfo = rig_parse_vfo(arg1); + freq_t freq=0; + rmode_t mode=RIG_MODE_NONE; + pbwidth_t width = 0; + retval = rig_get_vfo_info(rig, vfo, &freq, &mode, &width); + + rig_debug(RIG_DEBUG_ERR,"%s: vfo=%s\n", __func__, rig_strvfo(vfo)); + if ((interactive && prompt) || (interactive && !prompt && ext_resp)) + { + fprintf(fout,"%s: %.0f\n", cmd->arg1, freq); + fprintf(fout,"%s: %s\n", cmd->arg2, rig_strrmode(mode)); + fprintf(fout,"%s: %d\n", cmd->arg3, (int)width); + } + else + { + fprintf(fout,"%.0f\n%s\n%d\n", freq, rig_strrmode(mode), (int)width); + } + RETURNFUNC(retval); +} + /* 'T' */ declare_proto_rig(set_ptt) commit 3a25f54f744341c58cdf8a85f9f9e63cacad84ec Author: Michael Black W9MDB <mdb...@ya...> Date: Sun Feb 7 12:19:52 2021 -0600 Fix rot_dummy.c -- now behaves with gpredict tracking https://github.com/Hamlib/Hamlib/issues/531 diff --git a/rigs/dummy/rot_dummy.c b/rigs/dummy/rot_dummy.c index f4bea07a..c9af6ff8 100644 --- a/rigs/dummy/rot_dummy.c +++ b/rigs/dummy/rot_dummy.c @@ -260,8 +260,8 @@ static int dummy_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) gettimeofday(&priv->tv, NULL); } else { - priv->az = az; - priv->el = el; + priv->az = priv->target_az = az; + priv->el = priv->target_az = el; } @@ -898,7 +898,10 @@ static int dummy_rot_get_status(ROT *rot, rot_status_t *status) struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) rot->state.priv; - //dummy_rot_simulate_rotation(rot); + if (simulating) + { + dummy_rot_simulate_rotation(rot); + } *status = priv->status; commit ed25ac943dab61e4a83e74354cbf8d79233e92f4 Author: Michael Black W9MDB <mdb...@ya...> Date: Sun Feb 7 12:05:52 2021 -0600 Disable rotctl emulation -- override by setting simulating=1 in rot_dummy.c https://github.com/Hamlib/Hamlib/issues/531 diff --git a/rigs/dummy/rot_dummy.c b/rigs/dummy/rot_dummy.c index 974f9caf..f4bea07a 100644 --- a/rigs/dummy/rot_dummy.c +++ b/rigs/dummy/rot_dummy.c @@ -43,6 +43,8 @@ ROT_STATUS_MOVING_EL | ROT_STATUS_MOVING_UP | ROT_STATUS_MOVING_DOWN | \ ROT_STATUS_LIMIT_UP | ROT_STATUS_LIMIT_DOWN | ROT_STATUS_LIMIT_LEFT | ROT_STATUS_LIMIT_RIGHT) +static int simulating = 0; // do we need rotator emulation for debug? + struct dummy_rot_priv_data { azimuth_t az; @@ -251,10 +253,17 @@ static int dummy_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) rig_debug(RIG_DEBUG_VERBOSE, "%s called: %.2f %.2f\n", __func__, az, el); - priv->target_az = az; - priv->target_el = el; + if (simulating) + { + priv->target_az = az; + priv->target_el = el; + gettimeofday(&priv->tv, NULL); + } + else { + priv->az = az; + priv->el = el; + } - gettimeofday(&priv->tv, NULL); return RIG_OK; } @@ -341,7 +350,7 @@ static int dummy_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); - if (priv->az == priv->target_az && + if (simulating && priv->az == priv->target_az && priv->el == priv->target_el) { *az = priv->az; @@ -349,7 +358,10 @@ static int dummy_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) return RIG_OK; } - dummy_rot_simulate_rotation(rot); + if (simulating) + { + dummy_rot_simulate_rotation(rot); + } *az = priv->az; *el = priv->el; @@ -886,7 +898,7 @@ static int dummy_rot_get_status(ROT *rot, rot_status_t *status) struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) rot->state.priv; - dummy_rot_simulate_rotation(rot); + //dummy_rot_simulate_rotation(rot); *status = priv->status; @@ -902,7 +914,7 @@ const struct rot_caps dummy_rot_caps = ROT_MODEL(ROT_MODEL_DUMMY), .model_name = "Dummy", .mfg_name = "Hamlib", - .version = "20201203.0", + .version = "20210207.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rot_type = ROT_TYPE_AZEL, ----------------------------------------------------------------------- Summary of changes: include/hamlib/rig.h | 14 ++++++++++++- rigs/dummy/rot_dummy.c | 29 ++++++++++++++++++++------- src/misc.c | 9 +++++++-- src/rig.c | 54 +++++++++++++++++++++++++++++++++++++++++++------- tests/rigctl_parse.c | 36 +++++++++++++++++++++++++++++++++ 5 files changed, 125 insertions(+), 17 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |