Skip to content

Commit 4368788

Browse files
IamPete1rmackay9
authored andcommitted
AP_Motors: motor_test_checks add estop and safety check
1 parent 0fbce31 commit 4368788

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

libraries/AP_Motors/AP_Motors_Class.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,23 @@ bool AP_Motors::motor_test_checks(size_t buflen, char *buffer) const
330330
// Must pass base class arming checks (the function above)
331331
// Do not run frame specific arming checks as motor test is less strict
332332
// For example not all the outputs have to be assigned
333-
return AP_Motors::arming_checks(buflen, buffer);
333+
if (!AP_Motors::arming_checks(buflen, buffer)) {
334+
return false;
335+
}
336+
337+
// check if safety switch has been pushed
338+
if (hal.util->safety_switch_state() == AP_HAL::Util::SAFETY_DISARMED) {
339+
hal.util->snprintf(buffer, buflen, "Safety switch");
340+
return false;
341+
}
342+
343+
// check E-Stop is not active
344+
if (SRV_Channels::get_emergency_stop()) {
345+
hal.util->snprintf(buffer, buflen, "Motor Emergency Stopped");
346+
return false;
347+
}
348+
349+
return true;
334350
}
335351

336352
// set all limits

0 commit comments

Comments
 (0)