Skip to content

Commit 734ea3f

Browse files
committed
finish serial refactoring
1 parent 5d59b9e commit 734ea3f

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

serial_plugin/serial_base.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,7 @@ def _disconnect(self) -> None:
5353
if self._ser and self._ser.is_open:
5454
self._ser.close()
5555

56-
def wake_repl(self) -> None:
57-
"""
58-
Invokes a wake-up sequence for the REPL (Read-Eval-Print Loop) interface by
59-
interacting with the serial connection.
60-
61-
:return: None
62-
"""
63-
self._ser.reset_input_buffer()
64-
self._ser.write(b'\r\n')
65-
sleep(0.2)
66-
67-
self._ser.read_all()
68-
69-
def send_command(self, command: str, wait: float = 0.3) -> str:
56+
def send_repl_command(self, command: str, wait: float = 0.3) -> str:
7057
"""
7158
Sends a command to the REPL interface and retrieves its output.
7259

serial_plugin/serial_get_file_structure.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def get_tree(self) -> str:
4545
"""
4646
self.enter_raw_repl()
4747
self._ser.write(self._TREE_CODE.encode('utf-8') + b'\x04')
48+
4849
output = b''
4950
start = time()
5051

@@ -61,6 +62,7 @@ def get_tree(self) -> str:
6162
break
6263

6364
self.exit_raw_repl()
65+
6466
out = output.decode(errors="ignore")
6567
debug(f"[DEBUG] tree output: {out}")
6668

serial_plugin/serial_get_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def get_version(self) -> str:
3737
:return: The extracted Python version as a string.
3838
:rtype: str
3939
"""
40-
output = self.send_command("import sys; print(sys.version)")
40+
output = self.send_repl_command("import sys; print(sys.version)")
4141
debug(f"[DEBUG] version output: {output}")
4242

4343
return self._extract_version(output)

0 commit comments

Comments
 (0)