Bug reported as Github Issue for 300 bar Depth Sensor

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.

github issue #32