mirror of
https://gitee.com/dlmu-cone/half-steering-basic-framework
synced 2026-10-23 17:42:20 +08:00
Compare commits
1 Commits
dev-vision
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b0b62f6f9 |
@@ -5,7 +5,7 @@
|
||||
* @version beta
|
||||
* @date 2022-11-03
|
||||
* @todo 增加对串口调试助手协议的支持,包括vofa和serial debug
|
||||
* @copyright Copyright (c) 2023
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
#include "master_process.h"
|
||||
|
||||
@@ -24,10 +24,12 @@ static CANInstance sender_assignment[6] = {
|
||||
[1] = {.can_handle = &hcan1, .txconf.StdId = 0x200, .txconf.IDE = CAN_ID_STD, .txconf.RTR = CAN_RTR_DATA, .txconf.DLC = 0x08, .tx_buff = {0}},
|
||||
[2] = {.can_handle = &hcan1, .txconf.StdId = 0x2ff, .txconf.IDE = CAN_ID_STD, .txconf.RTR = CAN_RTR_DATA, .txconf.DLC = 0x08, .tx_buff = {0}},
|
||||
[3] = {.can_handle = &hcan2, .txconf.StdId = 0x1ff, .txconf.IDE = CAN_ID_STD, .txconf.RTR = CAN_RTR_DATA, .txconf.DLC = 0x08, .tx_buff = {0}},
|
||||
[4] = {.can_handle = &hcan2, .txconf.StdId = 0x3FE, .txconf.IDE = CAN_ID_STD, .txconf.RTR = CAN_RTR_DATA, .txconf.DLC = 0x08, .tx_buff = {0}},
|
||||
[4] = {.can_handle = &hcan2, .txconf.StdId = 0x200, .txconf.IDE = CAN_ID_STD, .txconf.RTR = CAN_RTR_DATA, .txconf.DLC = 0x08, .tx_buff = {0}},
|
||||
[5] = {.can_handle = &hcan2, .txconf.StdId = 0x2ff, .txconf.IDE = CAN_ID_STD, .txconf.RTR = CAN_RTR_DATA, .txconf.DLC = 0x08, .tx_buff = {0}},
|
||||
};
|
||||
|
||||
static CANInstance DM_sender_assignment[1] = {
|
||||
[0] = {.can_handle = &hcan2, .txconf.StdId = 0x3FE, .txconf.IDE = CAN_ID_STD, .txconf.RTR = CAN_RTR_DATA, .txconf.DLC = 0x08, .tx_buff = {0}}
|
||||
};
|
||||
/**
|
||||
* @brief 6个用于确认是否有电机注册到sender_assignment中的标志位,防止发送空帧,此变量将在DJIMotorControl()使用
|
||||
* flag的初始化在 MotorSenderGrouping()中进行
|
||||
@@ -326,10 +328,10 @@ void DJIMotorControl()
|
||||
group = motor->sender_group;
|
||||
num = motor->message_num;
|
||||
|
||||
if (i == 1)
|
||||
if (i == 1)//pitch轴电机对应i值为1,需要特殊处理,因为它的发送顺序和其他电机不同,在同一帧中与其他电机的高八位和低八位相反
|
||||
{
|
||||
sender_assignment[4].tx_buff[6] = (uint8_t)(set & 0x00ff); // 高八位
|
||||
sender_assignment[4].tx_buff[7] = (uint8_t)(set >> 8); // 低八位
|
||||
DM_sender_assignment[0].tx_buff[6] = (uint8_t)(set & 0x00ff); // 高八位
|
||||
DM_sender_assignment[0].tx_buff[7] = (uint8_t)(set >> 8); // 低八位
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -348,6 +350,7 @@ void DJIMotorControl()
|
||||
if (sender_enable_flag[i])
|
||||
{
|
||||
CANTransmit(&sender_assignment[i], 1);
|
||||
CANTransmit(&DM_sender_assignment[0], 1);//达妙电机单独一帧发送
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user