Anthony DiGirolamo | f90c669 | 2024-07-13 22:13:34 +0000 | [diff] [blame] | 1 | # This is a pw_console config file that defines a default window layout. |
| 2 | # For more info on what can be added to this file see: |
| 3 | # https://pigweed.dev/pw_console/py/pw_console/docs/user_guide.html#configuration |
| 4 | config_title: pw_console |
| 5 | |
| 6 | # Window layout |
| 7 | windows: |
| 8 | # Left split with tabbed views. |
| 9 | Split 1 tabbed: |
| 10 | Python Repl: |
| 11 | hidden: False |
| 12 | # Right split with stacked views. |
| 13 | Split 2 stacked: |
| 14 | Device Logs: |
| 15 | hidden: False |
| 16 | Host Logs: |
| 17 | hidden: False |
Anthony DiGirolamo | 1415626 | 2024-07-19 17:06:14 +0000 | [diff] [blame] | 18 | Pubsub Events: |
| 19 | loggers: |
| 20 | device.pubsub_events: |
| 21 | level: DEBUG |
| 22 | hidden: False |
Anthony DiGirolamo | f90c669 | 2024-07-13 22:13:34 +0000 | [diff] [blame] | 23 | |
| 24 | # Color options |
| 25 | ui_theme: dark |
| 26 | # ui_theme: nord |
| 27 | # ui_theme: high-contrast-dark |
| 28 | code_theme: pigweed-code |
| 29 | # code_theme: pigweed-code-light |
| 30 | # code_theme: gruvbox-dark |
| 31 | swap_light_and_dark: False |
| 32 | |
| 33 | # Display options |
| 34 | spaces_between_columns: 2 |
| 35 | window_column_split_method: vertical |
| 36 | # window_column_split_method: horizontal |
| 37 | # hide_date_from_log_time: True |
Anthony DiGirolamo | 1415626 | 2024-07-19 17:06:14 +0000 | [diff] [blame] | 38 | recolor_log_lines_to_match_level: False |
Anthony DiGirolamo | f90c669 | 2024-07-13 22:13:34 +0000 | [diff] [blame] | 39 | |
| 40 | snippets: |
| 41 | Echo RPC: |
| 42 | code: | |
| 43 | device.rpcs.pw.rpc.EchoService.Echo(msg='hello world') |
| 44 | description: | |
| 45 | Send a string to the device and receive a response with the same |
| 46 | message back. |
| 47 | |
| 48 | >>> device.rpcs.pw.rpc.EchoService.Echo(msg='hello world') |
| 49 | (Status.OK, pw.rpc.EchoMessage(msg='hello world')) |
| 50 | |
| 51 | Reboot to bootloader: |
| 52 | code: | |
| 53 | device.rpcs.board.Board.Reboot(reboot_type=1) |
| 54 | description: | |
| 55 | Sent a reboot request to the device. The console must be |
| 56 | relaunched to reconnect. |
| 57 | |
| 58 | Get onboard temp sensor value: |
| 59 | code: | |
| 60 | device.rpcs.board.Board.OnboardTemp() |
| 61 | description: | |
| 62 | Get the current value of the onboard temperature sensor. |
| 63 | |
| 64 | ```pycon |
| 65 | >>> device.rpcs.board.Board.OnboardTemp() |
| 66 | (Status.OK, board.OnboardTempResponse(temp=24.797744750976562)) |
| 67 | ``` |
| 68 | |
| 69 | Log onboard temp sensor values every 1000ms: |
| 70 | code: | |
| 71 | call = device.rpcs.board.Board.OnboardTempStream.invoke( |
| 72 | request_args=dict(sample_interval_ms=1000), |
| 73 | on_next=lambda _, message: LOG.info(message) |
| 74 | ) |
| 75 | description: | |
| 76 | Start logging with: |
| 77 | |
| 78 | ```pycon |
| 79 | >>> call = device.rpcs.board.Board.OnboardTempStream.invoke(request_args=dict(sample_interval_ms=1000), on_next=lambda _, message: LOG.info(message)) |
| 80 | ``` |
| 81 | |
| 82 | Log messages will appear in the 'Host Logs' window. |
| 83 | To stop the streaming RPC run `call.cancel()`: |
| 84 | |
| 85 | ```pycon |
| 86 | >>> call.cancel() |
| 87 | True |
| 88 | ``` |
| 89 | |
| 90 | # TODO: Make snippets for the following RPCs |
| 91 | # device.rpcs.blinky.Blinky.ToggleLed |
| 92 | # device.rpcs.blinky.Blinky.Blink |
| 93 | # device.rpcs.blinky.Blinky.Pulse |
| 94 | # device.rpcs.blinky.Blinky.SetRgb |
| 95 | # device.rpcs.blinky.Blinky.Rainbow |
| 96 | # device.rpcs.blinky.Blinky.IsIdle |
| 97 | # device.rpcs.morse_code.MorseCode.Send |
| 98 | |