mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 05:13:34 +08:00
CUAV CAN GPS support UAVCAN standard/indication/Button.uavcan
Co-authored-by: Daniel Agar <daniel@agar.ca>
This commit is contained in:
co-authored by
Daniel Agar
parent
5e79773275
commit
2308cb8a40
@@ -83,6 +83,7 @@ UavcanNode::UavcanNode(uavcan::ICanDriver &can_driver, uavcan::ISystemClock &sys
|
||||
_raw_air_data_publisher(_node),
|
||||
_range_sensor_measurement(_node),
|
||||
_flow_measurement_publisher(_node),
|
||||
_indication_button_publisher(_node),
|
||||
_param_server(_node),
|
||||
_cycle_perf(perf_alloc(PC_ELAPSED, MODULE_NAME": cycle time")),
|
||||
_interval_perf(perf_alloc(PC_INTERVAL, MODULE_NAME": cycle interval")),
|
||||
@@ -521,6 +522,20 @@ void UavcanNode::Run()
|
||||
}
|
||||
}
|
||||
|
||||
// safety -> standard::indication::button
|
||||
if (_safety_sub.updated()) {
|
||||
safety_s safety;
|
||||
|
||||
if (_safety_sub.copy(&safety)) {
|
||||
if (safety.safety_switch_available) {
|
||||
standard::indication::Button Button{};
|
||||
Button.button = standard::indication::Button::BUTTON_SAFETY;
|
||||
Button.press_time = safety.safety_off ? UINT8_MAX : 0;
|
||||
_indication_button_publisher.broadcast(Button);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
perf_end(_cycle_perf);
|
||||
|
||||
pthread_mutex_unlock(&_node_mutex);
|
||||
|
||||
Reference in New Issue
Block a user