Work_SY2.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2024-08-16 RuoFeng the first version
  9. */
  10. #ifndef APPLICATIONS_WORK_XCT_H_
  11. #define APPLICATIONS_WORK_XCT_H_
  12. /*********************↓ define ↓************************/
  13. #define Luxlimit_def 300 // 光控阈值
  14. #define tempup_def 50 // 温度上限
  15. #define tempdw_def 10 // 温度下限
  16. #define humiup_def 100 // 温度上限
  17. #define humidw_def 0 // 温度上限
  18. #define gktime_def 3 // 默认光控时长
  19. #define TakeINR 30 // mins 默认的拍照间隔
  20. /* 拍照定时参数默认值与取值范围 */
  21. #define PHO_INR_DAY_MIN 1 // 拍照间隔天数 最小值
  22. #define PHO_INR_DAY_MAX 7 // 拍照间隔天数 最大值
  23. #define PHO_INR_DAY_DEF 1 // 默认间隔天数(1天)
  24. #define PHO_T_HOUR_DEF 21 // 默认拍照时刻-时(21点)
  25. #define PHO_T_MIN_DEF 0 // 默认拍照时刻-分(整点)
  26. /*********************↑ define ↑************************/
  27. /**
  28. *
  29. *
  30. *
  31. *
  32. * */
  33. /*********************↓ include ↓************************/
  34. #include "stm32f1xx_hal.h"
  35. /*********************↑ include ↑************************/
  36. /**
  37. *
  38. *
  39. *
  40. *
  41. * */
  42. /*********************↓ extern ↓************************/
  43. /*********************↑ extern ↑************************/
  44. /**
  45. *
  46. *
  47. *
  48. *
  49. * */
  50. /********************↓ declaration ↓***********************/
  51. typedef struct
  52. {
  53. uint8_t temhumEN;
  54. uint8_t LuxEN;
  55. uint8_t RainEN;
  56. int16_t temp_up;
  57. int16_t temp_dw;
  58. int16_t humi_up;
  59. int16_t humi_dw;
  60. uint8_t LuxTime;
  61. }Limit;
  62. typedef struct
  63. {
  64. uint8_t start_work; // 是否开始工作
  65. RTC_TimeTypeDef start_time; // 开始工作时间
  66. uint16_t lux_set; // 出发光控的阈值
  67. uint8_t Read; // 是否读取了参数
  68. } Luxwork;
  69. typedef struct
  70. {
  71. uint8_t en_tigmode; // 工作模式
  72. uint8_t fan_speed; // 风机速度(10-100)
  73. uint8_t Demo_mode; // 演示模式
  74. uint32_t Demo_cnt; // 演示模式计数
  75. uint8_t photo_finsh; // 拍照完成
  76. uint8_t not_poweroff; // 拍照呢 别断电
  77. uint8_t rtu_sta; // 是否正常的开机就绪了
  78. uint16_t dattim;
  79. uint16_t photim;
  80. uint8_t pho_inr_day; // 拍照间隔天数 1-7(0=未配置, 开机校验后置默认)
  81. uint8_t pho_t_hour; // 拍照时刻-时 0-23
  82. uint8_t pho_t_min; // 拍照时刻-分 0-59
  83. }SYSCFG;
  84. void WorkTask_TN(void);
  85. struct tmm
  86. {
  87. int tm_sec;
  88. int tm_min;
  89. int tm_hour;
  90. int tm_mday;
  91. int tm_mon;
  92. int tm_year;
  93. int tm_wday;
  94. int tm_yday;
  95. int tm_isdst;
  96. #ifdef __TM_GMTOFF
  97. long __TM_GMTOFF;
  98. #endif
  99. #ifdef __TM_ZONE
  100. const char *__TM_ZONE;
  101. #endif
  102. };
  103. uint32_t math_timestampe_NEW(uint32_t *tim);
  104. void recode_timestampe_NEW(uint32_t *tim);
  105. void ctr_RTU_DTU(uint8_t status_rtu);
  106. uint8_t Check_Photo_Trigger(void); // 是否到达拍照触发时刻(间隔N天+指定时分)
  107. uint8_t Check_Photo_Near(void); // 是否接近拍照触发时刻(保持RTU上电用)
  108. void Check_Photo_Param_Valid(void); // 拍照参数合法性校验(非法/全0恢复默认)
  109. /********************↑ declaration ↑***********************/
  110. /**
  111. *
  112. *
  113. *
  114. *
  115. * */
  116. /*********************↓ global variables ↓************************/
  117. /*********************↑ global variables ↑************************/
  118. /**
  119. *
  120. *
  121. *
  122. *
  123. * */
  124. #endif /* APPLICATIONS_WORK_XCT_H_ */