Skip to content

Commit 0e2247a

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

File tree

8 files changed

+73
-72
lines changed

8 files changed

+73
-72
lines changed

m5stack/components/M5Unified/mpy_m5mic.cpp

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -23,67 +23,67 @@ namespace m5
2323
switch (mp_obj_str_get_qstr(kwargs->table[i].key)) {
2424
case MP_QSTR_pin_data_in:
2525
cfg.pin_data_in = (int)mp_obj_get_int(kwargs->table[i].value);
26-
break;
26+
break;
2727

2828
case MP_QSTR_pin_bck:
2929
cfg.pin_bck = (int)mp_obj_get_int(kwargs->table[i].value);
30-
break;
30+
break;
3131

3232
case MP_QSTR_pin_mck:
3333
cfg.pin_mck = (int)mp_obj_get_int(kwargs->table[i].value);
34-
break;
34+
break;
3535

3636
case MP_QSTR_pin_ws:
3737
cfg.pin_ws = (int)mp_obj_get_int(kwargs->table[i].value);
38-
break;
38+
break;
3939

4040
case MP_QSTR_sample_rate:
4141
cfg.sample_rate = (uint32_t)mp_obj_get_int(kwargs->table[i].value);
42-
break;
42+
break;
4343

4444
case MP_QSTR_stereo:
4545
cfg.stereo = (bool)mp_obj_is_true(kwargs->table[i].value);
46-
break;
46+
break;
4747

4848
case MP_QSTR_input_offset:
4949
cfg.input_offset = (int)mp_obj_get_int(kwargs->table[i].value);
50-
break;
50+
break;
5151

5252
case MP_QSTR_over_sampling:
5353
cfg.over_sampling = (uint8_t)mp_obj_get_int(kwargs->table[i].value);
54-
break;
54+
break;
5555

5656
case MP_QSTR_magnification:
5757
cfg.magnification = (uint8_t)mp_obj_get_int(kwargs->table[i].value);
58-
break;
58+
break;
5959

6060
case MP_QSTR_noise_filter_level:
6161
cfg.noise_filter_level = (uint8_t)mp_obj_get_int(kwargs->table[i].value);
62-
break;
62+
break;
6363

6464
case MP_QSTR_use_adc:
6565
cfg.use_adc = (bool)mp_obj_is_true(kwargs->table[i].value);
66-
break;
66+
break;
6767

6868
case MP_QSTR_dma_buf_len:
6969
cfg.dma_buf_len = (size_t)mp_obj_get_int(kwargs->table[i].value);
70-
break;
70+
break;
7171

7272
case MP_QSTR_dma_buf_count:
7373
cfg.dma_buf_count = (size_t)mp_obj_get_int(kwargs->table[i].value);
74-
break;
74+
break;
7575

7676
case MP_QSTR_task_priority:
7777
cfg.task_priority = (uint8_t)mp_obj_get_int(kwargs->table[i].value);
78-
break;
78+
break;
7979

8080
case MP_QSTR_task_pinned_core:
8181
cfg.task_pinned_core = (uint8_t)mp_obj_get_int(kwargs->table[i].value);
82-
break;
82+
break;
8383

8484
case MP_QSTR_i2s_port:
8585
cfg.i2s_port = (i2s_port_t)mp_obj_get_int(kwargs->table[i].value);
86-
break;
86+
break;
8787

8888
default:
8989
goto unknown;
@@ -120,67 +120,67 @@ namespace m5
120120
switch (mp_obj_str_get_qstr(args[1])) {
121121
case MP_QSTR_pin_data_in:
122122
return mp_obj_new_int(cfg.pin_data_in);
123-
break;
123+
break;
124124

125125
case MP_QSTR_pin_bck:
126126
return mp_obj_new_int(cfg.pin_bck);
127-
break;
127+
break;
128128

129129
case MP_QSTR_pin_mck:
130130
return mp_obj_new_int(cfg.pin_mck);
131-
break;
131+
break;
132132

133133
case MP_QSTR_pin_ws:
134134
return mp_obj_new_int(cfg.pin_ws);
135-
break;
135+
break;
136136

137137
case MP_QSTR_sample_rate:
138138
return mp_obj_new_int(cfg.sample_rate);
139-
break;
139+
break;
140140

141141
case MP_QSTR_stereo:
142142
return mp_obj_new_bool(cfg.stereo);
143-
break;
143+
break;
144144

145145
case MP_QSTR_input_offset:
146146
return mp_obj_new_int(cfg.input_offset);
147-
break;
147+
break;
148148

149149
case MP_QSTR_over_sampling:
150150
return mp_obj_new_int(cfg.over_sampling);
151-
break;
151+
break;
152152

153153
case MP_QSTR_magnification:
154154
return mp_obj_new_int(cfg.magnification);
155-
break;
155+
break;
156156

157157
case MP_QSTR_noise_filter_level:
158158
return mp_obj_new_int(cfg.noise_filter_level);
159-
break;
159+
break;
160160

161161
case MP_QSTR_use_adc:
162162
return mp_obj_new_bool(cfg.use_adc);
163-
break;
163+
break;
164164

165165
case MP_QSTR_dma_buf_len:
166166
return mp_obj_new_int(cfg.dma_buf_len);
167-
break;
167+
break;
168168

169169
case MP_QSTR_dma_buf_count:
170170
return mp_obj_new_int(cfg.dma_buf_count);
171-
break;
171+
break;
172172

173173
case MP_QSTR_task_priority:
174174
return mp_obj_new_int(cfg.task_priority);
175-
break;
175+
break;
176176

177177
case MP_QSTR_task_pinned_core:
178178
return mp_obj_new_int(cfg.task_pinned_core);
179-
break;
179+
break;
180180

181181
case MP_QSTR_i2s_port:
182182
return mp_obj_new_int(cfg.i2s_port);
183-
break;
183+
break;
184184

185185
default:
186186
goto unknown;

m5stack/components/M5Unified/mpy_m5spk.cpp

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,59 +22,59 @@ namespace m5
2222
switch (mp_obj_str_get_qstr(kwargs->table[i].key)) {
2323
case MP_QSTR_pin_data_out:
2424
cfg.pin_data_out = (int)mp_obj_get_int(kwargs->table[i].value);
25-
break;
25+
break;
2626

2727
case MP_QSTR_pin_bck:
2828
cfg.pin_bck = (int)mp_obj_get_int(kwargs->table[i].value);
29-
break;
29+
break;
3030

3131
case MP_QSTR_pin_ws:
3232
cfg.pin_ws = (int)mp_obj_get_int(kwargs->table[i].value);
33-
break;
33+
break;
3434

3535
case MP_QSTR_sample_rate:
3636
cfg.sample_rate = (uint32_t)mp_obj_get_int(kwargs->table[i].value);
37-
break;
37+
break;
3838

3939
case MP_QSTR_stereo:
4040
cfg.stereo = (bool)mp_obj_is_true(kwargs->table[i].value);
41-
break;
41+
break;
4242

4343
case MP_QSTR_buzzer:
4444
cfg.buzzer = (bool)mp_obj_is_true(kwargs->table[i].value);
45-
break;
45+
break;
4646

4747
case MP_QSTR_use_dac:
4848
cfg.use_dac = (bool)mp_obj_is_true(kwargs->table[i].value);
49-
break;
49+
break;
5050

5151
case MP_QSTR_dac_zero_level:
5252
cfg.dac_zero_level = (uint8_t)mp_obj_get_int(kwargs->table[i].value);
53-
break;
53+
break;
5454

5555
case MP_QSTR_magnification:
5656
cfg.magnification = (uint8_t)mp_obj_get_int(kwargs->table[i].value);
57-
break;
57+
break;
5858

5959
case MP_QSTR_dma_buf_len:
6060
cfg.dma_buf_len = (size_t)mp_obj_get_int(kwargs->table[i].value);
61-
break;
61+
break;
6262

6363
case MP_QSTR_dma_buf_count:
6464
cfg.dma_buf_count = (size_t)mp_obj_get_int(kwargs->table[i].value);
65-
break;
65+
break;
6666

6767
case MP_QSTR_task_priority:
6868
cfg.task_priority = (uint8_t)mp_obj_get_int(kwargs->table[i].value);
69-
break;
69+
break;
7070

7171
case MP_QSTR_task_pinned_core:
7272
cfg.task_pinned_core = (uint8_t)mp_obj_get_int(kwargs->table[i].value);
73-
break;
73+
break;
7474

7575
case MP_QSTR_i2s_port:
7676
cfg.i2s_port = (i2s_port_t)mp_obj_get_int(kwargs->table[i].value);
77-
break;
77+
break;
7878

7979
default:
8080
goto unknown;
@@ -110,59 +110,59 @@ namespace m5
110110
switch (mp_obj_str_get_qstr(args[1])) {
111111
case MP_QSTR_pin_data_out:
112112
return mp_obj_new_int(cfg.pin_data_out);
113-
break;
113+
break;
114114

115115
case MP_QSTR_pin_bck:
116116
return mp_obj_new_int(cfg.pin_bck);
117-
break;
117+
break;
118118

119119
case MP_QSTR_pin_ws:
120120
return mp_obj_new_int(cfg.pin_ws);
121-
break;
121+
break;
122122

123123
case MP_QSTR_sample_rate:
124124
return mp_obj_new_int(cfg.sample_rate);
125-
break;
125+
break;
126126

127127
case MP_QSTR_stereo:
128128
return mp_obj_new_bool(cfg.stereo);
129-
break;
129+
break;
130130

131131
case MP_QSTR_buzzer:
132132
return mp_obj_new_bool(cfg.buzzer);
133-
break;
133+
break;
134134

135135
case MP_QSTR_use_dac:
136136
return mp_obj_new_bool(cfg.use_dac);
137-
break;
137+
break;
138138

139139
case MP_QSTR_dac_zero_level:
140140
return mp_obj_new_int(cfg.dac_zero_level);
141-
break;
141+
break;
142142

143143
case MP_QSTR_magnification:
144144
return mp_obj_new_int(cfg.magnification);
145-
break;
145+
break;
146146

147147
case MP_QSTR_dma_buf_len:
148148
return mp_obj_new_int(cfg.dma_buf_len);
149-
break;
149+
break;
150150

151151
case MP_QSTR_dma_buf_count:
152152
return mp_obj_new_int(cfg.dma_buf_count);
153-
break;
153+
break;
154154

155155
case MP_QSTR_task_priority:
156156
return mp_obj_new_int(cfg.task_priority);
157-
break;
157+
break;
158158

159159
case MP_QSTR_task_pinned_core:
160160
return mp_obj_new_int(cfg.task_pinned_core);
161-
break;
161+
break;
162162

163163
case MP_QSTR_i2s_port:
164164
return mp_obj_new_int(cfg.i2s_port);
165-
break;
165+
break;
166166

167167
default:
168168
goto unknown;

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/libs/umqtt/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ def __init__(
2020
key_path = ssl_params1.get("key", None)
2121
key_value = self._load_file(key_path)
2222
if key_value:
23-
ssl_params1['key'] = key_value
23+
ssl_params1["key"] = key_value
2424

2525
cert_path = ssl_params1.get("cert", None)
2626
cert_value = self._load_file(cert_path)
2727
if cert_value:
28-
ssl_params1['cert'] = cert_value
28+
ssl_params1["cert"] = cert_value
2929

3030
super().__init__(client_id, server, port, user, password, keepalive, ssl, ssl_params1)
3131
self.set_callback(self._callback)

m5stack/libs/unit/uwb.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,3 @@ def update_new_value_loop(self):
130130
line[separate + 1 : -3]
131131
)
132132
rx_times += 1
133-

m5stack/modules/startup/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def startup(boot_opt, timeout: int = 60) -> None:
5858
board_id = M5.getBoard()
5959
if board_id == M5.BOARD.M5StickCPlus2:
6060
from machine import Pin
61+
6162
pin4 = Pin(4, Pin.OUT)
6263
pin4.value(1)
6364

m5stack/modules/startup/stickcplus.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,7 @@ def startup(self, ssid: str, pswd: str, timeout: int = 60) -> None:
717717
bg_img.set_src(BK_IMG)
718718
M5.Lcd.setBrightness(0)
719719
import time
720+
720721
for i in range(0, 128, 20):
721722
M5.Lcd.setBrightness(i)
722723
time.sleep_ms(80)

0 commit comments

Comments
 (0)