Browse Source

update

Finny_test
zwsd 3 years ago
parent
commit
1954899f7c
  1. 48
      main/app_main.cpp

48
main/app_main.cpp

@ -1,5 +1,6 @@
#include "camera.h"
#include <stdbool.h>
// //
#include "camera.h"
extern "C" extern "C"
{ {
#include "ble_spp_server_demo.h" #include "ble_spp_server_demo.h"
@ -8,7 +9,18 @@ extern "C"
#include "wifi.h" #include "wifi.h"
#include "heating_plate.h" #include "heating_plate.h"
#include "temp.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******************************************************* * * *******************************************************light******************************************************* *
***********************************************************************************************************************/ ***********************************************************************************************************************/
@ -45,6 +57,14 @@ heating_plate_structer_t heating_plate_structer = {
.heating_plate_preheat_finished_flag = false, .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) static void T_all_light_init(void)
{ {
T_power_light_init(&power_state_light_structer); 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 (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 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) extern "C" void app_main(void)
{ {
T_debug_light_init(); T_debug_light_init();

Loading…
Cancel
Save