You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.2 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. #pragma once
  2. #include <stdbool.h>
  3. #include <stdint.h>
  4. typedef enum {
  5. klevel1 = 0,
  6. klevel2,
  7. } level_t;
  8. typedef enum {
  9. knormal,
  10. ktimingMode,
  11. kintermittentMode,
  12. } mode_t;
  13. typedef enum {
  14. knone_active,
  15. kchange_level_input,
  16. kchange_countdonw_time_input,
  17. kchange_intermittentmode_time_input,
  18. } active_input_t;
  19. typedef enum {
  20. knoneException,
  21. kOzonePrimaryCircuitAnomaly, //臭氧一级回路异常,MOS断路,或者变压器断路,如果MOS短路,设备会直接无法启动
  22. kOzoneSecondaryCircuitAnomaly, //臭氧二级回路异常,臭氧发生棒无法击穿产生臭氧,可能是焊接问题,或者接触不良
  23. kfanIsBroken, //风扇故障
  24. kPowerOutOfControl, //功率控制失控
  25. } error_t;
  26. typedef struct {
  27. bool poweron;
  28. mode_t mode;
  29. level_t level;
  30. active_input_t active_input; //由human_computer_interaction_service维护
  31. uint32_t active_start_ticket; //由human_computer_interaction_service维护
  32. int countdonwnum;
  33. int countdonwnum_s;
  34. int countdonw_setting_num;
  35. uint32_t countdonw_start_ticket;
  36. // bool intermittentMode_idle;
  37. bool working;
  38. error_t error;
  39. } ThisDevice_t;
  40. #define kconst_flash_auto_close_time (1500) //按键输入状态有效时间
  41. #define kconst_countdown_step_s (10) //倒计时每按一次按键,倒计时增加时间
  42. #define kconst_active_input_light_flick_interval_ms (150) //按键输入状态闪烁间隔时间
  43. // #define INTERMITTENTMODE_PERIOD_S 55 //间歇工作模式的时间间隔,至少大于四倍的kconst_countdown_step_s
  44. #define KEY_PERIOD 20 //
  45. #define EXCEPTION_CHECK_PERIOD 50 //
  46. #define kconst_pwm_work_dutyns 5000 //臭氧模块工作时候高电平时间
  47. #define EXPECT_POWER_WINDONWS ((float)(0.3)) //允许设备工作在 [level1_expect_power-windows,level1_expect_power+windows]之间
  48. #define LEVEL1_EXPECT_POWER ((float)(3.0)) //
  49. #define LEVEL2_EXPECT_POWER ((float)(5.0)) //
  50. #define MAX_FREQ ((float)(38000)) //设备可提供调整频率的最大频率
  51. //卡尔曼滤波器参数
  52. #define KALMAN_FILTER_PARA \
  53. { 0.02, 0, 0, 0, 0.05, 0.543 }
  54. extern ThisDevice_t thisDevice;