Skip to content

Commit 531435b

Browse files
committed
libs/module/grbl.py: Code format.
Signed-off-by: lbuque <[email protected]>
1 parent 7b843c1 commit 531435b

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

m5stack/libs/module/grbl.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
from .mbus import i2c1
66
from .module_helper import ModuleError
7-
import struct
87
from micropython import const
9-
import re, math
8+
import re
9+
import math
1010
import time
1111

1212

@@ -49,7 +49,7 @@ def __init__(
4949
5050
params:
5151
address:
52-
note: The I2C address of the device.
52+
note: The I2C address of the device.
5353
"""
5454

5555
self.i2c = i2c1
@@ -70,7 +70,7 @@ def g_code(self, command):
7070
7171
params:
7272
command:
73-
note: The G-code command.
73+
note: The G-code command.
7474
"""
7575
self.i2c.writeto(self.addr, command + "\n")
7676
return self.get_code_time(command)
@@ -83,10 +83,10 @@ def get_code_time(self, code) -> int:
8383
8484
params:
8585
code:
86-
note: The G-code command
86+
note: The G-code command
8787
8888
return:
89-
note: The estimated time of the command.
89+
note: The estimated time of the command.
9090
9191
"""
9292
x_value = re.search(r"X-*\d+", code)
@@ -116,13 +116,13 @@ def turn(self, x=None, y=None, z=None, speed=None) -> int:
116116
117117
params:
118118
x:
119-
note: The position of the X motor, 1.6=360°.
119+
note: The position of the X motor, 1.6=360°.
120120
y:
121-
note: The position of the Y motor, 1.6=360°.
121+
note: The position of the Y motor, 1.6=360°.
122122
z:
123-
note: The position of the Z motor, 1.6=360°.
123+
note: The position of the Z motor, 1.6=360°.
124124
speed:
125-
note: The speed of the motor.
125+
note: The speed of the motor.
126126
"""
127127
command = "G1"
128128
command += " X{}".format(x) if x is not None else ""
@@ -140,11 +140,11 @@ def set_mode(self, mode):
140140
141141
params:
142142
mode:
143-
note: The mode of the motor.
144-
field: dropdown
145-
options:
146-
Absolute: GRBLModule.MODE_ABSOLUTE
147-
Relative: GRBLModule.MODE_RELATIVE
143+
note: The mode of the motor.
144+
field: dropdown
145+
options:
146+
Absolute: GRBLModule.MODE_ABSOLUTE
147+
Relative: GRBLModule.MODE_RELATIVE
148148
"""
149149
self.mode = mode
150150
if mode == self.MODE_ABSOLUTE:
@@ -160,13 +160,13 @@ def init(self, x_step=None, y_step=None, z_step=None, acc=None):
160160
161161
params:
162162
x_step:
163-
note: The step of the X motor.
163+
note: The step of the X motor.
164164
y_step:
165-
note: The step of the Y motor.
165+
note: The step of the Y motor.
166166
z_step:
167-
note: The step of the Z motor.
167+
note: The step of the Z motor.
168168
acc:
169-
note: The acceleration of the motor.
169+
note: The acceleration of the motor.
170170
"""
171171
if x_step:
172172
self.i2c.writeto(self.addr, "$0={}\n".format(x_step))
@@ -197,7 +197,7 @@ def get_message(self) -> str:
197197
en: Get the message.
198198
cn: 获取消息。
199199
return:
200-
note: The message string.
200+
note: The message string.
201201
"""
202202
i2c_data = ""
203203
while True:
@@ -214,7 +214,7 @@ def get_status(self) -> str:
214214
en: Get the status.
215215
cn: 获取状态。
216216
return:
217-
note: The status string.
217+
note: The status string.
218218
"""
219219
self.flush()
220220
self.i2c.writeto(self.addr, "@")
@@ -226,7 +226,7 @@ def get_idle_state(self) -> bool:
226226
en: Get the idle state.
227227
cn: 获取空闲状态。
228228
return:
229-
note: The idle state.
229+
note: The idle state.
230230
"""
231231
return self.get_status()[0] == "I"
232232

@@ -236,7 +236,7 @@ def get_lock_state(self) -> bool:
236236
en: Get the lock state.
237237
cn: 获取锁定状态。
238238
return:
239-
note: The lock state.
239+
note: The lock state.
240240
"""
241241
return self.get_status()[0] == "A"
242242

0 commit comments

Comments
 (0)