AP_Arming: add generator checks

This commit is contained in:
Peter Barker 2019-11-27 18:44:03 +11:00 committed by Randy Mackay
parent b2bd8d5759
commit fce9046dcf
2 changed files with 20 additions and 0 deletions

View File

@ -31,6 +31,7 @@
#include <AP_AHRS/AP_AHRS.h>
#include <AP_Baro/AP_Baro.h>
#include <AP_RangeFinder/AP_RangeFinder.h>
#include <AP_Generator/AP_Generator_RichenPower.h>
#include <AP_Terrain/AP_Terrain.h>
#include <AP_Scripting/AP_Scripting.h>
#include <AP_Camera/AP_RunCam.h>
@ -1040,6 +1041,22 @@ bool AP_Arming::aux_auth_checks(bool display_failure)
return true;
}
bool AP_Arming::generator_checks(bool display_failure) const
{
#if GENERATOR_ENABLED
const AP_Generator_RichenPower *generator = AP::generator();
if (generator == nullptr) {
return true;
}
char failure_msg[50] = {};
if (!generator->pre_arm_check(failure_msg, sizeof(failure_msg))) {
check_failed(display_failure, "Generator: %s", failure_msg);
return false;
}
#endif
return true;
}
bool AP_Arming::pre_arm_checks(bool report)
{
#if !APM_BUILD_TYPE(APM_BUILD_ArduCopter)
@ -1064,6 +1081,7 @@ bool AP_Arming::pre_arm_checks(bool report)
& board_voltage_checks(report)
& system_checks(report)
& can_checks(report)
& generator_checks(report)
& proximity_checks(report)
& camera_checks(report)
& visodom_checks(report)

View File

@ -166,6 +166,8 @@ protected:
bool aux_auth_checks(bool display_failure);
bool generator_checks(bool report) const;
virtual bool system_checks(bool report);
bool can_checks(bool report);