|
Aquarium Cooling Controller
ESP32 firmware for aquarium cooling fan control, monitoring, telemetry, and fault handling.
|
Discovers and samples DS18B20-compatible sensors on a OneWire bus. More...
#include <sensor_manager.h>
Public Member Functions | |
| SensorManager (const SensorManagerConfig &config) | |
| Creates a sensor manager for the supplied OneWire configuration. | |
| bool | begin (uint32_t nowMs) |
| Initializes the bus, discovers sensors, and requests the first conversion. | |
| void | update (uint32_t nowMs) |
| Advances discovery and temperature conversion state. | |
| const SensorSnapshot & | snapshot () const |
| Returns the latest sensor snapshot. | |
| void | formatTrackedAddress (size_t trackedIndex, char *buffer, size_t bufferSize) const |
| Formats a tracked sensor ROM code as a hexadecimal string. | |
Discovers and samples DS18B20-compatible sensors on a OneWire bus.
The class performs discovery, starts conversions, and later collects results once the conversion time for the selected resolution has elapsed. This avoids blocking the controller loop while still keeping tracked sensor roles stable.
|
explicit |
Creates a sensor manager for the supplied OneWire configuration.
| config | Bus pin, sampling interval, resolution, and tracked sensors. |
| bool SensorManager::begin | ( | uint32_t | nowMs | ) |
Initializes the bus, discovers sensors, and requests the first conversion.
| nowMs | Current monotonic timestamp in milliseconds. |
| void SensorManager::formatTrackedAddress | ( | size_t | trackedIndex, |
| char * | buffer, | ||
| size_t | bufferSize | ||
| ) | const |
Formats a tracked sensor ROM code as a hexadecimal string.
| trackedIndex | Index into the tracked sensor array. |
| buffer | Destination character buffer. |
| bufferSize | Size of the destination buffer in bytes. |
| const SensorSnapshot & SensorManager::snapshot | ( | ) | const |
Returns the latest sensor snapshot.
| void SensorManager::update | ( | uint32_t | nowMs | ) |
Advances discovery and temperature conversion state.
Call this frequently from the main loop. It will request a new conversion when the sample interval elapses and will finish pending conversions once the DS18B20 conversion time has passed.
| nowMs | Current monotonic timestamp in milliseconds. |