#ifndef __SOFT_EFT_H
#define __SOFT_EFT_H
#include "common.h"


#define REVE_EFT_INFO_1 0x8851
#define SEND_EFT_INFO   0x88F2
#define REVE_EFT_ACK    0x8853
#define REVE_EFT_INFO   0x8852
#define REVE_EFT_LOW    0x88F1
#define BMS_LINE_TEMP   0x88AA

#define LPump1 (uint32_t)0x8810
#define LPump2 (uint32_t)0x8821

//Z70吊运称重
#define CAN_EFT70_WEIGHT (0x88BA)
#define CAN_EFT70_WEIGHT_ACK (0x88BC)

#define Cal_Remove_Peel     20
#define Cal_Weight          21
#define Cal_Seed_Back       23

#define Cal_Set_Sensor_K    23
#define Cal_Set_Sensor_Mode 26
#define Cal_Set_Doserate    27

#pragma pack(1)
typedef struct 
{
    uint8_t reserve;
    uint16_t k1:14;
    uint16_t k2:14;
    uint16_t k3:14;
    uint16_t k4:14;
}z70_weight;
#pragma pack()

typedef union 
{
    uint8_t buf[8];
    z70_weight info;
}weight70_dev;
extern weight70_dev z70weight;

extern bool eft_sparyDev_priority;
extern bool eft_weightDev_priority;
extern bool weight_runing_time;
extern uint16_t LiftingWeight_warning;
void EftCanRecvHookFunction(uint32_t cellCanID, uint8_t data[], uint8_t len);
void can_sendmsg_eft(void);
void DMlacklossCanRecvFunction(uint32_t cellCanID, uint8_t data[], uint8_t len);

#pragma pack(1)
typedef struct {
    uint8_t work_status;    //工作状态
    uint8_t warn_status;    //报警状态 bit0: 1断药
    bool can_enable;        //can使能
    uint16_t capacitance;   //电容
    uint8_t electricity;    //电流
    char temperature;       //温度
    uint8_t func_status;    //功能状态
    uint8_t num;            //循环次数
    uint16_t weight;        //重量

    uint8_t cal_status;     //校准状态

    uint8_t valve_angel;   //舵机角度 0-100
    uint8_t speed_rpm;     //转盘转速  *10
    uint8_t enginearm_lock;//机臂锁
    uint8_t last_arm_lock; //发送给FCU的判断标志
    uint8_t pump1_rpm;     //水泵1转速
    uint8_t pump2_rpm;     //水泵2转速
    uint8_t cent1_rpm;     //喷头1转速
    uint8_t cent2_rpm;     //喷头1转速
    uint8_t watering_warn_status; //水泵喷头报警状态
    uint8_t seed_k[3];     //称重传感器K值

    char version[2];
    char sn[10];
}eft; 
#pragma pack()
extern eft eft_info;

#pragma pack(1)
typedef struct 
{
    uint16_t distance;
    uint16_t strength;
    uint8_t status; // 0满 1缺
    uint16_t cal_distance;
}_mimo_lackloss;
#pragma pack()
extern _mimo_lackloss mimo_lackloss;
extern _mimo_lackloss DM_lackloss;//电目断料计

#pragma pack(1)
typedef struct 
{
    uint8_t facid;
    int16_t Positive_pole;
    int16_t Negative_pole;
}_Temp_sensor;
#pragma pack()
extern _Temp_sensor Temp_sensor;

extern short tppwm_value;
extern short sow_rotate_value;
extern uint8_t seed_output_mode;

#pragma pack(1)
typedef struct 
{
    uint8_t error_status;
    uint8_t control_mode;//pwm can
    uint16_t can_baudrate;
    short rpm;
    uint8_t reserve;
    uint8_t life;
}water_dev;
#pragma pack()
extern water_dev Lpump1;
extern water_dev Lpump2;

#endif
