Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: MS5837_30BA26 300 bar sensor detected as 2 bar sensor #32

Open
scuba-hacker opened this issue Jan 12, 2024 · 0 comments
Open

Bug: MS5837_30BA26 300 bar sensor detected as 2 bar sensor #32

scuba-hacker opened this issue Jan 12, 2024 · 0 comments

Comments

@scuba-hacker
Copy link

I switched from using the current Arduino library version 1.1.1 of MS58357.h/.cpp to head of master (I forked the project) and found that depth was being reported as zero despite being several metres under water. This is for the 300 bar sensor, bought just under a year ago.

It turns out that the model detection code in the init() function is assigning model = MS5837_02BA (value 1) instead of = MS5837_30BA (value 0). I am not calling setModel() anywhere in the client code. It seems that something in the "Read calibration values and CRC" is not working.

The current Arduino library version doesn't have this model check and _model defaults to MS5837_30BA. As a separate issue none of the private member variables are being initialised in the constructor so their values are officially undefined (and fortunately the compiler is setting them to zero automatically). They should be initialised in the constructor to 0, including the C[8] array contents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant