UI module¶
serial_toolbox.ui¶
- class serial_toolbox.ui.SerialMonitor(interface, config: Config)¶
A command-line serial monitor equipped with plotting functionality.
- interface¶
The serial interface for communication.
- Type:
- plotting¶
Flag to enable or disable plotting.
- Type:
bool
- print_numbers¶
Flag to control numeric data printing.
- Type:
bool
- data_lock¶
Lock to manage access to shared data.
- Type:
threading.Lock
- traces¶
List of data traces for plotting.
- Type:
list
- plot_queue¶
Queue for handling plot data.
- Type:
queue.Queue
- print_queue¶
Queue for handling print data.
- Type:
queue.Queue
- window_size¶
Size of the data window for the plot.
- Type:
int
- session¶
Interactive session for the command prompt.
- Type:
PromptSession
- animation¶
Animation instance for the plot.
- Type:
FuncAnimation, optional
- cmdloop(intro=None)¶
A replacement for the standard cmdloop with additional processing.
- Parameters:
intro (str, optional) – An introductory message to display at the start of the cmdloop.
- do_exit(arg)¶
Exit the serial monitor.
- Parameters:
arg (str) – Unused parameter.
Examples
- exit
Exit the serial monitor.
- do_send(arg)¶
Send a command via the serial interface.
- Parameters:
arg (str) – The command to send.
Examples
send TEST_COMMAND
send 54657374 (for HEX)
- doc_header = 'Commands (type help <command> for details):'¶
- help_exit()¶
Print detailed help for the exit command.
- help_send()¶
Print detailed help for the send command.
- intro = 'Type help or ? to list commands.\n'¶
- is_comma_separated_numbers(data_str)¶
Check if the given string is a comma-separated string of numbers.
- Parameters:
data_str (str) – The string to check.
- Returns:
True if the string is a comma-separated string of numbers, False otherwise.
- Return type:
bool
- on_close_plot(event)¶
Handle the plot window being closed.
- Parameters:
event (matplotlib.backend_bases.CloseEvent) – The close event for the plot window.
- postloop()¶
Hook method executed once when the cmdloop method is about to return.
- preloop()¶
Hook method executed once when the cmdloop method is called.
- print_rxd()¶
Print the received data without interrupting the CLI.
- prompt = '(sertools) '¶
- rxd_update()¶
Continuously update received data.
- update_plot(frame)¶
Update the plot with the received data.
- Parameters:
frame (int) – The current frame number.
- update_traces(values)¶
Update the traces with new values.
- Parameters:
values (list of float) – The new values to add to the traces.
- serial_toolbox.ui.serial_monitor(config_file)¶
Start and run the CLI application with configuration from a YAML file.
- Parameters:
config_file (str) – Path to the configuration file.