// Sensor driver registry: the one place that knows the concrete list of // sensor drivers compiled into this firmware. app_main.c and // telemetry_client.c never reference bme280.c / ld2410.c directly -- they // only talk to this registry, so adding a new sensor never touches them. // // See README.md's "Adding a new sensor" section for the step-by-step. #pragma once #include "sensor_driver.h" #ifdef __cplusplus extern "C" { #endif // Calls every registered driver's init() (in array order), logging and // continuing past individual failures rather than aborting -- one dead // sensor shouldn't take the whole node offline. Call once at boot, before // the telemetry task starts. void sensor_registry_init_all(void); // Calls every registered driver's read() and appends its readings into // `out` (capacity `max_out`), writing the total count written to // `*out_count`. A driver that errors is logged and simply contributes zero // readings this cycle. Returns ESP_OK; this function does not fail as a // whole just because one driver did. esp_err_t sensor_registry_collect(sensor_reading_t *out, size_t max_out, size_t *out_count); #ifdef __cplusplus } #endif