/**
  **************************************************************************
  * @file     cmcng.h
  * @version  v1.0
  * @date     2025-09-08
  * @brief    һЩ����
  **************************************************************************
  *                       Copyright notice & Disclaimer
  *   *  Create 2025-09-08 by wangfq
  *   *
  **************************************************************************
  */
#ifndef __CMCNG_H__ 
#define __CMCNG_H__
#include <stdio.h>
#include <stdint.h>

#define     PRODUCT_MODEL                   "DLD960"
#define     FIRMWARE_VER                     "1.00"
#define     HARDWARE_VER                  "1.00"
#define     FIRMWARE_VER_MAIN           0
#define     FIRMWARE_VER_SUB            30
#define     FIRMWARE_VER_SSUB           0
#define     HARDWARE_VER_MAIN         1
#define     HARDWARE_VER_SUB          0 
#define     HARDWARE_VER_SSUB         0 


#define     FUNCTION_A                  0x01    //  二次判断
#define     FUNCTION_B                  0x02    //  二次判断增强条件判断
#define     FUNCTION_C                  0x04    //
#define     FUNCTION_D                  0x08    //


#ifdef DEBUG
#define PRINT(X...) printf(X)
#else
#define PRINT(X...)
#endif

#define       LOOP_CAPTURE_MAX      4           // 4 loop capture

#define     CMD_DEV_Ver                         0x4A    // Version

#define     CMD_DBN_SET_MCJQ_PARAM                0x63   // 设置 车检器多路参数
#define     CMD_DBN_GET_MCJQ_PARAM                0x64   // 读取 车检器多路参数

#define     CMD_DBN_DEV_RESET                    0x6D

#define     CMD_DBN_LOOP_SAMPLE_PARAM            0x87
#define     CMD_DBN_LOOP_BALANCE_PARAM           0x88
#define     CMD_DBN_LOOP_RELEASE_PLANB           0x89
#define     CMD_DBN_LOOP_SENS_LIST               0x8A
#define     CMD_DBN_SET_CJQ_FACTORY              0x92

#define CMD_SUB_SENS_REPORT             0xC0          //设备主动上报传感信息
// #define CMD_REQUIRE_DEV_MAC_ADDR        0xC1
// #define CMD_CHANGE_DEV_ADDR_BY_MAC      0xC2
// #define CMD_SET_LED                     0xC3
// #define CMD_SET_RELAY                   0xC4
#define CMD_SENS_ACS_ENABLE             0xC5         // 设备主动上报  使能

typedef enum
{
    SENS_NONE = 0,
    SENS_SUB_INFO = 1,                  // 传感器设备信息
    SENS_OBJ_DYNAMIC = 2,               // 动态目标类型
    SENS_SOUTPUT_STATUS = 3,            // 当前开关量输出的状态
    SENS_DETAIL_CNG = 4,                // 详细配置
    SENS_LOOP_DYNAMIC = 5,              // 线圈动态信息
    SENS_OBJ_BackGround = 6,             //
    SENS_OBJ_INSIDE = 7,                 //
    SENS_LOOP_TREND,
    SENS_OBJ_DYNAMIC_SIMPLE,
    SENS_OBJ_STATIC_XuJing,          //10, 0x0A
    SENS_DOBULE_LOOP_ESTIMATE,       //0x0B, 线圈环境评估
    SENS_MULTI_LOOP_DYNAMIC,        // 0x0C, 多路线圈环境动态信息
} SUB_SENS_TYPE;        // 传感数据类型


#define     BUFF_STACK_SIZE         64
// USART1 
#define USART1_RX_BUFFER_SIZE       BUFF_STACK_SIZE
extern char usart1_rx_buffer[USART1_RX_BUFFER_SIZE];

typedef struct _PKG_UART_
{
    uint8_t flag;
    uint8_t offset;
    uint8_t len;
    uint8_t pkg[BUFF_STACK_SIZE];
    uint32_t tick;
}Pkg_Uart;
extern Pkg_Uart g_pkg_uart_1;
extern Pkg_Uart g_pkg_uart_report;

extern uint8_t g_flag_output;
extern uint8_t g_flag_output2;
extern uint8_t g_input_div;

void uart_report_packet_loop_acs(uint8_t flag);

#endif
