CUAV CAN GPS support UAVCAN standard/indication/Button.uavcan

Co-authored-by: Daniel Agar <daniel@agar.ca>
This commit is contained in:
Lorenz Meier
2021-01-27 10:46:49 -05:00
committed by GitHub
co-authored by Daniel Agar
parent 5e79773275
commit 2308cb8a40
10 changed files with 50 additions and 11 deletions
+15
View File
@@ -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);