Skip to content

Releases: cleishm/thermo-cpp

v2.0.0

Choose a tag to compare

@cleishm cleishm released this 10 Jul 19:12
4d29e65

⚠️ Breaking changes

  • millifahrenheit and delta_millifahrenheit counts change meaning by 10×. These types used std::ratio<5, 900> (0.01 °F per count) instead of the documented std::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, and fahrenheit_real typedefs are removed. They existed mainly as a display workaround, which spec-based rendering (below) covers directly. Migration: replace std::format("{:.1f}", temperature_cast<celsius_real>(x)) with std::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} of delta_millifahrenheit(9000)"9.0Δ°F". The empty spec keeps the exact-count form ("22534m°C") unchanged.
  • The 18 hand-written std::formatter specializations and 15 to_string overloads are replaced by two generic templates each, covering every temperature/delta instantiation with byte-identical default output.

Full Changelog: v1.3.0...v2.0.0

v1.3.0

Choose a tag to compare

@cleishm cleishm released this 06 Jul 04:07

What's new

  • Add real-valued, double-precision temperature types — celsius_real, kelvin_real, and fahrenheit_real — whose count() 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::formatter specializations 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 the std::format feature-test check, so the formatter block is enabled in standalone (non-IDF) builds where nothing pulls in __cpp_lib_format first.

Full Changelog: v1.2.2...v1.3.0

v1.2.2

Choose a tag to compare

@cleishm cleishm released this 11 Jun 07:14
bef9ea5
  • Remove the target restriction from the component manifest — the component is target-independent and now resolves on any ESP-IDF target
  • Add workflow to upload the component to the ESP Component Registry on release

v1.2.1

Choose a tag to compare

@cleishm cleishm released this 10 Feb 04:24
  • Add CONFIG_THERMO_STD_FORMAT flag and Kconfig to allow explicit control over std::format support

v1.2.0

Choose a tag to compare

@cleishm cleishm released this 09 Feb 21:50

Add std::format support for delta types

v1.1.1

Choose a tag to compare

@cleishm cleishm released this 18 Jan 16:52

Bug Fixes

  • Fix ESP-IDF script mode compatibility by moving ESP_PLATFORM check before project()

v1.1.0

Choose a tag to compare

@cleishm cleishm released this 18 Jan 16:45

What's New

  • Add ESP-IDF component support for publishing to the ESP Component Registry
  • Add idf_component.yml manifest
  • Add ESP_PLATFORM detection 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

Choose a tag to compare

@cleishm cleishm released this 17 Jan 06:10

First Stable Release

thermo-cpp is a type-safe, header-only C++23 library for temperature handling, modeled after std::chrono.

📚 Full API Documentation

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::format support (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-cpp

Using 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.