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.

89 lines
2.9 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
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. #include "camera.h"
  2. //
  3. extern "C"
  4. {
  5. #include "ble_spp_server_demo.h"
  6. #include "light.h"
  7. #include "key.h"
  8. #include "wifi.h"
  9. #include "heating_plate.h"
  10. #include "temp.h"
  11. }
  12. /***********************************************************************************************************************
  13. * *******************************************************light******************************************************* *
  14. ***********************************************************************************************************************/
  15. power_state_light_structer_t power_state_light_structer = {
  16. .state = ShutDown,
  17. .change_flag = false,
  18. };
  19. heating_plate_state_light_structer_t heating_plate_state_light_structer = {
  20. .state = NoHeat,
  21. .change_flag = false,
  22. };
  23. reaction_state_light_structer_t reaction_state_light_structer = {
  24. .state = NoReaction,
  25. .change_flag = false,
  26. };
  27. wifi_state_light_structer_t wifi_state_light_structer = {
  28. .state = NotConnected,
  29. .change_flag = false,
  30. };
  31. /***********************************************************************************************************************
  32. * ********************************************************key******************************************************** *
  33. ***********************************************************************************************************************/
  34. T_key_structer_t T_key_structer = {
  35. .key_before_state = false,
  36. .key_now_state = false,
  37. };
  38. /***********************************************************************************************************************
  39. * ***************************************************heating_plate*************************************************** *
  40. ***********************************************************************************************************************/
  41. heating_plate_structer_t heating_plate_structer = {
  42. .heating_plate_preheat_start_flag = false,
  43. .heating_plate_preheat_finished_flag = false,
  44. };
  45. static void T_all_light_init(void)
  46. {
  47. T_power_light_init(&power_state_light_structer);
  48. T_heating_plate_state_light_init(&heating_plate_state_light_structer);
  49. T_reaction_state_light_init(&reaction_state_light_structer);
  50. T_wifi_state_light_init(&wifi_state_light_structer);
  51. }
  52. void process_key_event(void)
  53. {
  54. if (heating_plate_structer.heating_plate_preheat_finished_flag)
  55. {
  56. /* 加热完成 */
  57. }
  58. else
  59. {
  60. /* 加热未完成 */
  61. T_heating_plate_start();
  62. }
  63. }
  64. extern "C" void app_main(void)
  65. {
  66. T_debug_light_init();
  67. T_all_light_init();
  68. ble_spp_server_init();
  69. camera_init();
  70. T_key_init(&T_key_structer);
  71. T_wifi_init();
  72. T_temp_init();
  73. T_heating_plate_init(&heating_plate_structer);
  74. T_key_registered_cb(process_key_event);
  75. T_wifi_registered_cb();
  76. T_heating_plate_registered_cb(T_temp_get_data);
  77. while (true)
  78. {
  79. T_debug_light_schedule();
  80. T_key_schedule();
  81. T_heating_plate_schedule();
  82. }
  83. }