Skip to content

Commit b9417e7

Browse files
committed
style: code format
Signed-off-by: lbuque <[email protected]>
1 parent 06e2402 commit b9417e7

File tree

5 files changed

+70
-67
lines changed

5 files changed

+70
-67
lines changed

m5stack/libs/driver/qmp6988.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -238,21 +238,21 @@ def measure(self):
238238

239239
# Compensation based on datasheet section 4.3
240240
d = self.i2c.readfrom_mem(self.addr, _QMP6988_DATA, _QMP6988_DATA_LEN)
241-
dp = ((d[0] << 16) | (d[1] << 8) | d[2]) - 2**23
242-
dt = ((d[3] << 16) | (d[4] << 8) | d[5]) - 2**23
241+
dp = ((d[0] << 16) | (d[1] << 8) | d[2]) - 2 ** 23
242+
dt = ((d[3] << 16) | (d[4] << 8) | d[5]) - 2 ** 23
243243

244-
tr = self.a0 + (self.a1 * dt) + (self.a2 * (dt**2))
244+
tr = self.a0 + (self.a1 * dt) + (self.a2 * (dt ** 2))
245245

246246
pr = (
247247
self.b00
248248
+ (self.bt1 * tr)
249249
+ (self.bp1 * dp)
250250
+ (self.b11 * tr * dp)
251-
+ (self.bt2 * tr**2)
252-
+ (self.bp2 * dp**2)
253-
+ (self.b12 * dp * (tr**2))
254-
+ (self.b21 * (dp**2) * tr)
255-
+ (self.bp3 * (dp**3))
251+
+ (self.bt2 * tr ** 2)
252+
+ (self.bp2 * dp ** 2)
253+
+ (self.b12 * dp * (tr ** 2))
254+
+ (self.b21 * (dp ** 2) * tr)
255+
+ (self.bp3 * (dp ** 3))
256256
)
257257

258258
temperature = (tr / 256) if temp_en else 0.0

m5stack/libs/driver/scd40.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async def start(self):
4848
await self._write_values(_SCD40_CMD_REINIT, delay_ms=1000)
4949
# temperature offset can only be configured in idle mode
5050
if self.temp_offset is not None:
51-
t = int((self.temp_offset * 2**16) / 175)
51+
t = int((self.temp_offset * 2 ** 16) / 175)
5252
await self._write_values(_SCD40_CMD_SET_TEMPERATURE_OFFSET, (t,))
5353

5454
# create background task and wait for measurements to arrive

m5stack/modules/startup/stickcplus2.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ async def on_hide(self):
5757
async def on_exit(self):
5858
pass
5959

60-
class RunApp(AppBase):
6160

61+
class RunApp(AppBase):
6262
def __init__(self) -> None:
6363
super().__init__()
6464

@@ -230,18 +230,19 @@ async def _keycode_dpad_down_event_handler(self, fw):
230230
for label in self._labels:
231231
label.setText("")
232232

233-
for label, file in zip(self._labels, self._files[self._file_pos:]):
233+
for label, file in zip(self._labels, self._files[self._file_pos :]):
234234
file and label and label.setText(file)
235235

236236
for label in self._lebals:
237237
label.setText("")
238238

239-
files = self._files[:self._file_pos]
239+
files = self._files[: self._file_pos]
240240
files.reverse()
241241

242242
for label, file in zip(self._lebals, files):
243243
file and label and label.setText(file)
244244

245+
245246
_cloud_icos_0 = {
246247
0: "/system/stickcplus2/cloud1.png",
247248
1: "/system/stickcplus2/cloud2.png",
@@ -500,7 +501,7 @@ async def on_view(self):
500501
w=135,
501502
h=20,
502503
font_align=Label.CENTER_ALIGNED,
503-
fg_color=0x00ccff,
504+
fg_color=0x00CCFF,
504505
bg_color=0x000000,
505506
font=M5.Lcd.FONTS.DejaVu18,
506507
)

tests/bluetooth/test_bleuart_client.py

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,39 @@
1313

1414

1515
def setup():
16-
global ble_central, nums, i
17-
18-
M5.begin()
19-
ble_central = BLEUARTClient()
20-
ble_central.connect('ble-uart', timeout=2000)
21-
while not (ble_central.is_connected()):
22-
time.sleep_ms(100)
23-
print('Connected')
24-
nums = [4, 8, 15, 16, 23, 46]
25-
i = 1
26-
while True:
27-
ble_central.write((str((nums[int(i - 1)]))))
28-
i = (i + 1) % len(nums)
29-
time.sleep(1)
30-
print((str('rx:') + str(((ble_central.read()).decode()))))
31-
ble_central.close()
32-
ble_central.deinit()
16+
global ble_central, nums, i
17+
18+
M5.begin()
19+
ble_central = BLEUARTClient()
20+
ble_central.connect("ble-uart", timeout=2000)
21+
while not (ble_central.is_connected()):
22+
time.sleep_ms(100)
23+
print("Connected")
24+
nums = [4, 8, 15, 16, 23, 46]
25+
i = 1
26+
while True:
27+
ble_central.write((str((nums[int(i - 1)]))))
28+
i = (i + 1) % len(nums)
29+
time.sleep(1)
30+
print((str("rx:") + str(((ble_central.read()).decode()))))
31+
ble_central.close()
32+
ble_central.deinit()
3333

3434

3535
def loop():
36-
global ble_central, nums, i
37-
M5.update()
36+
global ble_central, nums, i
37+
M5.update()
3838

3939

40-
if __name__ == '__main__':
41-
try:
42-
setup()
43-
while True:
44-
loop()
45-
except (Exception, KeyboardInterrupt) as e:
40+
if __name__ == "__main__":
4641
try:
47-
from utility import print_error_msg
48-
print_error_msg(e)
49-
except ImportError:
50-
print("please update to latest firmware")
42+
setup()
43+
while True:
44+
loop()
45+
except (Exception, KeyboardInterrupt) as e:
46+
try:
47+
from utility import print_error_msg
48+
49+
print_error_msg(e)
50+
except ImportError:
51+
print("please update to latest firmware")

tests/bluetooth/test_bleuart_server.py

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,35 @@
1313

1414

1515
def setup():
16-
global label0, ble_periph, data
16+
global label0, ble_periph, data
1717

18-
M5.begin()
19-
Widgets.fillScreen(0x222222)
20-
label0 = Widgets.Label("Text", 20, 31, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu18)
18+
M5.begin()
19+
Widgets.fillScreen(0x222222)
20+
label0 = Widgets.Label("Text", 20, 31, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
2121

22-
ble_periph = BLEUARTServer(name='ble-uart')
22+
ble_periph = BLEUARTServer(name="ble-uart")
2323

2424

2525
def loop():
26-
global label0, ble_periph, data
27-
M5.update()
28-
if (ble_periph.any()) > 0:
29-
data = ble_periph.read()
30-
label0.setText(str(data))
31-
ble_periph.write(data)
32-
else:
33-
time.sleep_ms(100)
34-
35-
36-
if __name__ == '__main__':
37-
try:
38-
setup()
39-
while True:
40-
loop()
41-
except (Exception, KeyboardInterrupt) as e:
26+
global label0, ble_periph, data
27+
M5.update()
28+
if (ble_periph.any()) > 0:
29+
data = ble_periph.read()
30+
label0.setText(str(data))
31+
ble_periph.write(data)
32+
else:
33+
time.sleep_ms(100)
34+
35+
36+
if __name__ == "__main__":
4237
try:
43-
from utility import print_error_msg
44-
print_error_msg(e)
45-
except ImportError:
46-
print("please update to latest firmware")
38+
setup()
39+
while True:
40+
loop()
41+
except (Exception, KeyboardInterrupt) as e:
42+
try:
43+
from utility import print_error_msg
44+
45+
print_error_msg(e)
46+
except ImportError:
47+
print("please update to latest firmware")

0 commit comments

Comments
 (0)