Releases: cleishm/thermo-cpp
Releases · cleishm/thermo-cpp
Release list
v2.0.0
⚠️ Breaking changes
millifahrenheitanddelta_millifahrenheitcounts change meaning by 10×. These types usedstd::ratio<5, 900>(0.01 °F per count) instead of the documentedstd::ratio<5, 9000>(0.001 °F per count). The ratio now matches the documentation:temperature_cast<millifahrenheit>(fahrenheit(1)).count()was 100 and is now 1000. Any stored or transmitted raw counts from these two types must be reinterpreted; all other types are unaffected.- The
celsius_real,kelvin_real, andfahrenheit_realtypedefs are removed. They existed mainly as a display workaround, which spec-based rendering (below) covers directly. Migration: replacestd::format("{:.1f}", temperature_cast<celsius_real>(x))withstd::format("{:.1f}", x). Generic floating-point rep support remains available via e.g.temperature<celsius_scale, delta<double>>.
What's new
- All temperature and delta types now honor floating-point format specs, rendering the value in scale degrees:
std::format("{:.1f}", millicelsius(22534))→"22.5°C",{:.1f}ofdelta_millifahrenheit(9000)→"9.0Δ°F". The empty spec keeps the exact-count form ("22534m°C") unchanged. - The 18 hand-written
std::formatterspecializations and 15to_stringoverloads are replaced by two generic templates each, covering everytemperature/deltainstantiation with byte-identical default output.
Full Changelog: v1.3.0...v2.0.0
v1.3.0
What's new
- Add real-valued, double-precision temperature types —
celsius_real,kelvin_real, andfahrenheit_real— whosecount()reads directly in scale degrees. Intended use is casting an exact reading to a real-valued type for display or floating-point computation, e.g.temperature_cast<celsius_real>(millicelsius(22500)). - Their
std::formatterspecializations render the degree value with the scale suffix (22.5°C) and honor the standard floating-point format spec ({:.1f}→22.5°C). - Include
<version>before thestd::formatfeature-test check, so the formatter block is enabled in standalone (non-IDF) builds where nothing pulls in__cpp_lib_formatfirst.
Full Changelog: v1.2.2...v1.3.0
v1.2.2
v1.2.1
v1.2.0
v1.1.1
v1.1.0
What's New
- Add ESP-IDF component support for publishing to the ESP Component Registry
- Add
idf_component.ymlmanifest - Add
ESP_PLATFORMdetection in CMakeLists.txt - Added rounding functions
thermo::floor,thermo::ceil,thermo::round,thermo::trunc
The component is now available at: https://components.espressif.com/components/cleishm/thermo
v1.0.0 - First Stable Release
First Stable Release
thermo-cpp is a type-safe, header-only C++23 library for temperature handling, modeled after std::chrono.
Features
- Type-safe temperatures with distinct types for Celsius, Kelvin, and Fahrenheit
- Configurable precision: degree, decidegree, millidegree
- Automatic conversions between scales and precisions
- Lossless implicit conversions (lossy conversions require explicit casts)
- Temperature deltas distinct from absolute temperatures
- User-defined literals for concise notation (
20_c,32_f,273_k) std::formatsupport (when available)- Fully constexpr: All operations can be evaluated at compile time
Requirements
- C++23 compiler (GCC 13+, Clang 17+, MSVC 19.36+)
- MSVC users require:
/std:c++latest,/Zc:__cplusplus,/utf-8
Installation
Using vcpkg
vcpkg install cleishm-thermo-cppUsing CMake FetchContent
include(FetchContent)
FetchContent_Declare(
thermo
GIT_REPOSITORY https://github.com/cleishm/thermo-cpp.git
GIT_TAG v1.0.0
)
FetchContent_MakeAvailable(thermo)
target_link_libraries(your_target PRIVATE thermo::thermo)Manual Installation
Copy the include/thermo/ directory to your project.
Quick Start
#include <thermo/thermo>
using namespace thermo;
using namespace thermo_literals;
// Absolute temperatures
auto room_temp = 20_c;
auto boiling = 100_c;
auto absolute_zero = 0_k;
auto body_temp = 98.6_f;
// Temperature deltas (differences)
auto delta = 5_Δc;
auto new_temp = room_temp + delta; // 25°C
// Comparisons work across precisions
if (millicelsius{20000} == celsius{20}) {
// true - same temperature, different precision
}
// String conversion
std::string s = to_string(room_temp); // "20°C"Documentation
See the API Documentation and README for complete details.