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.

43 lines
1.1 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
  1. /**
  2. * @file heating_plate.c
  3. * @author Finny (tianjialong0106@163.com)
  4. * @brief
  5. * @version 0.1
  6. * @date 2022-09-26
  7. *
  8. * @copyright Copyright (c) 2022
  9. *
  10. */
  11. #include "heating_plate.h"
  12. #define heating_plate_target_temp 48.0
  13. #define heating_plate_variable_temperature_range 0.5
  14. static heating_plate_structer_t *heating_plate_structer_s;
  15. static get_temp_callback_t get_temp_cb_s;
  16. void T_heating_plate_init(heating_plate_structer_t *heating_plate_structer)
  17. {
  18. heating_plate_structer_s = heating_plate_structer;
  19. }
  20. void T_heating_plate_registered_cb(get_temp_callback_t cb) { get_temp_cb_s = cb; }
  21. void T_heating_plate_start(void) {}
  22. void T_heating_plate_stop(void) {}
  23. void T_heating_plate_schedule(void)
  24. {
  25. if (heating_plate_structer_s->heating_plate_preheat_start_flag)
  26. {
  27. if (get_temp_cb_s() >= heating_plate_target_temp + heating_plate_variable_temperature_range)
  28. {
  29. T_heating_plate_stop();
  30. }
  31. else if (get_temp_cb_s() <= heating_plate_target_temp - heating_plate_variable_temperature_range)
  32. {
  33. T_heating_plate_start();
  34. }
  35. }
  36. }