From 1954899f7c7ae31c3ab7a641803e64afda6a4db9 Mon Sep 17 00:00:00 2001 From: zwsd Date: Tue, 27 Sep 2022 10:07:06 +0800 Subject: [PATCH] update --- main/app_main.cpp | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/main/app_main.cpp b/main/app_main.cpp index a9fd90c..020fdc8 100644 --- a/main/app_main.cpp +++ b/main/app_main.cpp @@ -1,5 +1,6 @@ -#include "camera.h" +#include // +#include "camera.h" extern "C" { #include "ble_spp_server_demo.h" @@ -8,7 +9,18 @@ extern "C" #include "wifi.h" #include "heating_plate.h" #include "temp.h" +#include "port.h" } + +#define REACTION_TIME_MS 10 * 60 * 1000 + +typedef struct +{ + bool reaction_start_flag; + uint32_t reaction_start_time; + +} reaction_structer_t; + /*********************************************************************************************************************** * *******************************************************light******************************************************* * ***********************************************************************************************************************/ @@ -45,6 +57,14 @@ heating_plate_structer_t heating_plate_structer = { .heating_plate_preheat_finished_flag = false, }; +/*********************************************************************************************************************** + * *****************************************************reaction****************************************************** * + ***********************************************************************************************************************/ +reaction_structer_t reaction_structer = { + .reaction_start_flag = false, + .reaction_start_time = 0, +}; + static void T_all_light_init(void) { T_power_light_init(&power_state_light_structer); @@ -58,6 +78,20 @@ void process_key_event(void) if (heating_plate_structer.heating_plate_preheat_finished_flag) { /* 加热完成 */ + if (camera_recognition_reaction_plate()) + { + /* 识别有反应板放入 */ + if (!reaction_structer.reaction_start_flag) + { + /* 未开始反应 */ + reaction_structer.reaction_start_flag = true; + reaction_structer.reaction_start_time = port_get_ticket(); + } + } + else + { + /* 识别没有反应板放入 */ + } } else { @@ -66,6 +100,18 @@ void process_key_event(void) } } +void T_reaction_schedule(void) +{ + if (reaction_structer.reaction_start_flag) + { + if ((port_get_ticket() - reaction_structer.reaction_start_time) >= REACTION_TIME_MS) + { + /* 反应完成 */ + reaction_structer.reaction_start_flag = false; + } + } +} + extern "C" void app_main(void) { T_debug_light_init();