Browse Source

update

Finny_test
zwsd 3 years ago
parent
commit
2705fd865c
  1. 59
      main/app_main.cpp

59
main/app_main.cpp

@ -23,6 +23,12 @@ typedef struct
} reaction_structer_t;
typedef struct
{
bool device_standby_start_flag;
uint32_t device_standby_start_time;
} this_device_standby_t;
/***********************************************************************************************************************
* *******************************************************light******************************************************* *
***********************************************************************************************************************/
@ -77,6 +83,14 @@ wifi_structer_t wifi_structer = {
.wifi_max_connect_num = 10,
};
/***********************************************************************************************************************
* ****************************************************this_device**************************************************** *
***********************************************************************************************************************/
this_device_standby_t this_device_standby_structer = {
.device_standby_start_flag = false,
.device_standby_start_time = 0,
};
static void T_all_light_init(void)
{
T_power_light_init(&power_state_light_structer);
@ -85,30 +99,35 @@ static void T_all_light_init(void)
T_wifi_state_light_init(&wifi_state_light_structer);
}
void process_key_event(void)
void process_short_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
{
/* 识别没有反应板放入 */
}
}
/* 加热未完成 */
else
{
/* 加热未完成 */
T_heating_plate_start();
T_heating_plate_light_set_rgb_by_state(Heating);
}
}
@ -130,13 +149,36 @@ void T_reaction_schedule(void)
{
if (reaction_structer.reaction_start_flag)
{
/* 反应完成 */
if ((port_get_ticket() - reaction_structer.reaction_start_time) >= REACTION_TIME_MS)
{
/* 反应完成 */
beep_set_level(true);
reaction_structer.reaction_start_flag = false;
}
}
if ((heating_plate_structer.heating_plate_preheat_finished_flag == true) && //
(!camera_recognition_reaction_plate()) && !this_device_standby_structer.device_standby_start_flag)
{
this_device_standby_structer.device_standby_start_flag = true;
this_device_standby_structer.device_standby_start_time = port_get_ticket();
}
else
{
this_device_standby_structer.device_standby_start_flag = false;
}
}
void T_this_device_standby_schedule(void)
{
if (this_device_standby_structer.device_standby_start_flag)
{
if ((port_get_ticket() - this_device_standby_structer.device_standby_start_time) >= 600000)
{
T_heating_plate_stop();
T_heating_plate_light_set_rgb_by_state(NoHeat);
this_device_standby_structer.device_standby_start_flag = false;
}
}
}
extern "C" void app_main(void)
@ -152,7 +194,7 @@ extern "C" void app_main(void)
cover_init();
beep_init();
T_key_registered_cb(process_key_event, process_key_long_press_event);
T_key_registered_cb(process_short_key_event, process_key_long_press_event);
T_wifi_registered_cb();
T_heating_plate_registered_cb(T_temp_get_data);
@ -163,5 +205,6 @@ extern "C" void app_main(void)
T_key_schedule();
T_heating_plate_schedule();
T_reaction_schedule();
T_this_device_standby_schedule();
}
}
Loading…
Cancel
Save