Aquarium Cooling Controller
ESP32 firmware for aquarium cooling fan control, monitoring, telemetry, and fault handling.
Loading...
Searching...
No Matches
display_format.h
Go to the documentation of this file.
1#pragma once
2
8#include <Arduino.h>
9#include <stdio.h>
10
11namespace DisplayFormat {
12
13constexpr size_t kTemperatureBufferSize = 16;
14
25inline void formatTemperatureC(float value, char* buffer, size_t bufferSize) {
26 snprintf(buffer, bufferSize, "%.1f", value);
27}
28
35inline void printTemperatureC(Stream& out, float value) {
36 char buffer[kTemperatureBufferSize] = {};
37 formatTemperatureC(value, buffer, sizeof(buffer));
38 out.print(buffer);
39}
40
41} // namespace DisplayFormat
void printTemperatureC(Stream &out, float value)
Prints a temperature-like float with one decimal place.
Definition display_format.h:35
void formatTemperatureC(float value, char *buffer, size_t bufferSize)
Formats a temperature-like float with one decimal place.
Definition display_format.h:25