34 #include "../PreFlightCheck.hpp" 38 #include <px4_defines.h> 47 const bool optional, int32_t &
device_id,
const bool report_fail)
50 bool calibration_valid =
false;
51 bool mag_valid =
false;
61 mavlink_log_critical(mavlink_log_pub,
"Preflight Fail: no valid data from Compass #%u", instance);
65 device_id = magnetometer.get().device_id;
67 calibration_valid = check_calibration(
"CAL_MAG%u_ID", device_id);
69 if (!calibration_valid) {
76 if (!optional && report_fail) {
81 const bool success = calibration_valid && mag_valid;
84 set_health_flags(subsystem_info_s::SUBSYSTEM_TYPE_MAG, exists, !optional, success, status);
86 }
else if (instance == 1) {
87 set_health_flags(subsystem_info_s::SUBSYSTEM_TYPE_MAG2, exists, !optional, success, status);
static orb_advert_t * mavlink_log_pub
#define mavlink_log_critical(_pub, _text,...)
Send a mavlink critical message and print to console.
static struct vehicle_status_s status
int orb_exists(const struct orb_metadata *meta, int instance)
static int32_t device_id[max_accel_sens]
High-resolution timer with callouts and timekeeping.
void set_health_flags(uint64_t subsystem_type, bool present, bool enabled, bool ok, vehicle_status_s &status)
#define ORB_ID(_name)
Generates a pointer to the uORB metadata structure for a given topic.
static bool magnometerCheck(orb_advert_t *mavlink_log_pub, vehicle_status_s &status, const uint8_t instance, const bool optional, int32_t &device_id, const bool report_fail)
static hrt_abstime hrt_elapsed_time(const hrt_abstime *then)
Compute the delta between a timestamp taken in the past and now.
__BEGIN_DECLS typedef void * orb_advert_t
ORB topic advertiser handle.
Contains helper functions to efficiently set the system health flags from commander and preflight che...