Apologies for the delay on getting to this, although please be aware that posting the same question in several different places around the forum just contributes to clutter and is considered as spamming.
I’ve combined all your comments on this topic into a single one, along with the relevant posts, so that there’s a single discussion thread on this topic for people to find and track.
There are two possible approaches, as discussed above:
Proper (user-configurable) integration to the ArduPilot codebase, likely using a parameter
This is what the discussion at the end of the linked GitHub issue is about, and is awaiting a response from other ArduPilot developers on what the most relevant approach is
If you want to push this to happen faster then you’ll likely need to either bring it up on the ArduPilot discord server, or in one of their weekly development calls
I will also raise it with our lead ArduSub developer, but I can’t provide guarantees on whether / when we’ll have a chance to work on it from our end
Compiling a custom firmware with a hacky replacement of the current Bar30 (MS5837-30BA) support with Bar02 (MS5837-02BA) support, under the assumption that only Bar02 is necessary for use on the vehicle that will be using that firmware
Likely the most straightforward way of approaching this would be to replace the _calculate_5837 function with the conversion factors for the Bar02 sensor, which can be found in this library code
Sorry for creating the clutter, but I really needed your help, I couldn’t do it myself. I have been working on it for days and still was but wasn’t reaching any end.
Sure, I’ll bring it up on their discord server too.
I sincerely hope that you will encourage your lead Ardusub developer to assist me with this, I will be eternally grateful to you and this community.
And for the hacky replacement, I’ll surely do that the first thing tomorrow morning and I will let you know if it worked or not. And so you are also saying, that the Pixhawk (with Arudsub burnt on it) is able to detect the Bar02 pressure sensor? Like I don’t have to add any changes to the code regarding it’s detection itself?
I really request you and hope that you will help me resolve this issue. I will be grateful to you.
If you need fast turnaround support then it’s generally best to go via our support email (email@example.com), although in this case you’re putting in a request for somebody to develop new functionality (rather than fixing something broken), which is never guaranteed to happen quickly / to some external timeline.
Is there a particular application you have in mind for this? The Bar02 operating depth is only 10m, which is insufficient for many ArduSub applications, and the higher resolution does not typically make a practical difference to operation compared to a Bar30 or Bar100.
Our Bar02 and Bar30 sensors both use variants of the MS5837 chip, which have the same I2C address and the same communication protocol - the only difference between the variants is how the pressure gets calculated, and the pressure range they work for. Currently if you connect a Bar02 then ArduSub will detect it but will treat it as a Bar30, which results in incorrect pressure and depth readings.
I have to use it in a ROV and AUV.
I contacted the support at the mentioned email and I made several requests, but they didn’t help me out, saying all developers are busy and saddened me.
Also, I would have definitely went for Bar30 pressure sensor, but I am out of budget, the complete price, including the shipping charges(I am from India), sum up to 8k in my currency, which is quite a lot. That is why I am going through this hassle.
And sorry, I didn’t update here on the forum whether your proposed solution worked or not. I will definitely do it as soon possible. Please bear with me.
Once again, I know you have a lot of people to attend to, and I really appreciate the time you are giving me. Thank you.
So sorry for not seeing it sooner. I got busy. Also I didn’t received any email that there has been a response. I really apologize for the delay.
How do I integrate this code into Ardusub?
I committed some changes in the repo, in the libraries/AP_Baro/AP_Baro_MS5611.cpp.
Can you please take a look?
I really request you if you could response swiftly. I am really really grateful to you.
Also, I think we need to provide a different PROM start address as given in line 32 or do we need to provide a different function for ms5837 like that at line 181?
Sorry, I’ve been pretty busy. All I can say right now is that your code makes sense.
I would add some debug statements and compare the output of it with the output of the working bluerobotics library to narrow down where the issue is.
There’s some useful data and a crc calculation code in the datasheet.
Yeah, I compared the crc_crc4 function defined in crc.cpp and it’s completely same as the one in the datasheet, I think it’s issue with prom values only now.
And also, I apologise for the inconvenience caused to you by me, but I really need all the help that I can get, so I appreciate your time and efforts to help me out and request you to please help me resolve this issue completely.
Also, I think we seem to modify _read_prom_word function in line 181 in AP_Baro_MS5611.cpp.