|
|
@ -38,7 +38,7 @@ |
|
|
|
#include <ardupilot/indication/Button.hpp> |
|
|
|
#include <ardupilot/indication/Button.hpp> |
|
|
|
|
|
|
|
|
|
|
|
#include <uORB/SubscriptionCallback.hpp> |
|
|
|
#include <uORB/SubscriptionCallback.hpp> |
|
|
|
#include <uORB/topics/safety.h> |
|
|
|
#include <uORB/topics/button_event.h> |
|
|
|
|
|
|
|
|
|
|
|
namespace uavcannode |
|
|
|
namespace uavcannode |
|
|
|
{ |
|
|
|
{ |
|
|
@ -51,7 +51,7 @@ class SafetyButton : |
|
|
|
public: |
|
|
|
public: |
|
|
|
SafetyButton(px4::WorkItem *work_item, uavcan::INode &node) : |
|
|
|
SafetyButton(px4::WorkItem *work_item, uavcan::INode &node) : |
|
|
|
UavcanPublisherBase(ardupilot::indication::Button::DefaultDataTypeID), |
|
|
|
UavcanPublisherBase(ardupilot::indication::Button::DefaultDataTypeID), |
|
|
|
uORB::SubscriptionCallbackWorkItem(work_item, ORB_ID(safety)), |
|
|
|
uORB::SubscriptionCallbackWorkItem(work_item, ORB_ID(safety_button)), |
|
|
|
uavcan::Publisher<ardupilot::indication::Button>(node) |
|
|
|
uavcan::Publisher<ardupilot::indication::Button>(node) |
|
|
|
{ |
|
|
|
{ |
|
|
|
this->setPriority(uavcan::TransferPriority::Default); |
|
|
|
this->setPriority(uavcan::TransferPriority::Default); |
|
|
@ -69,14 +69,13 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
void BroadcastAnyUpdates() override |
|
|
|
void BroadcastAnyUpdates() override |
|
|
|
{ |
|
|
|
{ |
|
|
|
// safety -> standard::indication::button
|
|
|
|
button_event_s safety_button; |
|
|
|
safety_s safety; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (uORB::SubscriptionCallbackWorkItem::update(&safety)) { |
|
|
|
if (uORB::SubscriptionCallbackWorkItem::update(&safety_button)) { |
|
|
|
if (safety.safety_switch_available) { |
|
|
|
if (safety_button.triggered) { |
|
|
|
ardupilot::indication::Button Button{}; |
|
|
|
ardupilot::indication::Button Button{}; |
|
|
|
Button.button = ardupilot::indication::Button::BUTTON_SAFETY; |
|
|
|
Button.button = ardupilot::indication::Button::BUTTON_SAFETY; |
|
|
|
Button.press_time = safety.safety_off ? UINT8_MAX : 0; |
|
|
|
Button.press_time = UINT8_MAX; |
|
|
|
uavcan::Publisher<ardupilot::indication::Button>::broadcast(Button); |
|
|
|
uavcan::Publisher<ardupilot::indication::Button>::broadcast(Button); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|