Skip to content

Commit 1effbea

Browse files
committed
ism330dl: Rename temperature_c() to temperature() for convention.
1 parent a96fd64 commit 1effbea

7 files changed

Lines changed: 16 additions & 16 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ imu = ISM330DL(i2c)
224224
# Reading values
225225
ax, ay, az = imu.acceleration_g()
226226
gx, gy, gz = imu.gyroscope_dps()
227-
temp = imu.temperature_c()
227+
temp = imu.temperature()
228228

229229
# Configuration
230230
from ism330dl.const import ACCEL_ODR_104HZ, ACCEL_FS_4G

lib/ism330dl/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ imu = ISM330DL(i2c)
6262

6363
ax, ay, az = imu.acceleration_g()
6464
gx, gy, gz = imu.gyroscope_dps()
65-
temp = imu.temperature_c()
65+
temp = imu.temperature()
6666

6767
print("Accel:", ax, ay, az)
6868
print("Gyro :", gx, gy, gz)
@@ -168,7 +168,7 @@ imu.motion()
168168
## Temperature
169169

170170
```python
171-
imu.temperature_c()
171+
imu.temperature()
172172
```
173173

174174
Example:

lib/ism330dl/examples/basic_read.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
ax, ay, az = imu.acceleration_g()
1515
gx, gy, gz = imu.gyroscope_dps()
16-
temp = imu.temperature_c()
16+
temp = imu.temperature()
1717

1818
print(
1919
"A[g]=({:+.2f},{:+.2f},{:+.2f}) "

lib/ism330dl/ism330dl/device.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def gyroscope_rads(self):
182182
dps = self.gyroscope_dps()
183183
return tuple(v * pi / 180.0 for v in dps)
184184

185-
def temperature_c(self):
185+
def temperature(self):
186186
factory = TEMP_OFFSET + self.temperature_raw() / TEMP_SENSITIVITY
187187
return self._temp_gain * factory + self._temp_offset
188188

lib/steami_config/examples/calibrate_temperature.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
("hts221", "hts221.device", "HTS221", "temperature"),
3333
("wsen_pads", "wsen_pads.device", "WSEN_PADS", "temperature"),
3434
("lis2mdl", "lis2mdl.device", "LIS2MDL", "temperature"),
35-
("ism330dl", "ism330dl.device", "ISM330DL", "temperature_c"),
35+
("ism330dl", "ism330dl.device", "ISM330DL", "temperature"),
3636
]
3737

3838
for config_name, module, class_name, method in SENSORS:

tests/scenarios/board_temperature_comparison.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ tests:
5858
from ism330dl.device import ISM330DL
5959
imu = ISM330DL(i2c)
6060
sleep_ms(200) # stabilize after reset
61-
temps['ISM330DL'] = imu.temperature_c()
61+
temps['ISM330DL'] = imu.temperature()
6262
6363
# Print comparison table
6464
print('--- Temperature Comparison ---')
@@ -155,7 +155,7 @@ tests:
155155
mag_t = mag.temperature()
156156
157157
ref_t4 = ref.temperature()
158-
imu_t = imu.temperature_c()
158+
imu_t = imu.temperature()
159159
160160
print('--- Before offset alignment ---')
161161
print(' WSEN-HIDS (ref): ' + str(round(ref_t, 2)) + ' C')
@@ -179,7 +179,7 @@ tests:
179179
hts_t2 = hts.temperature()
180180
pads_t2 = pads.temperature()
181181
mag_t2 = mag.temperature()
182-
imu_t2 = imu.temperature_c()
182+
imu_t2 = imu.temperature()
183183
184184
print('--- After offset alignment ---')
185185
print(' WSEN-HIDS (ref): ' + str(round(ref_t5, 2)) + ' C')

tests/scenarios/ism330dl.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ tests:
141141

142142
- name: "Temperature returns 25.0 from mock data"
143143
action: call
144-
method: temperature_c
144+
method: temperature
145145
expect_range: [24.9, 25.1]
146146
mode: [mock]
147147

@@ -156,15 +156,15 @@ tests:
156156
action: script
157157
script: |
158158
dev.set_temp_offset(-2.5)
159-
result = abs(dev.temperature_c() - 22.5) < 0.1
159+
result = abs(dev.temperature() - 22.5) < 0.1
160160
expect_true: true
161161
mode: [mock]
162162

163163
- name: "Temperature with two-point calibration"
164164
action: script
165165
script: |
166166
dev.calibrate_temperature(20.0, 25.0, 30.0, 35.0)
167-
result = dev.temperature_c()
167+
result = dev.temperature()
168168
expect_range: [19.0, 21.0]
169169
mode: [mock]
170170

@@ -181,7 +181,7 @@ tests:
181181

182182
- name: "Temperature in plausible range"
183183
action: call
184-
method: temperature_c
184+
method: temperature
185185
expect_range: [10.0, 50.0]
186186
mode: [hardware]
187187

@@ -328,7 +328,7 @@ tests:
328328
action: script
329329
script: |
330330
dev.power_off()
331-
t = dev.temperature_c()
331+
t = dev.temperature()
332332
result = isinstance(t, float)
333333
expect_true: true
334334
mode: [mock]
@@ -410,7 +410,7 @@ tests:
410410
action: script
411411
script: |
412412
dev.power_off()
413-
t = dev.temperature_c()
413+
t = dev.temperature()
414414
result = 10.0 < t < 50.0
415415
expect_true: true
416416
mode: [hardware]
@@ -426,7 +426,7 @@ tests:
426426
- method: gyroscope_dps
427427
label: "Gyroscope (dps)"
428428
unit: ""
429-
- method: temperature_c
429+
- method: temperature
430430
label: "Temperature"
431431
unit: "°C"
432432
- method: orientation

0 commit comments

Comments
 (0)