From 9f5f9c577ee3eb4de67969630df85bf94719c5fe Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Mon, 2 Sep 2019 14:21:54 -0400 Subject: [PATCH] uavcan: limit actuator controls poll interval * rather than only in UavcanEscController updates --- src/drivers/uavcan/actuators/esc.hpp | 3 ++- src/drivers/uavcan/uavcan_main.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/drivers/uavcan/actuators/esc.hpp b/src/drivers/uavcan/actuators/esc.hpp index 210a23ae14..6001b5f5f6 100644 --- a/src/drivers/uavcan/actuators/esc.hpp +++ b/src/drivers/uavcan/actuators/esc.hpp @@ -73,6 +73,8 @@ public: */ void set_rotor_count(uint8_t count) { _rotor_count = count; } + static constexpr unsigned MAX_RATE_HZ = 200; ///< XXX make this configurable + private: /** * ESC status message reception will be reported via this callback. @@ -89,7 +91,6 @@ private: */ uint8_t check_escs_status(); - static constexpr unsigned MAX_RATE_HZ = 200; ///< XXX make this configurable static constexpr unsigned ESC_STATUS_UPDATE_RATE_HZ = 10; static constexpr unsigned UAVCAN_COMMAND_TRANSFER_PRIORITY = 5; ///< 0..31, inclusive, 0 - highest, 31 - lowest diff --git a/src/drivers/uavcan/uavcan_main.cpp b/src/drivers/uavcan/uavcan_main.cpp index 3c049734ca..a8d7ea15b9 100644 --- a/src/drivers/uavcan/uavcan_main.cpp +++ b/src/drivers/uavcan/uavcan_main.cpp @@ -1058,6 +1058,7 @@ UavcanNode::subscribe() if (_control_subs[i] >= 0) { _poll_ids[i] = add_poll_fd(_control_subs[i]); + orb_set_interval(_control_subs[i], 1000000 / UavcanEscController::MAX_RATE_HZ); } } }