Skip to content

Commit d5515a2

Browse files
committed
wsen-hids: Fix copilot issues.
1 parent 1aa9e20 commit d5515a2

7 files changed

Lines changed: 14 additions & 14 deletions

File tree

lib/wsen-hids/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,5 +236,5 @@ Examples include:
236236
Run an example using:
237237

238238
```bash
239-
mpremote mount lib/wsen-hids run lib/wsen-hids/examples/example1.py
239+
mpremote mount lib/wsen-hids run lib/wsen-hids/examples/continuous_mode.py
240240
```

lib/wsen-hids/examples/continuous_mode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from machine import I2C, Pin
1+
from machine import I2C
22
from time import sleep
33

44
from wsen_hids import WSEN_HIDS
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from machine import I2C, Pin
1+
from machine import I2C
22
from time import sleep
33

44
from wsen_hids import WSEN_HIDS

lib/wsen-hids/examples/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from machine import I2C, Pin
1+
from machine import I2C
22
from time import sleep, sleep_ms
33

44
from wsen_hids import WSEN_HIDS
@@ -302,7 +302,7 @@ def test_status_helpers(sensor):
302302

303303
sensor.set_one_shot_mode()
304304

305-
# Au moins un indicateur doit être cohérent avec STATUS
305+
# At least one indicator must match STATUS
306306
flags_match = (
307307
h_avail == bool(status & STATUS_H_DA)
308308
and t_avail == bool(status & STATUS_T_DA)

lib/wsen-hids/manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
metadata(
2-
description="Driver of wsen-hids humidity and temperature Device Sensor.",
2+
description="Driver of WSEN-HIDS humidity and temperature sensor.",
33
version="0.0.1",
44
)
55

lib/wsen-hids/wsen_hids/const.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@
7575
AVG_256 = 0x07
7676

7777
# Default averaging according to the manual:
78-
# temperature = 16 samples, humidity = 32 samples
78+
# temperature = 16 samples, humidity = 16 samples
7979
AVG_T_DEFAULT = AVG_16
80-
AVG_H_DEFAULT = AVG_16 # value 0x03 => 32 samples for humidity
80+
AVG_H_DEFAULT = AVG_16 # value 0x03 => 16 samples for humidity
81+
8182

82-
DEFAULT_ONE_SHOT_TIMEOUT_MS = 100
83-
DEFAULT_BOOT_TIME_MS = 10

lib/wsen-hids/wsen_hids/device.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ class WSEN_HIDS:
4141
AVG_128 = AVG_128
4242
AVG_256 = AVG_256
4343

44+
DEFAULT_ONE_SHOT_TIMEOUT_MS = 100
45+
DEFAULT_BOOT_TIME_MS = 10
46+
4447
def __init__(
4548
self,
4649
i2c,
@@ -54,8 +57,6 @@ def __init__(
5457
self.address = address
5558

5659
self._buffer_1 = bytearray(1)
57-
self._buffer_2 = bytearray(2)
58-
self._buffer_4 = bytearray(4)
5960

6061
self._calibration = {}
6162

@@ -173,7 +174,7 @@ def set_average(self, avg_t=AVG_T_DEFAULT, avg_h=AVG_H_DEFAULT):
173174

174175
def set_one_shot_mode(self):
175176
ctrl1 = self._read_reg(REG_CTRL_1)
176-
ctrl1 |= CTRL_1_PD # capteur actif
177+
ctrl1 |= CTRL_1_PD # sensor active
177178
ctrl1 &= ~CTRL_1_ODR_MASK # ODR = 00 => one-shot
178179
self._write_reg(REG_CTRL_1, ctrl1)
179180

@@ -193,7 +194,7 @@ def enable_heater(self, enabled=True):
193194

194195
def reboot_memory(self):
195196
self._update_reg(REG_CTRL_2, CTRL_2_BOOT, CTRL_2_BOOT)
196-
sleep_ms(DEFAULT_BOOT_TIME_MS)
197+
sleep_ms(self.DEFAULT_BOOT_TIME_MS)
197198
self._read_calibration()
198199

199200
# -------------------------------------------------------------------------

0 commit comments

Comments
 (0)