diff --git a/NEWS b/NEWS index 70fe9e26f..29fdbb15a 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,7 @@ Version 5.x -- future * Change FT1000MP Mark V model names to align with FT1000MP Version 4.6 + * Added RIG_FUNC_SYNC for FTDX101D/MP * Added Barrett 4100 * Added DL2MAN (tr)uSDX -- needs refinement * Added Thetis entry -- derived from FlexRadio/Apache PowerSDR diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 8bcb4df7c..c34003d80 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -1272,7 +1272,7 @@ typedef uint64_t setting_t; #define RIG_FUNC_SEND_MORSE CONSTANT_64BIT_FLAG (45) /*!< \c SEND_MORSE -- Send specified characters using CW */ #define RIG_FUNC_SEND_VOICE_MEM CONSTANT_64BIT_FLAG (46) /*!< \c SEND_VOICE_MEM -- Transmit in SSB message stored in memory */ #define RIG_FUNC_OVF_STATUS CONSTANT_64BIT_FLAG (47) /*!< \c OVF -- Read overflow status 0=Off, 1=On */ -#define RIG_FUNC_BIT48 CONSTANT_64BIT_FLAG (48) /*!< \c available for future RIG_FUNC items */ +#define RIG_FUNC_SYNC CONSTANT_64BIT_FLAG (48) /*!< \c Synchronize VFOS -- FTDX101D/MP for now SY command */ #define RIG_FUNC_BIT49 CONSTANT_64BIT_FLAG (49) /*!< \c available for future RIG_FUNC items */ #define RIG_FUNC_BIT50 CONSTANT_64BIT_FLAG (50) /*!< \c available for future RIG_FUNC items */ #define RIG_FUNC_BIT51 CONSTANT_64BIT_FLAG (51) /*!< \c available for future RIG_FUNC items */ @@ -3845,6 +3845,7 @@ extern HAMLIB_EXPORT(char*) rig_date_strget(char *buf, int buflen, int localtime enum GPIO { GPIO1, GPIO2, GPIO3, GPIO4 }; extern HAMLIB_EXPORT(int) rig_cm108_get_bit(hamlib_port_t *p, enum GPIO gpio, int *bit); extern HAMLIB_EXPORT(int) rig_cm108_set_bit(hamlib_port_t *p, enum GPIO gpio, int bit); +extern HAMLIB_EXPORT(int) rig_band_changed(RIG *rig, hamlib_bandselect_t band); extern HAMLIB_EXPORT(void *) rig_data_pointer(RIG *rig, rig_ptrx_t idx); diff --git a/rigs/yaesu/ftdx101.h b/rigs/yaesu/ftdx101.h index fd830f1c5..64a433a3c 100644 --- a/rigs/yaesu/ftdx101.h +++ b/rigs/yaesu/ftdx101.h @@ -65,7 +65,8 @@ #define FTDX101_FUNCS (RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_LOCK|\ RIG_FUNC_MON|RIG_FUNC_NB|RIG_FUNC_NR|RIG_FUNC_VOX|\ RIG_FUNC_FBKIN|RIG_FUNC_COMP|RIG_FUNC_ANF|RIG_FUNC_MN|\ - RIG_FUNC_RIT|RIG_FUNC_XIT|RIG_FUNC_TUNER|RIG_FUNC_APF) + RIG_FUNC_RIT|RIG_FUNC_XIT|RIG_FUNC_TUNER|RIG_FUNC_APF|\ + RIG_FUNC_SYNC) /* TBC */ #define FTDX101_VFO_OPS (RIG_OP_TUNE|RIG_OP_CPY|RIG_OP_XCHG|\ diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index f9360c8d1..946bc1e89 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -6435,6 +6435,16 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) break; + case RIG_FUNC_SYNC: + if (!newcat_valid_command(rig, "SY")) + { + RETURNFUNC(-RIG_ENAVAIL); + } + + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "SY%d%c", status ? 1 : 0, + cat_term); + break; + default: RETURNFUNC(-RIG_EINVAL); } @@ -6728,6 +6738,15 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) break; + case RIG_FUNC_SYNC: + if (!newcat_valid_command(rig, "SY")) + { + RETURNFUNC(-RIG_ENAVAIL); + } + + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "SY%c", cat_term); + break; + default: RETURNFUNC(-RIG_EINVAL); } @@ -6842,6 +6861,10 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) break; + case RIG_FUNC_SYNC: + *status = (retfunc[0] == '1') ? 1 : 0; + break; + default: RETURNFUNC(-RIG_EINVAL); } diff --git a/rigs/yaesu/newcat.h b/rigs/yaesu/newcat.h index d3a722eae..6951fa310 100644 --- a/rigs/yaesu/newcat.h +++ b/rigs/yaesu/newcat.h @@ -50,7 +50,7 @@ typedef char ncboolean; /* shared function version */ -#define NEWCAT_VER "20240113" +#define NEWCAT_VER "20240118" /* Hopefully large enough for future use, 128 chars plus '\0' */ #define NEWCAT_DATA_LEN 129 diff --git a/src/band_changed.c b/src/band_changed.c index 075f46ce2..848bef0bb 100644 --- a/src/band_changed.c +++ b/src/band_changed.c @@ -2,7 +2,7 @@ // Can customize during build // Eventually should improved this for external actions when // rigctld gets integrated as a service within Hamlib -int rig_band_changed(RIG *rig, hamlib_bandselect_t band) +int HAMLIB_API rig_band_changed(RIG *rig, hamlib_bandselect_t band) { // See band_changed.c // Examples: diff --git a/src/misc.c b/src/misc.c index c9000156c..6f13236aa 100644 --- a/src/misc.c +++ b/src/misc.c @@ -740,6 +740,7 @@ static const struct { RIG_FUNC_SEND_MORSE, "SEND_MORSE" }, { RIG_FUNC_SEND_VOICE_MEM, "SEND_VOICE_MEM" }, { RIG_FUNC_OVF_STATUS, "OVF_STATUS" }, + { RIG_FUNC_SYNC, "SYNC" }, { RIG_FUNC_NONE, "" }, }; diff --git a/src/rig.c b/src/rig.c index 751180729..08a9da292 100644 --- a/src/rig.c +++ b/src/rig.c @@ -588,7 +588,7 @@ RIG *HAMLIB_API rig_init(rig_model_t rig_model) rp = RIGPORT(rig); pttp = PTTPORT(rig); dcdp = DCDPORT(rig); - + rs->rig_model = caps->rig_model; rs->priv = NULL; rs->async_data_enabled = 0; @@ -1311,7 +1311,7 @@ int HAMLIB_API rig_open(RIG *rig) case RIG_DCD_GPIO: case RIG_DCD_GPION: dcdp->fd = gpio_open(dcdp, 0, - RIG_DCD_GPION == dcdp->type.dcd ? 0 : 1); + RIG_DCD_GPION == dcdp->type.dcd ? 0 : 1); if (dcdp->fd < 0) { @@ -1961,6 +1961,7 @@ int rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) vfo_t vfo_save; static int last_band = -1; int curr_band; + int band_changing = 0; if (CHECK_RIG_ARG(rig)) { @@ -1974,7 +1975,8 @@ int rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { rig_debug(RIG_DEBUG_VERBOSE, "%s: band changing to %s\n", __func__, rig_get_band_str(rig, curr_band, 0)); - rig_band_changed(rig, curr_band); + band_changing = 1; + //rig_band_changed(rig, curr_band); last_band = curr_band; } @@ -2106,8 +2108,13 @@ int rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) do { - HAMLIB_TRACE; retcode = caps->set_freq(rig, vfo, freq); + + if (band_changing) + { + rig_band_changed(rig, curr_band); + } + // disabling the freq check as of 2023-06-02 // seems unnecessary and slows down rigs unnecessarily tfreq = freq; @@ -2196,6 +2203,9 @@ int rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) } HAMLIB_TRACE; + + if (band_changing) { rig_band_changed(rig, curr_band); } + retcode = caps->set_freq(rig, vfo, freq); } @@ -3283,7 +3293,7 @@ int HAMLIB_API rig_get_vfo(RIG *rig, vfo_t *vfo) caps = rig->caps; - if (caps->get_vfo == NULL) + if (caps->get_vfo == NULL && RIG_ICOM != RIG_BACKEND_NUM(rig->caps->rig_model)) { rig_debug(RIG_DEBUG_WARN, "%s: no get_vfo\n", __func__); ELAPSED2; @@ -4464,7 +4474,7 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) const struct rig_caps *caps; const struct rig_state *rs; int retcode, rc2; - vfo_t curr_vfo, tx_vfo; + vfo_t curr_vfo, tx_vfo = RIG_VFO_CURR; freq_t tfreq = 0; ENTERFUNC2; @@ -8718,18 +8728,22 @@ int morse_data_handler_set_keyspd(RIG *rig, int keyspd) */ HAMLIB_EXPORT(void *) rig_data_pointer(RIG *rig, rig_ptrx_t idx) { - switch(idx) + switch (idx) { case RIG_PTRX_RIGPORT: - return RIGPORT(rig); + return RIGPORT(rig); + case RIG_PTRX_PTTPORT: - return PTTPORT(rig); + return PTTPORT(rig); + case RIG_PTRX_DCDPORT: - return DCDPORT(rig); + return DCDPORT(rig); + case RIG_PTRX_CACHE: - return CACHE(rig); + return CACHE(rig); + default: - rig_debug(RIG_DEBUG_ERR, "%s: Invalid data index=%d\n", __func__, idx); - return NULL; + rig_debug(RIG_DEBUG_ERR, "%s: Invalid data index=%d\n", __func__, idx); + return NULL; } } diff --git a/src/sprintflst.c b/src/sprintflst.c index a53bf30ab..1c22710af 100644 --- a/src/sprintflst.c +++ b/src/sprintflst.c @@ -177,6 +177,7 @@ int rig_sprintf_func(char *str, int nlen, setting_t func) if (!ms || !ms[0]) { + rig_debug(RIG_EINTERNAL, "%s: unknown RIG_FUNC=%x\n", __func__, i); continue; /* unknown, FIXME! */ }