add IMU,slove promblem about Ble_tx

This commit is contained in:
2025-06-29 14:06:17 +08:00
parent 88103d9eee
commit 32d4821e6f
34 changed files with 10077 additions and 7299 deletions

View File

@@ -39,7 +39,9 @@
#define BLE_RX_THREAD_PRIORITY 10
#define BLE_TX_THREAD_STACK_SIZE 2048
#define BLE_TX_THREAD_PRIORITY 10
//
//IMU define
#define IMU_ANGLE_THREAD_STACK_SIZE 1024
#define IMU_ANGLE_THREAD_PRIORITY 9
@@ -74,8 +76,15 @@ TX_QUEUE ble_tx_queue;
__attribute__((aligned(4)))
ULONG ble_tx_queue_buffer[BLE_TX_QUEUE_LEN * ((BLE_TX_MSG_LEN + sizeof(ULONG) - 1) / sizeof(ULONG))];
//
// 定义Ble 传输数据的队列 也就是经纬度融合数据
__attribute__((aligned(4)))
ULONG ble_tx_queue_buff[BLE_TX_QUEUE_LEN * ((sizeof(BleMessage) + sizeof(ULONG) - 1) / sizeof(ULONG))];
//imu thread
TX_THREAD imu_angle_thread;
UCHAR imu_angle_stack[IMU_ANGLE_THREAD_STACK_SIZE];
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
@@ -122,21 +131,42 @@ UINT App_ThreadX_Init(VOID *memory_ptr)
return status;
}
// === 创建 BLE TX 消息队列 ===
status = tx_queue_create(&ble_tx_queue, "BLE TX Queue",
(BLE_TX_MSG_LEN + sizeof(ULONG) - 1) / sizeof(ULONG),
ble_tx_queue_buffer,
sizeof(ble_tx_queue_buffer));
if (status != TX_SUCCESS) {
HCBle_SendData("❌ BLE TX 消息队列创建失败,错误码=%d\r\n", status);
return status;
}
status = tx_thread_create(&imu_angle_thread,"IMU Angle Thread",
imu_angle_ble_task_entry,0,
imu_angle_stack,IMU_ANGLE_THREAD_STACK_SIZE,
IMU_ANGLE_THREAD_PRIORITY,IMU_ANGLE_THREAD_PRIORITY,
TX_NO_TIME_SLICE,TX_AUTO_START);
if(status != TX_SUCCESS)
{
return status;
}
// === 创建 BLE TX 消息队列 ===
// status = tx_queue_create(&ble_tx_queue, "BLE TX Queue",
// (BLE_TX_MSG_LEN + sizeof(ULONG) - 1) / sizeof(ULONG),
// ble_tx_queue_buffer,
// sizeof(ble_tx_queue_buffer));
// if (status != TX_SUCCESS) {
// HCBle_SendData("❌ BLE TX 消息队列创建失败,错误码=%d\r\n", status);
// return status;
// }
status = tx_queue_create(&ble_tx_queue,"Ble lat Imu",
(sizeof(BleMessage) + sizeof(ULONG) - 1) / sizeof(ULONG),
ble_tx_queue_buff,
sizeof(ble_tx_queue_buff));
if (status != TX_SUCCESS) {
return status;
}
HCBle_SendData("✅ BLE RX/TX 线程和队列初始化完成\r\n");
return TX_SUCCESS;
}