Skip to content

Commit 5b1e157

Browse files
committed
lis2mdl: Address Copilot review on PR #114.
1 parent e7aa33d commit 5b1e157

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

lib/lis2mdl/lis2mdl/device.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,11 @@ def read_temperature_c(self) -> float:
252252
def set_temp_offset(self, offset_c):
253253
"""Set a temperature offset in °C (gain remains 1.0).
254254
255-
This replaces the default base offset (25 °C) with the given value.
256-
257255
Args:
258256
offset_c: offset value in degrees Celsius.
259257
"""
260258
self._temp_gain = 1.0
261-
self._temp_offset = 0.0
262-
self._temp_base_offset = float(offset_c)
259+
self._temp_offset = float(offset_c)
263260

264261
def calibrate_temperature(self, ref_low, measured_low, ref_high, measured_high):
265262
"""Two-point calibration from reference measurements.

tests/scenarios/lis2mdl.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ tests:
7373
- name: "Temperature with offset"
7474
action: script
7575
script: |
76-
dev.set_temp_offset(30.0)
76+
dev.set_temp_offset(-2.0)
7777
result = dev.read_temperature_c()
78-
expect: 30.0
78+
expect_range: [22.0, 24.0]
7979
mode: [mock]
8080

8181
- name: "Temperature with two-point calibration"

0 commit comments

Comments
 (0)