mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 07:03:34 +08:00
fixed mutex in hardpoint_controler_set()
This commit is contained in:
@@ -65,8 +65,6 @@ int UavcanHardpointController::init()
|
|||||||
|
|
||||||
void UavcanHardpointController::set_command(uint8_t hardpoint_id, uint16_t command)
|
void UavcanHardpointController::set_command(uint8_t hardpoint_id, uint16_t command)
|
||||||
{
|
{
|
||||||
(void)pthread_mutex_lock(&_node_mutex);
|
|
||||||
|
|
||||||
_cmd.command = command;
|
_cmd.command = command;
|
||||||
_cmd.hardpoint_id = hardpoint_id;
|
_cmd.hardpoint_id = hardpoint_id;
|
||||||
|
|
||||||
@@ -81,7 +79,7 @@ void UavcanHardpointController::set_command(uint8_t hardpoint_id, uint16_t comma
|
|||||||
if (!_timer.isRunning()) {
|
if (!_timer.isRunning()) {
|
||||||
_timer.startPeriodic(uavcan::MonotonicDuration::fromMSec(1000 / MAX_RATE_HZ));
|
_timer.startPeriodic(uavcan::MonotonicDuration::fromMSec(1000 / MAX_RATE_HZ));
|
||||||
}
|
}
|
||||||
(void)pthread_mutex_lock(&_node_mutex);
|
|
||||||
}
|
}
|
||||||
void UavcanHardpointController::periodic_update(const uavcan::TimerEvent &)
|
void UavcanHardpointController::periodic_update(const uavcan::TimerEvent &)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1224,7 +1224,9 @@ void UavcanNode::shrink()
|
|||||||
|
|
||||||
void UavcanNode::hardpoint_controller_set(uint8_t hardpoint_id, uint16_t command)
|
void UavcanNode::hardpoint_controller_set(uint8_t hardpoint_id, uint16_t command)
|
||||||
{
|
{
|
||||||
|
(void)pthread_mutex_lock(&_node_mutex);
|
||||||
_hardpoint_controller.set_command(hardpoint_id, command);
|
_hardpoint_controller.set_command(hardpoint_id, command);
|
||||||
|
(void)pthread_mutex_lock(&_node_mutex);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* App entry point
|
* App entry point
|
||||||
|
|||||||
Reference in New Issue
Block a user