mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-04 05:05:19 +08:00
bebop 2 disable motors on kill (#10605)
This commit is contained in:
committed by
Daniel Agar
parent
b83cb79596
commit
9530b6c24d
@@ -432,14 +432,16 @@ void task_main(int argc, char *argv[])
|
|||||||
orb_copy(ORB_ID(actuator_armed), _armed_sub, &_armed);
|
orb_copy(ORB_ID(actuator_armed), _armed_sub, &_armed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool lockdown = _armed.manual_lockdown || _armed.lockdown;
|
||||||
|
|
||||||
// Start the motors if armed but not alreay running
|
// Start the motors if armed but not alreay running
|
||||||
if (_armed.armed && !_motors_running) {
|
if (_armed.armed && !lockdown && !_motors_running) {
|
||||||
g_dev->start_motors();
|
g_dev->start_motors();
|
||||||
_motors_running = true;
|
_motors_running = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop motors if not armed but running
|
// Stop motors if not armed or killed, but running
|
||||||
if (!_armed.armed && _motors_running) {
|
if ((!_armed.armed || lockdown) && _motors_running) {
|
||||||
g_dev->stop_motors();
|
g_dev->stop_motors();
|
||||||
_motors_running = false;
|
_motors_running = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user