From ede556c5e569786112a6372f477d1d2c9824bea0 Mon Sep 17 00:00:00 2001 From: yuliang Date: Fri, 20 Dec 2024 09:51:31 +0800 Subject: [PATCH] =?UTF-8?q?FIX=20|=20=E5=8E=BB=E6=8E=89TAB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Core/Src/RS485_debug.c | 24 ++--- CablePositioning_APP_V1.0/Core/Src/cli.c | 18 ++-- CablePositioning_APP_V1.0/Core/Src/dau.c | 96 +++++++++---------- 3 files changed, 69 insertions(+), 69 deletions(-) diff --git a/CablePositioning_APP_V1.0/Core/Src/RS485_debug.c b/CablePositioning_APP_V1.0/Core/Src/RS485_debug.c index 20444d3..fd741d2 100644 --- a/CablePositioning_APP_V1.0/Core/Src/RS485_debug.c +++ b/CablePositioning_APP_V1.0/Core/Src/RS485_debug.c @@ -808,7 +808,7 @@ static HAL_StatusTypeDef _debug_adj_connect(void) HAL_GPIO_WritePin(RS485_A_DE_GPIO_Port, RS485_A_DE_Pin, GPIO_PIN_SET); HAL_E_RETURN(HAL_UART_Transmit(debug_adj_uart, debug_flash, head->len, 300)); HAL_GPIO_WritePin(RS485_A_DE_GPIO_Port, RS485_A_DE_Pin, GPIO_PIN_RESET); - + /* 接收报文. */ HAL_UART_Abort(debug_adj_uart); HAL_E_RETURN(HAL_UART_Receive(debug_adj_uart, debug_flash, 0x29, 300)); @@ -890,7 +890,7 @@ static HAL_StatusTypeDef _debug_adj_auto(uint8_t bitmap) /* 设置开始操作. */ HAL_E_RETURN(_debug_adj_start()); - //for(i = 0; i < DAU_PORT_POWER_CNT; i++) + //for(i = 0; i < DAU_PORT_POWER_CNT; i++) for(i = 0; i < 1; i++) { /* 过滤不需要的通道. */ @@ -914,15 +914,15 @@ static HAL_StatusTypeDef _debug_adj_auto(uint8_t bitmap) } /* 开始自动校准, 注意不同变比的通道不能一起校准. */ - for (j = 0; j < 1; j++) // 只校准一个分段点 2024/12/11 + for (j = 0; j < 1; j++) // 只校准一个分段点 2024/12/11 { HAL_E_RETURN(_debug_adj_source_set(bitmap_new, j)); osDelay(3000); g_is_adj_status = 1; while (g_is_adj_status != 2) { - common_watchdog_set(COM_WDG_CLI); - osDelay(2000); + 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)); @@ -949,7 +949,7 @@ static HAL_StatusTypeDef _debug_adj_autoEx(uint8_t bitmap, uint16_t elec, uint8_ /* 设置开始操作. */ HAL_E_RETURN(_debug_adj_start()); - //for(i = 0; i < DAU_PORT_POWER_CNT; i++) + //for(i = 0; i < DAU_PORT_POWER_CNT; i++) for(i = 0; i < 1; i++) { /* 过滤不需要的通道. */ @@ -974,18 +974,18 @@ static HAL_StatusTypeDef _debug_adj_autoEx(uint8_t bitmap, uint16_t elec, uint8_ /* 开始自动校准, 注意不同变比的通道不能一起校准. */ //for (j = 0; j < DAU_POWER_ADJ_CNT; j++) - { + { HAL_E_RETURN(_debug_adj_source_setEx(bitmap_new, index-1, elec)); - osDelay(5000); + osDelay(5000); g_is_adj_status = 1; while (g_is_adj_status != 2) { - common_watchdog_set(COM_WDG_CLI); - osDelay(2000); + 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; + g_is_adj_status = 0; } } @@ -1056,7 +1056,7 @@ void _debug_pkt_adj_autoEx(uint16_t elec, uint8_t index) data->ch_selecet = 1; if (data->ch_selecet == 1) { - HAL_GPIO_WritePin(LED_RUN_GPIO_Port, LED_RUN_Pin, GPIO_PIN_SET); + HAL_GPIO_WritePin(LED_RUN_GPIO_Port, LED_RUN_Pin, GPIO_PIN_SET); } rv = _debug_adj_autoEx(data->ch_selecet, elec, index); if (rv == HAL_OK) diff --git a/CablePositioning_APP_V1.0/Core/Src/cli.c b/CablePositioning_APP_V1.0/Core/Src/cli.c index 2dff234..86c47cf 100644 --- a/CablePositioning_APP_V1.0/Core/Src/cli.c +++ b/CablePositioning_APP_V1.0/Core/Src/cli.c @@ -887,24 +887,24 @@ void cli_start(void const * argument) /* 默认开启的 debug. */ if (IS_MONITOR_BIT_SET(dev_config.flag, DEV_FLAG_CLI)) { - dbg_cmd_hander(DBG_CMD_ON, DBG_M_DAU); - //dbg_cmd_hander(DBG_CMD_ON, DBG_M_DAU_TXRX); - //dbg_cmd_hander(DBG_CMD_ON, DBG_M_GPS); - dbg_cmd_hander(DBG_CMD_ON, DBG_M_4G); - dbg_cmd_hander(DBG_CMD_ON, DBG_M_RS485_SEN); - dbg_cmd_hander(DBG_CMD_ON, DBG_M_RS485_DEBUG); + dbg_cmd_hander(DBG_CMD_ON, DBG_M_DAU); + //dbg_cmd_hander(DBG_CMD_ON, DBG_M_DAU_TXRX); + //dbg_cmd_hander(DBG_CMD_ON, DBG_M_GPS); + dbg_cmd_hander(DBG_CMD_ON, DBG_M_4G); + dbg_cmd_hander(DBG_CMD_ON, DBG_M_RS485_SEN); + dbg_cmd_hander(DBG_CMD_ON, DBG_M_RS485_DEBUG); } /* 初始化 ADC 采样任务. */ ADC_init(); if (IS_MONITOR_BIT_SET(dev_config.flag, DEV_FLAG_ADJ)) { - dau_adj_init(); + dau_adj_init(); } else { - /* 初始化 DAU 任务. */ - dau_init(); + /* 初始化 DAU 任务. */ + dau_init(); } /* 初始化无线通讯任务. */ diff --git a/CablePositioning_APP_V1.0/Core/Src/dau.c b/CablePositioning_APP_V1.0/Core/Src/dau.c index b1e2cd9..55f5104 100644 --- a/CablePositioning_APP_V1.0/Core/Src/dau.c +++ b/CablePositioning_APP_V1.0/Core/Src/dau.c @@ -163,7 +163,7 @@ static struct tm _dau_tm; int8_t _dau_spi_rw; uint16_t _dau_spi_addr; uint16_t _dau_spi_len; -int8_t g_is_adj_status = 0; // 1:采集 2:采集完成 +int8_t g_is_adj_status = 0; // 1:采集 2:采集完成 /* Private function prototypes -----------------------------------------------*/ /* Internal functions --------------------------------------------------------*/ @@ -869,7 +869,7 @@ void _dau_power_calculate(DAU_SOURCE_E source) /* dau data base 自动计算. */ HAL_StatusTypeDef _dau_base_auto(uint8_t ch_bitmap, uint8_t index) { - int16_t (*val)[DAU_POWER_DATE_LEN] = dau_ctrl.reg_power; + int16_t (*val)[DAU_POWER_DATE_LEN] = dau_ctrl.reg_power; //uint32_t *power = dau_ctrl.reg_elec; uint8_t ch = 0; uint16_t i = 0; @@ -1237,54 +1237,54 @@ static void _dau_adj_start(void *argument) osDelay(10000); common_watchdog_set(COM_WDG_DAU); - if (g_is_adj_status == 1) - { - memset(dau_ctrl.reg_power, 0, sizeof(dau_ctrl.reg_power)); - /* 读取全局状态寄存器 */ - rv = _dau_reg_read_global_state(); - if (rv != HAL_OK) - { - vty_print("rv=%d\r\n", rv); - continue; - } - - /* 循环工频缺陷电流采集 */ - dau_ctrl.col_time = 600000; - MONITOR_BITMAP_SET(dau_ctrl.col_flag, DAU_COL_FLAG_FAULT_CMP); - MONITOR_BITMAP_SET(dau_ctrl.col_flag, DAU_COL_FLAG_REG_CMP); - _dau_wave_col_trigger_by_reg(); + if (g_is_adj_status == 1) + { + memset(dau_ctrl.reg_power, 0, sizeof(dau_ctrl.reg_power)); + /* 读取全局状态寄存器 */ + rv = _dau_reg_read_global_state(); + if (rv != HAL_OK) + { + vty_print("rv=%d\r\n", rv); + continue; + } + + /* 循环工频缺陷电流采集 */ + dau_ctrl.col_time = 600000; + MONITOR_BITMAP_SET(dau_ctrl.col_flag, DAU_COL_FLAG_FAULT_CMP); + MONITOR_BITMAP_SET(dau_ctrl.col_flag, DAU_COL_FLAG_REG_CMP); + _dau_wave_col_trigger_by_reg(); #if 1 - //for(i = 0; i < DAU_PORT_POWER_CNT; i++) - for(i = 0; i < 1; i++) - { - vty_print("POWER %d\r\n", i); - buf = (uint16_t*)dau_ctrl.reg_power[i]; - for(j = 0; j < DAU_PKT_POWER_CNT; j++) - { - common_watchdog_set(COM_WDG_DAU); - for(k = 0; k < 512;) - { - vty_print("%-04x ", buf[k++]); - if(0 == (j*512+k ) % 40) - { - osDelay(100); - vty_print("\r\n"); - } - } - /*if((j*512+k ) % 40 != 0) - { - osDelay(100); - vty_print("\r\n"); - }*/ - buf += 512; - } - vty_print("\r\n"); - } + //for(i = 0; i < DAU_PORT_POWER_CNT; i++) + for(i = 0; i < 1; i++) + { + vty_print("POWER %d\r\n", i); + buf = (uint16_t*)dau_ctrl.reg_power[i]; + for(j = 0; j < DAU_PKT_POWER_CNT; j++) + { + common_watchdog_set(COM_WDG_DAU); + for(k = 0; k < 512;) + { + vty_print("%-04x ", buf[k++]); + if(0 == (j*512+k ) % 40) + { + osDelay(100); + vty_print("\r\n"); + } + } + /*if((j*512+k ) % 40 != 0) + { + osDelay(100); + vty_print("\r\n"); + }*/ + buf += 512; + } + vty_print("\r\n"); + } #endif - g_is_adj_status = 2; - _dau_base_auto(1, 0); - } - } + g_is_adj_status = 2; + _dau_base_auto(1, 0); + } + } }