/*
 * Copyright 2022 NXP
 * SPDX-License-Identifier: MIT
 * The auto-generated can only be used on NXP devices
 */

#include "events_init.h"
#include <stdio.h>
#include "lvgl.h"
#include "gpio.h"
#include "usart.h"
#include "FreeRTOS.h"
#include "task.h"
#include "main.h"
#include "cmsis_os.h"
#include "as608.h"
#include "key.h"
#include "SIM900A.h"
#include "esp8266.h"

extern lv_ui guider_ui;
extern u8 alarmFlag ;//是否报警的标志
extern u8 lvgl_screen1_cotrol;//控制
extern u8 last_drug_STATE,last_aRxBuffer6;//保存上一次
extern float last_tempep;
extern int tempe[4];//设置温度上限
extern u8 ID_NUMBER;//指纹ID，医生为1，病人为2
extern u8 as608_cotrol;//切换指纹功能，0为识别指纹，1为录指纹，3为删除指纹
extern char temp_data[10] ;//转换数据缓存

extern osThreadId Task_KEYHandle;
extern osThreadId Task_NFCHandle;
extern osThreadId Task_LCDHandle;
extern osThreadId Task_fingerprinHandle;
extern osThreadId Task_controlHandle;
extern osThreadId Task_menuHandle;
extern osThreadId Task_tempHandle;
extern osThreadId Task_pushtipHandle;
extern osThreadId Task_lvglHandle;



u8 aTxBuffer6[3],at_state=0;//串口发送,防止一直发送信息
extern u8 face_id;//控制人脸修改,1医生，2病人
extern u8 face_control;//控制人脸修改
char buf3[10],buf2[10],buf[10];
int time_date1,time_date2,time_date3;
u8 control_time;
u8 beep_state=0;
u8 saee_state=0;
extern uint8_t number_control;//电话号码转录

void events_init(lv_ui *ui)
{
}

static void screen1_imgbtn_1_event_handler(lv_event_t *e)//设置图标
{
	lv_event_code_t code = lv_event_get_code(e);
	switch (code)
	{
	case LV_EVENT_PRESSED:
	{
		if (!lv_obj_is_valid(guider_ui.screen2))
			setup_scr_screen2(&guider_ui);
		lv_disp_t * d = lv_obj_get_disp(lv_scr_act());
		if (d->prev_scr == NULL && d->scr_to_load == NULL)
	lv_scr_load_anim(guider_ui.screen2, LV_SCR_LOAD_ANIM_NONE, 500, 500, true);
	lvgl_screen1_cotrol=0;//第一页的数据不再刷新
	  vTaskSuspend(Task_controlHandle);
		vTaskSuspend(Task_tempHandle);
		
	}
		break;
	default:
		break;
	}
}

static void screen1_imgbtn_2_event_handler(lv_event_t *e)//帮助
{
	lv_event_code_t code = lv_event_get_code(e);
	switch (code)
	{
	case LV_EVENT_PRESSED:
	{
		if (!lv_obj_is_valid(guider_ui.screen6))
			setup_scr_screen6(&guider_ui);
		lv_disp_t * d = lv_obj_get_disp(lv_scr_act());
		if (d->prev_scr == NULL && d->scr_to_load == NULL)
			lv_scr_load_anim(guider_ui.screen6, LV_SCR_LOAD_ANIM_NONE, 500, 500, true);
		 lvgl_screen1_cotrol=0;//第一页的数据不再刷新
		vTaskSuspend(Task_tempHandle);
	}
		break;
	default:
		break;
	}
}
static void screen1_imgbtn_3_event_handler(lv_event_t *e)//时间设置
{
	lv_event_code_t code = lv_event_get_code(e);
	switch (code)
	{
	case LV_EVENT_CLICKED:
	{
		if (!lv_obj_is_valid(guider_ui.screen8))
			setup_scr_screen8(&guider_ui);
		lv_disp_t * d = lv_obj_get_disp(lv_scr_act());
		if (d->prev_scr == NULL && d->scr_to_load == NULL)
		lv_scr_load_anim(guider_ui.screen8, LV_SCR_LOAD_ANIM_NONE, 500, 500, true);
		lvgl_screen1_cotrol=0;//第一页的数据不再刷新
	}
		break;
	default:
		break;
	}
}
void events_init_screen1(lv_ui *ui)
{
	lv_obj_add_event_cb(ui->screen1_imgbtn_1, screen1_imgbtn_1_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen1_imgbtn_2, screen1_imgbtn_2_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen1_imgbtn_3, screen1_imgbtn_3_event_handler, LV_EVENT_ALL, NULL);
}

static void screen2_btn_1_event_handler(lv_event_t *e)
{
	lv_event_code_t code = lv_event_get_code(e);
	switch (code)
	{
	case LV_EVENT_PRESSED:
	{
		if (!lv_obj_is_valid(guider_ui.screen3))
			setup_scr_screen3(&guider_ui);
		lv_disp_t * d = lv_obj_get_disp(lv_scr_act());
		if (d->prev_scr == NULL && d->scr_to_load == NULL)
			lv_scr_load_anim(guider_ui.screen3, LV_SCR_LOAD_ANIM_NONE, 1000, 1000, true);
	}
		break;
	default:
		break;
	}
}

static void screen2_btn_2_event_handler(lv_event_t *e)
{
	lv_event_code_t code = lv_event_get_code(e);
	switch (code)
	{
	case LV_EVENT_PRESSED:
	{
		if (!lv_obj_is_valid(guider_ui.screen4))
			setup_scr_screen4(&guider_ui);
		lv_disp_t * d = lv_obj_get_disp(lv_scr_act());
		if (d->prev_scr == NULL && d->scr_to_load == NULL)
			lv_scr_load_anim(guider_ui.screen4, LV_SCR_LOAD_ANIM_NONE, 1000, 1000, true);
	}
		break;
	default:
		break;
	}
}

static void screen2_btn_3_event_handler(lv_event_t *e)
{
	lv_event_code_t code = lv_event_get_code(e);
	switch (code)
	{
	case LV_EVENT_CLICKED:
	{
		if (!lv_obj_is_valid(guider_ui.screen5))
			setup_scr_screen5(&guider_ui);
		lv_disp_t * d = lv_obj_get_disp(lv_scr_act());
		if (d->prev_scr == NULL && d->scr_to_load == NULL)
			lv_scr_load_anim(guider_ui.screen5, LV_SCR_LOAD_ANIM_NONE, 1000, 1000, true);
	}
		break;
	default:
		break;
	}
}

static void screen2_imgbtn_2_event_handler(lv_event_t *e)//返回第一页
{
	lv_event_code_t code = lv_event_get_code(e);
	switch (code)
	{
	case LV_EVENT_CLICKED:
	{
		if (!lv_obj_is_valid(guider_ui.screen1))
			setup_scr_screen1(&guider_ui);
		lv_disp_t * d = lv_obj_get_disp(lv_scr_act());
		if (d->prev_scr == NULL && d->scr_to_load == NULL)
			lv_scr_load_anim(guider_ui.screen1, LV_SCR_LOAD_ANIM_NONE, 500, 500, true);
		/*保证回到主页是能显示原来的数据**/
    last_drug_STATE=2;
		last_aRxBuffer6=2;
		last_tempep=2;
	  lvgl_screen1_cotrol=1;//回复第一页的数据	
		aRxBuffer6[0]=100;
		vTaskResume(Task_controlHandle);
		vTaskResume(Task_tempHandle);
	}
		break;
	default:
		break;
	}
}

static void screen2_btn_4_event_handler(lv_event_t *e)
{
	lv_event_code_t code = lv_event_get_code(e);
	switch (code)
	{
	case LV_EVENT_PRESSED:
	{
		if (!lv_obj_is_valid(guider_ui.screen7))
			setup_scr_screen7(&guider_ui);
		lv_disp_t * d = lv_obj_get_disp(lv_scr_act());
		if (d->prev_scr == NULL && d->scr_to_load == NULL)
			lv_scr_load_anim(guider_ui.screen7, LV_SCR_LOAD_ANIM_NONE, 500, 500, true);
	  	vTaskSuspend(Task_controlHandle);
	}
		break;
	default:
		break;
	}
}

void events_init_screen2(lv_ui *ui)
{
	lv_obj_add_event_cb(ui->screen2_btn_1, screen2_btn_1_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen2_btn_2, screen2_btn_2_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen2_btn_3, screen2_btn_3_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen2_imgbtn_2, screen2_imgbtn_2_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen2_btn_4, screen2_btn_4_event_handler, LV_EVENT_ALL, NULL);
}

static void screen3_imgbtn_1_event_handler(lv_event_t *e)
{
	lv_event_code_t code = lv_event_get_code(e);
	switch (code)
	{
	case LV_EVENT_CLICKED:
	{
		if (!lv_obj_is_valid(guider_ui.screen2))
			setup_scr_screen2(&guider_ui);
		lv_disp_t * d = lv_obj_get_disp(lv_scr_act());
		if (d->prev_scr == NULL && d->scr_to_load == NULL)
			lv_scr_load_anim(guider_ui.screen2, LV_SCR_LOAD_ANIM_NONE, 500, 500, true);
	}
		break;
	default:
		break;
	}
}

void events_init_screen3(lv_ui *ui)
{
	lv_obj_add_event_cb(ui->screen3_imgbtn_1, screen3_imgbtn_1_event_handler, LV_EVENT_ALL, NULL);
}

static void screen4_imgbtn_2_event_handler(lv_event_t *e)
{
	lv_event_code_t code = lv_event_get_code(e);
	switch (code)
	{
	case LV_EVENT_CLICKED:
	{
		if (!lv_obj_is_valid(guider_ui.screen2))
			setup_scr_screen2(&guider_ui);
		lv_disp_t * d = lv_obj_get_disp(lv_scr_act());
		if (d->prev_scr == NULL && d->scr_to_load == NULL)
			lv_scr_load_anim(guider_ui.screen2, LV_SCR_LOAD_ANIM_NONE, 500, 500, true);
	}
		break;
	default:
		break;
	}
}

static void screen4_sw_1_event_handler(lv_event_t *e)//风扇
{
	lv_event_code_t code = lv_event_get_code(e);
  lv_obj_t *sw_1 = lv_event_get_target(e);
  if(lv_obj_has_state(sw_1, LV_STATE_CHECKED))
	{
      HAL_GPIO_WritePin(GPIOE,FAN_Pin,GPIO_PIN_RESET);//开风扇
	}
	else
	{
		 HAL_GPIO_WritePin(GPIOE,FAN_Pin,GPIO_PIN_SET);//关风扇
	}

}

static void screen4_sw_2_event_handler(lv_event_t *e)//消毒
{
	lv_event_code_t code = lv_event_get_code(e);
  lv_obj_t *sw_2 = lv_event_get_target(e);
  if(lv_obj_has_state(sw_2, LV_STATE_CHECKED))
	{
      HAL_GPIO_WritePin(GPIOG,spray_Pin,GPIO_PIN_RESET);//开喷雾
	}
	else
	{
		  HAL_GPIO_WritePin(GPIOG,spray_Pin,GPIO_PIN_SET);//关喷雾
	}
}

static void screen4_sw_3_event_handler(lv_event_t *e)//警报
{
	lv_event_code_t code = lv_event_get_code(e);
  lv_obj_t *sw_3 = lv_event_get_target(e);
  if(lv_obj_has_state(sw_3, LV_STATE_CHECKED))
	{
          alarmFlag=1;
	}
	else
	{
		  	  alarmFlag=0;
	}
}


static void screen4_spinbox_3_event_handler(lv_event_t *e)//温度设置
{
	lv_event_code_t code = lv_event_get_code(e);
	lv_obj_t *sp = lv_event_get_target(e);
	switch (code)
	{
	case LV_EVENT_VALUE_CHANGED:
	{
  //	printf("%d\r\n",lv_spinbox_get_value(sp));
		/**取出按键的每一位赋值**/
    tempe[0]=lv_spinbox_get_value(sp)/1000;
		tempe[1]=lv_spinbox_get_value(sp)/100-tempe[0]*10;
		tempe[2]=lv_spinbox_get_value(sp)/10-tempe[0]*100-tempe[1]*10;
		tempe[3]=lv_spinbox_get_value(sp)-tempe[0]*1000-tempe[1]*100-tempe[2]*10;
   // printf("%d,%d,%d，%d\r\n",tempe[0],tempe[1],tempe[2],tempe[3]);
	}
		break;
	default:
		break;
	}
}

static void screen4_sw_4_event_handler(lv_event_t *e)//箱门
{
	static u8 temp_control=0;
	lv_event_code_t code = lv_event_get_code(e);
  lv_obj_t *sw_4 = lv_event_get_target(e);
  if(lv_obj_has_state(sw_4, LV_STATE_CHECKED))
	{
		if(temp_control==0)
		{
      	HAL_GPIO_WritePin(GPIOG, GPIO_PIN_14, GPIO_PIN_RESET);//开
		}
		temp_control=1;
	}
	else
	{
		if(temp_control==1)
		{
		  	HAL_GPIO_WritePin(GPIOG, GPIO_PIN_14, GPIO_PIN_SET);//关
		}
		temp_control=0;
	}
}

static void screen4_sw_5_event_handler(lv_event_t *e)//短信测试
{

	lv_event_code_t code = lv_event_get_code(e);
  lv_obj_t *sw_5 = lv_event_get_target(e);
  if(lv_obj_has_state(sw_5, LV_STATE_CHECKED))
	{
		if(saee_state==0)
		{
			  number_control=1;
      	Sim900A_SendMsg2("6D4B8BD5");//测试
		}
		saee_state=1;
	}
	else
	{
		if(saee_state==1)
		{
			  number_control=0;
		  	HAL_GPIO_WritePin(GPIOG, GPIO_PIN_14, GPIO_PIN_SET);//关
		}
		saee_state=0;
	}
}

void events_init_screen4(lv_ui *ui)
{
	lv_obj_add_event_cb(ui->screen4_imgbtn_2, screen4_imgbtn_2_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen4_sw_1, screen4_sw_1_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen4_sw_2, screen4_sw_2_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen4_sw_3, screen4_sw_3_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen4_spinbox_3, screen4_spinbox_3_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen4_sw_4, screen4_sw_4_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen4_sw_5, screen4_sw_5_event_handler, LV_EVENT_ALL, NULL);
}

static void screen5_imgbtn_3_event_handler(lv_event_t *e)
{
	lv_event_code_t code = lv_event_get_code(e);
	switch (code)
	{
	case LV_EVENT_CLICKED:
	{
		if (!lv_obj_is_valid(guider_ui.screen2))
			setup_scr_screen2(&guider_ui);
		lv_disp_t * d = lv_obj_get_disp(lv_scr_act());
		if (d->prev_scr == NULL && d->scr_to_load == NULL)
			lv_scr_load_anim(guider_ui.screen2, LV_SCR_LOAD_ANIM_NONE, 500, 500, true);
	}
		break;
	default:
		break;
	}
}

void events_init_screen5(lv_ui *ui)
{
	lv_obj_add_event_cb(ui->screen5_imgbtn_3, screen5_imgbtn_3_event_handler, LV_EVENT_ALL, NULL);
}

static void screen6_imgbtn_4_event_handler(lv_event_t *e)//help返回
{
	lv_event_code_t code = lv_event_get_code(e);
	switch (code)
	{
	case LV_EVENT_CLICKED:
	{
		if (!lv_obj_is_valid(guider_ui.screen1))
			setup_scr_screen1(&guider_ui);
		lv_disp_t * d = lv_obj_get_disp(lv_scr_act());
		if (d->prev_scr == NULL && d->scr_to_load == NULL)
			lv_scr_load_anim(guider_ui.screen1, LV_SCR_LOAD_ANIM_NONE, 500, 500, true);
		 lvgl_screen1_cotrol=1;//回复第一页的数据
		  vTaskResume(Task_tempHandle);
	}
		break;
	default:
		break;
	}
}

static void screen6_sw_6_event_handler(lv_event_t *e)//自助查药
{
	lv_event_code_t code = lv_event_get_code(e);
  lv_obj_t *sw_6 = lv_event_get_target(e);
  if(lv_obj_has_state(sw_6, LV_STATE_CHECKED))
	{
      aTxBuffer6[0]='1';
			if(at_state==1)
			{
			 HAL_UART_Transmit(&huart6,aTxBuffer6,1,100);
			}
			at_state=0;
	}
	else
	{
		  aTxBuffer6[0]='0';
			if(at_state==0)
			{
			 HAL_UART_Transmit(&huart6,aTxBuffer6,1,100);
			}
			at_state=1;
	}
}

static void screen6_sw_7_event_handler(lv_event_t *e)//紧急呼叫
{
lv_event_code_t code = lv_event_get_code(e);
  lv_obj_t *sw_7 = lv_event_get_target(e);
  if(lv_obj_has_state(sw_7, LV_STATE_CHECKED))
	{
    
			if(beep_state==1)
			{
				 number_control=1;
      	 Sim900A_SendMsg2("003153F7836F7BB175C54EBA970089815E2E52A9002C8BF77ACB5373524D976273B0573A ");//测试
			   beep_one(500);
				 printf("救命\r\n");
				
			}
			beep_state=0;
	}
	else
	{
		 
			if(beep_state==0)
			{
			   number_control=0;
			}
			beep_state=1;
	}
}

void events_init_screen6(lv_ui *ui)
{
	lv_obj_add_event_cb(ui->screen6_imgbtn_4, screen6_imgbtn_4_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen6_sw_6, screen6_sw_6_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen6_sw_7, screen6_sw_7_event_handler, LV_EVENT_ALL, NULL);
}

static void screen7_imgbtn_5_event_handler(lv_event_t *e)//返回键
{
	lv_event_code_t code = lv_event_get_code(e);
	switch (code)
	{
	case LV_EVENT_CLICKED:
	{
		if (!lv_obj_is_valid(guider_ui.screen2))
			setup_scr_screen2(&guider_ui);
		lv_disp_t * d = lv_obj_get_disp(lv_scr_act());
		if (d->prev_scr == NULL && d->scr_to_load == NULL)
			lv_scr_load_anim(guider_ui.screen2, LV_SCR_LOAD_ANIM_NONE, 500, 500, true);
		 as608_cotrol=0;
		 face_control=0;
	}
		break;
	default:
		break;
	}
}

static void screen7_cb_1_event_handler(lv_event_t *e)//医生选择按键
{
	
	lv_event_code_t code = lv_event_get_code(e);
	lv_obj_t *bt_1 = lv_event_get_target(e);
	switch (code)
	{
	case LV_STATE_CHECKED :
	{
	 // printf("%d\r\n",lv_obj_has_state(bt_1, LV_STATE_CHECKED)); // 选择0，不选1
		if(!lv_obj_has_state(bt_1, LV_STATE_CHECKED))
		{
		 lv_obj_set_style_text_color(guider_ui.screen7_label_17, lv_color_hex(0xFF3300), 0);
	   lv_label_set_text(guider_ui.screen7_label_17, "doctor");
		
		}
	 face_id=1;
		face_control=0;
		ID_NUMBER=1;
		as608_cotrol=0;
	}
		break;
	default:
		break;
	}
}

static void screen7_cb_2_event_handler(lv_event_t *e)//病人选择按键
{
	lv_event_code_t code = lv_event_get_code(e);
	lv_obj_t *bt_2 = lv_event_get_target(e);
	switch (code)
	{
	case LV_STATE_CHECKED :
	{
		if(!lv_obj_has_state(bt_2, LV_STATE_CHECKED))
		{
	 		lv_obj_set_style_text_color(guider_ui.screen7_label_17, lv_color_hex(0xFF3300), 0);
	    lv_label_set_text(guider_ui.screen7_label_17, "patient");
			
		}
		  face_id=2;
			face_control=0;
		  ID_NUMBER=2;
		  as608_cotrol=0;
	}
		break;
	default:
		break;
	}
}

static void screen7_imgbtn_6_event_handler(lv_event_t *e)//指纹选择
{
	lv_event_code_t code = lv_event_get_code(e);
	switch (code)
	{
	case LV_EVENT_PRESSED:
	{
		 as608_cotrol=1;
		 Del_FR();//删除之前的指纹
	}
		break;
	default:
		break;
	}
}

static void screen7_imgbtn_7_event_handler(lv_event_t *e)//人脸选择
{
	lv_event_code_t code = lv_event_get_code(e);
	switch (code)
	{
	case LV_EVENT_PRESSED:
	{
		
		vTaskSuspend(Task_controlHandle);
		face_control=1;
	}
		break;
	default:
		break;
	}
}

void events_init_screen7(lv_ui *ui)
{
	lv_obj_add_event_cb(ui->screen7_imgbtn_5, screen7_imgbtn_5_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen7_cb_1, screen7_cb_1_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen7_cb_2, screen7_cb_2_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen7_imgbtn_6, screen7_imgbtn_6_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen7_imgbtn_7, screen7_imgbtn_7_event_handler, LV_EVENT_ALL, NULL);
}
static void screen8_imgbtn_1_event_handler(lv_event_t *e)//时间设置返回
{
	lv_event_code_t code = lv_event_get_code(e);
	switch (code)
	{
	case LV_EVENT_CLICKED:
	{
		if (!lv_obj_is_valid(guider_ui.screen1))
			setup_scr_screen1(&guider_ui);
		lv_disp_t * d = lv_obj_get_disp(lv_scr_act());
		if (d->prev_scr == NULL && d->scr_to_load == NULL)
			lv_scr_load_anim(guider_ui.screen1, LV_SCR_LOAD_ANIM_NONE, 500, 500, true);
		lvgl_screen1_cotrol=1;//回复第一页的数据
	}
		break;
	default:
		break;
	}
}

static void screen8_roller_1_event_handler(lv_event_t *e)//小时
{
	lv_event_code_t code = lv_event_get_code(e);
	lv_obj_t *roller_1 = lv_event_get_target(e);
	switch (code)
	{
	case LV_EVENT_VALUE_CHANGED:
	{	
     lv_roller_get_selected_str(roller_1, buf, sizeof(buf));
		
    // printf("Selected : %s\n", buf);
		 sscanf(buf, "%d",&time_date1);
	   lv_label_set_text_fmt(guider_ui.screen8_label_1, "%s", (const char*)buf);
		control_time=1;
	}
		break;
	default:
		break;
	}
}

static void screen8_roller_2_event_handler(lv_event_t *e)//分
{
  lv_event_code_t code = lv_event_get_code(e);
	lv_obj_t *roller_2 = lv_event_get_target(e);
	switch (code)
	{
	case LV_EVENT_VALUE_CHANGED:
	{
     lv_roller_get_selected_str(roller_2, buf2, sizeof(buf2));
		// printf("%d\r\n",roller1_date);
		sscanf(buf2, "%d",&time_date2);
		 lv_label_set_text_fmt(guider_ui.screen8_label_3, "%s", (const char*)buf2);
		control_time=1;
	}
		break;
	default:
		break;
	}
}

static void screen8_roller_3_event_handler(lv_event_t *e)//feng
{
  lv_event_code_t code = lv_event_get_code(e);
	lv_obj_t *roller_3 = lv_event_get_target(e);
	switch (code)
	{
	case LV_EVENT_VALUE_CHANGED:
	{

     lv_roller_get_selected_str(roller_3, buf3, sizeof(buf3));
		// printf("%d\r\n",roller1_date);
		sscanf(buf3, "%d",&time_date3);
		lv_label_set_text_fmt(guider_ui.screen8_label_4, "%s", (const char*)buf3);
		control_time=1;
	}
		break;
	default:
		break;
	}
}

void events_init_screen8(lv_ui *ui)
{
	lv_obj_add_event_cb(ui->screen8_imgbtn_3, screen8_imgbtn_1_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen8_roller_1, screen8_roller_1_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen8_roller_2, screen8_roller_2_event_handler, LV_EVENT_ALL, NULL);
	lv_obj_add_event_cb(ui->screen8_roller_3, screen8_roller_3_event_handler, LV_EVENT_ALL, NULL);
}
