Skip to content

Commit 74aa1f5

Browse files
committed
Merge remote-tracking branch 'origin/develop' into develop-pandian
2 parents 868c0ac + d52f841 commit 74aa1f5

File tree

5 files changed

+46
-26
lines changed

5 files changed

+46
-26
lines changed

docs/make.bat

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@ REM Command file for Sphinx documentation
77
if "%SPHINXBUILD%" == "" (
88
set SPHINXBUILD=sphinx-build
99
)
10-
set SOURCEDIR=zh_CN
11-
set BUILDDIR=build
10+
11+
set SOURCEDIR=%1
12+
set BUILDDIR=build/%SOURCEDIR%
13+
14+
@REM set SOURCEDIR=en
15+
@REM set BUILDDIR=build/en
1216

1317
if "%1" == "" goto help
18+
if "%2" == "" goto help
1419

1520
%SPHINXBUILD% >NUL 2>NUL
1621
if errorlevel 9009 (
@@ -27,7 +32,7 @@ if errorlevel 9009 (
2732

2833
doxygen.exe
2934

30-
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
35+
%SPHINXBUILD% -M %2 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
3136
goto end
3237

3338
:help

m5stack/libs/module/relay_4.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,31 @@
33
import struct
44
import time
55

6-
DEV_I2C_ADDR = 0x26
7-
RELAY_REG = 0x10
8-
ADC_8BIT_REG = 0x20
9-
ADC_16BIT_REG = 0x30
10-
I2C_ADDR_REG = 0xFF
6+
DEV_I2C_ADDR = 0x26
7+
RELAY_REG = 0x10
8+
ADC_8BIT_REG = 0x20
9+
ADC_16BIT_REG = 0x30
10+
I2C_ADDR_REG = 0xFF
1111

12-
class Relay_Stack:
1312

13+
class Relay_Stack:
1414
def __init__(self, i2c, addr):
1515
self.i2c = i2c
1616
self.i2c_addr = addr
17-
17+
1818
def _available(self):
1919
if not (self.i2c_addr in self.i2c.scan()):
2020
raise ModuleError("4 relay module maybe not connect")
2121

2222
def get_relay_status(self, num):
23-
"""
23+
"""
2424
get RELAY Status.
2525
reg: 0x10
2626
num: select only 1 to 4
2727
return 0 or 1
2828
"""
2929
num = min(4, max(num, 1))
30-
return ((self.i2c.readfrom_mem(self.i2c_addr, RELAY_REG, 1)[0] >> (num - 1)) & 0x01)
30+
return (self.i2c.readfrom_mem(self.i2c_addr, RELAY_REG, 1)[0] >> (num - 1)) & 0x01
3131

3232
def set_relay_state(self, num, state):
3333
"""
@@ -39,7 +39,7 @@ def set_relay_state(self, num, state):
3939
num = min(4, max(num, 1))
4040
data = self.i2c.readfrom_mem(self.i2c_addr, RELAY_REG, 1)[0]
4141
if state:
42-
data |= (0x01 << (num - 1))
42+
data |= 0x01 << (num - 1)
4343
else:
4444
data &= ~(0x01 << (num - 1))
4545
self.i2c.writeto_mem(self.i2c_addr, RELAY_REG, bytes([data]))
@@ -51,18 +51,18 @@ def set_all_relay_state(self, state):
5151
state: value is 0 or 1
5252
"""
5353
state = min(1, max(state, 0))
54-
data = 0x0f if state else 0x00
54+
data = 0x0F if state else 0x00
5555
self.i2c.writeto_mem(self.i2c_addr, RELAY_REG, bytes([data]))
5656

57-
#************************# Version 1.1 #****************************#
57+
# ************************# Version 1.1 #****************************#
5858
def get_adc_8bit_value(self, volt=0):
5959
"""
6060
get adc raw/volt 8bit value
6161
"""
6262
val = self.i2c.readfrom_mem(self.i2c_addr, ADC_8BIT_REG, 1)[0]
6363
if volt:
64-
val = (3.3/255) * val * 8
65-
return round(val, 2)
64+
val = (3.3 / 255) * val * 8
65+
return round(val, 2)
6666
else:
6767
return val
6868

@@ -71,29 +71,29 @@ def get_adc_12bit_value(self, volt=0):
7171
get adc raw/volt 12bit value
7272
"""
7373
buf = self.i2c.readfrom_mem(self.i2c_addr, ADC_16BIT_REG, 2)
74-
val = struct.unpack('<H', buf)[0]
74+
val = struct.unpack("<H", buf)[0]
7575
if volt:
76-
val = (3.3/4095) * val * 8
76+
val = (3.3 / 4095) * val * 8
7777
return round(val, 2)
7878
else:
7979
return val
80-
80+
8181
def set_i2c_address(self, addr):
8282
"""
8383
set i2c address.
84-
addr : 1 to 127
84+
addr : 1 to 127
8585
"""
8686
if addr >= 1 and addr <= 127:
8787
if addr != self.i2c_addr:
8888
self.i2c.writeto_mem(self.i2c_addr, I2C_ADDR_REG, bytes([addr]))
8989
self.i2c_addr = addr
9090
time.sleep_ms(100)
9191

92-
#*******************************************************************#
9392

94-
class Relay4(Relay_Stack):
93+
# *******************************************************************#
9594

95+
96+
class Relay4(Relay_Stack):
9697
def __init__(self, address: int = DEV_I2C_ADDR):
9798
super().__init__(i2c1, address)
9899
self._available()
99-

m5stack/libs/unit/env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ def read_humidity(self) -> float:
4949
return round(self._temp_humid.measure()[1], 2)
5050

5151
def read_pressure(self) -> float:
52-
return round((self._pressure.measure()[1]/100), 2)
52+
return round((self._pressure.measure()[1] / 100), 2)

m5stack/modules/startup/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ def startup(boot_opt, timeout: int = 60) -> None:
6969

7070
pin4 = Pin(4, Pin.OUT)
7171
pin4.value(1)
72-
if board_id in (M5.BOARD.M5AtomS3U, M5.BOARD.M5AtomS3Lite, M5.BOARD.M5StampS3):
72+
if board_id in (
73+
M5.BOARD.M5AtomS3U,
74+
M5.BOARD.M5AtomS3Lite,
75+
M5.BOARD.M5StampS3,
76+
M5.BOARD.M5Capsule,
77+
):
7378
# M5AtomS3U may fail to enter the AUTODETECT process, which will cause
7479
# m5things to fail to obtain the board id.
7580
nvs = esp32.NVS("M5GFX")
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package(
2+
"startup",
3+
(
4+
"__init__.py",
5+
"atoms3lite.py",
6+
"stamps3.py",
7+
),
8+
base_path="..",
9+
opt=3,
10+
)

0 commit comments

Comments
 (0)