Skip to content

Commit

Permalink
uavcan: fix hw_errors from mutex lock, hide ESC/Servo status if no fu…
Browse files Browse the repository at this point in the history
…nction set (#23888)
  • Loading branch information
dakejahl authored Jan 21, 2025
1 parent a321541 commit 1900d2c
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/drivers/uavcan/uavcan_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1073,8 +1073,6 @@ void UavcanMixingInterfaceServo::Run()
void
UavcanNode::print_info()
{
(void)pthread_mutex_lock(&_node_mutex);

// Memory status
printf("Pool allocator status:\n");
printf("\tCapacity hard/soft: %" PRIu16 "/%" PRIu16 " blocks\n",
Expand Down Expand Up @@ -1112,14 +1110,28 @@ UavcanNode::print_info()
printf("\n");

#if defined(CONFIG_UAVCAN_OUTPUTS_CONTROLLER)
printf("ESC outputs:\n");
_mixing_interface_esc.mixingOutput().printStatus();

printf("Servo outputs:\n");
_mixing_interface_servo.mixingOutput().printStatus();
#endif
// Print esc status if at least one channel is enabled
for (int i = 0; i < OutputModuleInterface::MAX_ACTUATORS; i++) {
if (_mixing_interface_esc.mixingOutput().isFunctionSet(i)) {
printf("ESC outputs:\n");
_mixing_interface_esc.mixingOutput().printStatus();
printf("\n");
break;
}
}

printf("\n");
// Print servo status if at least one channel is enabled
for (int i = 0; i < OutputModuleInterface::MAX_ACTUATORS; i++) {
if (_mixing_interface_servo.mixingOutput().isFunctionSet(i)) {
printf("Servo outputs:\n");
_mixing_interface_servo.mixingOutput().printStatus();
printf("\n");
break;
}
}

#endif

// Sensor bridges
for (const auto &br : _sensor_bridges) {
Expand All @@ -1140,8 +1152,6 @@ UavcanNode::print_info()

perf_print_counter(_cycle_perf);
perf_print_counter(_interval_perf);

(void)pthread_mutex_unlock(&_node_mutex);
}

void
Expand Down

0 comments on commit 1900d2c

Please sign in to comment.