AP_Baro: Support MS5837-02BA #27787 #29122
Open
+93
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The changes include differentiation between multiple MS5xxx sensor variants using the PROM Word 0 bits [11:5], enabling automatic initialization and configuration of the correct driver. Additionally, this update includes specific calculations and second-order compensation logic for the MS5837-02BA sensor, making it more viable for shallow water applications.
Key Changes
Differentiation Logic:
Extracted product ID from PROM Word 0 bits [11:5] to identify sensor variants:
MS5837-30BA26: 0b0011010
MS5837-02BA01: 0b0000000
MS5837-02BA21: 0b0010101
New Sensor Type:
Added a new enum type BARO_MS5837_02BA to differentiate MS5837-02BA sensors.
Calculation Logic:
Implemented _calculate_5837_02ba() for MS5837-02BA-specific pressure and temperature calculations, including second-order compensation for temperatures below 20°C.
Driver Initialization:
Updated _init() to automatically detect and initialize the appropriate sensor type using PROM data.
Added automatic assignment of water pressure type (AP_Baro::BARO_TYPE_WATER) for MS5837 sensors.