Hi all,
we are running a new Compass, therefore I took ArduCopter Version 4.0.7 as basic and adapted the Compass files as following:
user@ubuntu-bionic:/ardupilot$ git diff
diff --git a/libraries/AP_Compass/AP_Compass.cpp b/libraries/AP_Compass/AP_Compass.cpp
index aa548ecd73…128abc40f1 100644
— a/libraries/AP_Compass/AP_Compass.cpp
+++ b/libraries/AP_Compass/AP_Compass.cpp
@@ -24,6 +24,7 @@
#include “AP_Compass_UAVCAN.h”
#endif
#include “AP_Compass_MMC3416.h”
+#include “AP_Compass_MMC5xx3.h”
#include “AP_Compass_MAG3110.h”
#include “AP_Compass_RM3100.h”
#include “AP_Compass.h”
@@ -1025,7 +1026,7 @@ void Compass::_probe_external_i2c_compasses(void)
ADD_BACKEND(DRIVER_QMC5883L, AP_Compass_QMC5883L::probe(GET_I2C_DEVICE(i, HAL_COMPASS_QMC5883L_I2C_ADDR),
true, HAL_COMPASS_QMC5883L_ORIENTATION_EXTERNAL));
}
- // internal i2c bus
if (all_external) {
// only probe QMC5883L on internal if we are treating internals as externals
@@ -1035,6 +1036,31 @@ void Compass::_probe_external_i2c_compasses(void)
all_external?HAL_COMPASS_QMC5883L_ORIENTATION_EXTERNAL:HAL_COMPASS_QMC5883L_ORIENTATION_INTERNAL));
}
}
+//#if !defined(HAL_DISABLE_I2C_MAGS_BY_DEFAULT) || defined(HAL_USE_I2C_MAG_MMC3416)
- // external i2c bus
- //FOREACH_I2C_EXTERNAL(i) {
-
// ADD_BACKEND(DRIVER_MMC3416, AP_Compass_MMC3416::probe(GET_I2C_DEVICE(i, HAL_COMPASS_MMC3416_I2C_ADDR),
-
// true, ROTATION_NONE));
- //}
- //FOREACH_I2C_INTERNAL(i) {
-
// ADD_BACKEND(DRIVER_MMC3416, AP_Compass_MMC3416::probe(GET_I2C_DEVICE(i, HAL_COMPASS_MMC3416_I2C_ADDR),
-
//all_external, ROTATION_NONE));
- //}
+//#endif
+#if !defined(HAL_DISABLE_I2C_MAGS_BY_DEFAULT) || defined(HAL_USE_I2C_MAG_MMC3416)
- // external i2c bus
- FOREACH_I2C_EXTERNAL(i) {
-
ADD_BACKEND(DRIVER_MMC3416, AP_Compass_MMC5XX3::probe(GET_I2C_DEVICE(i, HAL_COMPASS_MMC5xx3_I2C_ADDR),
-
true, ROTATION_NONE));
- }
- FOREACH_I2C_INTERNAL(i) {
-
ADD_BACKEND(DRIVER_MMC3416, AP_Compass_MMC5XX3::probe(GET_I2C_DEVICE(i, HAL_COMPASS_MMC5xx3_I2C_ADDR),
-
all_external, ROTATION_NONE));
- }
+#endif
Build commands
./waf configure --board=CubeBlack or --board=CubeOrange
./waf build --target=bin/arducopter
This custom firmware runs flawlessly on a CubeBlack, not on a CubeOrange. I compiled it twice to see if something could have been wrong during the building process, but the results were the same.
The issue is that after some seconds, the CubeOrange does not have a serial connection to the rest of the system anymore.
Thanks in advance for some advice, I don’t know how to continue here.
Cheers