setting.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**
  2. * @Author: 李建
  3. * @Date: 2025/5/2 11:48
  4. * Description: 系统设置功能
  5. * Copyright: Copyright (©) 2025 永续绿建. All rights reserved.
  6. */
  7. #ifndef WIRE_CONTROLLER_SETTING_H
  8. #define WIRE_CONTROLLER_SETTING_H
  9. #include <stdint.h>
  10. #include <stdbool.h>
  11. //#define NVS_POWER_CONTROLLER "power" // 电源
  12. #define NVS_INNER_ADDR "inner_addr" // 内机地址
  13. #define NVS_XF_HAVE_ADDR "xf_have" // 是否有新风
  14. #define NVS_MIN_HUM "min_hum" // 最小湿度
  15. #define FILTER_LIFE_TIME "filter_life_time" //滤芯最大使用寿命
  16. #define NVS_FAV_FIRST_VOL "fan_first_vol" // 风机一档电压
  17. #define NVS_FAN_SECOND_VOL "fan_second_vol" // 风机二档电压
  18. #define NVS_FAN_THIRD_VOL "fan_third_vol" // 风机三档电压
  19. #define NVS_REPORT_DATA_DURATION "report_dur" // 上报数据间隔
  20. #define NVS_SOUND_ON_OFF_KEY "S_ON_OFF"
  21. #define NVS_SCREEN_AUTO_OFF_KEY "SCREEN_A_O"
  22. #define NVS_SOUND_VOLUME_KEY "S_VOLUME"
  23. #define NVS_SCREEN_OFF_MINUTE_KEY "SCREEN_O_M"
  24. #define NVS_SCREEN_ON_OFF "scr_on_off" // 屏幕当前状态
  25. #define NVS_FIX_TEMP_KEY "FIX_TEMP"
  26. #define NVS_FIX_HUM_KEY "FIX_HUM"
  27. /**
  28. * 定义系统设定参数结构体
  29. */
  30. typedef struct {
  31. uint8_t filter_life_remaining;
  32. uint16_t filter_life_time;
  33. uint16_t fan_first_vol;
  34. uint16_t fan_second_vol;
  35. uint16_t fan_third_vol;
  36. uint8_t sound_on_off; // 声音开关
  37. uint8_t screen_auto_off; // 是否自动关屏
  38. uint8_t sound_volume; // 声音音量大小
  39. uint8_t screen_off_minute; // 屏幕自动关屏时间
  40. uint8_t timer_status; // 定时器状态
  41. uint8_t duration; // 定时器时间
  42. uint8_t report_data_duration;
  43. uint8_t inner_addr;
  44. int8_t fix_temp; // 温度修正值(-5,5)
  45. int8_t fix_hum; // 湿度修正值(-5,5)
  46. uint8_t xf_have;//是否有新风模块
  47. } system_setting_t;
  48. /**
  49. * 读取系统设定参数
  50. * @param setting
  51. */
  52. void read_system_setting(system_setting_t *setting);
  53. /**
  54. * 保存系统配置
  55. */
  56. void save_system_setting(system_setting_t * setting);
  57. /**
  58. * 保存风阀配置信息
  59. * @param setting
  60. * @param ctrl_no 控制编号 (1-5)
  61. * @param fan_valve_no 风阀编号(1-5)
  62. * @param value 0或1,代表关联与取消关联
  63. */
  64. void save_fan_valve_setting(system_setting_t *setting, uint8_t ctrl_no, uint8_t fan_valve_no, uint8_t value);
  65. /**
  66. * 熄屏计时器初始化
  67. */
  68. void screen_off_timer_init( system_setting_t * setting);
  69. /**
  70. * 重置屏幕熄灭
  71. */
  72. bool reset_screen_off();
  73. void save_inner_addr(uint8_t addr);
  74. #endif //WIRE_CONTROLLER_SETTING_H