Skip to content

Commit 10da470

Browse files
Tinyu-Zhaolbuque
authored andcommitted
lib: Fix some errors.
Signed-off-by: Tinyu-Zhao <[email protected]>
1 parent aec9f9a commit 10da470

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

docs/en/module/ain4.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ Methods
148148

149149
Sets a new I2C address for the AIN 4-20mA module.
150150

151-
:param int addr: The new I2C address, must be between 0x08 and 0x78.
151+
:param int addr: The new I2C address, must be between 0x08 and 0x77.
152152

153153
UIFLOW2:
154154

docs/en/units/bytebutton.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ Methods
226226

227227
Set a new I2C address for the ByteButtonUnit.
228228

229-
:param int new_addr: The new I2C address to set. Must be in the range 0x08 to 0x78.
229+
:param int new_addr: The new I2C address to set. Must be in the range 0x08 to 0x77.
230230

231231
UIFLOW2:
232232

docs/en/units/byteswitch.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ Methods
225225

226226
Set a new I2C address for the ByteSwitchUnit.
227227

228-
:param int new_addr: The new I2C address to set. Must be in the range 0x08 to 0x78.
228+
:param int new_addr: The new I2C address to set. Must be in the range 0x08 to 0x77.
229229

230230
UIFLOW2:
231231

m5stack/libs/module/ain4.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ def set_i2c_address(self, addr: int) -> None:
116116
117117
Sets a new I2C address for the AIN 4-20mA module.
118118
119-
@param addr: The new I2C address, must be between 0x08 and 0x78.
119+
@param addr: The new I2C address, must be between 0x08 and 0x77.
120120
121-
@raise ValueError: If the address is not within the range 0x08 to 0x78.
121+
@raise ValueError: If the address is not within the range 0x08 to 0x77.
122122
"""
123-
if addr >= 0x08 and addr <= 0x78:
123+
if addr >= 0x08 and addr <= 0x77:
124124
if addr != self._i2c_addr:
125125
time.sleep_ms(2)
126126
self._i2c.writeto_mem(self._i2c_addr, self._AIN_I2C_ADDR_REG, bytearray([addr]))
127127
self._i2c_addr = addr
128128
time.sleep_ms(200)
129129
else:
130-
raise ValueError("I2C address error, range:0x08~0x78")
130+
raise ValueError("I2C address error, range:0x08~0x77")

m5stack/libs/module/module_4in8out.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def set_i2c_address(self, addr: int) -> None:
8181
"""! Set a new I2C address for the 4In8Out module.
8282
@param addr: The new I2C address to set.
8383
"""
84-
if 0x08 <= addr <= 0x78:
84+
if 0x08 <= addr <= 0x77:
8585
if addr != self._i2c_addr:
8686
time.sleep_ms(2)
8787
self._i2c.writeto_mem(
@@ -90,7 +90,7 @@ def set_i2c_address(self, addr: int) -> None:
9090
self._i2c_addr = addr
9191
time.sleep_ms(200)
9292
else:
93-
raise ValueError("I2C address error, range:0x08~0x78")
93+
raise ValueError("I2C address error, range:0x08~0x77")
9494

9595
def _read_reg_data(self, sub_reg: int, num: int) -> bytes:
9696
"""! Helper function to read data from a specific register.

m5stack/libs/unit/bytebutton.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,16 +316,16 @@ def set_i2c_address(self, new_addr: int):
316316
317317
params:
318318
new_addr:
319-
note: The new I2C address to set. Must be in the range 0x08 to 0x78.
319+
note: The new I2C address to set. Must be in the range 0x08 to 0x77.
320320
"""
321-
if new_addr >= 0x08 and new_addr <= 0x78:
321+
if new_addr >= 0x08 and new_addr <= 0x77:
322322
if new_addr != self.address:
323323
self.i2c.writeto_mem(
324324
self.address, self._BYTEUNIT_I2C_ADDRESS_REG, bytearray([new_addr])
325325
)
326326
self.address = new_addr
327327
else:
328-
raise ValueError("I2C address error, range:0x08~0x78")
328+
raise ValueError("I2C address error, range:0x08~0x77")
329329

330330
def get_i2c_address(self):
331331
"""

0 commit comments

Comments
 (0)