first commit
This commit is contained in:
33
main/auto_ctrl_thresholds.h
Normal file
33
main/auto_ctrl_thresholds.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "esp_err.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
float pump_on_soil_below_pct;
|
||||
float pump_off_soil_above_pct;
|
||||
float light_on_lux_below;
|
||||
float light_off_lux_above;
|
||||
} auto_ctrl_thresholds_t;
|
||||
|
||||
// Initializes default thresholds once at boot.
|
||||
void auto_ctrl_thresholds_init_defaults(void);
|
||||
|
||||
// Thread-safe snapshot read, intended for control loop usage.
|
||||
void auto_ctrl_thresholds_get(auto_ctrl_thresholds_t *out);
|
||||
|
||||
// Thread-safe full update with range/order validation.
|
||||
esp_err_t auto_ctrl_thresholds_set(const auto_ctrl_thresholds_t *cfg);
|
||||
|
||||
// Convenience API for MQTT callback usage.
|
||||
esp_err_t auto_ctrl_thresholds_set_values(float pump_on_soil_below_pct,
|
||||
float pump_off_soil_above_pct,
|
||||
float light_on_lux_below,
|
||||
float light_off_lux_above);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user