setting.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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_MIN_HUM "min_hum" // 最小湿度
  13. #define FILTER_LIFE_TIME "filter_life_time" //滤芯最大使用寿命
  14. #define AIR_EXHAUST_FIRST_VOL "exhaust_first_vol" // 排风风机一档电压
  15. #define AIR_EXHAUST_SECOND_VOL "exhaust_second_vol" // 排风风机二档电压
  16. #define AIR_EXHAUST_THIRD_VOL "exhaust_third_vol" // 排风风机三档电压
  17. #define AIR_EXHAUST_FOURTH_VOL "exhaust_fourth_vol" // 排风风机四档电压
  18. #define AIR_EXHAUST_FIFTH_VOL "exhaust_fifth_vol" // 排风风机五档电压
  19. #define AIR_SUPPLY_FIRST_VOL "supply_first_vol" // 送风风机一档电压
  20. #define AIR_SUPPLY_SECOND_VOL "supply_second_vol" // 送风风机二档电压
  21. #define AIR_SUPPLY_THIRD_VOL "supply_third_vol" // 送风风机三档电压
  22. #define AIR_SUPPLY_FOURTH_VOL "supply_fourth_vol" // 送风风机四档电压
  23. #define AIR_SUPPLY_FIFTH_VOL "supply_fifth_vol" // 送风风机五档电压
  24. #define NVS_REPORT_DATA_DURATION "report_dur" // 上报数据间隔
  25. #define NVS_SOUND_ON_OFF_KEY "S_ON_OFF"
  26. #define NVS_SCREEN_AUTO_OFF_KEY "SCREEN_A_O"
  27. #define NVS_SOUND_VOLUME_KEY "S_VOLUME"
  28. #define NVS_SCREEN_OFF_MINUTE_KEY "SCREEN_O_M"
  29. #define NVS_SCREEN_ON_OFF "scr_on_off" // 屏幕当前状态
  30. /**
  31. * 定义系统设定参数结构体
  32. */
  33. typedef struct {
  34. uint16_t set_min_hum;
  35. uint8_t filter_life_remaining;
  36. uint16_t filter_life_time;
  37. uint16_t exhaust_first_vol;
  38. uint16_t exhaust_second_vol;
  39. uint16_t exhaust_third_vol;
  40. uint16_t exhaust_fourth_vol;
  41. uint16_t exhaust_fifth_vol;
  42. uint16_t supply_first_vol;
  43. uint16_t supply_second_vol;
  44. uint16_t supply_third_vol;
  45. uint16_t supply_fourth_vol;
  46. uint16_t supply_fifth_vol;
  47. uint8_t sound_on_off; // 声音开关
  48. uint8_t screen_auto_off; // 是否自动关屏
  49. uint8_t sound_volume; // 声音音量大小
  50. uint8_t screen_off_minute; // 屏幕自动关屏时间
  51. uint8_t timer_status; // 定时器状态
  52. uint8_t duration; // 定时器时间
  53. uint8_t report_data_duration;
  54. } system_setting_t;
  55. /**
  56. * 读取系统设定参数
  57. * @param setting
  58. */
  59. void read_system_setting(system_setting_t *setting);
  60. /**
  61. * 保存系统配置
  62. */
  63. void save_system_setting(system_setting_t * setting);
  64. /**
  65. * 保存风阀配置信息
  66. * @param setting
  67. * @param ctrl_no 控制编号 (1-5)
  68. * @param fan_valve_no 风阀编号(1-5)
  69. * @param value 0或1,代表关联与取消关联
  70. */
  71. void save_fan_valve_setting(system_setting_t *setting, uint8_t ctrl_no, uint8_t fan_valve_no, uint8_t value);
  72. /**
  73. * 熄屏计时器初始化
  74. */
  75. void screen_off_timer_init( system_setting_t * setting);
  76. /**
  77. * 重置屏幕熄灭
  78. */
  79. bool reset_screen_off();
  80. #endif //WIRE_CONTROLLER_SETTING_H