diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index e56443606d..decc0a0e89 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -38,7 +38,7 @@ jobs: uses: lukka/run-vcpkg@v11 with: vcpkgDirectory: '/opt/vcpkg' - vcpkgGitCommitId: 'c8696863d371ab7f46e213d8f5ca923c4aef2a00' + vcpkgGitCommitId: '50bffcc62d7f6571eb32bc1a0b1807e77af1166c' vcpkgJsonGlob: 'vcpkg.json' - name: Run CMake consuming CMakePreset.json and vcpkg.json by mean of vcpkg. diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 832a282876..d9b440c1f8 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -18,7 +18,7 @@ jobs: uses: lukka/run-vcpkg@v11 with: vcpkgDirectory: '/opt/vcpkg' - vcpkgGitCommitId: 'c8696863d371ab7f46e213d8f5ca923c4aef2a00' + vcpkgGitCommitId: '50bffcc62d7f6571eb32bc1a0b1807e77af1166c' vcpkgJsonGlob: 'vcpkg.json' - name: Build diff --git a/.github/workflows/ubuntu-packaging.yml b/.github/workflows/ubuntu-packaging.yml index 4d4f7f6762..92f36e4d6e 100644 --- a/.github/workflows/ubuntu-packaging.yml +++ b/.github/workflows/ubuntu-packaging.yml @@ -43,7 +43,7 @@ jobs: uses: lukka/run-vcpkg@v11 with: vcpkgDirectory: '/opt/vcpkg' - vcpkgGitCommitId: 'c8696863d371ab7f46e213d8f5ca923c4aef2a00' + vcpkgGitCommitId: '50bffcc62d7f6571eb32bc1a0b1807e77af1166c' vcpkgJsonGlob: 'vcpkg.json' - name: Run CMake consuming CMakePreset.json and vcpkg.json by mean of vcpkg. diff --git a/exes/ethercat/inc/public/tfc/ec/devices/base.hpp b/exes/ethercat/inc/public/tfc/ec/devices/base.hpp index 1a19f2ba6d..5731d25016 100644 --- a/exes/ethercat/inc/public/tfc/ec/devices/base.hpp +++ b/exes/ethercat/inc/public/tfc/ec/devices/base.hpp @@ -94,7 +94,7 @@ class base { template auto sdo_write(setting_t&& in) const { - return base::sdo_write(in.index, in.value.numerical_value_); + return base::sdo_write(in.index, in.value.numerical_value_ref_in(decltype(in.value)::unit)); } protected: diff --git a/exes/ethercat/inc/public/tfc/ec/devices/eilersen/4x60a.hpp b/exes/ethercat/inc/public/tfc/ec/devices/eilersen/4x60a.hpp index 52ee24620a..c9c792375f 100644 --- a/exes/ethercat/inc/public/tfc/ec/devices/eilersen/4x60a.hpp +++ b/exes/ethercat/inc/public/tfc/ec/devices/eilersen/4x60a.hpp @@ -409,7 +409,8 @@ PRAGMA_CLANG_WARNING_POP return std::unexpected{ ipc::details::mass_error_e::not_calibrated }; } auto normalized_calibration_signal{ calibration_signal - *zero }; - result = ((calculated_signal * calibration_mass.numerical_value_) / normalized_calibration_signal) * + result = ((calculated_signal * calibration_mass.numerical_value_ref_in(mass_t::unit)) / + normalized_calibration_signal) * mass_t::reference; // at this point we have result with full resolution if (auto resolution{ group_1_cal.get_resolution() }) { diff --git a/exes/ethercat/inc/public/tfc/ec/devices/schneider/atv320.hpp b/exes/ethercat/inc/public/tfc/ec/devices/schneider/atv320.hpp index 13746f26e0..8abcb6b9d4 100644 --- a/exes/ethercat/inc/public/tfc/ec/devices/schneider/atv320.hpp +++ b/exes/ethercat/inc/public/tfc/ec/devices/schneider/atv320.hpp @@ -95,7 +95,7 @@ constexpr auto percentage_to_deci_freq(mp_units::quantity struct append_single { static void op(auto* interface, auto* sd_bus_msg, mp_units::Quantity auto&& item) { using value_t = typename quantity_t::rep; - append_single::op(interface, sd_bus_msg, item.numerical_value_); + append_single::op(interface, sd_bus_msg, item.numerical_value_ref_in(quantity_t::unit)); } }; diff --git a/libs/motor/tests/positioner_test.cpp b/libs/motor/tests/positioner_test.cpp index 97b1dc537c..62efb9a269 100644 --- a/libs/motor/tests/positioner_test.cpp +++ b/libs/motor/tests/positioner_test.cpp @@ -1,4 +1,6 @@ +#include #include + #include #include #include @@ -216,25 +218,25 @@ int main(int argc, char** argv) { signal_b.send(true); io_context.run_for(milliseconds(5)); - expect(positioner.position() == 1 * mm) << positioner.position().numerical_value_; + expect(positioner.position() == 1 * mm) << fmt::format("{}", positioner.position()); expect(callback_counter == 1); signal_a.send(true); io_context.run_for(milliseconds(5)); - expect(positioner.position() == 2 * mm) << positioner.position().numerical_value_; + expect(positioner.position() == 2 * mm) << fmt::format("{}", positioner.position()); expect(callback_counter == 2); signal_b.send(false); io_context.run_for(milliseconds(5)); - expect(positioner.position() == 3 * mm) << positioner.position().numerical_value_; + expect(positioner.position() == 3 * mm) << fmt::format("{}", positioner.position()); expect(callback_counter == 3); signal_a.send(false); io_context.run_for(milliseconds(5)); - expect(positioner.position() == 4 * mm) << positioner.position().numerical_value_; + expect(positioner.position() == 4 * mm) << fmt::format("{}", positioner.position()); expect(callback_counter == 3); }; diff --git a/libs/stx/inc/public/tfc/utils/units_glaze_meta.hpp b/libs/stx/inc/public/tfc/utils/units_glaze_meta.hpp index bf71932f52..2759d38b3b 100644 --- a/libs/stx/inc/public/tfc/utils/units_glaze_meta.hpp +++ b/libs/stx/inc/public/tfc/utils/units_glaze_meta.hpp @@ -24,35 +24,14 @@ struct glz::meta { static constexpr auto name{ "units::ratio" }; }; -template -struct const_unit_symbol { - static consteval auto unit_symbol_len() -> std::size_t { return unit_symbol(U{}, fmt).size(); } - static constexpr auto impl() noexcept { - std::array buffer{}; - auto foo = unit_symbol(U{}, fmt); - std::ranges::copy(std::begin(foo), std::end(foo), std::begin(buffer)); - return buffer; - } - // Give the joined string static storage - static constexpr auto arr = impl(); - // View as a std::string_view - static constexpr std::basic_string_view value{ arr.data(), arr.size() - 1 }; -}; - -template -[[nodiscard]] constexpr std::basic_string_view unit_symbol_view(U) { - return const_unit_symbol::value; -} - template struct glz::meta> { using type = mp_units::quantity; static constexpr std::string_view unit{ - unit_symbol_view( - ref_t) + mp_units::unit_symbol(ref_t) }; static constexpr auto dimension{ tfc::unit::dimension_name() }; - static auto constexpr value{ [](auto&& self) -> auto& { return self.numerical_value_; } }; + static auto constexpr value{ [](auto&& self) -> auto& { return self.numerical_value_ref_in(type::unit); } }; static std::string_view constexpr prefix{ "units::quantity<" }; static std::string_view constexpr postfix{ ">" }; static std::string_view constexpr separator{ "," }; @@ -69,13 +48,10 @@ struct to_json_schema; template struct to_json_schema> { static constexpr std::string_view unit_ascii{ - unit_symbol_view( - ref_t) + mp_units::unit_symbol(ref_t) }; static constexpr std::string_view unit_unicode{ - unit_symbol_view(ref_t) + mp_units::unit_symbol(ref_t) }; static constexpr mp_units::ratio ratio{ mp_units::as_ratio(ref_t) }; static constexpr auto dimension{ tfc::unit::dimension_name() }; diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json index 2d58bf6036..e3c73f0aca 100644 --- a/vcpkg-configuration.json +++ b/vcpkg-configuration.json @@ -2,7 +2,7 @@ "default-registry": { "kind": "git", "repository": "https://github.com/microsoft/vcpkg", - "baseline": "c8696863d371ab7f46e213d8f5ca923c4aef2a00" + "baseline": "50bffcc62d7f6571eb32bc1a0b1807e77af1166c" }, "registries": [ {