#ifndef _USER_CONFIG_H_
#define _USER_CONFIG_H_

#include "yc_protocol.h"
#include "GT5DL32A3W.h"
#include "EPD.h"
#include "GUI_Paint.h"
#include "LORA.h"
#include "LED.h"
#include "user_button.h"
#include "FONT_LIB.h"
#include "SPIFFS.h"
#include "Decection.h"


typedef enum
{
    YC_TASK_NONE = 0,
    
    YC_TASK_OTHER,
    YC_TASK_BUTTON,
    YC_TASK_LORA,
    YC_TASK_UNPACK,
    YC_TASK_LOGIC,
    
    YC_TASK_RIGHT_SCREEN,
    YC_TASK_LEFT_SCREEN,

    YC_TASK_DEAL, //数据处理

    YC_TASK_END,

}YC_TASK_FUNC;
#define LEFT_SCREEN_BIT 1
#define RIGHT_SCREEN_BIT 2


#define SCREEN_WIDTH                648
#define SCREEN_HEIGHT               480


#define IS_FEB_MONTH                ((Machine_info.day==29)&&(Machine_info.month==2)&&\
                                        (!((Machine_info.year/4==0)||(Machine_info.year/2000==0))))

#define IS_LEAP_YEAR                ((Machine_info.day==30)&&(Machine_info.month==2)&&\
                                        ((Machine_info.year/4==0)||(Machine_info.year/2000==0)))


#define IS_SMALL_MONTH              ((Machine_info.day==31) &&   ((Machine_info.month==4)||\
                                                                    (Machine_info.month==6)||\
                                                                    (Machine_info.month==9)||\
                                                                    (Machine_info.month==11)))

#define IS_BIG_MONTH                ((Machine_info.day==32) && ((Machine_info.month==1) ||\
                                                                (Machine_info.month==3) ||\
                                                                (Machine_info.month==5) ||\
                                                                (Machine_info.month==7) ||\
                                                                (Machine_info.month==8) ||\
                                                                (Machine_info.month==10) ||\
                                                                (Machine_info.month==12 )))

extern FONT_TYPE_T ascii_type_5x7;
extern FONT_TYPE_T ascii_type_7x8;
extern FONT_TYPE_T ascii_type_6x12;
extern FONT_TYPE_T ascii_type_8x16;
extern FONT_TYPE_T ascii_type_12x24;
extern FONT_TYPE_T ascii_type_12x24_b;
extern FONT_TYPE_T ascii_type_16x32;
extern FONT_TYPE_T chinese_type_12;
extern FONT_TYPE_T chinese_type_16;
extern FONT_TYPE_T chinese_type_24;
extern FONT_TYPE_T chinese_type_32;

extern PAINT_TIME Paint_time_info;
extern PAINT Paint_info;

#if !HARDWARE_SPI
extern struct EPD_INFO_SET left_screen;
extern struct EPD_INFO_SET right_screen;
#endif

extern adc_oneshot_unit_handle_t adc1_handle;

//extern Machine_info_t Machine_info;


typedef enum
{
    STATE_NONE                  = 0,        //机器状态
    
    STATE_OPERATION             = 1,        //运行
    STATE_SHUT_DOWN             = 2,        //停机
    STATE_BREAKDOWN             = 3,        //故障
    STATE_SAFEKEEP              = 4,        //封存
    STATE_UPKEEP                = 5,        //保养
    STATE_WAIT_MATERIALS        = 6,        //待料

    STATE_END,
}Machine_state_t;



extern int last_batt_precent;

// void yc_timer_restart(void);
void Paint_leftScreen_main(Machine_info_t* info);
void Paint_rightScreen_main(Machine_info_t* info);


void Paint_leftScreen_main_quick(Machine_info_t* info);
void Paint_leftScreen_main_slow(Machine_info_t* info);


void Paint_leftScreen_main_powerOn(void);
void Paint_rightScreen_main_powerON(void);
void Paint_rightScreen_main_quick(Machine_info_t* info);

void Paint_rightScreen_main_slow(Machine_info_t* info);
void dis_instructions();

void esp_ble_ota(void);
void reset_default(bool is_dis);
#endif
