first commit

This commit is contained in:
Wang Beihong
2026-03-14 14:19:32 +08:00
commit fcc2d0825d
68 changed files with 16382 additions and 0 deletions

View 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