diff --git a/src/modules/commander/CMakeLists.txt b/src/modules/commander/CMakeLists.txt index 6a3280ba097..ca6ebf55e5b 100644 --- a/src/modules/commander/CMakeLists.txt +++ b/src/modules/commander/CMakeLists.txt @@ -40,6 +40,10 @@ add_subdirectory(MulticopterThrowLaunch) set(SRCS) +if(CONFIG_SENSORS_VEHICLE_AIRSPEED) + list(APPEND SRCS airspeed_calibration.cpp) +endif() + if(CONFIG_SENSORS_VEHICLE_MAGNETOMETER) list(APPEND SRCS mag_calibration.cpp) endif() @@ -51,7 +55,6 @@ px4_add_module( SRCS ${SRCS} accelerometer_calibration.cpp - airspeed_calibration.cpp baro_calibration.cpp calibration_routines.cpp Commander.cpp diff --git a/src/modules/commander/Commander.cpp b/src/modules/commander/Commander.cpp index b8b7b7d77b9..67bcb95f457 100644 --- a/src/modules/commander/Commander.cpp +++ b/src/modules/commander/Commander.cpp @@ -1525,9 +1525,13 @@ Commander::handle_command(const vehicle_command_s &cmd) } else if ((int)(cmd.param6) == 1 || (int)(cmd.param6) == 2) { // TODO: param6 == 1 is deprecated, but we still accept it for a while (feb 2017) /* airspeed calibration */ +#if defined(CONFIG_SENSORS_VEHICLE_AIRSPEED) answer_command(cmd, vehicle_command_ack_s::VEHICLE_CMD_RESULT_ACCEPTED); _vehicle_status.calibration_enabled = true; _worker_thread.startTask(WorkerThread::Request::AirspeedCalibration); +#else + answer_command(cmd, vehicle_command_ack_s::VEHICLE_CMD_RESULT_UNSUPPORTED); +#endif } else if ((int)(cmd.param7) == 1) { /* do esc calibration */ diff --git a/src/modules/commander/worker_thread.cpp b/src/modules/commander/worker_thread.cpp index 97e8781c236..23a36a1a5af 100644 --- a/src/modules/commander/worker_thread.cpp +++ b/src/modules/commander/worker_thread.cpp @@ -33,7 +33,9 @@ #include "worker_thread.hpp" #include "accelerometer_calibration.h" +#if defined(CONFIG_SENSORS_VEHICLE_AIRSPEED) #include "airspeed_calibration.h" +#endif #include "calibration_routines.h" #include "baro_calibration.h" #include "esc_calibration.h" @@ -146,9 +148,17 @@ void WorkerThread::threadEntry() _ret_value = do_accel_calibration_quick(&_mavlink_log_pub); break; +#if defined(CONFIG_SENSORS_VEHICLE_AIRSPEED) + case Request::AirspeedCalibration: _ret_value = do_airspeed_calibration(&_mavlink_log_pub); break; +#else + + case Request::AirspeedCalibration: + _ret_value = -1; + break; +#endif case Request::ESCCalibration: _ret_value = do_esc_calibration(&_mavlink_log_pub); diff --git a/src/modules/mavlink/mavlink_messages.cpp b/src/modules/mavlink/mavlink_messages.cpp index aa01df6b311..1f1beedd3ae 100644 --- a/src/modules/mavlink/mavlink_messages.cpp +++ b/src/modules/mavlink/mavlink_messages.cpp @@ -94,7 +94,10 @@ #include "streams/HYGROMETER_SENSOR.hpp" #include "streams/LANDING_TARGET.hpp" #include "streams/LOCAL_POSITION_NED.hpp" +// constrained builds without mag processing have no mag calibration to report +#if defined(CONFIG_SENSORS_VEHICLE_MAGNETOMETER) || !defined(CONSTRAINED_FLASH) #include "streams/MAG_CAL_REPORT.hpp" +#endif #include "streams/MANUAL_CONTROL.hpp" #if defined(MAVLINK_MSG_ID_MANUAL_INPUT_STATUS) #include "streams/MANUAL_INPUT_STATUS.hpp"