更新:使能标志未置位时,所有数据均不接收

This commit is contained in:
吴俊潮 2025-05-12 15:51:51 +08:00
parent 98b9efdc2d
commit 9bd6a9d702
9 changed files with 8914 additions and 8856 deletions

View File

@ -34,7 +34,8 @@
"app_screen_setting.h": "c", "app_screen_setting.h": "c",
"key_functions.h": "c", "key_functions.h": "c",
"sstream": "c", "sstream": "c",
"modbus_485.h": "c" "modbus_485.h": "c",
"hart.h": "c"
}, },
"C_Cpp.errorSquiggles": "disabled", "C_Cpp.errorSquiggles": "disabled",
"idf.pythonInstallPath": "F:\\Espressif\\tools\\idf-python\\3.11.2\\python.exe", "idf.pythonInstallPath": "F:\\Espressif\\tools\\idf-python\\3.11.2\\python.exe",

View File

@ -830,8 +830,6 @@ float32 my_power(int a, int b)
//初始化打包 //初始化打包
void my_inits_gather(void) void my_inits_gather(void)
{ {
SIG24130_Init();
//HART复位关闭 //HART复位关闭
HART_RESET(GPIO_PIN_SET); HART_RESET(GPIO_PIN_SET);
@ -842,11 +840,11 @@ void my_inits_gather(void)
tm1650_init(&hi2c1); tm1650_init(&hi2c1);
//LVGL //LVGL
lv_init(); // LVGL 初始化 lv_init(); // LVGL 初始化
lv_port_disp_init(); // 注册LVGL的显示任务初始化 lv_port_disp_init(); // 注册LVGL的显示任务初始化
// lv_demo_benchmark(); //lv_conf.h, line:761 // lv_demo_benchmark(); //lv_conf.h, line:761
setup_ui(&guider_ui); // 初始化UI设置与加载初始界面 setup_ui(&guider_ui); // 初始化UI设置与加载初始界面
events_init(&guider_ui); // 初始化事件 events_init(&guider_ui); // 初始化事件
} }

View File

@ -4,6 +4,7 @@
#include "task.h" #include "task.h"
#include "hart.h" #include "hart.h"
#include "gpio.h" #include "gpio.h"
#include "apps_gather.h"
void hart_send(UART_HandleTypeDef *huart, uint8_t *data) void hart_send(UART_HandleTypeDef *huart, uint8_t *data)
{ {

View File

@ -89,6 +89,7 @@ void transparent_485(st_scom *scom)
//清空缓存区,等待新的数据 //清空缓存区,等待新的数据
memset(scom->tx_buff, 0, sizeof(scom->tx_buff)); memset(scom->tx_buff, 0, sizeof(scom->tx_buff));
scom->tx_len = 0; scom->tx_len = 0;
//HAL_UART_Transmit_IT(&huart2, scom->tx_buff, scom->tx_len);
} }
} }

View File

@ -254,17 +254,17 @@ void start_task_ble(void const * argument)
{ {
if( ble_init() == 1 ) if( ble_init() == 1 )
{ {
if(ble_send_test == 1)
{
ble_send_test = 0;
//驱动验证DEVICE <--- BLUETOOTH ---> SIG
strcpy((char *)scom6_ble.tx_buff, "hellow I am ble.\r\n");
ble_send(&huart6, scom6_ble.tx_buff);
}
if(tabdata.bluetooth_enable == 1) if(tabdata.bluetooth_enable == 1)
{ {
if(ble_send_test == 1)
{
ble_send_test = 0;
//驱动验证DEVICE <--- BLUETOOTH ---> SIG
strcpy((char *)scom6_ble.tx_buff, "hellow I am ble.\r\n");
ble_send(&huart6, scom6_ble.tx_buff);
}
sig_trans = TRANS_BLUETOOTH; sig_trans = TRANS_BLUETOOTH;
transparent_bluetooth(&scom6_ble); transparent_bluetooth(&scom6_ble);
} }
@ -317,6 +317,7 @@ lv_mem_monitor_t my_mon;
void start_mux_analog(void const * argument) void start_mux_analog(void const * argument)
{ {
/* USER CODE BEGIN start_mux_analog */ /* USER CODE BEGIN start_mux_analog */
SIG24130_Init(); //多路输入输出初始化
/* Infinite loop */ /* Infinite loop */
for (;;) for (;;)
{ {
@ -353,7 +354,7 @@ void start_mux_analog(void const * argument)
void start_menu(void const * argument) void start_menu(void const * argument)
{ {
/* USER CODE BEGIN start_menu */ /* USER CODE BEGIN start_menu */
screen_data_init(); screen_data_init(); //显示数据初始化
/* Infinite loop */ /* Infinite loop */
for(;;) for(;;)
{ {

View File

@ -22,7 +22,7 @@
#include "stm32f4xx_it.h" #include "stm32f4xx_it.h"
/* Private includes ----------------------------------------------------------*/ /* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */ /* USER CODE BEGIN Includes */
#include "usart.h" #include "apps_gather.h"
/* USER CODE END Includes */ /* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/ /* Private typedef -----------------------------------------------------------*/
@ -311,14 +311,25 @@ void USART6_IRQHandler(void)
} }
/* USER CODE BEGIN 1 */ /* USER CODE BEGIN 1 */
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{ {
if( huart == &huart6 ) // if( (huart == &huart1)||(huart == &huart2)||(huart == &huart6) )
{ // {
//HAL_UART_Receive_IT(&huart6, scom6_ble.rx_buff, 255); // xTaskResumeFromISR(task_lcdHandle);
} // xTaskResumeFromISR(task_menuHandle);
// screen_suspend_flag = 0;
// }
// st_scom *scom;
// if (huart == &huart1) scom = &scom1_hart;
// else if (huart == &huart2) scom = &scom2_rs485;
// else if (huart == &huart6) scom = &scom6_ble;
// if (!scom) return;
// //清空缓存区,等待新的数据
// memset(scom->tx_buff, 0, sizeof(scom->tx_buff));
// scom->tx_len = 0;
} }
/* USER CODE END 1 */ /* USER CODE END 1 */

View File

@ -389,11 +389,49 @@ void proc_huart_it(UART_HandleTypeDef *huart)
st_scom *scom; st_scom *scom;
if (huart == &huart1) if (huart == &huart1)
{
scom = &scom1_hart; scom = &scom1_hart;
else if (huart == &huart2) if(tabdata.hart_enable == 0)
{
scom->rx_len = 0;
memset(scom->rx_buff, 0, BUFFER_SIZE);
__HAL_UART_CLEAR_FLAG(huart, UART_FLAG_RXNE);
__HAL_UART_CLEAR_IDLEFLAG(huart);
return;
}
}
if (huart == &huart2)
{
scom = &scom2_rs485; scom = &scom2_rs485;
else if (huart == &huart6) if( !(tabdata.bluetooth_enable||tabdata.hart_enable||tabdata.modbus_enable) )
{
scom->rx_len = 0;
memset(scom->rx_buff, 0, BUFFER_SIZE);
__HAL_UART_CLEAR_FLAG(huart, UART_FLAG_RXNE);
__HAL_UART_CLEAR_IDLEFLAG(huart);
return;
}
}
if (huart == &huart6)
{
scom = &scom6_ble; scom = &scom6_ble;
if(tabdata.bluetooth_enable == 0)
{
scom->rx_len = 0;
memset(scom->rx_buff, 0, BUFFER_SIZE);
__HAL_UART_CLEAR_FLAG(huart, UART_FLAG_RXNE);
__HAL_UART_CLEAR_IDLEFLAG(huart);
return;
}
}
if (!scom) if (!scom)
return; return;
@ -401,8 +439,6 @@ void proc_huart_it(UART_HandleTypeDef *huart)
if (__HAL_UART_GET_FLAG(huart, UART_FLAG_RXNE) != RESET) if (__HAL_UART_GET_FLAG(huart, UART_FLAG_RXNE) != RESET)
{ {
//接收数据时将显示任务挂起但是vTaskSuspend无法在中断中调用 //接收数据时将显示任务挂起但是vTaskSuspend无法在中断中调用
//vTaskSuspend(task_lcdHandle);
//vTaskSuspend(task_menuHandle);
screen_suspend_flag = 1; screen_suspend_flag = 1;
if (scom->rx_len >= BUFFER_SIZE - 1) if (scom->rx_len >= BUFFER_SIZE - 1)

View File

@ -265,6 +265,11 @@
<WinNumber>1</WinNumber> <WinNumber>1</WinNumber>
<ItemText>HoldReg,0x0A</ItemText> <ItemText>HoldReg,0x0A</ItemText>
</Ww> </Ww>
<Ww>
<count>22</count>
<WinNumber>1</WinNumber>
<ItemText>screen_suspend_flag</ItemText>
</Ww>
</WatchWindow1> </WatchWindow1>
<WatchWindow2> <WatchWindow2>
<Ww> <Ww>

File diff suppressed because it is too large Load Diff