Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ imu = ISM330DL(i2c)
# Reading values
ax, ay, az = imu.acceleration_g()
gx, gy, gz = imu.gyroscope_dps()
temp = imu.temperature_c()
temp = imu.temperature()

# Configuration
from ism330dl.const import ACCEL_ODR_104HZ, ACCEL_FS_4G
Expand Down
4 changes: 2 additions & 2 deletions lib/ism330dl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ imu = ISM330DL(i2c)

ax, ay, az = imu.acceleration_g()
gx, gy, gz = imu.gyroscope_dps()
temp = imu.temperature_c()
temp = imu.temperature()

print("Accel:", ax, ay, az)
print("Gyro :", gx, gy, gz)
Expand Down Expand Up @@ -168,7 +168,7 @@ imu.motion()
## Temperature

```python
imu.temperature_c()
imu.temperature()
```

Example:
Expand Down
2 changes: 1 addition & 1 deletion lib/ism330dl/examples/basic_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

ax, ay, az = imu.acceleration_g()
gx, gy, gz = imu.gyroscope_dps()
temp = imu.temperature_c()
temp = imu.temperature()

print(
"A[g]=({:+.2f},{:+.2f},{:+.2f}) "
Expand Down
2 changes: 1 addition & 1 deletion lib/ism330dl/ism330dl/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def gyroscope_rads(self):
dps = self.gyroscope_dps()
return tuple(v * pi / 180.0 for v in dps)

def temperature_c(self):
def temperature(self):
factory = TEMP_OFFSET + self.temperature_raw() / TEMP_SENSITIVITY
return self._temp_gain * factory + self._temp_offset

Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming temperature_c() to temperature() is a breaking API change for downstream users. Consider keeping a temperature_c() wrapper (deprecated) that forwards to temperature() for at least one release cycle, or document the breaking change prominently in the driver README/root README changelog section if you intentionally want a hard break.

Suggested change
def temperature_c(self):
"""Deprecated: use `temperature()` instead."""
return self.temperature()

Copilot uses AI. Check for mistakes.
Expand Down
2 changes: 1 addition & 1 deletion lib/steami_config/examples/calibrate_temperature.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
("hts221", "hts221.device", "HTS221", "temperature"),
("wsen_pads", "wsen_pads.device", "WSEN_PADS", "temperature"),
("lis2mdl", "lis2mdl.device", "LIS2MDL", "temperature"),
("ism330dl", "ism330dl.device", "ISM330DL", "temperature_c"),
("ism330dl", "ism330dl.device", "ISM330DL", "temperature"),
]

for config_name, module, class_name, method in SENSORS:
Expand Down
6 changes: 3 additions & 3 deletions tests/scenarios/board_temperature_comparison.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ tests:
from ism330dl.device import ISM330DL
imu = ISM330DL(i2c)
sleep_ms(200) # stabilize after reset
temps['ISM330DL'] = imu.temperature_c()
temps['ISM330DL'] = imu.temperature()

# Print comparison table
print('--- Temperature Comparison ---')
Expand Down Expand Up @@ -155,7 +155,7 @@ tests:
mag_t = mag.temperature()

ref_t4 = ref.temperature()
imu_t = imu.temperature_c()
imu_t = imu.temperature()

print('--- Before offset alignment ---')
print(' WSEN-HIDS (ref): ' + str(round(ref_t, 2)) + ' C')
Expand All @@ -179,7 +179,7 @@ tests:
hts_t2 = hts.temperature()
pads_t2 = pads.temperature()
mag_t2 = mag.temperature()
imu_t2 = imu.temperature_c()
imu_t2 = imu.temperature()

print('--- After offset alignment ---')
print(' WSEN-HIDS (ref): ' + str(round(ref_t5, 2)) + ' C')
Expand Down
14 changes: 7 additions & 7 deletions tests/scenarios/ism330dl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ tests:

- name: "Temperature returns 25.0 from mock data"
action: call
method: temperature_c
method: temperature
expect_range: [24.9, 25.1]
mode: [mock]

Expand All @@ -156,15 +156,15 @@ tests:
action: script
script: |
dev.set_temp_offset(-2.5)
result = abs(dev.temperature_c() - 22.5) < 0.1
result = abs(dev.temperature() - 22.5) < 0.1
expect_true: true
mode: [mock]

- name: "Temperature with two-point calibration"
action: script
script: |
dev.calibrate_temperature(20.0, 25.0, 30.0, 35.0)
result = dev.temperature_c()
result = dev.temperature()
expect_range: [19.0, 21.0]
mode: [mock]

Expand All @@ -181,7 +181,7 @@ tests:

- name: "Temperature in plausible range"
action: call
method: temperature_c
method: temperature
expect_range: [10.0, 50.0]
mode: [hardware]

Expand Down Expand Up @@ -328,7 +328,7 @@ tests:
action: script
script: |
dev.power_off()
t = dev.temperature_c()
t = dev.temperature()
result = isinstance(t, float)
expect_true: true
mode: [mock]
Expand Down Expand Up @@ -410,7 +410,7 @@ tests:
action: script
script: |
dev.power_off()
t = dev.temperature_c()
t = dev.temperature()
result = 10.0 < t < 50.0
expect_true: true
mode: [hardware]
Expand All @@ -426,7 +426,7 @@ tests:
- method: gyroscope_dps
label: "Gyroscope (dps)"
unit: ""
- method: temperature_c
- method: temperature
label: "Temperature"
unit: "°C"
- method: orientation
Expand Down
Loading