|  |  |  | @ -36,6 +36,7 @@ | 
		
	
		
			
				|  |  |  |  | /* Includes ------------------------------------------------------------------*/ | 
		
	
		
			
				|  |  |  |  | #include "stdio.h" | 
		
	
		
			
				|  |  |  |  | #include "string.h" | 
		
	
		
			
				|  |  |  |  | #include "math.h" | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | #include "usart.h" | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -85,19 +86,15 @@ typedef struct | 
		
	
		
			
				|  |  |  |  | /* RS485 调试通讯协议配置信息. */ | 
		
	
		
			
				|  |  |  |  | typedef struct | 
		
	
		
			
				|  |  |  |  | { | 
		
	
		
			
				|  |  |  |  |     uint16_t flag; | 
		
	
		
			
				|  |  |  |  |     uint8_t energy_mode; | 
		
	
		
			
				|  |  |  |  |     uint8_t is_voltage_col; | 
		
	
		
			
				|  |  |  |  |     uint8_t sensor_id[SENSOR_SUM]; | 
		
	
		
			
				|  |  |  |  |     uint16_t collect_interval; | 
		
	
		
			
				|  |  |  |  |     uint16_t wave_interval; | 
		
	
		
			
				|  |  |  |  |     uint16_t collect_threshold; | 
		
	
		
			
				|  |  |  |  |     uint16_t wave_threshold; | 
		
	
		
			
				|  |  |  |  |     uint8_t main_cable; | 
		
	
		
			
				|  |  |  |  |     uint8_t normal_sleep; | 
		
	
		
			
				|  |  |  |  |     uint8_t is_temp_col; | 
		
	
		
			
				|  |  |  |  |     uint8_t is_wave_col; | 
		
	
		
			
				|  |  |  |  |     uint8_t APN[DEV_APN_LEN]; | 
		
	
		
			
				|  |  |  |  |     uint8_t debug_mode;             // 调试模式.
 | 
		
	
		
			
				|  |  |  |  |     uint8_t work_mode;              // 工作模式.
 | 
		
	
		
			
				|  |  |  |  |     uint16_t col_inr;               // 采集间隔, 单位: 分钟.
 | 
		
	
		
			
				|  |  |  |  |     uint16_t live_inr;              // 保活间隔, 单位: 分钟.
 | 
		
	
		
			
				|  |  |  |  |     uint16_t power_thr;             // 工频阈值, 单位: A.
 | 
		
	
		
			
				|  |  |  |  |     uint16_t defect_thr;            // 隐患阈值, 单位: mA.
 | 
		
	
		
			
				|  |  |  |  |     uint16_t fault_thr;             // 故障阈值, 单位: A.
 | 
		
	
		
			
				|  |  |  |  |     uint8_t APN[DEV_APN_LEN];       // APN 名字.
 | 
		
	
		
			
				|  |  |  |  |     uint8_t reserve[20]; | 
		
	
		
			
				|  |  |  |  | } debug_config_t; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /* Private macro -------------------------------------------------------------*/ | 
		
	
	
		
			
				
					|  |  |  | @ -112,7 +109,9 @@ static UART_HandleTypeDef *debug_adj_uart = &huart4; | 
		
	
		
			
				|  |  |  |  | static uint8_t debug_state = 0; | 
		
	
		
			
				|  |  |  |  | /* 远程升级 flash 数据校验使用. */ | 
		
	
		
			
				|  |  |  |  | static uint8_t debug_flash[DEBUG_FLASH_BUF_SIZE]; | 
		
	
		
			
				|  |  |  |  | extern int8_t g_is_adj_status; | 
		
	
		
			
				|  |  |  |  | static dev_adj_defect_zero_t debug_adj_defect; | 
		
	
		
			
				|  |  |  |  | dev_adj_fault_zero_t debug_adj_fault; | 
		
	
		
			
				|  |  |  |  | dev_adj_power_t debug_adj_power; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /* Private function prototypes -----------------------------------------------*/ | 
		
	
		
			
				|  |  |  |  | /* Internal functions --------------------------------------------------------*/ | 
		
	
	
		
			
				
					|  |  |  | @ -537,19 +536,38 @@ static void _debug_pkt_config_get(void) | 
		
	
		
			
				|  |  |  |  |     proto_head_t *head = (proto_head_t*)debug_buf.buf; | 
		
	
		
			
				|  |  |  |  |     debug_config_t *data = (debug_config_t*)(debug_buf.buf + sizeof(proto_head_t)); | 
		
	
		
			
				|  |  |  |  |     uint32_t *crc = NULL; | 
		
	
		
			
				|  |  |  |  |     uint8_t i = 0; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 封装报文头. */ | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_head_init(sizeof(proto_head_t) + sizeof(debug_config_t), DEBUG_CT_REPLY); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 封装数据. */ | 
		
	
		
			
				|  |  |  |  |     data->flag = dev_config.flag; | 
		
	
		
			
				|  |  |  |  |     for(i = 0; i < SENSOR_SUM; i++) | 
		
	
		
			
				|  |  |  |  |     if (IS_MONITOR_BIT_SET(dev_config.flag, DEV_FLAG_CLI)) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         data->debug_mode = 0; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     else | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         data->debug_mode = 1; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     if (IS_MONITOR_BIT_SET(dev_config.flag, DEV_FLAG_ADJ)) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         data->work_mode = 1; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     else if(IS_MONITOR_BIT_SET(dev_config.flag, DEV_FLAG_FACTORY)) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         data->sensor_id[i] = 0; | 
		
	
		
			
				|  |  |  |  |         data->work_mode = 2; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     data->collect_interval = dev_config.collect_interval; | 
		
	
		
			
				|  |  |  |  |     data->wave_interval = 12; | 
		
	
		
			
				|  |  |  |  |     else | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         data->work_mode = 0; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |      | 
		
	
		
			
				|  |  |  |  |     data->col_inr = dev_config.collect_interval; | 
		
	
		
			
				|  |  |  |  |     data->live_inr = dev_config.keepalive; | 
		
	
		
			
				|  |  |  |  |     data->power_thr = dev_config.power_threshold; | 
		
	
		
			
				|  |  |  |  |     data->defect_thr = dev_config.defect_threshold; | 
		
	
		
			
				|  |  |  |  |     data->fault_thr = dev_config.fault_threshold; | 
		
	
		
			
				|  |  |  |  |     memcpy(data->APN, dev_config.APN, DEV_APN_LEN); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 计算校验和. */ | 
		
	
	
		
			
				
					|  |  |  | @ -567,18 +585,37 @@ static void _debug_pkt_config_set(void) | 
		
	
		
			
				|  |  |  |  | { | 
		
	
		
			
				|  |  |  |  |     proto_head_t *head = (proto_head_t*)debug_buf.buf; | 
		
	
		
			
				|  |  |  |  |     debug_config_t *data = (debug_config_t*)(debug_buf.buf + sizeof(proto_head_t)); | 
		
	
		
			
				|  |  |  |  |     uint16_t flag = 0; | 
		
	
		
			
				|  |  |  |  |     uint8_t is_reboot = FALSE; | 
		
	
		
			
				|  |  |  |  |     uint32_t reset_delay = 2; | 
		
	
		
			
				|  |  |  |  |     uint32_t *crc = NULL; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 保存数据. */ | 
		
	
		
			
				|  |  |  |  |     if (dev_config.flag != data->flag) | 
		
	
		
			
				|  |  |  |  |     if (0 == data->debug_mode) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         MONITOR_BITMAP_SET(flag, DEV_FLAG_CLI); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     if (1 == data->work_mode) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         MONITOR_BITMAP_SET(flag, DEV_FLAG_ADJ); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     else if(2 == data->work_mode) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         MONITOR_BITMAP_SET(flag, DEV_FLAG_FACTORY); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |      | 
		
	
		
			
				|  |  |  |  |     if (dev_config.flag != flag) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         is_reboot = TRUE; | 
		
	
		
			
				|  |  |  |  |         dev_config_flag_assgin(data->flag); | 
		
	
		
			
				|  |  |  |  |         dev_config_flag_assgin(flag); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     dev_config.collect_interval = data->collect_interval; | 
		
	
		
			
				|  |  |  |  |     dev_config.collect_interval = data->col_inr; | 
		
	
		
			
				|  |  |  |  |     dev_config.keepalive = data->live_inr; | 
		
	
		
			
				|  |  |  |  |     dev_config.power_threshold = data->power_thr; | 
		
	
		
			
				|  |  |  |  |     dev_config.defect_threshold = data->defect_thr; | 
		
	
		
			
				|  |  |  |  |     dev_config.fault_threshold = data->fault_thr; | 
		
	
		
			
				|  |  |  |  |     memcpy(dev_config.APN, data->APN, DEV_APN_LEN); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 封装报文头. */ | 
		
	
	
		
			
				
					|  |  |  | @ -608,20 +645,15 @@ static void _debug_pkt_config_set(void) | 
		
	
		
			
				|  |  |  |  | static void _debug_pkt_adj_get(void) | 
		
	
		
			
				|  |  |  |  | { | 
		
	
		
			
				|  |  |  |  |     proto_head_t *head = (proto_head_t*)debug_buf.buf; | 
		
	
		
			
				|  |  |  |  |     dev_adj_t *data = (dev_adj_t*)(debug_buf.buf + sizeof(proto_head_t)); | 
		
	
		
			
				|  |  |  |  |     dev_adj_cfg_t *data = (dev_adj_cfg_t*)(debug_buf.buf + sizeof(proto_head_t)); | 
		
	
		
			
				|  |  |  |  |     uint32_t *crc = NULL; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 封装报文头. */ | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_head_init(sizeof(proto_head_t) + sizeof(dev_adj_t), DEBUG_CT_PRV_REPLY); | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_head_init(sizeof(proto_head_t) + sizeof(dev_adj_cfg_t), DEBUG_CT_PRV_REPLY); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 封装数据, 这里减 4 是因为结构体最后 4byte 位置特殊. */ | 
		
	
		
			
				|  |  |  |  |     memcpy(data->ADCRatio, dev_config.ADC_ratio, sizeof(dev_config.ADC_ratio)); | 
		
	
		
			
				|  |  |  |  |     memcpy(data->ADCBase_elec, dev_config.ADC_base_elec, sizeof(dev_config.ADC_base_elec)); | 
		
	
		
			
				|  |  |  |  |     memcpy(data->ADCAdj, dev_config.ADC_adj, sizeof(dev_config.ADC_adj)); | 
		
	
		
			
				|  |  |  |  |     memcpy(data->ADCBase, dev_config.ADC_base, sizeof(dev_config.ADC_base)); | 
		
	
		
			
				|  |  |  |  |     data->vin = dev_config.vin; | 
		
	
		
			
				|  |  |  |  |     memcpy(data->power_adj, dev_config.power_adj, 64); | 
		
	
		
			
				|  |  |  |  |     data->vin_adj = dev_config.vin_adj; | 
		
	
		
			
				|  |  |  |  |     memcpy(data->ADC_turns, dev_config.ADC_turns, DAU_PORT_POWER_CNT); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 计算校验和. */ | 
		
	
		
			
				|  |  |  |  |     crc = (uint32_t*)(debug_buf.buf + head->len); | 
		
	
	
		
			
				
					|  |  |  | @ -634,20 +666,67 @@ static void _debug_pkt_adj_get(void) | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /* 校准参数设置报文处理. */ | 
		
	
		
			
				|  |  |  |  | static void _debug_pkt_adj_set(void) | 
		
	
		
			
				|  |  |  |  | static void _debug_pkt_adj_set_power(void) | 
		
	
		
			
				|  |  |  |  | { | 
		
	
		
			
				|  |  |  |  |     proto_head_t *head = (proto_head_t*)debug_buf.buf; | 
		
	
		
			
				|  |  |  |  |     dev_adj_t *data = (dev_adj_t*)(debug_buf.buf + sizeof(proto_head_t)); | 
		
	
		
			
				|  |  |  |  |     dev_adj_power_cfg_t *data = (dev_adj_power_cfg_t*)(debug_buf.buf + sizeof(proto_head_t)); | 
		
	
		
			
				|  |  |  |  |     uint32_t *crc = NULL; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 配置参数. */ | 
		
	
		
			
				|  |  |  |  |     memcpy(dev_config.ADC_ratio, data->ADCRatio, sizeof(dev_config.ADC_ratio)); | 
		
	
		
			
				|  |  |  |  |     memcpy(dev_config.ADC_base_elec, data->ADCBase_elec, sizeof(dev_config.ADC_base_elec)); | 
		
	
		
			
				|  |  |  |  |     memcpy(dev_config.ADC_adj, data->ADCAdj, sizeof(dev_config.ADC_adj)); | 
		
	
		
			
				|  |  |  |  |     memcpy(dev_config.ADC_base, data->ADCBase, sizeof(dev_config.ADC_base)); | 
		
	
		
			
				|  |  |  |  |     dev_config.vin = data->vin; | 
		
	
		
			
				|  |  |  |  |     memcpy(dev_config.power_adj, data->power_adj, 32); | 
		
	
		
			
				|  |  |  |  |     dev_config.vin_adj = data->vin_adj; | 
		
	
		
			
				|  |  |  |  |     memcpy(dev_config.ADC_turns, data->ADC_turns, DAU_PORT_POWER_CNT); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 封装报文头. */ | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_head_init(sizeof(proto_head_t), DEBUG_CT_PRV_REPLY); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 计算校验和. */ | 
		
	
		
			
				|  |  |  |  |     crc = (uint32_t*)(debug_buf.buf + head->len); | 
		
	
		
			
				|  |  |  |  |     *crc = crc32(debug_buf.buf, head->len); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 发送报文 */ | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_send(head->len + 4, 20); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 保存参数. */ | 
		
	
		
			
				|  |  |  |  |     common_sys_set(COM_SYS_SAVE_CONFIG, 0); | 
		
	
		
			
				|  |  |  |  |      | 
		
	
		
			
				|  |  |  |  |     return; | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /* 校准参数设置报文处理. */ | 
		
	
		
			
				|  |  |  |  | static void _debug_pkt_adj_set_defect(void) | 
		
	
		
			
				|  |  |  |  | { | 
		
	
		
			
				|  |  |  |  |     proto_head_t *head = (proto_head_t*)debug_buf.buf; | 
		
	
		
			
				|  |  |  |  |     dev_adj_defect_cfg_t *data = (dev_adj_defect_cfg_t*)(debug_buf.buf + sizeof(proto_head_t)); | 
		
	
		
			
				|  |  |  |  |     uint32_t *crc = NULL; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 配置参数. */ | 
		
	
		
			
				|  |  |  |  |     memcpy(dev_config.defect_base, data->defect_base, sizeof(dev_adj_defect_cfg_t)); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 封装报文头. */ | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_head_init(sizeof(proto_head_t), DEBUG_CT_PRV_REPLY); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 计算校验和. */ | 
		
	
		
			
				|  |  |  |  |     crc = (uint32_t*)(debug_buf.buf + head->len); | 
		
	
		
			
				|  |  |  |  |     *crc = crc32(debug_buf.buf, head->len); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 发送报文 */ | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_send(head->len + 4, 20); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 保存参数. */ | 
		
	
		
			
				|  |  |  |  |     common_sys_set(COM_SYS_SAVE_CONFIG, 0); | 
		
	
		
			
				|  |  |  |  |      | 
		
	
		
			
				|  |  |  |  |     return; | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /* 校准参数设置报文处理. */ | 
		
	
		
			
				|  |  |  |  | static void _debug_pkt_adj_set_fault(void) | 
		
	
		
			
				|  |  |  |  | { | 
		
	
		
			
				|  |  |  |  |     proto_head_t *head = (proto_head_t*)debug_buf.buf; | 
		
	
		
			
				|  |  |  |  |     dev_adj_fault_cfg_t *data = (dev_adj_fault_cfg_t*)(debug_buf.buf + sizeof(proto_head_t)); | 
		
	
		
			
				|  |  |  |  |     uint32_t *crc = NULL; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 配置参数. */ | 
		
	
		
			
				|  |  |  |  |     memcpy(dev_config.fault_base, data->fault_base, sizeof(dev_adj_fault_cfg_t)); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 封装报文头. */ | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_head_init(sizeof(proto_head_t), DEBUG_CT_PRV_REPLY); | 
		
	
	
		
			
				
					|  |  |  | @ -943,6 +1022,77 @@ static HAL_StatusTypeDef _debug_adj_start(void) | 
		
	
		
			
				|  |  |  |  |     return HAL_OK; | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /* 工频系数自动计算. */ | 
		
	
		
			
				|  |  |  |  | void _debug_adj_power_cal(void) | 
		
	
		
			
				|  |  |  |  | { | 
		
	
		
			
				|  |  |  |  |     int16_t (*val)[DAU_POWER_DATE_LEN] = dau_ctrl.reg_power; | 
		
	
		
			
				|  |  |  |  |     uint8_t ch = 0; | 
		
	
		
			
				|  |  |  |  |     uint16_t i = 0; | 
		
	
		
			
				|  |  |  |  |     uint64_t square_sum = 0; | 
		
	
		
			
				|  |  |  |  |     int32_t mean = 0; | 
		
	
		
			
				|  |  |  |  |     float base_elec = 0; | 
		
	
		
			
				|  |  |  |  |     float temp = 0; | 
		
	
		
			
				|  |  |  |  |     int16_t min = 32767; | 
		
	
		
			
				|  |  |  |  |     int16_t max = -32768; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 遍历通道, 计算有效值 */ | 
		
	
		
			
				|  |  |  |  |     for(ch = 0; ch < DAU_PORT_POWER_CNT; ch++) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         if (!IS_MONITOR_BIT_SET(debug_adj_power.bitmap, ch)) | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             continue; | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |      | 
		
	
		
			
				|  |  |  |  |         /* 计算所有值的算术平均值 */ | 
		
	
		
			
				|  |  |  |  |         mean = 0; | 
		
	
		
			
				|  |  |  |  |         min = 32767; | 
		
	
		
			
				|  |  |  |  |         max = -32768; | 
		
	
		
			
				|  |  |  |  |         for(i = 0; i < DAU_POWER_DATE_LEN; i++) | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             if (val[ch][i] < min) | 
		
	
		
			
				|  |  |  |  |                 min = val[ch][i]; | 
		
	
		
			
				|  |  |  |  |             if (val[ch][i] > max) | 
		
	
		
			
				|  |  |  |  |                 max = val[ch][i]; | 
		
	
		
			
				|  |  |  |  |             mean += val[ch][i]; | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |         mean = mean / DAU_POWER_DATE_LEN; | 
		
	
		
			
				|  |  |  |  |         vty_print("#DE P%d %d %d %d", ch, mean, min, max); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         /* 遍历通道所有值, 求和, 并计算出最大值和最小值. */ | 
		
	
		
			
				|  |  |  |  |         square_sum = 0; | 
		
	
		
			
				|  |  |  |  |         for(i = 0; i < DAU_POWER_DATE_LEN; i++) | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             val[ch][i] -= mean; | 
		
	
		
			
				|  |  |  |  |             square_sum += val[ch][i] * val[ch][i]; | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         /* 根据数据查找数据落在哪个分段点上. */ | 
		
	
		
			
				|  |  |  |  |         temp = (double)sqrt(square_sum / DAU_POWER_DATE_LEN); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         /* 计算系数. */ | 
		
	
		
			
				|  |  |  |  |         if (ch < 4) | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             dev_config.power_adj[ch] = (uint16_t)(temp * 8000 / (debug_adj_power.elec * 10)); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |         else  | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             dev_config.power_adj[ch] = (uint16_t)(temp * 120000 / (debug_adj_power.elec * 10)); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |          | 
		
	
		
			
				|  |  |  |  |         if (ch < 4) | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             base_elec = debug_adj_power.elec * 14.14 * 2; | 
		
	
		
			
				|  |  |  |  |             dev_config.power_adj_point[ch] = (uint16_t)((max - min) * 8000 / base_elec); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |         else | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             base_elec = debug_adj_power.elec * 1.414 * 2; | 
		
	
		
			
				|  |  |  |  |             dev_config.power_adj_point[ch] = (uint16_t)((max - min) * 12000 / base_elec); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /* 自动校准处理. */ | 
		
	
		
			
				|  |  |  |  | static HAL_StatusTypeDef _debug_adj_auto(uint8_t bitmap) | 
		
	
		
			
				|  |  |  |  | { | 
		
	
	
		
			
				
					|  |  |  | @ -962,7 +1112,7 @@ static HAL_StatusTypeDef _debug_adj_auto(uint8_t bitmap) | 
		
	
		
			
				|  |  |  |  |     for(i = 0; i < 1; i++) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         /* 过滤不需要的通道. */ | 
		
	
		
			
				|  |  |  |  |         if (!IS_MONITOR_BIT_SET(bitmap, i) || 0 == dev_config.ADC_ratio[i]) | 
		
	
		
			
				|  |  |  |  |         if (!IS_MONITOR_BIT_SET(bitmap, i)) | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             continue; | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
	
		
			
				
					|  |  |  | @ -971,8 +1121,7 @@ static HAL_StatusTypeDef _debug_adj_auto(uint8_t bitmap) | 
		
	
		
			
				|  |  |  |  |         bitmap_new = 0; | 
		
	
		
			
				|  |  |  |  |         for (j = i; j < DAU_PORT_POWER_CNT; j++) | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             if (!IS_MONITOR_BIT_SET(bitmap, j) | 
		
	
		
			
				|  |  |  |  |                 || dev_config.ADC_ratio[i] != dev_config.ADC_ratio[j]) | 
		
	
		
			
				|  |  |  |  |             if (!IS_MONITOR_BIT_SET(bitmap, j)) | 
		
	
		
			
				|  |  |  |  |             { | 
		
	
		
			
				|  |  |  |  |                 continue; | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
	
		
			
				
					|  |  |  | @ -986,14 +1135,14 @@ static HAL_StatusTypeDef _debug_adj_auto(uint8_t bitmap) | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             HAL_E_RETURN(_debug_adj_source_set(bitmap_new, j)); | 
		
	
		
			
				|  |  |  |  |             osDelay(3000); | 
		
	
		
			
				|  |  |  |  |             g_is_adj_status = 1; | 
		
	
		
			
				|  |  |  |  |             while (g_is_adj_status != 2) | 
		
	
		
			
				|  |  |  |  |             dau_adj_state = DAU_ADJ_STATE_POWER; | 
		
	
		
			
				|  |  |  |  |             while (dau_adj_state != DAU_ADJ_STATE_NONE) | 
		
	
		
			
				|  |  |  |  |             { | 
		
	
		
			
				|  |  |  |  |                 common_watchdog_set(COM_WDG_CLI); | 
		
	
		
			
				|  |  |  |  |                 osDelay(2000); | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             DBG(DBG_M_RS485_DEBUG, "capture end...\r\n"); | 
		
	
		
			
				|  |  |  |  |             HAL_E_RETURN(_dau_base_auto(bitmap_new, j + 1)); | 
		
	
		
			
				|  |  |  |  |             _debug_adj_power_cal(); | 
		
	
		
			
				|  |  |  |  |         }         | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -1021,7 +1170,7 @@ static HAL_StatusTypeDef _debug_adj_autoEx(uint8_t bitmap, uint16_t elec, uint8_ | 
		
	
		
			
				|  |  |  |  |     for(i = 0; i < 1; i++) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         /* 过滤不需要的通道. */ | 
		
	
		
			
				|  |  |  |  |         if (!IS_MONITOR_BIT_SET(bitmap, i) || 0 == dev_config.ADC_ratio[i]) | 
		
	
		
			
				|  |  |  |  |         if (!IS_MONITOR_BIT_SET(bitmap, i)) | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             continue; | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
	
		
			
				
					|  |  |  | @ -1030,8 +1179,7 @@ static HAL_StatusTypeDef _debug_adj_autoEx(uint8_t bitmap, uint16_t elec, uint8_ | 
		
	
		
			
				|  |  |  |  |         bitmap_new = 0; | 
		
	
		
			
				|  |  |  |  |         for (j = i; j < DAU_PORT_POWER_CNT; j++) | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             if (!IS_MONITOR_BIT_SET(bitmap, j) | 
		
	
		
			
				|  |  |  |  |                 || dev_config.ADC_ratio[i] != dev_config.ADC_ratio[j]) | 
		
	
		
			
				|  |  |  |  |             if (!IS_MONITOR_BIT_SET(bitmap, j)) | 
		
	
		
			
				|  |  |  |  |             { | 
		
	
		
			
				|  |  |  |  |                 continue; | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
	
		
			
				
					|  |  |  | @ -1045,15 +1193,14 @@ static HAL_StatusTypeDef _debug_adj_autoEx(uint8_t bitmap, uint16_t elec, uint8_ | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             HAL_E_RETURN(_debug_adj_source_setEx(bitmap_new, index-1, elec)); | 
		
	
		
			
				|  |  |  |  |             osDelay(5000); | 
		
	
		
			
				|  |  |  |  |             g_is_adj_status = 1;        | 
		
	
		
			
				|  |  |  |  |             while (g_is_adj_status != 2) | 
		
	
		
			
				|  |  |  |  |             dau_adj_state = DAU_ADJ_STATE_POWER;        | 
		
	
		
			
				|  |  |  |  |             while (dau_adj_state != DAU_ADJ_STATE_NONE) | 
		
	
		
			
				|  |  |  |  |             { | 
		
	
		
			
				|  |  |  |  |                 common_watchdog_set(COM_WDG_CLI); | 
		
	
		
			
				|  |  |  |  |                 osDelay(2000); | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             DBG(DBG_M_RS485_DEBUG, "capture end...\r\n"); | 
		
	
		
			
				|  |  |  |  |             HAL_E_RETURN(_dau_base_auto(bitmap_new, index));     | 
		
	
		
			
				|  |  |  |  |             g_is_adj_status = 0; | 
		
	
		
			
				|  |  |  |  |             _debug_adj_power_cal(); | 
		
	
		
			
				|  |  |  |  |         }         | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -1064,52 +1211,6 @@ static HAL_StatusTypeDef _debug_adj_autoEx(uint8_t bitmap, uint16_t elec, uint8_ | 
		
	
		
			
				|  |  |  |  |     return HAL_OK; | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /* 自动校准报文处理. */ | 
		
	
		
			
				|  |  |  |  | void _debug_pkt_adj_auto(void) | 
		
	
		
			
				|  |  |  |  | { | 
		
	
		
			
				|  |  |  |  |     proto_head_t *head = (proto_head_t*)debug_buf.buf; | 
		
	
		
			
				|  |  |  |  |     debug_adj_set *data = (debug_adj_set*)(debug_buf.buf + sizeof(proto_head_t)); | 
		
	
		
			
				|  |  |  |  |     uint32_t *rt = (uint32_t*)(debug_buf.buf + sizeof(proto_head_t)); | 
		
	
		
			
				|  |  |  |  |     uint32_t *crc = NULL; | 
		
	
		
			
				|  |  |  |  |     HAL_StatusTypeDef rv = HAL_ERROR; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     if (IS_MONITOR_BIT_SET(dev_config.flag, DEV_FLAG_ADJ)) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         /* 开始自动校准. */ | 
		
	
		
			
				|  |  |  |  |         //data->ch_selecet = 1;
 | 
		
	
		
			
				|  |  |  |  |         rv = _debug_adj_auto(data->ch_selecet); | 
		
	
		
			
				|  |  |  |  |         if (rv == HAL_OK) | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             /* 完成后保存配置. */ | 
		
	
		
			
				|  |  |  |  |             common_sys_set(COM_SYS_SAVE_CONFIG, 0); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         /* 电池电压自动校准. */ | 
		
	
		
			
				|  |  |  |  |         if (data->is_voltage_sel) | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             ADC_vbat_auto(dev_config.vin); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     else | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         rv = HAL_ERROR; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     *rt = rv; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 封装报文头. */ | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_head_init(sizeof(proto_head_t) + 4, DEBUG_CT_PRV_REPLY); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 计算校验和. */ | 
		
	
		
			
				|  |  |  |  |     crc = (uint32_t*)(debug_buf.buf + head->len); | 
		
	
		
			
				|  |  |  |  |     *crc = crc32(debug_buf.buf, head->len); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 发送报文 */ | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_send(head->len + 4, 20); | 
		
	
		
			
				|  |  |  |  |      | 
		
	
		
			
				|  |  |  |  |     return; | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void _debug_pkt_adj_autoEx(uint16_t elec, uint8_t index) | 
		
	
		
			
				|  |  |  |  | { | 
		
	
		
			
				|  |  |  |  |     proto_head_t *head = (proto_head_t*)debug_buf.buf; | 
		
	
	
		
			
				
					|  |  |  | @ -1136,7 +1237,6 @@ void _debug_pkt_adj_autoEx(uint16_t elec, uint8_t index) | 
		
	
		
			
				|  |  |  |  |         /* 电池电压自动校准. */ | 
		
	
		
			
				|  |  |  |  |         if (data->is_voltage_sel) | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             ADC_vbat_auto(dev_config.vin); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     else | 
		
	
	
		
			
				
					|  |  |  | @ -1174,12 +1274,18 @@ static void _debug_pkt_data_get(void) | 
		
	
		
			
				|  |  |  |  |     data->temperature = ADC_ctrl.ADCi_temp; | 
		
	
		
			
				|  |  |  |  |     data->vbat = ADC_ctrl.ADCi_vbat; | 
		
	
		
			
				|  |  |  |  |     data->vin = ADC_ctrl.ADCi_vin; | 
		
	
		
			
				|  |  |  |  |     data->vsc = ADC_ctrl.ADCi_vsc; | 
		
	
		
			
				|  |  |  |  |     data->CSQ = wl_ctrl.CSQ; | 
		
	
		
			
				|  |  |  |  |     for(i = 0; i < DAU_PORT_POWER_CNT; i++) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         //data->elec[i] = ADC_ctrl.ADC_elec[i];
 | 
		
	
		
			
				|  |  |  |  |         data->elec[i] = dau_ctrl.reg_elec[i]; | 
		
	
		
			
				|  |  |  |  |         data->elec_fault[i] = dau_ctrl.fault_elec[i]; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     for(i = 0; i < DAU_PORT_DEFECT_MAX; i++) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         data->elec_defect_max[i] = dau_ctrl.reg_defect_max[i]; | 
		
	
		
			
				|  |  |  |  |         data->elec_fault_max[i] = dau_ctrl.fault_max[i]; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     data->fault_utc = dau_ctrl.fault_utc; | 
		
	
		
			
				|  |  |  |  |     data->fault_ns = dau_ctrl.fault_ns; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 计算校验和. */ | 
		
	
		
			
				|  |  |  |  |     crc = (uint32_t*)(debug_buf.buf + head->len); | 
		
	
	
		
			
				
					|  |  |  | @ -1297,32 +1403,22 @@ static void _debug_pkt_wave_get(void) | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /* 设备状态获取报文处理. */ | 
		
	
		
			
				|  |  |  |  | static void _debug_pkt_dev_state_get(void) | 
		
	
		
			
				|  |  |  |  | static void _debug_pkt_wave_col(void) | 
		
	
		
			
				|  |  |  |  | { | 
		
	
		
			
				|  |  |  |  |     proto_head_t *head = (proto_head_t*)debug_buf.buf; | 
		
	
		
			
				|  |  |  |  |     dev_state_t *data = (dev_state_t*)(debug_buf.buf + sizeof(proto_head_t)); | 
		
	
		
			
				|  |  |  |  |     uint32_t *crc = NULL; | 
		
	
		
			
				|  |  |  |  |     uint32_t reset_delay = 2; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 封装报文头. */ | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_head_init(sizeof(proto_head_t) + sizeof(dev_state_t), DEBUG_CT_PRV_REPLY); | 
		
	
		
			
				|  |  |  |  |     st_data.wave_time = 0; | 
		
	
		
			
				|  |  |  |  |     st_data.wave_start = TRUE; | 
		
	
		
			
				|  |  |  |  |     st_data.wave_up_start = TRUE; | 
		
	
		
			
				|  |  |  |  |     st_data.wave_index = 0; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 装填数据. */ | 
		
	
		
			
				|  |  |  |  |     data->is_adc_up = ADC_ctrl.up_finish; | 
		
	
		
			
				|  |  |  |  |     data->adci_cnt = ADC_ctrl.ADCi_err_cnt; | 
		
	
		
			
				|  |  |  |  |     data->adci_state = ADC_ctrl.ADCi_state; | 
		
	
		
			
				|  |  |  |  |     data->adc_cnt = ADC_ctrl.ADC_err_cnt; | 
		
	
		
			
				|  |  |  |  |     data->adc_state = ADC_ctrl.ADC_state; | 
		
	
		
			
				|  |  |  |  |     data->is_adc_thr = ADC_ctrl.is_ADC_thr; | 
		
	
		
			
				|  |  |  |  |     data->wave_time = st_data.wave_time; | 
		
	
		
			
				|  |  |  |  |     data->wave_start = st_data.wave_start; | 
		
	
		
			
				|  |  |  |  |     data->wave_up_start = st_data.wave_up_start; | 
		
	
		
			
				|  |  |  |  |     data->wave_idx = st_data.wave_index; | 
		
	
		
			
				|  |  |  |  |     data->wave_force = st_data.wave_force; | 
		
	
		
			
				|  |  |  |  |     data->wl_state = wl_ctrl.state; | 
		
	
		
			
				|  |  |  |  |     data->wl_cnt = wl_ctrl.send_cnt; | 
		
	
		
			
				|  |  |  |  |     data->force_sleep_up = st_data.force_sleep_up; | 
		
	
		
			
				|  |  |  |  |     data->is_bat_charge = HAL_GPIO_ReadPin(BAT_CHECK_GPIO_Port, BAT_CHECK_Pin); | 
		
	
		
			
				|  |  |  |  |     data->sys_time = HAL_GetTick() / 1000; | 
		
	
		
			
				|  |  |  |  |     flash_log_write(FLASH_LOG_TYPE_INFO, "Force wavc collect system reset!\r\n"); | 
		
	
		
			
				|  |  |  |  |     common_sys_set(COM_SYS_RESET, (void*)&reset_delay); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 封装报文头. */ | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_head_init(sizeof(proto_head_t), DEBUG_CT_PRV_REPLY); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 计算校验和. */ | 
		
	
		
			
				|  |  |  |  |     crc = (uint32_t*)(debug_buf.buf + head->len); | 
		
	
	
		
			
				
					|  |  |  | @ -1335,19 +1431,32 @@ static void _debug_pkt_dev_state_get(void) | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /* 设备状态获取报文处理. */ | 
		
	
		
			
				|  |  |  |  | static void _debug_pkt_wave_col(void) | 
		
	
		
			
				|  |  |  |  | static void _debug_pkt_adj_defect_zero(void) | 
		
	
		
			
				|  |  |  |  | { | 
		
	
		
			
				|  |  |  |  |     proto_head_t *head = (proto_head_t*)debug_buf.buf; | 
		
	
		
			
				|  |  |  |  |     dev_adj_defect_zero_t *data = (dev_adj_defect_zero_t*)(debug_buf.buf + sizeof(proto_head_t)); | 
		
	
		
			
				|  |  |  |  |     uint32_t *crc = NULL; | 
		
	
		
			
				|  |  |  |  |     uint32_t reset_delay = 2; | 
		
	
		
			
				|  |  |  |  |     uint8_t i = 0; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     st_data.wave_time = 0; | 
		
	
		
			
				|  |  |  |  |     st_data.wave_start = TRUE; | 
		
	
		
			
				|  |  |  |  |     st_data.wave_up_start = TRUE; | 
		
	
		
			
				|  |  |  |  |     st_data.wave_index = 0; | 
		
	
		
			
				|  |  |  |  |     /* 解析数据. */ | 
		
	
		
			
				|  |  |  |  |     memcpy(&debug_adj_defect, data, sizeof(dev_adj_defect_zero_t)); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     flash_log_write(FLASH_LOG_TYPE_INFO, "Force wavc collect system reset!\r\n"); | 
		
	
		
			
				|  |  |  |  |     common_sys_set(COM_SYS_RESET, (void*)&reset_delay); | 
		
	
		
			
				|  |  |  |  |     dau_adj_state = DAU_ADJ_STATE_DEFECT_ZERO; | 
		
	
		
			
				|  |  |  |  |     while(dau_adj_state != DAU_ADJ_STATE_NONE) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         osDelay(1000); | 
		
	
		
			
				|  |  |  |  |         common_watchdog_set(COM_WDG_CLI); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     for(i = 0; i < DAU_PORT_DEFECT_CNT; i++) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         if (!IS_MONITOR_BIT_SET(debug_adj_defect.bitmap, i)) | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             continue; | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         dev_config.defect_base[i] = dau_ctrl.reg_port_state.DAVR[i]; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 封装报文头. */ | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_head_init(sizeof(proto_head_t), DEBUG_CT_PRV_REPLY); | 
		
	
	
		
			
				
					|  |  |  | @ -1362,14 +1471,39 @@ static void _debug_pkt_wave_col(void) | 
		
	
		
			
				|  |  |  |  |     return; | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /* 校准参数设置报文处理. */ | 
		
	
		
			
				|  |  |  |  | static void _debug_pkt_wave_cal(void) | 
		
	
		
			
				|  |  |  |  | /* 设备状态获取报文处理. */ | 
		
	
		
			
				|  |  |  |  | static void _debug_pkt_adj_defect(void) | 
		
	
		
			
				|  |  |  |  | { | 
		
	
		
			
				|  |  |  |  |     proto_head_t *head = (proto_head_t*)debug_buf.buf; | 
		
	
		
			
				|  |  |  |  |     dev_adj_defect_cfg_t *data = (dev_adj_defect_cfg_t*)(debug_buf.buf + sizeof(proto_head_t)); | 
		
	
		
			
				|  |  |  |  |     uint32_t *crc = NULL; | 
		
	
		
			
				|  |  |  |  |     uint32_t temp = 0; | 
		
	
		
			
				|  |  |  |  |     uint8_t i = 0; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     dau_adj_state = DAU_ADJ_STATE_DEFECT; | 
		
	
		
			
				|  |  |  |  |     while(dau_adj_state != DAU_ADJ_STATE_NONE) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         osDelay(1000); | 
		
	
		
			
				|  |  |  |  |         common_watchdog_set(COM_WDG_CLI); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |      | 
		
	
		
			
				|  |  |  |  |     for(i = 0; i < DAU_PORT_DEFECT_CNT; i++) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         if (!IS_MONITOR_BIT_SET(debug_adj_defect.bitmap, i)) | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             continue; | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |         temp = dau_ctrl.reg_port_state.DAVR[i] - dev_config.defect_base[i]; | 
		
	
		
			
				|  |  |  |  |         temp = 3276; | 
		
	
		
			
				|  |  |  |  |         dev_config.defect_adj[i] = debug_adj_defect.defect_elec * 32768 / temp; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 封装报文头. */ | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_head_init(sizeof(proto_head_t), DEBUG_CT_PRV_REPLY); | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_head_init(sizeof(proto_head_t) + sizeof(dev_adj_defect_cfg_t), DEBUG_CT_PRV_REPLY); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 配置参数. */ | 
		
	
		
			
				|  |  |  |  |     memcpy(data->defect_base, dev_config.defect_base, sizeof(dev_adj_defect_cfg_t)); | 
		
	
		
			
				|  |  |  |  |      | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 计算校验和. */ | 
		
	
		
			
				|  |  |  |  |     crc = (uint32_t*)(debug_buf.buf + head->len); | 
		
	
	
		
			
				
					|  |  |  | @ -1378,6 +1512,9 @@ static void _debug_pkt_wave_cal(void) | 
		
	
		
			
				|  |  |  |  |     /* 发送报文 */ | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_send(head->len + 4, 20); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 保存参数. */ | 
		
	
		
			
				|  |  |  |  |     common_sys_set(COM_SYS_SAVE_CONFIG, 0); | 
		
	
		
			
				|  |  |  |  |      | 
		
	
		
			
				|  |  |  |  |     return; | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -1544,7 +1681,7 @@ static HAL_StatusTypeDef _debug_adj_manual(uint8_t bitmap, uint8_t index) | 
		
	
		
			
				|  |  |  |  |     for(i = 0; i < DAU_PORT_POWER_CNT; i++) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         /* 过滤不需要的通道. */ | 
		
	
		
			
				|  |  |  |  |         if (!IS_MONITOR_BIT_SET(bitmap, i) || 0 == dev_config.ADC_ratio[i]) | 
		
	
		
			
				|  |  |  |  |         if (!IS_MONITOR_BIT_SET(bitmap, i)) | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             continue; | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
	
		
			
				
					|  |  |  | @ -1565,7 +1702,7 @@ static HAL_StatusTypeDef _debug_adj_manual(uint8_t bitmap, uint8_t index) | 
		
	
		
			
				|  |  |  |  |         }    | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     HAL_E_RETURN(_dau_base_auto(bitmap, index + 1)); | 
		
	
		
			
				|  |  |  |  |     _debug_adj_power_cal(); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     return HAL_OK; | 
		
	
		
			
				|  |  |  |  | } | 
		
	
	
		
			
				
					|  |  |  | @ -1608,14 +1745,25 @@ static void _debug_pkt_adj_manual(void) | 
		
	
		
			
				|  |  |  |  |     return; | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /* 南网配置获取报文处理. */ | 
		
	
		
			
				|  |  |  |  | static void _debug_pkt_csg_config_get(void) | 
		
	
		
			
				|  |  |  |  | /* 设备状态获取报文处理. */ | 
		
	
		
			
				|  |  |  |  | static void _debug_pkt_adj_fault_zero(void) | 
		
	
		
			
				|  |  |  |  | { | 
		
	
		
			
				|  |  |  |  |     proto_head_t *head = (proto_head_t*)debug_buf.buf; | 
		
	
		
			
				|  |  |  |  |     dev_adj_fault_zero_t *data = (dev_adj_fault_zero_t*)(debug_buf.buf + sizeof(proto_head_t)); | 
		
	
		
			
				|  |  |  |  |     uint32_t *crc = NULL; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 解析数据. */ | 
		
	
		
			
				|  |  |  |  |     memcpy(&debug_adj_fault, data, sizeof(dev_adj_fault_zero_t)); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     dau_adj_state = DAU_ADJ_STATE_FAULT_ZERO; | 
		
	
		
			
				|  |  |  |  |     while(dau_adj_state != DAU_ADJ_STATE_NONE) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         osDelay(1000); | 
		
	
		
			
				|  |  |  |  |         common_watchdog_set(COM_WDG_CLI); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 封装报文头. */ | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_head_init(sizeof(proto_head_t) + sizeof(debug_csg_config_t), DEBUG_CT_PRV_REPLY); | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_head_init(sizeof(proto_head_t), DEBUG_CT_PRV_REPLY); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 计算校验和. */ | 
		
	
		
			
				|  |  |  |  |     crc = (uint32_t*)(debug_buf.buf + head->len); | 
		
	
	
		
			
				
					|  |  |  | @ -1627,14 +1775,43 @@ static void _debug_pkt_csg_config_get(void) | 
		
	
		
			
				|  |  |  |  |     return; | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /* 修改南网配置报文处理. */ | 
		
	
		
			
				|  |  |  |  | static void _debug_pkt_csg_config_set(void) | 
		
	
		
			
				|  |  |  |  | /* 设备状态获取报文处理. */ | 
		
	
		
			
				|  |  |  |  | static void _debug_pkt_adj_fault(void) | 
		
	
		
			
				|  |  |  |  | { | 
		
	
		
			
				|  |  |  |  |     proto_head_t *head = (proto_head_t*)debug_buf.buf; | 
		
	
		
			
				|  |  |  |  |     dev_adj_fault_cfg_t *data = (dev_adj_fault_cfg_t*)(debug_buf.buf + sizeof(proto_head_t)); | 
		
	
		
			
				|  |  |  |  |     uint32_t *crc = NULL; | 
		
	
		
			
				|  |  |  |  |     uint8_t i = 0; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     dau_adj_state = DAU_ADJ_STATE_FAULT; | 
		
	
		
			
				|  |  |  |  |     while(dau_adj_state != DAU_ADJ_STATE_NONE) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         osDelay(1000); | 
		
	
		
			
				|  |  |  |  |         common_watchdog_set(COM_WDG_CLI); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |      | 
		
	
		
			
				|  |  |  |  |     for(i = 0; i < DAU_PORT_FAULT_CNT; i++) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         data->fault_base[i] = dev_config.fault_base[i]; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         if (!IS_MONITOR_BIT_SET(debug_adj_fault.bitmap, i)) | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             data->fault_adj[i] = dev_config.fault_adj[i]; | 
		
	
		
			
				|  |  |  |  |             continue; | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         if (!((dau_ctrl.reg_global.GFTR & DAU_GFTR_FAULT_Msk) >> DAU_GFTR_FAULT_Pos)) | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |             data->fault_adj[i] = 0; | 
		
	
		
			
				|  |  |  |  |             continue; | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         //data->fault_adj[i] = abs_cal_u(dau_ctrl.reg_port_state.FMAX[i] - dev_config.fault_base[i]);
 | 
		
	
		
			
				|  |  |  |  |         data->fault_adj[i] = 13107; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 封装报文头. */ | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_head_init(sizeof(proto_head_t), DEBUG_CT_PRV_REPLY); | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_head_init(sizeof(proto_head_t) + sizeof(dev_adj_fault_cfg_t), DEBUG_CT_PRV_REPLY); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 计算校验和. */ | 
		
	
		
			
				|  |  |  |  |     crc = (uint32_t*)(debug_buf.buf + head->len); | 
		
	
	
		
			
				
					|  |  |  | @ -1669,6 +1846,80 @@ static void _debug_pkt_update_fpga_result() | 
		
	
		
			
				|  |  |  |  |     return; | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /* 自动校准报文处理. */ | 
		
	
		
			
				|  |  |  |  | void _debug_pkt_adj_auto(void) | 
		
	
		
			
				|  |  |  |  | { | 
		
	
		
			
				|  |  |  |  |     proto_head_t *head = (proto_head_t*)debug_buf.buf; | 
		
	
		
			
				|  |  |  |  |     dev_adj_power_t *data = (dev_adj_power_t*)(debug_buf.buf + sizeof(proto_head_t)); | 
		
	
		
			
				|  |  |  |  |     dev_adj_power_cfg_t *cfg = (dev_adj_power_cfg_t*)(debug_buf.buf + sizeof(proto_head_t)); | 
		
	
		
			
				|  |  |  |  |     uint32_t *crc = NULL; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 解析数据. */ | 
		
	
		
			
				|  |  |  |  |     memcpy(&debug_adj_power, data, sizeof(dev_adj_power_t)); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 组装数据 */ | 
		
	
		
			
				|  |  |  |  |     //cfg->return_value = _debug_adj_auto(debug_adj_power.bitmap);
 | 
		
	
		
			
				|  |  |  |  |     cfg->return_value = 0; | 
		
	
		
			
				|  |  |  |  |     if (debug_adj_power.is_voltage_adj) | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |         ADC_vbat_auto(5000); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     memcpy(cfg->power_adj, dev_config.power_adj, 32); | 
		
	
		
			
				|  |  |  |  |     cfg->vin_adj = dev_config.vin_adj; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 封装报文头. */ | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_head_init(sizeof(proto_head_t) + sizeof(dev_adj_power_cfg_t), DEBUG_CT_PRV_REPLY); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 计算校验和. */ | 
		
	
		
			
				|  |  |  |  |     crc = (uint32_t*)(debug_buf.buf + head->len); | 
		
	
		
			
				|  |  |  |  |     *crc = crc32(debug_buf.buf, head->len); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 发送报文 */ | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_send(head->len + 4, 20); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 保存参数. */ | 
		
	
		
			
				|  |  |  |  |     common_sys_set(COM_SYS_SAVE_CONFIG, 0); | 
		
	
		
			
				|  |  |  |  |      | 
		
	
		
			
				|  |  |  |  |     return; | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /* 设备状态获取报文处理. */ | 
		
	
		
			
				|  |  |  |  | static void _debug_pkt_dev_state_get(void) | 
		
	
		
			
				|  |  |  |  | { | 
		
	
		
			
				|  |  |  |  |     proto_head_t *head = (proto_head_t*)debug_buf.buf; | 
		
	
		
			
				|  |  |  |  |     dev_state_t *data = (dev_state_t*)(debug_buf.buf + sizeof(proto_head_t)); | 
		
	
		
			
				|  |  |  |  |     uint32_t *crc = NULL; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 封装报文头. */ | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_head_init(sizeof(proto_head_t) + sizeof(dev_state_t), DEBUG_CT_PRV_REPLY); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 装填数据. */ | 
		
	
		
			
				|  |  |  |  |     data->is_adc_up = ADC_ctrl.up_finish; | 
		
	
		
			
				|  |  |  |  |     data->adci_cnt = ADC_ctrl.ADCi_err_cnt; | 
		
	
		
			
				|  |  |  |  |     data->adci_state = ADC_ctrl.ADCi_state; | 
		
	
		
			
				|  |  |  |  |     data->adc_cnt = ADC_ctrl.ADC_err_cnt; | 
		
	
		
			
				|  |  |  |  |     data->adc_state = ADC_ctrl.ADC_state; | 
		
	
		
			
				|  |  |  |  |     data->is_adc_thr = ADC_ctrl.is_ADC_thr; | 
		
	
		
			
				|  |  |  |  |     data->wave_time = st_data.wave_time; | 
		
	
		
			
				|  |  |  |  |     data->wave_start = st_data.wave_start; | 
		
	
		
			
				|  |  |  |  |     data->wave_up_start = st_data.wave_up_start; | 
		
	
		
			
				|  |  |  |  |     data->wave_idx = st_data.wave_index; | 
		
	
		
			
				|  |  |  |  |     data->wave_force = st_data.wave_force; | 
		
	
		
			
				|  |  |  |  |     data->wl_state = wl_ctrl.state; | 
		
	
		
			
				|  |  |  |  |     data->wl_cnt = wl_ctrl.send_cnt; | 
		
	
		
			
				|  |  |  |  |     data->force_sleep_up = st_data.force_sleep_up; | 
		
	
		
			
				|  |  |  |  |     data->is_bat_charge = HAL_GPIO_ReadPin(BAT_CHECK_GPIO_Port, BAT_CHECK_Pin); | 
		
	
		
			
				|  |  |  |  |     data->sys_time = HAL_GetTick() / 1000; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 计算校验和. */ | 
		
	
		
			
				|  |  |  |  |     crc = (uint32_t*)(debug_buf.buf + head->len); | 
		
	
		
			
				|  |  |  |  |     *crc = crc32(debug_buf.buf, head->len); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /* 发送报文 */ | 
		
	
		
			
				|  |  |  |  |     _debug_pkt_send(head->len + 4, 20); | 
		
	
		
			
				|  |  |  |  |      | 
		
	
		
			
				|  |  |  |  |     return; | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /* 收包报文处理. */ | 
		
	
		
			
				|  |  |  |  | static void _debug_pkt_process(void) | 
		
	
	
		
			
				
					|  |  |  | @ -1729,23 +1980,26 @@ static void _debug_pkt_process(void) | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_DEFECT: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_wave_get(); | 
		
	
		
			
				|  |  |  |  |             break; | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_ADJ_INFO: | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_ADJ_GET: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_adj_get(); | 
		
	
		
			
				|  |  |  |  |             break; | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_ADJ_INFO_SET: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_adj_set(); | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_ADJ_SET_POWER: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_adj_set_power(); | 
		
	
		
			
				|  |  |  |  |             break; | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_ADJ_AUTO: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_adj_auto(); | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_ADJ_SET_DEFECT: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_adj_set_defect(); | 
		
	
		
			
				|  |  |  |  |             break; | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_DEV_STATE: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_dev_state_get(); | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_ADJ_SET_FAULT: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_adj_set_fault(); | 
		
	
		
			
				|  |  |  |  |             break; | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_WAVE_COL: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_wave_col(); | 
		
	
		
			
				|  |  |  |  |             break; | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_WAVE_CAL: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_wave_cal(); | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_ADJ_DECFECT_ZERO: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_adj_defect_zero(); | 
		
	
		
			
				|  |  |  |  |             break; | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_ADJ_DECFECT: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_adj_defect(); | 
		
	
		
			
				|  |  |  |  |             break; | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_LOG: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_log_get(); | 
		
	
	
		
			
				
					|  |  |  | @ -1756,15 +2010,21 @@ static void _debug_pkt_process(void) | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_ADJ_MANUAL: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_adj_manual(); | 
		
	
		
			
				|  |  |  |  |             break; | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_CSG_CONFIG: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_csg_config_get(); | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_ADJ_FAULT_ZERO: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_adj_fault_zero(); | 
		
	
		
			
				|  |  |  |  |             break; | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_CSG_CONFIG_SET: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_csg_config_set(); | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_ADJ_FAULT: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_adj_fault(); | 
		
	
		
			
				|  |  |  |  |             break; | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_UPDATE_FPGA: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_update_fpga(); | 
		
	
		
			
				|  |  |  |  |             break; | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_ADJ_AUTO: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_adj_auto(); | 
		
	
		
			
				|  |  |  |  |             break; | 
		
	
		
			
				|  |  |  |  |         case DEBUG_PRV_DEV_STATE: | 
		
	
		
			
				|  |  |  |  |             _debug_pkt_dev_state_get(); | 
		
	
		
			
				|  |  |  |  |             break; | 
		
	
		
			
				|  |  |  |  |         default: | 
		
	
		
			
				|  |  |  |  |             break; | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
	
		
			
				
					|  |  |  | 
 |