【类 型】:feat 1校准加速度计函数 2.style 发送命令包成员函数加上注释说明
【原 因】: 【过 程】:接收到前端校准命令 执行校准 和一步 一步执行(两个函数发送命令帧) 【影 响】:
This commit is contained in:
parent
b0a8659b0a
commit
dcbd67fb7f
@ -742,6 +742,12 @@ void FoodCube::mav_channels_override(uint16_t chan[])
|
|||||||
SWrite(buf, len, mavlinkSerial);
|
SWrite(buf, len, mavlinkSerial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 发送MAVLink命令
|
||||||
|
* 该函数通过串口发送一个MAVLink `COMMAND_LONG` 命令。此命令可以用于向飞控发送各种控制命令,
|
||||||
|
* 包括但不限于模式切换、校准、任务启动等。
|
||||||
|
* @param msg_cmd 参考传递的 `mavlink_command_long_t` 类型的 MAVLink 命令结构体。
|
||||||
|
*/
|
||||||
void FoodCube::mav_send_command(mavlink_command_long_t &msg_cmd)
|
void FoodCube::mav_send_command(mavlink_command_long_t &msg_cmd)
|
||||||
{
|
{
|
||||||
mavlink_message_t msg; // mavlink协议信息(msg)
|
mavlink_message_t msg; // mavlink协议信息(msg)
|
||||||
@ -752,6 +758,18 @@ void FoodCube::mav_send_command(mavlink_command_long_t &msg_cmd)
|
|||||||
SWrite(buf, len, mavlinkSerial);
|
SWrite(buf, len, mavlinkSerial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 发送 COMMAND_ACK 消息
|
||||||
|
* 该函数用于发送一个 `COMMAND_ACK` 消息,以响应飞控发送的命令确认请求。该消息通常用于通知飞控某个命令
|
||||||
|
* 是否已被接收和处理,以及处理的结果状态。
|
||||||
|
* @param command 表示要响应的命令 ID,通常与接收到的命令相对应。
|
||||||
|
* @param result 表示命令的处理结果。常用值包括:
|
||||||
|
* - 0: MAV_RESULT_ACCEPTED (命令成功接受)
|
||||||
|
* - 1: MAV_RESULT_TEMPORARILY_REJECTED (命令被暂时拒绝)
|
||||||
|
* - 2: MAV_RESULT_DENIED (命令被拒绝)
|
||||||
|
* - 3: MAV_RESULT_UNSUPPORTED (命令不受支持)
|
||||||
|
* - 4: MAV_RESULT_FAILED (命令执行失败)
|
||||||
|
*/
|
||||||
void FoodCube::sendCommandAck(uint16_t command, uint8_t result)
|
void FoodCube::sendCommandAck(uint16_t command, uint8_t result)
|
||||||
{
|
{
|
||||||
mavlink_message_t msg; // MAVLink 信息
|
mavlink_message_t msg; // MAVLink 信息
|
||||||
|
@ -206,11 +206,11 @@ void mqtt_receiveCallback(char *topic, byte *payload, unsigned int length)
|
|||||||
uint32_t todo = value.as<uint32_t>(); // 转换值
|
uint32_t todo = value.as<uint32_t>(); // 转换值
|
||||||
if (todo == 1)
|
if (todo == 1)
|
||||||
{
|
{
|
||||||
initAcce();
|
initAcce(); // 发起校准
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fc.sendCommandAck(1, 1);
|
fc.sendCommandAck(1, 1); // 摆好校准
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (key == "refreshRequest")
|
else if (key == "refreshRequest")
|
||||||
|
Loading…
Reference in New Issue
Block a user