mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-25 00:30:50 +08:00
fix(commander): build mag calibration only with CONFIG_SENSORS_VEHICLE_MAGNETOMETER (#28555)
Boards that compile the magnetometer pipeline out still linked 8.6 KB of calibration that could never run. holybro_kakutef7 is one of them and sits at 100 % of flash on main. The calibration commands answer UNSUPPORTED there.
This commit is contained in:
1 parent
29120280ac
commit
6dc89338a8
3 files changed
+33
-6
No files matched your search
@@ -1459,9 +1459,13 @@ Commander::handle_command(const vehicle_command_s &cmd)
|
||||
|
||||
} else if ((int)(cmd.param2) == 1) {
|
||||
/* magnetometer calibration */
|
||||
#if defined(CONFIG_SENSORS_VEHICLE_MAGNETOMETER)
|
||||
answer_command(cmd, vehicle_command_ack_s::VEHICLE_CMD_RESULT_ACCEPTED);
|
||||
_vehicle_status.calibration_enabled = true;
|
||||
_worker_thread.startTask(WorkerThread::Request::MagCalibration);
|
||||
#else
|
||||
answer_command(cmd, vehicle_command_ack_s::VEHICLE_CMD_RESULT_UNSUPPORTED);
|
||||
#endif
|
||||
|
||||
} else if ((int)(cmd.param3) == 1) {
|
||||
/* baro calibration */
|
||||
@@ -1564,6 +1568,7 @@ Commander::handle_command(const vehicle_command_s &cmd)
|
||||
"Calibration denied: not supported in SIH mode");
|
||||
|
||||
} else {
|
||||
#if defined(CONFIG_SENSORS_VEHICLE_MAGNETOMETER)
|
||||
answer_command(cmd, vehicle_command_ack_s::VEHICLE_CMD_RESULT_ACCEPTED);
|
||||
// parameter 1: Heading (degrees)
|
||||
// parameter 3: Latitude (degrees)
|
||||
@@ -1586,6 +1591,9 @@ Commander::handle_command(const vehicle_command_s &cmd)
|
||||
_vehicle_status.calibration_enabled = true;
|
||||
_worker_thread.setMagQuickData(heading_radians, latitude, longitude);
|
||||
_worker_thread.startTask(WorkerThread::Request::MagCalibrationQuick);
|
||||
#else
|
||||
answer_command(cmd, vehicle_command_ack_s::VEHICLE_CMD_RESULT_UNSUPPORTED);
|
||||
#endif
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user