diff --git a/src/AutoPilotPlugins/APM/APMCompassCal.cc b/src/AutoPilotPlugins/APM/APMCompassCal.cc index b769142a79e83c0992b06f4ebf929710687a4b15..a3bb441e5902d42814225a92d686530eae926799 100644 --- a/src/AutoPilotPlugins/APM/APMCompassCal.cc +++ b/src/AutoPilotPlugins/APM/APMCompassCal.cc @@ -157,7 +157,7 @@ CalWorkerThread::calibrate_return CalWorkerThread::calibrate(void) sensorId = 6.0f; } if (sensorId != 0.0f) { - _vehicle->doCommandLong(0, MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS, sensorId, -sphere_x[cur_mag], -sphere_y[cur_mag], -sphere_z[cur_mag]); + _vehicle->doCommandLong(_vehicle->defaultComponentId(), MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS, sensorId, -sphere_x[cur_mag], -sphere_y[cur_mag], -sphere_z[cur_mag]); } } } diff --git a/src/FactSystem/ParameterLoader.h b/src/FactSystem/ParameterLoader.h index 3b1e622c545e26502c8deebb6621d5969cf38942..6dbd25e15d173cb11a184ca5f096397b19faad97 100644 --- a/src/FactSystem/ParameterLoader.h +++ b/src/FactSystem/ParameterLoader.h @@ -103,6 +103,8 @@ public: /// If this file is newer than anything in the cache, cache it as the latest version static void cacheMetaDataFile(const QString& metaDataFile, MAV_AUTOPILOT firmwareType); + + int defaultComponenentId(void) { return _defaultComponentId; } signals: /// Signalled when the full set of facts are ready diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index 961fab5559cee35cc4b9a535c9860617b89628d9..a26750b3207374c2771b26f61302ecfcb87a22c7 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -210,7 +210,7 @@ Vehicle::Vehicle(LinkInterface* link, connect(_parameterLoader, &ParameterLoader::parameterListProgress, _autopilotPlugin, &AutoPilotPlugin::parameterListProgress); // Ask the vehicle for firmware version info - doCommandLong(MAV_COMP_ID_ALL, MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES, 1 /* request firmware version */); + doCommandLong(defaultComponentId(), MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES, 1 /* request firmware version */); _firmwarePlugin->initializeVehicle(this); @@ -1691,12 +1691,16 @@ QString Vehicle::firmwareVersionTypeString(void) const } } - void Vehicle::rebootVehicle() { doCommandLong(id(), MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); } +int Vehicle::defaultComponentId(void) +{ + return _parameterLoader->defaultComponenentId(); +} + const char* VehicleGPSFactGroup::_hdopFactName = "hdop"; const char* VehicleGPSFactGroup::_vdopFactName = "vdop"; const char* VehicleGPSFactGroup::_courseOverGroundFactName = "courseOverGround"; diff --git a/src/Vehicle/Vehicle.h b/src/Vehicle/Vehicle.h index 43c753498669f181ac193b14bf3cd8e0c16e569e..05afe3df4fb16888c3316f9f2c8de671e799e86e 100644 --- a/src/Vehicle/Vehicle.h +++ b/src/Vehicle/Vehicle.h @@ -541,6 +541,8 @@ public: void setFirmwareVersion(int majorVersion, int minorVersion, int patchVersion, FIRMWARE_VERSION_TYPE versionType = FIRMWARE_VERSION_TYPE_OFFICIAL); static const int versionNotSetValue = -1; + int defaultComponentId(void); + public slots: void setLatitude(double latitude); void setLongitude(double longitude);