diff --git a/CMakeLists.txt b/CMakeLists.txt index ca25c3a08..c3edc5b52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/Transceiver/HamlibTransceiver.cpp b/Transceiver/HamlibTransceiver.cpp index ea30a5b17..8919c06bb 100644 --- a/Transceiver/HamlibTransceiver.cpp +++ b/Transceiver/HamlibTransceiver.cpp @@ -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); diff --git a/wsjtx_config.h.in b/wsjtx_config.h.in index 22ff0f438..0866cf061 100644 --- a/wsjtx_config.h.in +++ b/wsjtx_config.h.in @@ -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