mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 03:23:33 +08:00
Simplified esc_status healthiness logic.
Signed-off-by: Claudio Micheli <claudio@auterion.com>
This commit is contained in:
committed by
Beat Küng
parent
8a2d05be4f
commit
09d79b221f
@@ -233,14 +233,13 @@ void UavcanEscController::orb_pub_timer_cb(const uavcan::TimerEvent &)
|
||||
|
||||
uint8_t UavcanEscController::check_escs_status()
|
||||
{
|
||||
int esc_status_flags = 255;
|
||||
int esc_status_flags = 0;
|
||||
|
||||
|
||||
for (int index = 0; index < esc_status_s::CONNECTED_ESC_MAX; index++) {
|
||||
if (_esc_status.esc[index].timestamp == 0) {
|
||||
esc_status_flags &= ~(1 << index);
|
||||
|
||||
} else if (hrt_elapsed_time(&_esc_status.esc[index].timestamp) > 800000.0f) {
|
||||
esc_status_flags &= ~(1 << index);
|
||||
if (_esc_status.esc[index].timestamp > 0 && hrt_elapsed_time(&_esc_status.esc[index].timestamp) < 800000.0f) {
|
||||
esc_status_flags |= (1 << index);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1125,9 +1125,9 @@ UavcanNode::ioctl(file *filp, int cmd, unsigned long arg)
|
||||
_mixers->groups_required(_groups_required);
|
||||
PX4_INFO("Groups required %d", _groups_required);
|
||||
|
||||
_rotor_count = _mixers->get_multirotor_count();
|
||||
_esc_controller.set_rotor_count(_rotor_count);
|
||||
PX4_INFO("Number of rotors %d", _rotor_count);
|
||||
int rotor_count = _mixers->get_multirotor_count();
|
||||
_esc_controller.set_rotor_count(rotor_count);
|
||||
PX4_INFO("Number of rotors %d", rotor_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,8 +216,6 @@ private:
|
||||
// index into _poll_fds for each _control_subs handle
|
||||
uint8_t _poll_ids[NUM_ACTUATOR_CONTROL_GROUPS_UAVCAN];
|
||||
|
||||
uint8_t _rotor_count = 0;
|
||||
|
||||
void handle_time_sync(const uavcan::TimerEvent &);
|
||||
|
||||
typedef uavcan::MethodBinder<UavcanNode *, void (UavcanNode::*)(const uavcan::TimerEvent &)> TimerCallback;
|
||||
|
||||
Reference in New Issue
Block a user