|
HardFOC Flux V1 HAL
Unified HAL API for the HardFOC Flux valve-control platform (ESP32-S3)
|
Singleton manager for all temperature sensors on Flux V1. More...
#include <TemperatureManager.h>
Public Member Functions | |
| TemperatureManager (const TemperatureManager &)=delete | |
| TemperatureManager & | operator= (const TemperatureManager &)=delete |
| TemperatureManager (TemperatureManager &&)=delete | |
| TemperatureManager & | operator= (TemperatureManager &&)=delete |
| bool | EnsureInitialized () noexcept |
| Initialise the temperature subsystem if not already initialised. | |
| bool | IsInitialized () const noexcept |
| Check whether the temperature subsystem has been initialised. | |
| bool | Deinitialize () noexcept |
| Release all temperature sensor resources and reset to uninitialized state. | |
| TemperatureError | GetLastError () const noexcept |
| Get the most recent error code. | |
| flux::hal::ManagerError | GetManagerError () const noexcept |
Lifecycle / bind error of the last EnsureInitialized() (shared catalog). | |
| bool | IsSensorReady (FluxTempSensorType type) const noexcept |
| Whether one sensor came up during the last bring-up attempt (valid for diagnosis even when the manager failed closed). | |
| bool | IsDegraded () const noexcept |
| Initialised with at least one fitted sensor missing. | |
| TemperatureError | ReadTemperatureCelsius (std::string_view name, float &temperature_c) noexcept |
| Read temperature in Celsius from a named sensor. | |
| TemperatureError | ReadTemperatureFahrenheit (std::string_view name, float &temperature_f) noexcept |
| Read temperature in Fahrenheit from a named sensor. | |
| TemperatureError | ReadInternalTemperature (float &temperature_c) noexcept |
| Convenience: read the ESP32 internal temperature sensor. | |
| TemperatureError | ReadNtcTemperature (float &temperature_c) noexcept |
| Convenience: read the NTC thermistor temperature. | |
| TemperatureError | ReadMcp9700Temperature (float &temperature_c) noexcept |
| Convenience: read the MCP9700 sensor (ADS7952 CH8). | |
| TemperatureError | GetSystemTemperatureStats (float &min_c, float &max_c, float &avg_c) noexcept |
| Read all sensors and compute min, max, and average temperatures. | |
| size_t | GetSensorCount () const noexcept |
| Get the number of registered temperature sensors. | |
| const TempEntry * | GetSensorEntry (std::string_view name) const noexcept |
| Look up a sensor entry by name. | |
| TemperatureError | GetSystemDiagnostics (TempSystemDiagnostics &diag) const noexcept |
| Populate a TempSystemDiagnostics snapshot. | |
| void | DumpStatistics () const noexcept |
| Log temperature sensor statistics and health info to the console. | |
Static Public Member Functions | |
| static TemperatureManager & | GetInstance () noexcept |
| Return the singleton TemperatureManager instance. | |
Private Member Functions | |
| TemperatureManager () noexcept=default | |
| ~TemperatureManager ()=default | |
| bool | Initialize () noexcept |
| void | ReleaseLocked () noexcept |
| bool | InitializeEsp32Internal () noexcept |
| bool | InitializeNtcThermistor () noexcept |
| bool | InitializeMcp9700Thermistor () noexcept |
| size_t | FindByName (std::string_view name) const noexcept |
Private Attributes | |
| std::array< TempEntry, kMaxSensors > | entries_ {} |
| size_t | registered_count_ {0} |
| uint64_t | init_time_ms_ {0} |
| Timestamp (ms) when Initialize() completed. | |
| BaseTemperature * | die_temp_ {nullptr} |
| std::optional< NtcTemperatureHandler > | ntc_handler_ |
| std::optional< Mcp9700TemperatureHandler > | mcp9700_handler_ |
| std::atomic< bool > | initialized_ {false} |
| std::atomic< TemperatureError > | last_error_ {TemperatureError::SUCCESS} |
| std::atomic< flux::hal::ManagerError > | manager_error_ {flux::hal::ManagerError::NotInitialized} |
| RtosMutex | mutex_ |
Static Private Attributes | |
| static constexpr size_t | kMaxSensors = static_cast<size_t>(FluxTempSensorType::SENSOR_COUNT) |
| static constexpr size_t | kInvalidIndex = SIZE_MAX |
Singleton manager for all temperature sensors on Flux V1.
Manages the ESP32 internal temperature sensor and the NTC thermistor connected via ADC (GPIO4 / ADC1_CH4). Sensors are registered in a fixed-size array at initialisation; readings are returned in Celsius or Fahrenheit.
|
delete |
|
delete |
|
privatedefaultnoexcept |
|
privatedefault |
|
noexcept |
Release all temperature sensor resources and reset to uninitialized state.
|
noexcept |
Log temperature sensor statistics and health info to the console.
|
noexcept |
Initialise the temperature subsystem if not already initialised.
|
privatenoexcept |
|
staticnoexcept |
|
inlinenoexcept |
Get the most recent error code.
|
inlinenoexcept |
Lifecycle / bind error of the last EnsureInitialized() (shared catalog).
ManagerError::None when initialised; otherwise why bring-up failed.
|
inlinenoexcept |
Get the number of registered temperature sensors.
|
noexcept |
Look up a sensor entry by name.
| name | Sensor name. |
|
noexcept |
Populate a TempSystemDiagnostics snapshot.
| [out] | diag | Diagnostics structure to fill. |
|
noexcept |
Read all sensors and compute min, max, and average temperatures.
| [out] | min_c | Minimum temperature across all sensors (°C). |
| [out] | max_c | Maximum temperature across all sensors (°C). |
| [out] | avg_c | Average temperature across all sensors (°C). |
|
privatenoexcept |
|
privatenoexcept |
|
privatenoexcept |
|
privatenoexcept |
|
inlinenoexcept |
Initialised with at least one fitted sensor missing.
The temperature manager is the one manager allowed to run degraded: its sensors are independent monitors with a fallback chain (MCP9700, NTC, die sensor). When degraded, GetManagerError() holds the reason and diagnostics never report it healthy.
|
inlinenoexcept |
Check whether the temperature subsystem has been initialised.
|
noexcept |
Whether one sensor came up during the last bring-up attempt (valid for diagnosis even when the manager failed closed).
|
delete |
|
delete |
|
noexcept |
Convenience: read the ESP32 internal temperature sensor.
| temperature_c | Output temperature in °C. |
|
noexcept |
Convenience: read the MCP9700 sensor (ADS7952 CH8).
| temperature_c | Output temperature in °C. |
|
noexcept |
Convenience: read the NTC thermistor temperature.
| temperature_c | Output temperature in °C. |
|
noexcept |
Read temperature in Celsius from a named sensor.
| name | "ESP32_INTERNAL", "NTC_THERMISTOR", or "MCP9700_THERMISTOR" |
| temperature_c | Output temperature in °C |
|
noexcept |
Read temperature in Fahrenheit from a named sensor.
| name | Sensor name ("ESP32_INTERNAL" or "NTC_THERMISTOR"). |
| temperature_f | Output temperature in °F. |
|
privatenoexcept |
|
private |
|
private |
|
private |
Timestamp (ms) when Initialize() completed.
|
private |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
private |
|
private |
|
private |
|
mutableprivate |
|
private |
|
private |