wsen-hids: Add two-point temperature calibration methods.#111
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds two-point software temperature calibration to the WSEN-HIDS driver (as part of the cross-driver harmonization effort) and extends the YAML scenario runner so mock scenarios can validate calibration behavior with multi-step scripts.
Changes:
- Add
_temp_gain/_temp_offsetstate to WSEN-HIDS and apply it in the temperature conversion path. - Introduce
set_temp_offset()andcalibrate_temperature()APIs on WSEN-HIDS. - Add a new YAML scenario action (
script) and new mock scenario coverage for offset and two-point calibration.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
lib/wsen-hids/wsen_hids/device.py |
Adds temperature calibration state + public calibration methods and applies calibration in _convert_temperature(). |
tests/runner/executor.py |
Implements mock-mode script action execution via exec() and returns result. |
tests/test_scenarios.py |
Adds handling for action: script (with a board-scenario guard) in the scenario test runner. |
tests/scenarios/wsen_hids.yaml |
Adds mock scenarios that validate temperature offset and two-point calibration behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
Suggestions Copilot prises en compte dans le commit 1a6bb31 :
|
|
🎉 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 #105
Summary
Add two-point software temperature calibration to the WSEN-HIDS driver, following the harmonized interface defined in #103.
Changes
self._temp_gain = 1.0andself._temp_offset = 0.0in__init__set_temp_offset(offset_c)— simple offset (resets gain to 1.0)calibrate_temperature(ref_low, measured_low, ref_high, measured_high)— computes gain and offset from two reference points_convert_temperature():return gain * factory_value + offsetAPI
Hardware validation
Related
Test plan
ruff checkpassespytest tests/ -k mock— 44/44 passed (no regressions)set_temp_offset()andcalibrate_temperature()validated on board