123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- /**
- * @Author: 李建
- * @Date: 2025/3/25 15:23
- * Description: 空调控制器
- * Copyright: Copyright (©) 2025 永续绿建. All rights reserved.
- */
- #ifndef WIRE_CONTROLLER_XF_CONTROLLER_H
- #define WIRE_CONTROLLER_XF_CONTROLLER_H
- #include "stdint.h"
- #include "setting.h"
- #include "esp_err.h"
- #define NVS_POWER_CONTROLLER "power" // 电源
- #define NVS_MODEL_CONTROLLER "model" // 工作模式
- #define NVS_FAN_SPEED_SET "fan_speed" // 风速挡位
- #define NVS_FILTER_USED_TIME "filter" //滤芯已使用时间
- #define NVS_MAX_HUM_SET "set_max_hum" // 自动模式下最大湿度
- #define NVS_MIN_HUM_SET "set_min_hum" // 自动模式下最小湿度
- // 风口序号
- enum {
- FAN_VALVE_1 = 1,
- FAN_VALVE_2,
- FAN_VALVE_3,
- FAN_VALVE_4,
- FAN_VALVE_5,
- };
- /**
- * 定义保存空调设置参数的结构体
- */
- typedef struct {
- uint16_t power; // 电源状态
- uint16_t mode;
- uint16_t fan_speed;
- uint16_t filter_used_time;
- uint16_t set_max_hum;
- uint8_t filter_life_remaining;
- uint8_t error_code;
- }xf_status_t;
- typedef struct {
- uint8_t code[3];
- uint8_t description[32];
- }xf_fault_t;
- enum {
- NXH = 1,
- JS=3,
- XF=2,
- AUTO=4,
- };
- extern xf_fault_t xf_fault[9];
- void stop_xf_controller();
- // 保存当前空调状态
- extern xf_status_t xf_status;
- /**
- * 控制器初始化
- * @param setting 系统设置参数
- */
- void xf_controller_init(system_setting_t * setting);
- /**
- * 设置滤网剩余寿命
- * @param saved 是否保存到 nvs 中
- */
- void xf_set_filter_life_remain(bool saved);
- /**
- * 设置风档
- * @param saved 是否保存到 nvs 中
- */
- esp_err_t xf_set_fan_speed(bool saved);
- /**
- * 设置电源
- * @param saved 是否保存到 nvs 中
- */
- esp_err_t xf_set_power(bool saved);
- /**
- * 设置温度
- * @param saved 是否保存到 nvs 中
- */
- esp_err_t ac_set_temp(bool saved);
- /**
- * 设置模式
- * @param saved 是否保存到 nvs 中
- */
- esp_err_t xf_set_mode(bool saved);
- /**
- * 设置对应风阀开度
- * @param no 风阀序号
- * @param degree 风阀开度
- */
- esp_err_t ac_set_fan_valve(uint8_t no, uint16_t degree);
- /**
- * 注册云端指令
- */
- void register_sparrow_commands(void);
- esp_err_t xf_set_max_hum(bool saved);
- void read_xf_status(system_setting_t *setting);
- void timer_init_lx();
- #endif //WIRE_CONTROLLER_XF_CONTROLLER_H
|