Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if(ESP_PLATFORM)
endif()

project(thermo
VERSION 1.3.0
VERSION 2.0.0
DESCRIPTION "Type-safe temperature handling library modeled after std::chrono"
HOMEPAGE_URL "https://github.com/cleishm/thermo-cpp"
LANGUAGES CXX
Expand Down
23 changes: 9 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ if (millicelsius{20000} == celsius{20}) {
// String conversion
std::string s = to_string(room_temp); // "20°C"

// Real-valued display: cast an exact reading to a floating-point degree type,
// whose formatter reads in degrees (rather than raw ticks).
// Formatting: a floating-point format spec renders in scale degrees,
// while the default renders the exact stored value.
millicelsius reading{22500};
celsius_real shown = reading; // 22.5 (implicit)
std::string disp = std::format("{:.1f}", shown); // "22.5°C"
std::string disp = std::format("{:.1f}", reading); // "22.5°C"
std::string raw = std::format("{}", reading); // "22500m°C" (exact stored value)
```

## Temperature Types
Expand All @@ -114,16 +114,11 @@ std::string disp = std::format("{:.1f}", shown); // "22.5°C"
| `fahrenheit` | Fahrenheit | 1°F |
| `decifahrenheit` | Fahrenheit | 0.1°F |
| `millifahrenheit` | Fahrenheit | 0.001°F |
| `celsius_real` | Celsius | real-valued (`double`) |
| `kelvin_real` | Kelvin | real-valued (`double`) |
| `fahrenheit_real` | Fahrenheit | real-valued (`double`) |

The `*_real` types hold a floating-point degree value, so `count()` reads
directly in scale degrees (e.g. `22.5`) and `std::format` renders them as
`22.5°C`, honoring the standard float format spec (`{:.1f}` → `22.5°C`). Obtain
one from an exact reading with a cast — see [Usage](#usage). The integer types
format as their exact stored value with a precision-qualified unit (e.g.
`millicelsius{22500}` → `22500m°C`).

With `std::format`, `{}` renders a temperature as its exact stored value with a
precision-qualified unit (e.g. `millicelsius{22500}` → `22500m°C`), while any
floating-point format spec renders the value in scale degrees — no cast needed
(`{:.1f}` of `millicelsius{22534}` → `22.5°C`).

### Temperature Deltas

Expand Down
2 changes: 1 addition & 1 deletion docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "thermo"
PROJECT_NUMBER = "1.3.0"
PROJECT_NUMBER = "2.0.0"
PROJECT_BRIEF = "Type-safe temperature handling library modeled after std::chrono"
PROJECT_LOGO =
OUTPUT_DIRECTORY = .
Expand Down
2 changes: 1 addition & 1 deletion idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "1.3.0"
version: "2.0.0"
description: "Type-safe temperature handling library modeled after std::chrono"
url: "https://github.com/cleishm/thermo-cpp"
repository: "https://github.com/cleishm/thermo-cpp.git"
Expand Down
Loading
Loading