diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cc27accc3..0b747318d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/checkout@v1 - name: install dependencies - run: sudo apt-get update && sudo apt-get install ninja-build libboost-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev libboost-serialization-dev liblog4cpp5-dev gnuradio-dev gr-osmosdr libpugixml-dev libpcap-dev libblas-dev liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev python3-mako + run: sudo apt-get update && sudo apt-get install ninja-build libboost-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev libboost-serialization-dev liblog4cpp5-dev gnuradio-dev gr-osmosdr libpugixml-dev libpcap-dev libblas-dev liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev python3-mako liborc-0.4-dev - name: configure run: cd build && cmake -GNinja .. - name: build diff --git a/CMakeLists.txt b/CMakeLists.txt index f484e8669..d713872e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -630,45 +630,6 @@ endif() -################################################################################ -# Log4cpp - http://log4cpp.sourceforge.net/ -################################################################################ -if(GNURADIO_USES_LOG4CPP) - find_package(LOG4CPP) - set_package_properties(LOG4CPP PROPERTIES - PURPOSE "Required by GNU Radio." - TYPE REQUIRED - ) -endif() - - - -################################################################################ -# spdlog - https://github.com/gabime/spdlog -################################################################################ -if(GNURADIO_USES_SPDLOG) - find_package(SPDLOG REQUIRED) - set_package_properties(SPDLOG PROPERTIES - PURPOSE "Required by GNU Radio." - TYPE REQUIRED - ) -endif() - - - -################################################################################ -# fmt - https://github.com/fmtlib/fmt -################################################################################ -if(GNURADIO_USES_SPDLOG) - find_package(FMT REQUIRED) - set_package_properties(FMT PROPERTIES - PURPOSE "Required by GNU Radio." - TYPE REQUIRED - ) -endif() - - - ################################################################################ # Detect availability of std::filesystem and set C++ standard accordingly ################################################################################ diff --git a/cmake/Modules/FindFMT.cmake b/cmake/Modules/FindFMT.cmake deleted file mode 100644 index 49d091d8a..000000000 --- a/cmake/Modules/FindFMT.cmake +++ /dev/null @@ -1,76 +0,0 @@ -# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. -# This file is part of GNSS-SDR. -# -# SPDX-FileCopyrightText: 2021 C. Fernandez-Prades cfernandez(at)cttc.es -# SPDX-License-Identifier: BSD-3-Clause - -if(NOT COMMAND feature_summary) - include(FeatureSummary) -endif() - -# Locate header -find_path(FMT_INCLUDE_DIR fmt/core.h - HINTS ${FMT_ROOT_DIR}/include - PATHS - /usr/include - /usr/local/include - /opt/local/include -) - -# Locate library -find_library(FMT_LIBRARY NAMES fmt - HINTS ${FMT_ROOT_DIR}/lib ${FMT_ROOT_DIR}/lib64 - PATHS - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib -) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(FMT DEFAULT_MSG FMT_INCLUDE_DIR FMT_LIBRARY) - -set_package_properties(FMT PROPERTIES - URL "https://github.com/fmtlib/fmt" - DESCRIPTION "An open-source formatting library" -) - -# Add imported target. -if(FMT_FOUND) - set(FMT_INCLUDE_DIRS "${FMT_INCLUDE_DIR}") - - if(NOT TARGET fmt::fmt) - add_library(fmt::fmt UNKNOWN IMPORTED) - set_target_properties(fmt::fmt PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${FMT_INCLUDE_DIRS}" - ) - set_property(TARGET fmt::fmt APPEND PROPERTY - IMPORTED_LOCATION "${FMT_LIBRARY}" - ) - endif() -endif() diff --git a/cmake/Modules/FindGNURADIO.cmake b/cmake/Modules/FindGNURADIO.cmake index e7a561018..9e03fdae8 100644 --- a/cmake/Modules/FindGNURADIO.cmake +++ b/cmake/Modules/FindGNURADIO.cmake @@ -20,7 +20,7 @@ include(FindPackageHandleStandardArgs) # if GR_REQUIRED_COMPONENTS is not defined, it will be set to the following list if(NOT GR_REQUIRED_COMPONENTS) - set(GR_REQUIRED_COMPONENTS RUNTIME PMT BLOCKS FFT FILTER ANALOG) + set(GR_REQUIRED_COMPONENTS RUNTIME PMT BLOCKS FFT FILTER ANALOG) endif() # Allows us to use all .cmake files in this directory @@ -411,10 +411,28 @@ if(GNURADIO_RUNTIME_INCLUDE_DIRS) endif() endforeach() if(${_uses_log4cpp}) - set(GNURADIO_USES_LOG4CPP TRUE) + find_package(LOG4CPP) + set_package_properties(LOG4CPP PROPERTIES + PURPOSE "Required by GNU Radio." + TYPE REQUIRED + ) + if(CMAKE_VERSION VERSION_GREATER 3.13) + target_link_libraries(Gnuradio::filter INTERFACE Log4cpp::log4cpp) + else() + set(LOG4CPP_WITH_OLD_CMAKE TRUE) + endif() endif() if(${_uses_spdlog}) + find_package(spdlog REQUIRED CONFIG) + set_package_properties(spdlog PROPERTIES + URL "https://github.com/gabime/spdlog" + DESCRIPTION "Very fast, header-only/compiled, C++ logging library (found: v${spdlog_VERSION})" + PURPOSE "Required by GNU Radio." + TYPE REQUIRED + ) set(GNURADIO_USES_SPDLOG TRUE) + target_link_libraries(Gnuradio::runtime INTERFACE spdlog::spdlog) + target_link_libraries(Gnuradio::blocks INTERFACE spdlog::spdlog) endif() endif() endif() diff --git a/cmake/Modules/FindSPDLOG.cmake b/cmake/Modules/FindSPDLOG.cmake deleted file mode 100644 index ac53fc870..000000000 --- a/cmake/Modules/FindSPDLOG.cmake +++ /dev/null @@ -1,84 +0,0 @@ -# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. -# This file is part of GNSS-SDR. -# -# SPDX-FileCopyrightText: 2021 C. Fernandez-Prades cfernandez(at)cttc.es -# SPDX-License-Identifier: BSD-3-Clause - -if(NOT COMMAND feature_summary) - include(FeatureSummary) -endif() - -# Locate header -find_path(SPDLOG_INCLUDE_DIR spdlog/spdlog.h - HINTS ${SPDLOG_ROOT_DIR}/include - PATHS - /usr/include - /usr/local/include - /opt/local/include -) - -# Locate library -find_library(SPDLOG_LIBRARY NAMES spdlog spdlogd - HINTS ${SPDLOG_ROOT_DIR}/lib ${SPDLOG_ROOT_DIR}/lib64 - PATHS - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib -) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(SPDLOG DEFAULT_MSG SPDLOG_INCLUDE_DIR SPDLOG_LIBRARY) - -set_package_properties(SPDLOG PROPERTIES - URL "https://github.com/gabime/spdlog" - DESCRIPTION "Very fast, header-only/compiled, C++ logging library" -) - -# Add imported target. -if(SPDLOG_FOUND) - set(SPDLOG_INCLUDE_DIRS "${SPDLOG_INCLUDE_DIR}") - - if(NOT TARGET spdlog::spdlog) - add_library(spdlog::spdlog UNKNOWN IMPORTED) - set_target_properties(spdlog::spdlog PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${SPDLOG_INCLUDE_DIRS}" - ) - set_property(TARGET spdlog::spdlog APPEND PROPERTY - IMPORTED_LOCATION "${SPDLOG_LIBRARY}" - ) - endif() - - if(CMAKE_VERSION VERSION_GREATER 3.11.0) - target_compile_definitions(spdlog::spdlog INTERFACE -DSPDLOG_FMT_EXTERNAL=1) - else() - set_property(TARGET spdlog::spdlog APPEND PROPERTY - INTERFACE_COMPILE_DEFINITIONS SPDLOG_FMT_EXTERNAL=1 - ) - endif() -endif() diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 91db3563c..512b55ccc 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -62,6 +62,7 @@ All notable changes to GNSS-SDR will be documented in this file. - The configuration options at building time `-DENABLE_OWN_GLOG`, `-DENABLE_OWN_ARMADILLO`, and `-DENABLE_OWN_GNSSTK` can now be switched `ON` and `OFF` without the need to start from an empty buiding folder. +- Improved CMake handling of the spdlog library used by GNU Radio >= 3.10. ### Improvements in Usability: diff --git a/src/algorithms/PVT/adapters/CMakeLists.txt b/src/algorithms/PVT/adapters/CMakeLists.txt index 3cf70fe95..6b9ff33e6 100644 --- a/src/algorithms/PVT/adapters/CMakeLists.txt +++ b/src/algorithms/PVT/adapters/CMakeLists.txt @@ -39,14 +39,6 @@ if(USE_OLD_BOOST_MATH_COMMON_FACTOR) ) endif() -if(GNURADIO_USES_SPDLOG) - target_link_libraries(pvt_adapters - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(pvt_adapters diff --git a/src/algorithms/PVT/libs/rtcm.cc b/src/algorithms/PVT/libs/rtcm.cc index 6023f19ee..f799f81ee 100644 --- a/src/algorithms/PVT/libs/rtcm.cc +++ b/src/algorithms/PVT/libs/rtcm.cc @@ -1873,8 +1873,8 @@ int32_t Rtcm::read_MT1020(const std::string& message, Glonass_Gnav_Ephemeris& gl { } // Avoid compiler warning - glonass_gnav_eph.d_P_1 = static_cast(Rtcm::bin_to_uint(message_bin.substr(index, 2))); - glonass_gnav_eph.d_P_1 = (glonass_gnav_eph.d_P_1 + 1) * 15; + uint32_t P_1_tmp = Rtcm::bin_to_uint(message_bin.substr(index, 2)); + glonass_gnav_eph.d_P_1 = (P_1_tmp == 0) ? 0. : (P_1_tmp + 1) * 15; index += 2; glonass_gnav_eph.d_t_k += static_cast(Rtcm::bin_to_int(message_bin.substr(index, 5))) * 3600; @@ -5102,8 +5102,9 @@ int32_t Rtcm::set_DF105(uint32_t glonass_gnav_alm_health_ind) int32_t Rtcm::set_DF106(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { - // Convert the value from (15, 30, 45, 60) to (00, 01, 10, 11) - const auto P_1 = static_cast(std::round(glonass_gnav_eph.d_P_1 / 15.0 - 1.0)); + // Convert the value from (0, 30, 45, 60) to (00, 01, 10, 11) + uint32_t P_1_tmp = std::round(glonass_gnav_eph.d_P_1 / 15.); + uint32_t P_1 = (P_1_tmp == 0) ? 0 : P_1_tmp - 1; DF106 = std::bitset<2>(P_1); return 0; } diff --git a/src/algorithms/channel/adapters/channel.cc b/src/algorithms/channel/adapters/channel.cc index 28376dfd8..18590afca 100644 --- a/src/algorithms/channel/adapters/channel.cc +++ b/src/algorithms/channel/adapters/channel.cc @@ -40,6 +40,8 @@ Channel::Channel(const ConfigurationInterface* configuration, role_(role), channel_(channel) { + glonass_extend_correlation_ms_ = configuration->property("Tracking_1G.extend_correlation_ms", 0) + configuration->property("Tracking_2G.extend_correlation_ms", 0); + channel_fsm_ = std::make_shared(); flag_enable_fpga_ = configuration->property("GNSS-SDR.enable_FPGA", false); @@ -128,7 +130,7 @@ void Channel::connect(gr::top_block_sptr top_block) // Message ports top_block->msg_connect(nav_->get_left_block(), pmt::mp("telemetry_to_trk"), trk_->get_right_block(), pmt::mp("telemetry_to_trk")); - if ((trk_->get_right_block()->name() == "glonass_l1_ca_dll_pll_c_aid_tracking_cc") || (trk_->get_right_block()->name() == "glonass_l2_ca_dll_pll_c_aid_tracking_cc")) + if (glonass_dll_pll_c_aid_tracking_check()) { top_block->msg_connect(nav_->get_left_block(), pmt::mp("preamble_timestamp_samples"), trk_->get_right_block(), pmt::mp("preamble_timestamp_samples")); } @@ -162,7 +164,7 @@ void Channel::disconnect(gr::top_block_sptr top_block) nav_->disconnect(top_block); top_block->msg_disconnect(nav_->get_left_block(), pmt::mp("telemetry_to_trk"), trk_->get_right_block(), pmt::mp("telemetry_to_trk")); - if ((trk_->get_right_block()->name() == "glonass_l1_ca_dll_pll_c_aid_tracking_cc") || (trk_->get_right_block()->name() == "glonass_l2_ca_dll_pll_c_aid_tracking_cc")) + if (glonass_dll_pll_c_aid_tracking_check()) { top_block->msg_disconnect(nav_->get_left_block(), pmt::mp("preamble_timestamp_samples"), trk_->get_right_block(), pmt::mp("preamble_timestamp_samples")); } @@ -270,3 +272,28 @@ void Channel::start_acquisition() } DLOG(INFO) << "Channel start_acquisition()"; } + +bool Channel::glonass_dll_pll_c_aid_tracking_check() +{ + if (glonass_extend_correlation_ms_) + { + const pmt::pmt_t nav_ports_out = nav_->get_left_block()->message_ports_out(); + const pmt::pmt_t trk_ports_in = trk_->get_right_block()->message_ports_in(); + const pmt::pmt_t symbol = pmt::mp("preamble_timestamp_samples"); + for (unsigned k = 0; k < pmt::length(nav_ports_out); k++) + { + if (pmt::vector_ref(nav_ports_out, k) == symbol) + { + for (unsigned j = 0; j < pmt::length(trk_ports_in); j++) + { + if (pmt::vector_ref(trk_ports_in, j) == symbol) + { + return true; + } + } + return false; + } + } + } + return false; +} diff --git a/src/algorithms/channel/adapters/channel.h b/src/algorithms/channel/adapters/channel.h index d43d1df42..519f6babd 100644 --- a/src/algorithms/channel/adapters/channel.h +++ b/src/algorithms/channel/adapters/channel.h @@ -96,6 +96,7 @@ public: inline std::shared_ptr telemetry() const { return nav_; } private: + bool glonass_dll_pll_c_aid_tracking_check(); std::shared_ptr channel_fsm_; std::shared_ptr acq_; std::shared_ptr trk_; @@ -106,6 +107,7 @@ private: std::string role_; std::mutex mx_; uint32_t channel_; + int glonass_extend_correlation_ms_; bool connected_; bool repeat_; bool flag_enable_fpga_; diff --git a/src/algorithms/channel/libs/CMakeLists.txt b/src/algorithms/channel/libs/CMakeLists.txt index 90607d700..63e0d72d8 100644 --- a/src/algorithms/channel/libs/CMakeLists.txt +++ b/src/algorithms/channel/libs/CMakeLists.txt @@ -54,14 +54,6 @@ if(GNURADIO_USES_STD_POINTERS) ) endif() -if(GNURADIO_USES_SPDLOG) - target_link_libraries(channel_libs - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - if(USE_GENERIC_LAMBDAS) set(has_generic_lambdas HAS_GENERIC_LAMBDA=1) set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0) diff --git a/src/algorithms/conditioner/adapters/CMakeLists.txt b/src/algorithms/conditioner/adapters/CMakeLists.txt index 265965e67..7c24d008e 100644 --- a/src/algorithms/conditioner/adapters/CMakeLists.txt +++ b/src/algorithms/conditioner/adapters/CMakeLists.txt @@ -42,14 +42,6 @@ target_link_libraries(conditioner_adapters Glog::glog ) -if(GNURADIO_USES_SPDLOG) - target_link_libraries(conditioner_adapters - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - target_include_directories(conditioner_adapters PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/data_type_adapter/gnuradio_blocks/CMakeLists.txt b/src/algorithms/data_type_adapter/gnuradio_blocks/CMakeLists.txt index a0e1f2ddc..5a05385c2 100644 --- a/src/algorithms/data_type_adapter/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/data_type_adapter/gnuradio_blocks/CMakeLists.txt @@ -55,14 +55,6 @@ if(GNURADIO_USES_STD_POINTERS) ) endif() -if(GNURADIO_USES_SPDLOG) - target_link_libraries(data_type_gr_blocks - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - set_property(TARGET data_type_gr_blocks APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $ diff --git a/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt b/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt index c652131ea..51113a267 100644 --- a/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt @@ -48,26 +48,18 @@ target_link_libraries(input_filter_gr_blocks Volk::volk ) -if(LOG4CPP_FOUND) - target_link_libraries(input_filter_gr_blocks - PRIVATE - Log4cpp::log4cpp - ) -endif() - -if(GNURADIO_USES_SPDLOG) - target_link_libraries(input_filter_gr_blocks - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - target_include_directories(input_filter_gr_blocks PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) +if(LOG4CPP_WITH_OLD_CMAKE) + target_link_libraries(input_filter_gr_blocks + PRIVATE + Log4cpp::log4cpp + ) +endif() + if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(input_filter_gr_blocks PUBLIC -DGNURADIO_USES_STD_POINTERS=1 diff --git a/src/algorithms/libs/CMakeLists.txt b/src/algorithms/libs/CMakeLists.txt index e8f0d6366..1e31cf4c3 100644 --- a/src/algorithms/libs/CMakeLists.txt +++ b/src/algorithms/libs/CMakeLists.txt @@ -119,14 +119,6 @@ if(GNURADIO_USES_STD_POINTERS) ) endif() -if(GNURADIO_USES_SPDLOG) - target_link_libraries(algorithms_libs - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - if(FILESYSTEM_FOUND) target_compile_definitions(algorithms_libs PUBLIC -DHAS_STD_FILESYSTEM=1) if(find_experimental) diff --git a/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt b/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt index 7f6537ccf..225518612 100644 --- a/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt @@ -37,14 +37,6 @@ target_link_libraries(obs_gr_blocks Gnuradio::pmt ) -if(GNURADIO_USES_SPDLOG) - target_link_libraries(obs_gr_blocks - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - target_include_directories(obs_gr_blocks PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt b/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt index ae521eeb9..9a7ea4e5d 100644 --- a/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt @@ -50,14 +50,6 @@ if(GNURADIO_USES_STD_POINTERS) ) endif() -if(NOT GNURADIO_USES_LOG4CPP) - target_link_libraries(resampler_gr_blocks - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - target_include_directories(resampler_gr_blocks PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/signal_generator/adapters/CMakeLists.txt b/src/algorithms/signal_generator/adapters/CMakeLists.txt index e8486b326..c430af3c2 100644 --- a/src/algorithms/signal_generator/adapters/CMakeLists.txt +++ b/src/algorithms/signal_generator/adapters/CMakeLists.txt @@ -44,14 +44,6 @@ if(GNURADIO_USES_STD_POINTERS) ) endif() -if(GNURADIO_USES_SPDLOG) - target_link_libraries(signal_generator_adapters - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(signal_generator_adapters diff --git a/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.cc b/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.cc index 91f11b410..a999d1025 100644 --- a/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.cc @@ -109,16 +109,19 @@ Ad936xCustomSignalSource::Ad936xCustomSignalSource(const ConfigurationInterface* else if (ssize_ == 8) { gr_interleaved_char_to_complex_.push_back(gr::blocks::interleaved_char_to_complex::make()); + unpack_short_byte.push_back(make_unpack_short_byte_samples()); } else if (ssize_ == 4) { gr_interleaved_short_to_complex_.push_back(gr::blocks::interleaved_short_to_complex::make(false, false)); unpack_byte_fourbits.push_back(make_unpack_byte_4bit_samples()); + unpack_short_byte.push_back(make_unpack_short_byte_samples()); } else if (ssize_ == 2) { gr_interleaved_short_to_complex_.push_back(gr::blocks::interleaved_short_to_complex::make(false, false)); unpack_byte_twobits.push_back(make_unpack_byte_2bit_cpx_samples()); + unpack_short_byte.push_back(make_unpack_short_byte_samples()); } } } @@ -165,7 +168,8 @@ void Ad936xCustomSignalSource::connect(gr::top_block_sptr top_block) } else if (ssize_ == 8) { - top_block->connect(ad936x_iio_source, n, gr_interleaved_char_to_complex_.at(n), 0); + top_block->connect(ad936x_iio_source, n, unpack_short_byte.at(n), 0); + top_block->connect(unpack_short_byte.at(n), 0, gr_interleaved_char_to_complex_.at(n), 0); DLOG(INFO) << "connected ad936x_iio_source source to gr_interleaved_char_to_complex_ for channel " << n; if (dump_) { @@ -175,7 +179,8 @@ void Ad936xCustomSignalSource::connect(gr::top_block_sptr top_block) } else if (ssize_ == 4) { - top_block->connect(ad936x_iio_source, n, unpack_byte_fourbits.at(n), 0); + top_block->connect(ad936x_iio_source, n, unpack_short_byte.at(n), 0); + top_block->connect(unpack_short_byte.at(n), 0, unpack_byte_fourbits.at(n), 0); top_block->connect(unpack_byte_fourbits.at(n), 0, gr_interleaved_short_to_complex_.at(n), 0); DLOG(INFO) << "connected ad936x_iio_source source to unpack_byte_fourbits for channel " << n; if (dump_) @@ -186,7 +191,8 @@ void Ad936xCustomSignalSource::connect(gr::top_block_sptr top_block) } else if (ssize_ == 2) { - top_block->connect(ad936x_iio_source, n, unpack_byte_twobits.at(n), 0); + top_block->connect(ad936x_iio_source, n, unpack_short_byte.at(n), 0); + top_block->connect(unpack_short_byte.at(n), 0, unpack_byte_twobits.at(n), 0); top_block->connect(unpack_byte_twobits.at(n), 0, gr_interleaved_short_to_complex_.at(n), 0); DLOG(INFO) << "connected ad936x_iio_source source to unpack_byte_fourbits for channel " << n; if (dump_) @@ -216,53 +222,56 @@ void Ad936xCustomSignalSource::disconnect(gr::top_block_sptr top_block) if (ssize_ == 16) { top_block->disconnect(ad936x_iio_source, n, gr_interleaved_short_to_complex_.at(n), 0); - DLOG(INFO) << "connected ad936x_iio_source source to gr_interleaved_short_to_complex for channel " << n; + DLOG(INFO) << "disconnect ad936x_iio_source source to gr_interleaved_short_to_complex for channel " << n; if (dump_) { top_block->disconnect(gr_interleaved_short_to_complex_.at(n), 0, sink_.at(n), 0); - DLOG(INFO) << "connected source to file sink"; + DLOG(INFO) << "disconnect source to file sink"; } } else if (ssize_ == 8) { - top_block->disconnect(ad936x_iio_source, n, gr_interleaved_char_to_complex_.at(n), 0); - DLOG(INFO) << "connected ad936x_iio_source source to gr_interleaved_char_to_complex_ for channel " << n; + top_block->connect(ad936x_iio_source, n, unpack_short_byte.at(n), 0); + top_block->connect(unpack_short_byte.at(n), 0, unpack_byte_fourbits.at(n), 0); + DLOG(INFO) << "disconnect ad936x_iio_source source to gr_interleaved_char_to_complex_ for channel " << n; if (dump_) { top_block->disconnect(gr_interleaved_char_to_complex_.at(n), 0, sink_.at(n), 0); - DLOG(INFO) << "connected source to file sink"; + DLOG(INFO) << "disconnect source to file sink"; } } else if (ssize_ == 4) { - top_block->disconnect(ad936x_iio_source, n, unpack_byte_fourbits.at(n), 0); + top_block->disconnect(ad936x_iio_source, n, unpack_short_byte.at(n), 0); + top_block->disconnect(unpack_short_byte.at(n), 0, unpack_byte_fourbits.at(n), 0); top_block->disconnect(unpack_byte_fourbits.at(n), 0, gr_interleaved_short_to_complex_.at(n), 0); - DLOG(INFO) << "connected ad936x_iio_source source to unpack_byte_fourbits for channel " << n; + DLOG(INFO) << "disconnect ad936x_iio_source source to unpack_byte_fourbits for channel " << n; if (dump_) { - top_block->connect(gr_interleaved_short_to_complex_.at(n), 0, sink_.at(n), 0); - DLOG(INFO) << "connected source to file sink"; + top_block->disconnect(gr_interleaved_short_to_complex_.at(n), 0, sink_.at(n), 0); + DLOG(INFO) << "disconnect source to file sink"; } } else if (ssize_ == 2) { - top_block->disconnect(ad936x_iio_source, n, unpack_byte_twobits.at(n), 0); + top_block->disconnect(ad936x_iio_source, n, unpack_short_byte.at(n), 0); + top_block->disconnect(unpack_short_byte.at(n), 0, unpack_byte_twobits.at(n), 0); top_block->disconnect(unpack_byte_twobits.at(n), 0, gr_interleaved_short_to_complex_.at(n), 0); - DLOG(INFO) << "connected ad936x_iio_source source to unpack_byte_fourbits for channel " << n; + DLOG(INFO) << "disconnect ad936x_iio_source source to unpack_byte_fourbits for channel " << n; if (dump_) { top_block->disconnect(gr_interleaved_short_to_complex_.at(n), 0, sink_.at(n), 0); - DLOG(INFO) << "connected source to file sink"; + DLOG(INFO) << "disconnect source to file sink"; } } else { top_block->disconnect(ad936x_iio_source, n, gr_interleaved_short_to_complex_.at(n), 0); - DLOG(INFO) << "connected ad936x_iio_source source to gr_interleaved_short_to_complex for channel " << n; + DLOG(INFO) << "disconnect ad936x_iio_source source to gr_interleaved_short_to_complex for channel " << n; if (dump_) { top_block->disconnect(gr_interleaved_short_to_complex_.at(n), 0, sink_.at(n), 0); - DLOG(INFO) << "connected source to file sink"; + DLOG(INFO) << "disconnect source to file sink"; } } } diff --git a/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.h b/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.h index cc9abb82b..88bba68ef 100644 --- a/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.h +++ b/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.h @@ -23,6 +23,7 @@ #include "signal_source_base.h" #include "unpack_byte_2bit_cpx_samples.h" #include "unpack_byte_4bit_samples.h" +#include "unpack_short_byte_samples.h" #include #include #include @@ -74,6 +75,7 @@ private: std::vector gr_interleaved_short_to_complex_; std::vector gr_interleaved_char_to_complex_; + std::vector unpack_short_byte; std::vector unpack_byte_fourbits; std::vector unpack_byte_twobits; diff --git a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt index b09f94cca..c0f89540a 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt @@ -30,6 +30,7 @@ set(SIGNAL_SOURCE_GR_BLOCKS_SOURCES unpack_byte_2bit_cpx_samples.cc unpack_byte_4bit_samples.cc unpack_intspir_1bit_samples.cc + unpack_short_byte_samples.cc rtl_tcp_signal_source_c.cc unpack_2bit_samples.cc unpack_spir_gss6450_samples.cc @@ -44,6 +45,7 @@ set(SIGNAL_SOURCE_GR_BLOCKS_HEADERS unpack_byte_2bit_cpx_samples.h unpack_byte_4bit_samples.h unpack_intspir_1bit_samples.h + unpack_short_byte_samples.h rtl_tcp_signal_source_c.h unpack_2bit_samples.h unpack_spir_gss6450_samples.h diff --git a/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc b/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc index f19a7e0a3..77ebd64bc 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc @@ -79,6 +79,21 @@ ad936x_iio_source_sptr ad936x_iio_make_source_sptr( spattern_)); } +void ad936x_iio_source::ad9361_channel_demux_and_record(ad936x_iio_samples *samples_in, int nchannels, std::vector *files_out) +{ + int32_t current_byte = 0; + int16_t ch = 0; + // std::cout << "nbytes: " << samples_in->n_bytes << " nsamples: " << samples_in->n_samples << " nch: " << nchannels << "\n"; + while (current_byte < samples_in->n_bytes) + { + for (ch = 0; ch < nchannels; ch++) + { + //std::cout << current_byte << " of " << samples_in->n_bytes << " test: " << (int)samples_in->buffer[current_byte] << "\n"; + (*files_out).at(ch).write(&samples_in->buffer[current_byte], 4); //two bytes I + two bytes Q per channel + current_byte += 4; + } + } +} ad936x_iio_source::ad936x_iio_source( std::string pluto_uri_, @@ -222,9 +237,22 @@ ad936x_iio_source::ad936x_iio_source( exit(1); } - //set_min_noutput_items(IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * 2); - set_min_output_buffer(IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * 2); + set_min_noutput_items(IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * 2); // multiplexed I,Q, so, two samples per complex sample + set_min_output_buffer(IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * sizeof(int16_t) * 2); //std::cout << "max_output_buffer " << min_output_buffer(0) << " min_noutput_items: " << min_noutput_items() << "\n"; + + // for (int n = 0; n < ad936x_custom->n_channels; n++) + // { + // std::string cap_file_root_name = "./debug_cap_ch"; + // samplesfile.push_back(std::fstream(cap_file_root_name + std::to_string(n) + ".dat", std::ios::out | std::ios::binary)); + // //samplesfile.back().exceptions(std::ios_base::badbit | std::ios_base::failbit); //this will enable exceptions for debug + // + // if (samplesfile.back().is_open() == false) + // { + // std::cout << "ERROR: Could not open " << cap_file_root_name + "_ch" + std::to_string(n) + ".dat" + // << " for record samples!\n"; + // } + // } } ad936x_iio_source::~ad936x_iio_source() @@ -246,6 +274,7 @@ bool ad936x_iio_source::start() bool ad936x_iio_source::stop() { + std::cout << "stopping ad936x_iio_source...\n"; ad936x_custom->stop_record(); return true; } @@ -261,16 +290,46 @@ int ad936x_iio_source::general_work(int noutput_items, current_samples = current_buffer.get(); //I and Q samples are interleaved in buffer: IQIQIQ... - - for (size_t n = 0; n < ad936x_custom->n_channels; n++) + int32_t n_interleaved_iq_samples_per_channel = current_samples->n_bytes / (ad936x_custom->n_channels * 2); + if (noutput_items < n_interleaved_iq_samples_per_channel) { - if (output_items.size() > n) // check if the output channel is connected - { - memcpy(reinterpret_cast(output_items[n]), reinterpret_cast(current_samples->buffer[n]), current_samples->n_bytes[n]); - produce(n, current_samples->n_samples[n]); - } + std::cout << "ad936x_iio_source output buffer overflow! noutput_items: " << noutput_items << " vs. " << n_interleaved_iq_samples_per_channel << "\n"; + return 0; } + else + { + //ad9361_channel_demux_and_record(current_samples, ad936x_custom->n_channels, &samplesfile); - ad936x_custom->push_sample_buffer(current_buffer); - return this->WORK_CALLED_PRODUCE; + uint32_t current_byte = 0; + uint32_t current_byte_in_gr = 0; + int16_t ch = 0; + //std::cout << "nbytes: " << samples_in->n_bytes << " nsamples: " << samples_in->n_samples << " nch: " << nchannels << "\n"; + if (ad936x_custom->n_channels == 1) + { + memcpy(&((char *)output_items[0])[0], ¤t_samples->buffer[current_byte], current_samples->n_bytes); + } + else + { + while (current_byte < current_samples->n_bytes) + + { + for (ch = 0; ch < ad936x_custom->n_channels; ch++) + { + memcpy(&((char *)output_items[ch])[current_byte_in_gr], ¤t_samples->buffer[current_byte], 4); // two bytes I + two bytes Q per channel: 4 bytes + current_byte += 4; + } + current_byte_in_gr += 4; + } + } + ad936x_custom->push_sample_buffer(current_buffer); + return n_interleaved_iq_samples_per_channel; // always int16_t samples interleaved (I,Q,I,Q) + + // for (size_t n = 0; n < ad936x_custom->n_channels; n++) + // { + // produce(n, current_samples->n_samples[n]); + // } + // + // + // return this->WORK_CALLED_PRODUCE; + } } diff --git a/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.h b/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.h index 497146277..7285ce15b 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.h +++ b/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.h @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -131,12 +132,16 @@ private: int bshift_, bool spattern_); + + void ad9361_channel_demux_to_buffer(ad936x_iio_samples *samples_in, int nchannels, gr_vector_void_star &output_items); + void ad9361_channel_demux_and_record(ad936x_iio_samples *samples_in, int nchannels, std::vector *files_out); + std::thread pps_rx_thread; - - std::unique_ptr ad936x_custom; std::shared_ptr pps_rx; std::shared_ptr> ppsqueue; + + std::vector samplesfile; }; diff --git a/src/algorithms/signal_source/gnuradio_blocks/unpack_short_byte_samples.cc b/src/algorithms/signal_source/gnuradio_blocks/unpack_short_byte_samples.cc new file mode 100644 index 000000000..6c9a91ded --- /dev/null +++ b/src/algorithms/signal_source/gnuradio_blocks/unpack_short_byte_samples.cc @@ -0,0 +1,55 @@ +/*! + * \file unpack_short_byte_samples.cc + * + * \brief Unpacks shorts samples to byte samples (1 short = 2 byte samples). + * Packing Order + * Packing order in Nibble I0 I1 + * \author Javier Arribas jarribas (at) cttc.es + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "unpack_short_byte_samples.h" +#include + +unpack_short_byte_samples_sptr make_unpack_short_byte_samples() +{ + return unpack_short_byte_samples_sptr(new unpack_short_byte_samples()); +} + + +unpack_short_byte_samples::unpack_short_byte_samples() : sync_interpolator("unpack_short_byte_samples", + gr::io_signature::make(1, 1, sizeof(int16_t)), + gr::io_signature::make(1, 1, sizeof(int8_t)), + 2) +{ +} + + +void unpack_short_byte_samples::forecast(int noutput_items, + gr_vector_int &ninput_items_required) +{ + if (noutput_items != 0) + { + ninput_items_required[0] = static_cast(noutput_items) / 2; + } +} + +int unpack_short_byte_samples::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + // const auto *in = reinterpret_cast(input_items[0]); + // auto *out = reinterpret_cast(output_items[0]); + + memcpy(reinterpret_cast(output_items[0]), reinterpret_cast(input_items[0]), noutput_items); + + return noutput_items; +} diff --git a/src/algorithms/signal_source/gnuradio_blocks/unpack_short_byte_samples.h b/src/algorithms/signal_source/gnuradio_blocks/unpack_short_byte_samples.h new file mode 100644 index 000000000..e6e64781a --- /dev/null +++ b/src/algorithms/signal_source/gnuradio_blocks/unpack_short_byte_samples.h @@ -0,0 +1,58 @@ +/*! + * \file unpack_short_byte_samples.cc + * + * \brief Unpacks shorts samples to byte samples (1 short = 2 byte samples). + * Packing Order + * Packing order in Nibble I0 I1 + * \author Javier Arribas jarribas (at) cttc.es + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_UNPACK_SHORT_BYTE_SAMPLES_H +#define GNSS_SDR_UNPACK_SHORT_BYTE_SAMPLES_H + +#include "gnss_block_interface.h" +#include + +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_gnuradio_blocks + * \{ */ + + +class unpack_short_byte_samples; + +using unpack_short_byte_samples_sptr = gnss_shared_ptr; + +unpack_short_byte_samples_sptr make_unpack_short_byte_samples(); + +/*! + * \brief This class implements conversion between short packet samples to byte samples + * 1 short = 2 byte samples + */ +class unpack_short_byte_samples : public gr::sync_interpolator +{ +public: + unpack_short_byte_samples(); + void forecast(int noutput_items, gr_vector_int &ninput_items_required); + ~unpack_short_byte_samples() = default; + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + +private: + friend unpack_short_byte_samples_sptr make_unpack_short_byte_samples_sptr(); +}; + + +/** \} */ +/** \} */ +#endif // GNSS_SDR_UNPACK_SHORT_BYTE_SAMPLES_H diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index 00555c424..e37eb9d48 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -92,14 +92,6 @@ if(GNURADIO_USES_STD_POINTERS) ) endif() -if(GNURADIO_USES_SPDLOG) - target_link_libraries(signal_source_libs - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - if(ENABLE_FMCOMMS2 OR ENABLE_AD9361 OR ENABLE_PLUTOSDR) target_link_libraries(signal_source_libs PUBLIC diff --git a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc index 0076c27fc..92be896c4 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc +++ b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc @@ -247,7 +247,8 @@ bool ad936x_iio_custom::config_ad9361_dds(uint64_t freq_rf_tx_hz_, double tx_attenuation_db_, int64_t freq_dds_tx_hz_, double scale_dds_, - double phase_dds_deg_) + double phase_dds_deg_, + int channel) { // TX stream config std::cout << "Start of AD9361 TX Oscillator DDS configuration\n"; @@ -260,52 +261,60 @@ bool ad936x_iio_custom::config_ad9361_dds(uint64_t freq_rf_tx_hz_, params_phy.push_back("out_altvoltage1_TX_LO_frequency=" + std::to_string(freq_rf_tx_hz_)); - - params_phy.push_back("out_voltage0_hardwaregain=" + - std::to_string(-tx_attenuation_db_)); - - //disable the other TX - params_phy.push_back("out_voltage1_hardwaregain=" + - std::to_string(-tx_attenuation_db_)); - - + double disabled_tx_attenuation = 89.75; + if (channel == 1) + { + params_phy.push_back("out_voltage0_hardwaregain=" + + std::to_string(-tx_attenuation_db_)); + //disable the other TX + params_phy.push_back("out_voltage1_hardwaregain=" + + std::to_string(-disabled_tx_attenuation)); + } + else + { + params_phy.push_back("out_voltage1_hardwaregain=" + + std::to_string(-tx_attenuation_db_)); + //disable the other TX + params_phy.push_back("out_voltage0_hardwaregain=" + + std::to_string(-disabled_tx_attenuation)); + } configure_params(phy, params_phy); std::vector params_dds; //DDS TX CH1 I (tone #1) - params_dds.push_back("out_altvoltage0_TX1_I_F1_frequency=" + - std::to_string(freq_dds_tx_hz_)); - params_dds.push_back("out_altvoltage0_TX1_I_F1_phase=" + - std::to_string(phase_dds_deg_ * 1000.0)); - params_dds.push_back("out_altvoltage0_TX1_I_F1_scale=" + - std::to_string(scale_dds_)); - params_dds.push_back("out_altvoltage0_TX1_I_F1_raw=1"); - //DDS TX CH1 Q (tone #1) - params_dds.push_back("out_altvoltage2_TX1_Q_F1_frequency=" + - std::to_string(freq_dds_tx_hz_)); - params_dds.push_back("out_altvoltage2_TX1_Q_F1_phase=" + - std::to_string(phase_dds_deg_ * 1000.0 + 270000.0)); - params_dds.push_back("out_altvoltage2_TX1_Q_F1_scale=" + - std::to_string(scale_dds_)); - params_dds.push_back("out_altvoltage2_TX1_Q_F1_raw=1"); - - //DDS TX CH1 I (tone #1) - // params_dds.push_back("out_altvoltage4_TX2_I_F1_frequency=" + + // params_dds.push_back("out_altvoltage0_TX1_I_F1_frequency=" + // std::to_string(freq_dds_tx_hz_)); - // params_dds.push_back("out_altvoltage4_TX2_I_F1_phase=" + + // params_dds.push_back("out_altvoltage0_TX1_I_F1_phase=" + // std::to_string(phase_dds_deg_ * 1000.0)); - // params_dds.push_back("out_altvoltage4_TX2_I_F1_scale=" + + // params_dds.push_back("out_altvoltage0_TX1_I_F1_scale=" + // std::to_string(scale_dds_)); - // params_dds.push_back("out_altvoltage4_TX2_I_F1_raw=1"); + // params_dds.push_back("out_altvoltage0_TX1_I_F1_raw=1"); // //DDS TX CH1 Q (tone #1) - // params_dds.push_back("out_altvoltage6_TX2_Q_F1_frequency=" + + // params_dds.push_back("out_altvoltage2_TX1_Q_F1_frequency=" + // std::to_string(freq_dds_tx_hz_)); - // params_dds.push_back("out_altvoltage6_TX2_Q_F1_phase=" + + // params_dds.push_back("out_altvoltage2_TX1_Q_F1_phase=" + // std::to_string(phase_dds_deg_ * 1000.0 + 270000.0)); - // params_dds.push_back("out_altvoltage6_TX2_Q_F1_scale=" + + // params_dds.push_back("out_altvoltage2_TX1_Q_F1_scale=" + // std::to_string(scale_dds_)); - // params_dds.push_back("out_altvoltage6_TX2_Q_F1_raw=1"); + // params_dds.push_back("out_altvoltage2_TX1_Q_F1_raw=1"); + + //DDS TX CH2 I (tone #1) + params_dds.push_back("out_altvoltage4_TX2_I_F1_frequency=" + + std::to_string(freq_dds_tx_hz_)); + params_dds.push_back("out_altvoltage4_TX2_I_F1_phase=" + + std::to_string(phase_dds_deg_ * 1000.0)); + params_dds.push_back("out_altvoltage4_TX2_I_F1_scale=" + + std::to_string(scale_dds_)); + params_dds.push_back("out_altvoltage4_TX2_I_F1_raw=1"); + //DDS TX CH2 Q (tone #1) + params_dds.push_back("out_altvoltage6_TX2_Q_F1_frequency=" + + std::to_string(freq_dds_tx_hz_)); + params_dds.push_back("out_altvoltage6_TX2_Q_F1_phase=" + + std::to_string(phase_dds_deg_ * 1000.0 + 270000.0)); + params_dds.push_back("out_altvoltage6_TX2_Q_F1_scale=" + + std::to_string(scale_dds_)); + params_dds.push_back("out_altvoltage6_TX2_Q_F1_raw=1"); configure_params(dds_dev, params_dds); @@ -511,10 +520,11 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, std::cout << "Configuring DDS Local Oscillator generation. LO Freq. is " << delta_freq_hz << " [Hz]\n"; PlutoTxEnable(true); config_ad9361_dds(delta_freq_hz, - 30, - 100000, + 0, + 0, 0.9, - 0); + 0, + 2); std::cout << "Configuring DDS Local Oscillator generation DONE\n"; } else @@ -633,6 +643,7 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, // } std::cout << "AD936x Front-end configuration summary: \n"; + std::cout << "RF frequency tunned in AD936x: " << freq_ << " [Hz]\n"; std::cout << "Baseband sampling frequency: " << sample_rate_sps << " [SPS]\n"; std::cout << "RX chain gain: " << rf_gain_rx0_ << " [dB][only valid in manual mode]\n"; std::cout << "RX chain gain mode: " << gain_mode_rx0_ << "\n"; @@ -812,13 +823,13 @@ void ad936x_iio_custom::stop_record() { receive_samples = false; - if (capture_time_thread.joinable() == true) + if (capture_samples_thread.joinable() == true) { std::cout << "Joining sample cature thread...\n"; capture_samples_thread.join(); } - if (capture_time_thread.joinable() == true) + if (overflow_monitor_thread.joinable() == true) { std::cout << "Joining overflow monitor thread...\n"; overflow_monitor_thread.join(); @@ -1153,7 +1164,7 @@ void ad936x_iio_custom::capture(const std::vector &channels) unsigned long items_in_buffer; std::cerr << "Enter capture loop...\n"; int ret; - int bytes_per_channel = static_cast(channels.size()) * 2; //each channel has two items in channels vector (I,Q). Each component has two bytes. + int bytes_to_interleaved_iq_samples = n_channels * sizeof(int16_t); while (receive_samples == true) { free_buffers.wait_and_pop(current_buffer); @@ -1173,21 +1184,16 @@ void ad936x_iio_custom::capture(const std::vector &channels) return; } } + memcpy(¤t_samples->buffer[0], iio_buffer_start(rxbuf), ret); - // Demultiplex the samples of a given channel - int n_ch = 0; - for (auto it = std::begin(channel_list); it != std::end(channel_list); ++it) - { - current_samples->n_bytes[n_ch] = iio_channel_read_raw(*it, rxbuf, ¤t_samples->buffer[n_ch][0], IIO_MAX_BYTES_PER_CHANNEL); - current_samples->n_samples[n_ch] = current_samples->n_bytes[n_ch] / sizeof(short); - n_ch++; - } + items_in_buffer = static_cast(ret) / bytes_to_interleaved_iq_samples; - // old, valid only for one channel - //memcpy(¤t_samples->buffer[0], iio_buffer_start(rxbuf), ret); - - if (current_samples->n_bytes[0] == 0) return; + if (items_in_buffer == 0) return; + current_samples->n_channels = n_channels; + current_samples->n_interleaved_iq_samples = items_in_buffer; + current_samples->n_bytes = ret; + current_samples->step_bytes = iio_buffer_step(rxbuf); used_buffers.push(current_buffer); } diff --git a/src/algorithms/signal_source/libs/ad936x_iio_custom.h b/src/algorithms/signal_source/libs/ad936x_iio_custom.h index f8c1fe718..4d95fb340 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_custom.h +++ b/src/algorithms/signal_source/libs/ad936x_iio_custom.h @@ -99,7 +99,8 @@ private: double tx_attenuation_db_, int64_t freq_dds_tx_hz_, double scale_dds_, - double phase_dds_deg_); + double phase_dds_deg_, + int channel); void get_PPS_timestamp(); void capture(const std::vector &channels); diff --git a/src/algorithms/signal_source/libs/ad936x_iio_samples.cc b/src/algorithms/signal_source/libs/ad936x_iio_samples.cc index 7d1ef5681..b9b7b505a 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_samples.cc +++ b/src/algorithms/signal_source/libs/ad936x_iio_samples.cc @@ -18,9 +18,8 @@ ad936x_iio_samples::ad936x_iio_samples() { - for (int n = 0; n < IIO_MAX_CH; n++) - { - n_bytes[n] = 0; - n_samples[n] = 0; - } + n_bytes = 0; + n_interleaved_iq_samples = 0; + step_bytes = 0; + n_channels = 0; } diff --git a/src/algorithms/signal_source/libs/ad936x_iio_samples.h b/src/algorithms/signal_source/libs/ad936x_iio_samples.h index 5e932075c..5156e89f0 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_samples.h +++ b/src/algorithms/signal_source/libs/ad936x_iio_samples.h @@ -18,12 +18,9 @@ #ifndef SRC_LIBS_ad936x_iio_samples_H_ #define SRC_LIBS_ad936x_iio_samples_H_ -#define IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES 32768 * 2 +#define IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES 32768 -#define IIO_INPUTRAMFIFOSIZE 512 - -#define IIO_MAX_CH 4 -#define IIO_MAX_BYTES_PER_CHANNEL IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * 2 * 2 //(2-bytes per I + 2-bytes per Q) +#define IIO_INPUTRAMFIFOSIZE 256 #include #include @@ -33,9 +30,11 @@ class ad936x_iio_samples { public: ad936x_iio_samples(); - uint32_t n_bytes[IIO_MAX_CH]; - uint32_t n_samples[IIO_MAX_CH]; - int16_t buffer[IIO_MAX_CH][IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * 2]; //16 bits I,Q samples buffers + uint32_t n_bytes; + uint32_t n_interleaved_iq_samples; + uint16_t n_channels; + uint16_t step_bytes; + char buffer[IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * 4 * 4]; //max 16 bits samples per buffer (4 channels, 2-bytes per I + 2-bytes per Q) }; #endif diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt index d6bed4f97..c71184aa8 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt @@ -69,14 +69,6 @@ if(GNURADIO_USES_STD_POINTERS) ) endif() -if(GNURADIO_USES_SPDLOG) - target_link_libraries(telemetry_decoder_gr_blocks - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - target_include_directories(telemetry_decoder_gr_blocks PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc index 6ca1c9030..0c3884cf3 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -85,7 +85,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(const p DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN); if (d_enable_extended_integration == false) // avoid re-setting preamble indicator { - d_preamble_timestamp_s = pmt::to_double(msg); + d_preamble_timestamp_samples = pmt::to_double(msg); d_enable_extended_integration = true; d_preamble_synchronized = false; } @@ -134,10 +134,10 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc d_pll_to_dll_assist_secs_Ti(0.0), d_carr_phase_error_secs_Ti(0.0), d_code_error_chips_Ti(0.0), - d_preamble_timestamp_s(0.0), - d_extend_correlation_ms(extend_correlation_ms), + d_preamble_timestamp_samples(0.0), d_code_error_filt_chips_s(0.0), d_code_error_filt_chips_Ti(0.0), + d_extend_correlation_ms(extend_correlation_ms), d_correlation_length_samples(static_cast(d_vector_length)), d_sample_counter(0ULL), d_acq_sample_stamp(0), @@ -154,8 +154,8 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc d_dump(dump) { // Telemetry bit synchronization message port input - this->message_port_register_in(pmt::mp("preamble_timestamp_s")); - this->set_msg_handler(pmt::mp("preamble_timestamp_s"), + this->message_port_register_in(pmt::mp("preamble_timestamp_samples")); + this->set_msg_handler(pmt::mp("preamble_timestamp_samples"), #if HAS_GENERIC_LAMBDA [this](auto &&PH1) { msg_handler_preamble_index(PH1); }); #else @@ -209,7 +209,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking() const double acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / static_cast(d_fs_in); // Doppler effect // Fd=(C/(C+Vr))*F - d_glonass_freq_ch = GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_FREQ_HZ * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)); + d_glonass_freq_ch = GLONASS_L1_CA_FREQ_HZ + (DFRQ1_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)); const double radial_velocity = (d_glonass_freq_ch + d_acq_carrier_doppler_hz) / d_glonass_freq_ch; // new chip and prn sequence periods based on acq Doppler d_code_freq_chips = radial_velocity * GLONASS_L1_CA_CODE_RATE_CPS; @@ -273,8 +273,8 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking() // enable tracking d_pull_in = true; d_enable_tracking = true; - d_enable_extended_integration = true; - d_preamble_synchronized = true; + d_enable_extended_integration = false; + d_preamble_synchronized = false; LOG(INFO) << "PULL-IN Doppler [Hz]=" << d_carrier_doppler_hz << " Code Phase correction [samples]=" << delay_correction_samples @@ -604,7 +604,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at bool enable_dll_pll; if (d_enable_extended_integration == true) { - int64_t symbol_diff = round(1000.0 * ((static_cast(d_sample_counter) + d_rem_code_phase_samples) / static_cast(d_fs_in) - d_preamble_timestamp_s)); + int64_t symbol_diff = round(1000.0 * ((static_cast(d_sample_counter) + d_rem_code_phase_samples - d_preamble_timestamp_samples) / static_cast(d_fs_in))); if (symbol_diff > 0 and symbol_diff % d_extend_correlation_ms == 0) { // compute coherent integration and enable tracking loop @@ -631,6 +631,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at } // UPDATE INTEGRATION TIME CURRENT_INTEGRATION_TIME_S = static_cast(d_extend_correlation_ms) * GLONASS_L1_CA_CODE_PERIOD_S; + d_code_loop_filter.set_pdi(static_cast(CURRENT_INTEGRATION_TIME_S)); enable_dll_pll = true; } else diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.h b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.h index 8c482ec92..696991b86 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.h +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.h @@ -170,10 +170,10 @@ private: double d_pll_to_dll_assist_secs_Ti; double d_carr_phase_error_secs_Ti; double d_code_error_chips_Ti; - double d_preamble_timestamp_s; - int32_t d_extend_correlation_ms; + double d_preamble_timestamp_samples; double d_code_error_filt_chips_s; double d_code_error_filt_chips_Ti; + int32_t d_extend_correlation_ms; // Integration period in samples int32_t d_correlation_length_samples; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc index ebd6894e6..ad99f53cd 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc @@ -83,7 +83,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(const p DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN); if (d_enable_extended_integration == false) // avoid re-setting preamble indicator { - d_preamble_timestamp_s = pmt::to_double(msg); + d_preamble_timestamp_samples = pmt::to_double(msg); d_enable_extended_integration = true; d_preamble_synchronized = false; } @@ -132,10 +132,10 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc d_pll_to_dll_assist_secs_Ti(0.0), d_carr_phase_error_secs_Ti(0.0), d_code_error_chips_Ti(0.0), - d_preamble_timestamp_s(0.0), - d_extend_correlation_ms(extend_correlation_ms), + d_preamble_timestamp_samples(0.0), d_code_error_filt_chips_s(0.0), d_code_error_filt_chips_Ti(0.0), + d_extend_correlation_ms(extend_correlation_ms), d_correlation_length_samples(static_cast(d_vector_length)), d_sample_counter(0ULL), d_acq_sample_stamp(0), @@ -152,8 +152,8 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc d_dump(dump) { // Telemetry bit synchronization message port input - this->message_port_register_in(pmt::mp("preamble_timestamp_s")); - this->set_msg_handler(pmt::mp("preamble_timestamp_s"), + this->message_port_register_in(pmt::mp("preamble_timestamp_samples")); + this->set_msg_handler(pmt::mp("preamble_timestamp_samples"), #if HAS_GENERIC_LAMBDA [this](auto &&PH1) { msg_handler_preamble_index(PH1); }); #else @@ -206,7 +206,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::start_tracking() const double acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / static_cast(d_fs_in); // Doppler effect // Fd=(C/(C+Vr))*F - d_glonass_freq_ch = GLONASS_L2_CA_FREQ_HZ + (GLONASS_L2_CA_FREQ_HZ * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)); + d_glonass_freq_ch = GLONASS_L2_CA_FREQ_HZ + (DFRQ2_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)); const double radial_velocity = (d_glonass_freq_ch + d_acq_carrier_doppler_hz) / d_glonass_freq_ch; // new chip and prn sequence periods based on acq Doppler d_code_freq_chips = radial_velocity * GLONASS_L2_CA_CODE_RATE_CPS; @@ -269,8 +269,8 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::start_tracking() // enable tracking d_pull_in = true; d_enable_tracking = true; - d_enable_extended_integration = true; - d_preamble_synchronized = true; + d_enable_extended_integration = false; + d_preamble_synchronized = false; d_acc_carrier_phase_initialized = false; LOG(INFO) << "PULL-IN Doppler [Hz]=" << d_carrier_doppler_hz @@ -601,7 +601,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at bool enable_dll_pll; if (d_enable_extended_integration == true) { - const int64_t symbol_diff = round(1000.0 * ((static_cast(d_sample_counter) + d_rem_code_phase_samples) / static_cast(d_fs_in) - d_preamble_timestamp_s)); + const int64_t symbol_diff = round(1000.0 * ((static_cast(d_sample_counter) + d_rem_code_phase_samples - d_preamble_timestamp_samples) / static_cast(d_fs_in))); if (symbol_diff > 0 and symbol_diff % d_extend_correlation_ms == 0) { // compute coherent integration and enable tracking loop @@ -663,6 +663,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at // perform basic (1ms) correlation // UPDATE INTEGRATION TIME CURRENT_INTEGRATION_TIME_S = static_cast(d_correlation_length_samples) / static_cast(d_fs_in); + d_code_loop_filter.set_pdi(static_cast(CURRENT_INTEGRATION_TIME_S)); enable_dll_pll = true; } } diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.h b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.h index 0902aa17a..203e47d2e 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.h +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.h @@ -165,10 +165,10 @@ private: double d_pll_to_dll_assist_secs_Ti; double d_carr_phase_error_secs_Ti; double d_code_error_chips_Ti; - double d_preamble_timestamp_s; - int32_t d_extend_correlation_ms; + double d_preamble_timestamp_samples; double d_code_error_filt_chips_s; double d_code_error_filt_chips_Ti; + int32_t d_extend_correlation_ms; // Integration period in samples int32_t d_correlation_length_samples; diff --git a/src/core/libs/supl/CMakeLists.txt b/src/core/libs/supl/CMakeLists.txt index 36b7261c7..a08631e91 100644 --- a/src/core/libs/supl/CMakeLists.txt +++ b/src/core/libs/supl/CMakeLists.txt @@ -65,6 +65,15 @@ target_include_directories(core_libs_supl ${CMAKE_CURRENT_SOURCE_DIR}/types ) +# This is ancient and unmaintained code. As the project migrates to modern +# compilers, non-standards-conforming constructs will be flagged as errors. This +# should be upgraded, but until then, allow non-standards-conforming constructs +if(NOT (CMAKE_VERSION VERSION_LESS "3.1")) + set_target_properties(core_libs_supl + PROPERTIES C_EXTENSIONS ON + ) +endif() + set_property(TARGET core_libs_supl APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $ diff --git a/src/core/monitor/CMakeLists.txt b/src/core/monitor/CMakeLists.txt index 4f6211a40..cfd2cdab3 100644 --- a/src/core/monitor/CMakeLists.txt +++ b/src/core/monitor/CMakeLists.txt @@ -73,14 +73,6 @@ if(GNURADIO_USES_STD_POINTERS) ) endif() -if(GNURADIO_USES_SPDLOG) - target_link_libraries(core_monitor - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - if(USE_BOOST_ASIO_IO_CONTEXT) target_compile_definitions(core_monitor PUBLIC diff --git a/src/core/system_parameters/glonass_gnav_navigation_message.cc b/src/core/system_parameters/glonass_gnav_navigation_message.cc index d6469898d..3f1bcd12e 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.cc +++ b/src/core/system_parameters/glonass_gnav_navigation_message.cc @@ -235,6 +235,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame { int32_t J = 0; d_frame_ID = 0U; + uint64_t P_1_tmp = 0; // Unpack bytes to bits const std::bitset string_bits(frame_string); @@ -252,7 +253,8 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame { case 1: // --- It is string 1 ----------------------------------------------- - gnav_ephemeris.d_P_1 = (static_cast(read_navigation_unsigned(string_bits, P1)) + 1) * 15; + P_1_tmp = read_navigation_unsigned(string_bits, P1); + gnav_ephemeris.d_P_1 = (P_1_tmp == 0) ? 0. : (P_1_tmp + 1) * 15; gnav_ephemeris.d_t_k = static_cast(read_navigation_unsigned(string_bits, T_K_HR)) * 3600 + static_cast(read_navigation_unsigned(string_bits, T_K_MIN)) * 60 + static_cast(read_navigation_unsigned(string_bits, T_K_SEC)) * 30; diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt b/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt index 6740932fb..53545ef44 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt +++ b/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt @@ -53,14 +53,6 @@ target_include_directories(signal_processing_testing_lib ${GNSSSDR_SOURCE_DIR}/src/tests/common-files ) -if(GNURADIO_USES_SPDLOG) - target_link_libraries(signal_processing_testing_lib - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - if(USE_GENERIC_LAMBDAS) set(has_generic_lambdas HAS_GENERIC_LAMBDA=1) set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0) diff --git a/src/tests/unit-tests/signal-processing-blocks/pvt/rtcm_test.cc b/src/tests/unit-tests/signal-processing-blocks/pvt/rtcm_test.cc index 5e26a758e..a8434e645 100644 --- a/src/tests/unit-tests/signal-processing-blocks/pvt/rtcm_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/pvt/rtcm_test.cc @@ -274,13 +274,13 @@ TEST(RtcmTest, MT1020) Glonass_Gnav_Utc_Model gnav_utc_model_read = Glonass_Gnav_Utc_Model(); // Perform data read and print of special values types - gnav_ephemeris.d_P_1 = 15; + gnav_ephemeris.d_P_1 = 0.; // Bit distribution per fields - gnav_ephemeris.d_t_k = 7560; + gnav_ephemeris.d_t_k = 7560.; // Glonass signed values gnav_ephemeris.d_VXn = -0.490900039672852; // Bit distribution per fields dependent on other factors - gnav_ephemeris.d_t_b = 8100; + gnav_ephemeris.d_t_b = 8100.; // Binary flag representation gnav_ephemeris.d_P_3 = true; diff --git a/src/tests/unit-tests/system-parameters/glonass_gnav_nav_message_test.cc b/src/tests/unit-tests/system-parameters/glonass_gnav_nav_message_test.cc index 1f136f48e..1af57d484 100644 --- a/src/tests/unit-tests/system-parameters/glonass_gnav_nav_message_test.cc +++ b/src/tests/unit-tests/system-parameters/glonass_gnav_nav_message_test.cc @@ -76,10 +76,10 @@ TEST(GlonassGnavNavigationMessageTest, String1Decoder) Glonass_Gnav_Ephemeris gnav_ephemeris; // Fill out ephemeris values for truth - gnav_ephemeris.d_P_1 = 15; - gnav_ephemeris.d_t_k = 7560; + gnav_ephemeris.d_P_1 = 0.; + gnav_ephemeris.d_t_k = 7560.; gnav_ephemeris.d_VXn = -0.490900039672852; - gnav_ephemeris.d_AXn = 0; + gnav_ephemeris.d_AXn = 0.; gnav_ephemeris.d_Xn = -11025.6669921875; // Call target test method diff --git a/src/utils/front-end-cal/main.cc b/src/utils/front-end-cal/main.cc index 42d7a7601..5d7122686 100644 --- a/src/utils/front-end-cal/main.cc +++ b/src/utils/front-end-cal/main.cc @@ -60,6 +60,7 @@ #include #include // for ctime #include +#include // for std::setiosflags, std::setprecision #include #include #include