#ifndef ERROR_DETECT_H
#define ERROR_DETECT_H

#include "struct_typedef.h"


#define DETECT_TASK_INIT_TIME 57
#define DETECT_CONTROL_TIME 10

enum errorList
{
	  NUC_TOE =0,
	
	  CHASSIS3508M1_TOE,
	  CHASSIS3508M2_TOE,
	  CHASSIS3508M3_TOE,
	  CHASSIS3508M4_TOE,
	
	  PITCH6020_TOE,
    
    YAW26020_TOE,
    PITCH26020_TOE,

    BOARD_GYRO_TOE,
    BOARD_ACCEL_TOE,
    IMU_TOE,
	
    ERROR_LIST_LENGHT,
};
typedef __packed struct
{
    uint32_t new_time;
    uint32_t last_time;
    uint32_t lost_time;
    uint32_t work_time;
    uint16_t set_offline_time : 12;
    uint16_t set_online_time : 12;
    uint8_t enable : 1;
    uint8_t priority : 4;
    uint8_t error_exist : 1;
    uint8_t is_lost : 1;
    uint8_t data_is_error : 1;

    fp32 frequency;
    bool_t (*data_is_error_fun)(void);
    void (*solve_lost_fun)(void);
    void (*solve_data_error_fun)(void);
} error_t;


/**
  * @brief          get toe error status
  * @param[in]      toe: table of equipment
  * @retval         true (eror) or false (no error)
  */
extern bool_t toe_is_error(uint8_t err);


/**
  * @brief          record the time
  * @param[in]      toe: table of equipment
  * @retval         none
  */
extern void detect_hook(uint8_t toe);




#endif

