mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 18:47:21 +08:00
uavcan/actuators: stop update esc status if there is no UAVCAN ESCs
This commit is contained in:
@@ -132,6 +132,16 @@ UavcanEscController::update_outputs(bool stop_motors, uint16_t outputs[MAX_ACTUA
|
|||||||
_uavcan_pub_raw_cmd.broadcast(msg);
|
_uavcan_pub_raw_cmd.broadcast(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
UavcanEscController::set_rotor_count(uint8_t count)
|
||||||
|
{
|
||||||
|
_rotor_count = count;
|
||||||
|
|
||||||
|
if (_rotor_count != 0u) {
|
||||||
|
_orb_timer.startPeriodic(uavcan::MonotonicDuration::fromMSec(1000 / ESC_STATUS_UPDATE_RATE_HZ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
UavcanEscController::esc_status_sub_cb(const uavcan::ReceivedDataStructure<uavcan::equipment::esc::Status> &msg)
|
UavcanEscController::esc_status_sub_cb(const uavcan::ReceivedDataStructure<uavcan::equipment::esc::Status> &msg)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -72,9 +72,9 @@ public:
|
|||||||
void update_outputs(bool stop_motors, uint16_t outputs[MAX_ACTUATORS], unsigned num_outputs);
|
void update_outputs(bool stop_motors, uint16_t outputs[MAX_ACTUATORS], unsigned num_outputs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the number of rotors
|
* Sets the number of rotors and enable timer
|
||||||
*/
|
*/
|
||||||
void set_rotor_count(uint8_t count) { _rotor_count = count; }
|
void set_rotor_count(uint8_t count);
|
||||||
|
|
||||||
static int max_output_value() { return uavcan::equipment::esc::RawCommand::FieldTypes::cmd::RawValueType::max(); }
|
static int max_output_value() { return uavcan::equipment::esc::RawCommand::FieldTypes::cmd::RawValueType::max(); }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user