ism330dl: Add two-point temperature calibration methods.#121
Merged
Conversation
1 task
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a harmonized two-point temperature calibration interface to the ISM330DL MicroPython driver (per #103 / #107), and validates it via new mock scenario tests.
Changes:
- Initialize temperature calibration state (
_temp_gain,_temp_offset) inISM330DL.__init__(). - Apply calibration in
temperature_c()and addset_temp_offset()+calibrate_temperature()APIs. - Add mock scenario coverage for offset calibration, two-point calibration, and invalid calibration inputs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
lib/ism330dl/ism330dl/device.py |
Adds calibration state + public calibration methods; applies gain/offset to computed factory temperature. |
tests/scenarios/ism330dl.yaml |
Adds mock scenario tests covering offset behavior, two-point calibration result, and ValueError on invalid delta. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🎉 This PR is included in version 0.0.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #107
Summary
Add temperature calibration methods to the ISM330DL driver, consistent with the harmonized interface from #103:
set_temp_offset(offset_c)— simple offset correction (gain=1.0)calibrate_temperature(ref_low, measured_low, ref_high, measured_high)— two-point gain+offset calibration_temp_gainand_temp_offsetinitialized in__init__temperature_c()applies calibration:gain * factory + offsetTest plan
python3 -m pytest tests/ -k "ism330dl and mock" -v3 new mock tests (24 total):
Test results