I was wrong.
It can detect upto 8, but only store params for 1,2 and 3. So basically the 4th compass is just existing, might be used if one compass fails, but quite unlikely.
You are right most problems here are “just configuration issues”
Can you show a screenshot of mission planner showing all your 4 compasses are correctly detetecd by Tab SETUP>>Mandantory Hardware/HW ID.
Also answer which FC you are using and exactly which Firmware you are installed based on which board HWDEF. Than I can give you one of two possible answers to your problem.
Also just out of curiosity, same question as for your 2 GPS, why want you use 4 compass. For me this only makes sence on scientific base
Regarding the compass:
earlier i only had no gps 1 compass (internal) so I added hmc5883
Then I cheaped-out on gps and bought m8n, which also had hmc5883. So i replaced the hmc5883 with mmc5983 which I had lying around.
I found a gps module lying around too so I put it too because the m8n was not performing too well, and I didn’t know about all the knowledge that I got in the other thread. So now there were 3 compass. Now, when i bought the m10 gps, it also had ist8310 so I connected it as the hmc5883 is older low-res didn’t want to remove it because of complex soldering. I was like - if the chip is already there on drone and the (negligible) weight is already there, why not just solder it and use it. Little funny but this is how i got too many sensors, even though there is just 1 imu which removes the ability to run multiple ekf lanes.
Ok, sorry for the delay. Just saw that you edited your posting with the screen shot.
So the reason why you only can use 3 compasses is the unset limit in Hwdef file used by your Firmware. The Firmware PixHawk1 is just a extension to the Firmware FMU3 both Hwdef dont have defined “HAL_COMPASS_MAX_SENSORS” and if this is not defined the AP_COMPASS library takes the default of max 3 compasses.
This mean with other words ardupilot firmware is able to use more compasses but in most cases of the firmware only the default 3 compasses are used.
The other possibility I had in mind was a mismtch of I2C adresses as the cheap modules don’t have the possibility to change the adress. But your screenshot shows that the differerent chips using different adresses. So from that side all is ok.
so in the hwdef.dat of Pixhawk1 file after line 30, I need to add the following line right:
define HAL_COMPASS_MAX_SENSORS 4
This will then create the needed parameters for Compass 4?
Hwdef is at: libraries/AP_HAL_ChibiOS/hwdef/Pixhawk1
Or somewhere else (some little spelling error might be there in the above path)
I didn’t tested it yet but yes I think you can try it.
Either in the correct hwdef.dat as you said or directly in the library AP_Compass/AP_compass.h
So I added that line in hwdef, and did the following:
cd ardupilot
cd libraries/AP_HAL_ChibiOS/hwdef/Pixhawk1
code . hwdef.dat
cd build
rm -rf Pixhawk1
cd ..
./waf configure --board=Pixhawk1 --enable-i-BUS
./waf copter
and then in mission planner the compass 4 just did not get detected, tried rebooting. flashed the old firmware, the compass 4 was detected. Wiring is not the issue.
Only the 4th compass was not detected or all 4 compasses?
As I said I didn’t tried this yet, but you can see at AP_compass, the use of such definition
4th compass (hmc5883) was not detected.
When I saw this, i kinda panicked, and reflashed the previous firmware, which I shouldn’t have done, so unfortunately I dont have more info than this.
In AP_COMPASS.h there is another #define HAL_COMPASS_MAX_SENSORS which is set to 3, so I will remove the line in hwdef and try 4 here, in AP_COMPASS.h
#ifndef HAL_BUILD_AP_PERIPH
#ifndef HAL_COMPASS_MAX_SENSORS
#define HAL_COMPASS_MAX_SENSORS 4 // This line to be changed
#endif
#if HAL_COMPASS_MAX_SENSORS > 1
#define COMPASS_MAX_UNREG_DEV 5
#else
#define COMPASS_MAX_UNREG_DEV 0
#endif
#else
#ifndef HAL_COMPASS_MAX_SENSORS
#define HAL_COMPASS_MAX_SENSORS 1
#endif
#define COMPASS_MAX_UNREG_DEV 0
#endif
I believe I need to set the comment-marked line value to 4.
Still doesnt work with the change mentioned in the previous post.
Same issue as before - Compass 4 not detected. The calibration data parameters for Compass 4 also did not come
I believe that this issue can be fixed in libraries/AP_Compass/AP_Compass.h or in libraries/AP_Compass/AP_Compass.cpp. How to fix needs to be figured out.
Maybe I can try using 5 there if it fixes the issue (less likely although). But, I would be grateful if @Yuri_Rage or @xfacta or anyone else, can suggest possible fixes and code that needs to be changed.