Skip to content

Commit ef97522

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

File tree

8 files changed

+39
-35
lines changed

8 files changed

+39
-35
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/fire/app.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
except ImportError:
44
import asyncio
55

6+
67
def generator(d):
78
try:
89
len(d)
@@ -15,7 +16,8 @@ def generator(d):
1516
while d:
1617
yield from d
1718

18-
class AppSelector():
19+
20+
class AppSelector:
1921
def __init__(self, apps) -> None:
2022
self._apps = apps
2123
self._id = 0
@@ -27,6 +29,7 @@ def next(self):
2729
def current(self):
2830
return self._apps[self._id]
2931

32+
3033
class AppBase:
3134
def __init__(self) -> None:
3235
self._task = None
@@ -76,4 +79,3 @@ def stop(self):
7679

7780
def uninstall(self):
7881
self.on_uninstall()
79-

m5stack/modules/startup/fire/apps/app_list.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import sys
88

99

10-
class Rectangle():
10+
class Rectangle:
1111
def __init__(self, x, y, w, h, color, fill_c, parent=M5.Lcd) -> None:
1212
self._x = x
1313
self._y = y
@@ -203,4 +203,3 @@ async def _btnb_event_handler(self, fw):
203203
async def _btnc_event_handler(self, fw):
204204
execfile("apps/" + self._files[self._file_pos])
205205
sys.exit(0)
206-

m5stack/modules/startup/fire/apps/app_run.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
import machine
99
import os
1010
import time
11+
1112
try:
1213
import M5Things
1314

1415
_HAS_SERVER = True
1516
except ImportError:
1617
_HAS_SERVER = False
1718

19+
1820
class RunApp(AppBase):
1921
def __init__(self, icos: dict, data=None) -> None:
2022
super().__init__()
@@ -122,12 +124,7 @@ def _get_file_info(path) -> tuple(str, str, str):
122124
mtime = "Time: ----/--/-- --:--:--"
123125
else:
124126
mtime = "Time: {:04d}/{:d}/{:d} {:02d}:{:02d}:{:02d}".format(
125-
mtime[0],
126-
mtime[1],
127-
mtime[2],
128-
mtime[3],
129-
mtime[4],
130-
mtime[5]
127+
mtime[0], mtime[1], mtime[2], mtime[3], mtime[4], mtime[5]
131128
)
132129

133130
with open(path, "r") as f:
@@ -149,5 +146,3 @@ def _get_file_info(path) -> tuple(str, str, str):
149146
ver = "Ver: None"
150147

151148
return (mtime, account, ver)
152-
153-

m5stack/modules/startup/fire/apps/dev.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import M5
33
from widgets.image import Image
44
from widgets.label import Label
5+
56
try:
67
import uasyncio as asyncio
78
except ImportError:
@@ -27,32 +28,36 @@
2728
except ImportError:
2829
_HAS_SERVER = False
2930

31+
3032
class NetworkStatus:
3133
INIT = 0
3234
RSSI_GOOD = 1
3335
RSSI_MID = 2
3436
RSSI_WORSE = 3
3537
DISCONNECTED = 4
3638

39+
3740
class CloudStatus:
3841
INIT = 0
3942
CONNECTED = 1
4043
DISCONNECTED = 2
4144

45+
4246
_NETWORK_STATUS_ICOS = {
4347
NetworkStatus.INIT: "/system/fire/WiFi/wifi_empty.png",
4448
NetworkStatus.RSSI_GOOD: "/system/fire/WiFi/wifi_good.png",
4549
NetworkStatus.RSSI_MID: "/system/fire/WiFi/wifi_mid.png",
4650
NetworkStatus.RSSI_WORSE: "/system/fire/WiFi/wifi_worse.png",
47-
NetworkStatus.DISCONNECTED: "/system/fire/WiFi/wifi_disconnected.png"
51+
NetworkStatus.DISCONNECTED: "/system/fire/WiFi/wifi_disconnected.png",
4852
}
4953

5054
_CLOUD_STATUS_ICOS = {
5155
CloudStatus.INIT: "/system/fire/Server/server_empty.png",
5256
CloudStatus.CONNECTED: "/system/fire/Server/Server_Green.png",
53-
CloudStatus.DISCONNECTED: "/system/fire/Server/server_error.png"
57+
CloudStatus.DISCONNECTED: "/system/fire/Server/server_error.png",
5458
}
5559

60+
5661
class DevApp(AppBase):
5762
def __init__(self, icos: dict, data=None) -> None:
5863
self._lcd = icos
@@ -71,7 +76,9 @@ def on_launch(self):
7176
self._cloud_status = self._get_cloud_status()
7277
self._network_status_src = _NETWORK_STATUS_ICOS[self._network_status]
7378
self._cloud_status_src = _CLOUD_STATUS_ICOS[self._cloud_status]
74-
self._battery_src = self._get_battery_src(M5.Power.getBatteryLevel(), M5.Power.isCharging())
79+
self._battery_src = self._get_battery_src(
80+
M5.Power.getBatteryLevel(), M5.Power.isCharging()
81+
)
7582
self._battery_text = self._get_battery_text(M5.Power.getBatteryLevel())
7683
self._avatar_src = self._get_avatar()
7784

@@ -94,7 +101,7 @@ def on_view(self):
94101
fg_color=0x000000,
95102
bg_color=0xEEEEEF,
96103
font=MontserratMedium18.FONT,
97-
parent=self._lcd
104+
parent=self._lcd,
98105
)
99106
self._mac_label.setText(self._mac_text)
100107

@@ -107,7 +114,7 @@ def on_view(self):
107114
fg_color=0x000000,
108115
bg_color=0xEEEEEF,
109116
font=MontserratMedium18.FONT,
110-
parent=self._lcd
117+
parent=self._lcd,
111118
)
112119
self._account_label.setText(self._account_text)
113120

@@ -146,7 +153,7 @@ def on_view(self):
146153
fg_color=0x534D4C,
147154
bg_color=0xFEFEFE,
148155
font=MontserratMedium10.FONT,
149-
parent=self._lcd
156+
parent=self._lcd,
150157
)
151158
self._battery_label.setText(self._battery_text)
152159
self._lcd.push(self._origin_x, self._origin_y)
@@ -283,7 +290,7 @@ def _get_avatar():
283290
def _get_bg_src(self):
284291
if _HAS_SERVER is True and M5Things.status() is 2:
285292
infos = M5Things.info()
286-
if infos[0] is 0 :
293+
if infos[0] is 0:
287294
return "/system/fire/developPrivate.png"
288295
elif infos[0] in (1, 2):
289296
return "/system/fire/developPublic.png"
@@ -293,7 +300,7 @@ def _get_bg_src(self):
293300
def _get_bar_src(self):
294301
if _HAS_SERVER is True and M5Things.status() is 2:
295302
infos = M5Things.info()
296-
if infos[0] is 0 :
303+
if infos[0] is 0:
297304
return "/system/fire/bar2.png"
298305
elif infos[0] in (1, 2):
299306
return "/system/fire/bar3.png"
@@ -357,5 +364,3 @@ def _get_battery_text(battery):
357364
return "{:d}%".format(battery)
358365
else:
359366
return ""
360-
361-

m5stack/modules/startup/fire/apps/settings.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import esp32
77
from common.font import MontserratMedium16
88

9+
910
class WiFiSetting(AppBase):
1011
def __init__(self, icos: dict, data=None) -> None:
1112
self._lcd = icos
@@ -31,7 +32,7 @@ def on_view(self):
3132
fg_color=0x000000,
3233
bg_color=0xFEFEFE,
3334
font=MontserratMedium16.FONT,
34-
parent=self._lcd
35+
parent=self._lcd,
3536
)
3637
self._ssid_label.setLongMode(Label.LONG_DOT)
3738
self._ssid_label.setText(self.ssid)
@@ -45,10 +46,10 @@ def on_view(self):
4546
fg_color=0x000000,
4647
bg_color=0xFEFEFE,
4748
font=MontserratMedium16.FONT,
48-
parent=self._lcd
49+
parent=self._lcd,
4950
)
5051
self._pwd_label.setLongMode(Label.LONG_DOT)
51-
self._pwd_label.setText('*' * 20)
52+
self._pwd_label.setText("*" * 20)
5253

5354
self._server_label = Label(
5455
"server",
@@ -59,7 +60,7 @@ def on_view(self):
5960
fg_color=0x000000,
6061
bg_color=0xFEFEFE,
6162
font=MontserratMedium16.FONT,
62-
parent=self._lcd
63+
parent=self._lcd,
6364
)
6465
self._server_label.setLongMode(Label.LONG_DOT)
6566
self._server_label.setText(self.server)

m5stack/modules/startup/fire/framework.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from .app import AppBase, AppSelector
2+
23
try:
34
import uasyncio as asyncio
45
except ImportError:
@@ -7,6 +8,7 @@
78
import M5
89
import gc
910

11+
1012
class Framework:
1113
def __init__(self) -> None:
1214
self._apps = []

0 commit comments

Comments
 (0)