kopia lustrzana https://github.com/Hamlib/Hamlib
Fix unidirectional rig cached frequency (e.g. FT736R)
https://github.com/Hamlib/Hamlib/issues/1187pull/1215/head
rodzic
b1828d951a
commit
ea29263f35
|
@ -3395,6 +3395,7 @@ 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, split_t *split, int *satmode);
|
extern HAMLIB_EXPORT(int) rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, pbwidth_t *width, split_t *split, int *satmode);
|
||||||
extern HAMLIB_EXPORT(int) rig_get_rig_info(RIG *rig, char *response, int max_response_len);
|
extern HAMLIB_EXPORT(int) rig_get_rig_info(RIG *rig, char *response, int max_response_len);
|
||||||
extern HAMLIB_EXPORT(int) rig_get_cache(RIG *rig, vfo_t vfo, freq_t *freq, int * cache_ms_freq, rmode_t *mode, int *cache_ms_mode, pbwidth_t *width, int *cache_ms_width);
|
extern HAMLIB_EXPORT(int) rig_get_cache(RIG *rig, vfo_t vfo, freq_t *freq, int * cache_ms_freq, rmode_t *mode, int *cache_ms_mode, pbwidth_t *width, int *cache_ms_width);
|
||||||
|
extern HAMLIB_EXPORT(int) rig_get_cache_freq(RIG *rig, vfo_t vfo, freq_t *freq, int * cache_ms_freq);
|
||||||
|
|
||||||
extern HAMLIB_EXPORT(int) rig_set_clock(RIG *rig, int year, int month, int day, int hour, int min, int sec, double msec, int utc_offset);
|
extern HAMLIB_EXPORT(int) rig_set_clock(RIG *rig, int year, int month, int day, int hour, int min, int sec, double msec, int utc_offset);
|
||||||
extern HAMLIB_EXPORT(int) rig_get_clock(RIG *rig, int *year, int *month, int *day, int *hour, int *min, int *sec, double *msec, int *utc_offset);
|
extern HAMLIB_EXPORT(int) rig_get_clock(RIG *rig, int *year, int *month, int *day, int *hour, int *min, int *sec, double *msec, int *utc_offset);
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "yaesu.h"
|
#include "yaesu.h"
|
||||||
#include "tones.h"
|
#include "tones.h"
|
||||||
|
#include "cache.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,7 +100,7 @@ const struct rig_caps ft736_caps =
|
||||||
RIG_MODEL(RIG_MODEL_FT736R),
|
RIG_MODEL(RIG_MODEL_FT736R),
|
||||||
.model_name = "FT-736R",
|
.model_name = "FT-736R",
|
||||||
.mfg_name = "Yaesu",
|
.mfg_name = "Yaesu",
|
||||||
.version = "20221214.0",
|
.version = "20221218.0",
|
||||||
.copyright = "LGPL",
|
.copyright = "LGPL",
|
||||||
.status = RIG_STATUS_STABLE,
|
.status = RIG_STATUS_STABLE,
|
||||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||||
|
@ -270,6 +271,7 @@ int ft736_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||||
{
|
{
|
||||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x01};
|
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x01};
|
||||||
struct ft736_priv_data *priv = (struct ft736_priv_data *)rig->state.priv;
|
struct ft736_priv_data *priv = (struct ft736_priv_data *)rig->state.priv;
|
||||||
|
int retval;
|
||||||
|
|
||||||
// we will assume requesting to set VFOB is split mode
|
// we will assume requesting to set VFOB is split mode
|
||||||
if (vfo == RIG_VFO_B) { return rig_set_split_freq(rig, vfo, freq); }
|
if (vfo == RIG_VFO_B) { return rig_set_split_freq(rig, vfo, freq); }
|
||||||
|
@ -288,8 +290,11 @@ int ft736_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||||
cmd[0] = (cmd[0] & 0x0f) | 0xc0;
|
cmd[0] = (cmd[0] & 0x0f) | 0xc0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Frequency set */
|
retval = write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||||
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
|
||||||
|
if (retval == RIG_OK) { rig_set_cache_freq(rig, vfo, freq); }
|
||||||
|
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ft736_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
int ft736_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||||
|
@ -297,7 +302,7 @@ int ft736_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||||
|
|
||||||
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN) { *freq = rig->state.cache.freqMainA; }
|
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN) { *freq = rig->state.cache.freqMainA; }
|
||||||
else { *freq = rig->state.cache.freqMainB; }
|
else { rig_get_cache_freq(rig, vfo, freq, NULL); }
|
||||||
|
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
35
src/cache.c
35
src/cache.c
|
@ -442,6 +442,41 @@ int rig_get_cache(RIG *rig, vfo_t vfo, freq_t *freq, int *cache_ms_freq,
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief get cached values for a VFO
|
||||||
|
* \param rig The rig handle
|
||||||
|
* \param vfo The VFO to get information from
|
||||||
|
* \param freq The frequency is stored here
|
||||||
|
* \param cache_ms_freq The age of the last frequency update in ms -- NULL if you don't want it
|
||||||
|
|
||||||
|
* Use this to query the frequency cache and then determine to actually fetch data from
|
||||||
|
* the rig.
|
||||||
|
*
|
||||||
|
* \return RIG_OK if the operation has been successful, otherwise
|
||||||
|
* a negative value if an error occurred (in which case, cause is
|
||||||
|
* set appropriately).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
int rig_get_cache_freq(RIG *rig, vfo_t vfo, freq_t *freq, int *cache_ms_freq_p)
|
||||||
|
{
|
||||||
|
rmode_t mode;
|
||||||
|
int cache_ms_freq;
|
||||||
|
int cache_ms_mode;
|
||||||
|
pbwidth_t width;
|
||||||
|
int cache_ms_width;
|
||||||
|
int retval;
|
||||||
|
retval = rig_get_cache(rig, vfo, freq, &cache_ms_freq, &mode, &cache_ms_mode,
|
||||||
|
&width, &cache_ms_width);
|
||||||
|
|
||||||
|
if (retval == RIG_OK)
|
||||||
|
{
|
||||||
|
if (cache_ms_freq_p) { *cache_ms_freq_p = cache_ms_freq; }
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void rig_cache_show(RIG *rig, const char *func, int line)
|
void rig_cache_show(RIG *rig, const char *func, int line)
|
||||||
{
|
{
|
||||||
rig_debug(RIG_DEBUG_CACHE,
|
rig_debug(RIG_DEBUG_CACHE,
|
||||||
|
|
|
@ -1806,7 +1806,11 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||||
|
|
||||||
if (retcode != RIG_OK) { RETURNFUNC(retcode); }
|
if (retcode != RIG_OK) { RETURNFUNC(retcode); }
|
||||||
|
|
||||||
|
// Unidirectional rigs do not reset cache
|
||||||
|
if (rig->caps->rig_model != RIG_MODEL_FT736R)
|
||||||
|
{
|
||||||
rig_set_cache_freq(rig, vfo, (freq_t)0);
|
rig_set_cache_freq(rig, vfo, (freq_t)0);
|
||||||
|
}
|
||||||
|
|
||||||
#if 0 // this verification seems to be causing bad behavior on some rigs
|
#if 0 // this verification seems to be causing bad behavior on some rigs
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue