|
15 | 15 |
|
16 | 16 | from gs.backend.ground_station_cli import GroundStationShell |
17 | 17 |
|
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) |
21 | 21 |
|
22 | 22 | class CliPanel(ScrollableContainer): |
23 | 23 | """ |
@@ -54,7 +54,7 @@ def on_mount(self) -> None: |
54 | 54 | """ |
55 | 55 | Set up periodic CLI output refresh and initialize the output panel |
56 | 56 | """ |
57 | | - self.output_refresh = self.set_interval(1 / 600, self.update_cli) |
| 57 | + self.output_refresh = self.set_interval(1 / 120, self.update_cli) |
58 | 58 | self.cli_output_panel = self.query_one("#cli-output-panel", Static) |
59 | 59 |
|
60 | 60 | # Buffer.getvalue() returns the contents of the string buffer as a str |
@@ -251,17 +251,14 @@ def update_logs(self) -> None: |
251 | 251 | with open("gs/backend/logs.log") as logs: |
252 | 252 | self.logs = logs.read() |
253 | 253 | 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]") |
255 | 255 |
|
256 | 256 | def watch_logs(self, logs: str) -> None: |
257 | 257 | """ |
258 | 258 | Update logs panel with the latest logs |
259 | 259 | """ |
260 | 260 | 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() |
265 | 262 |
|
266 | 263 | def scroll_to_bottom(self) -> None: |
267 | 264 | """ |
@@ -303,7 +300,7 @@ def compose(self) -> ComposeResult: |
303 | 300 |
|
304 | 301 | def main() -> None: |
305 | 302 | """ |
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. |
307 | 304 | """ |
308 | 305 | if len(argv) != 2: |
309 | 306 | print("One argument needed: Com Port") |
|
0 commit comments