Disable Hamlib caching while determining rig VFO resolution

This commit is contained in:
Bill Somerville 2020-07-04 22:19:59 +01:00
parent f6a7d8c4bd
commit 74c7fade32
No known key found for this signature in database
GPG Key ID: D864B06D1E81618F
3 changed files with 20 additions and 0 deletions

View File

@ -846,6 +846,8 @@ endif (APPLE)
#
# find some useful tools
#
include (CheckSymbolExists)
find_program(CTAGS ctags)
find_program(ETAGS etags)
@ -881,6 +883,10 @@ message (STATUS "hamlib_INCLUDE_DIRS: ${hamlib_INCLUDE_DIRS}")
message (STATUS "hamlib_LIBRARIES: ${hamlib_LIBRARIES}")
message (STATUS "hamlib_LIBRARY_DIRS: ${hamlib_LIBRARY_DIRS}")
set (CMAKE_REQUIRED_INCLUDES "${hamlib_INCLUDE_DIRS}")
set (CMAKE_REQUIRED_LIBRARIES "${hamlib_LIBRARIES}")
check_symbol_exists (rig_set_cache_timeout_ms "hamlib/rig.h" HAVE_HAMLIB_CACHING)
#
# Qt5 setup

View File

@ -606,6 +606,13 @@ int HamlibTransceiver::do_start ()
}
}
#if HAVE_HAMLIB_CACHING
// we must disable Hamlib caching because it lies about frequency
// for less than 1 Hz resolution rigs
auto orig_cache_timeout = rig_get_cache_timeout_ms (rig_.data (), HAMLIB_CACHE_ALL);
rig_set_cache_timeout_ms (rig_.data (), CACHE_ALL, 0);
#endif
int resolution {0};
if (freq_query_works_)
{
@ -646,6 +653,11 @@ int HamlibTransceiver::do_start ()
resolution = -1; // best guess
}
#if HAVE_HAMLIB_CACHING
// revert Hamlib cache timeout
rig_set_cache_timeout_ms (rig_.data (), HAMLIB_CACHE_ALL, orig_cache_timeout);
#endif
do_poll ();
TRACE_CAT ("HamlibTransceiver", "exit" << state () << "reversed =" << reversed_ << "resolution = " << resolution);

View File

@ -19,6 +19,8 @@ extern "C" {
#cmakedefine PROJECT_SAMPLES_URL "@PROJECT_SAMPLES_URL@"
#cmakedefine PROJECT_SUMMARY_DESCRIPTION "@PROJECT_SUMMARY_DESCRIPTION@"
#cmakedefine01 HAVE_HAMLIB_CACHING
#cmakedefine01 WSJT_SHARED_RUNTIME
#cmakedefine01 WSJT_QDEBUG_TO_FILE
#cmakedefine01 WSJT_QDEBUG_IN_RELEASE