Skip to content

Commit b11f65b

Browse files
committed
implement requested changes from pr
1 parent 867ecdb commit b11f65b

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

gs/backend/cli.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
from gs.backend.ground_station_cli import GroundStationShell
1717

18-
COM_PORT = argv[1]
19-
shell = GroundStationShell(COM_PORT)
20-
18+
if len(argv) == 2:
19+
COM_PORT = argv[1]
20+
shell = GroundStationShell(COM_PORT)
2121

2222
class CliPanel(ScrollableContainer):
2323
"""
@@ -54,7 +54,7 @@ def on_mount(self) -> None:
5454
"""
5555
Set up periodic CLI output refresh and initialize the output panel
5656
"""
57-
self.output_refresh = self.set_interval(1 / 600, self.update_cli)
57+
self.output_refresh = self.set_interval(1 / 120, self.update_cli)
5858
self.cli_output_panel = self.query_one("#cli-output-panel", Static)
5959

6060
# Buffer.getvalue() returns the contents of the string buffer as a str
@@ -251,17 +251,14 @@ def update_logs(self) -> None:
251251
with open("gs/backend/logs.log") as logs:
252252
self.logs = logs.read()
253253
except FileNotFoundError:
254-
print("[red]Logs file not found. Try running interface from root directory (OBC-Firmware)?[/red]")
254+
self.update("[red]Logs file not found. Try running interface from root directory (OBC-Firmware)[/red]")
255255

256256
def watch_logs(self, logs: str) -> None:
257257
"""
258258
Update logs panel with the latest logs
259259
"""
260260
self.update("LOGS\n\n" + self.logs)
261-
try:
262-
self.scroll_to_bottom()
263-
except Exception as e:
264-
print(e)
261+
self.scroll_to_bottom()
265262

266263
def scroll_to_bottom(self) -> None:
267264
"""
@@ -303,7 +300,7 @@ def compose(self) -> ComposeResult:
303300

304301
def main() -> None:
305302
"""
306-
Entry point for the CLI application, sets up serial and runs the app
303+
Usage: Entry point for the CLI application; opens the serial port at the com port and runs the ground station cli.
307304
"""
308305
if len(argv) != 2:
309306
print("One argument needed: Com Port")

gs/backend/ground_station_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def do_start_logging(self, line: str) -> None:
131131

132132
def do_print_logs(self, line: str) -> None:
133133
"""
134-
Prints out logs and polls for log_pathlogs that are comming in. Use a Keyboard Interupt to exit (e.g. Ctrl + C)
134+
Prints out logs and polls for log_pathlogs that are coming in. Use a Keyboard Interrupt to exit (e.g. Ctrl + C)
135135
"""
136136
self.stop_printing = False
137137

gs/backend/obc_utils/command_utils.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,15 +322,12 @@ def poll(
322322
com_port: str,
323323
file_path: str | Path,
324324
timeout: int = 0,
325-
print_console: bool = False,
326325
stop_flag: Callable[[], bool] | None = None,
327326
) -> None:
328327
"""
329328
A function that is supposed to run in the background to keep receiving logs from the board
330329
331330
:param com_port: The port that the board is connected to so it can poll
332-
:param print_console: Whether the function should print to console or not. By default, this is set to False. This is
333-
useful for the CLI where sometimes we want to print out the received logs from the board
334331
"""
335332

336333
comms = CommsPipeline()
@@ -376,5 +373,3 @@ def poll(
376373

377374
file.write(data_string)
378375
file.flush()
379-
# if print_console and len(data_string) != 0:
380-
# # print(data_string)

0 commit comments

Comments
 (0)