完成初代的雏形设计
This commit is contained in:
41
main/auto_ctrl_thresholds.h
Normal file
41
main/auto_ctrl_thresholds.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include "esp_err.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
float light_on_lux_below;
|
||||
float light_off_lux_above;
|
||||
float hot_on_temp_below_c;
|
||||
float hot_off_temp_above_c;
|
||||
float cool_on_temp_above_c;
|
||||
float cool_off_temp_below_c;
|
||||
float fan_on_humidity_above_pct;
|
||||
float fan_off_humidity_below_pct;
|
||||
} 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 light_on_lux_below,
|
||||
float light_off_lux_above,
|
||||
float hot_on_temp_below_c,
|
||||
float hot_off_temp_above_c,
|
||||
float cool_on_temp_above_c,
|
||||
float cool_off_temp_below_c,
|
||||
float fan_on_humidity_above_pct,
|
||||
float fan_off_humidity_below_pct);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user