Custom buttons¶
Add custom buttons to the toolbar by configuring custom_buttons
in your JSON config. Each button can send serial commands, run REPL commands,
or execute scripts. The defaults have five: Info, which runs /cfg.info, and
one for each setting you change most, each showing its value: Baud
(/port.baud_rate cycle), EOL (/term.eol cycle), Echo (/term.echo
toggle) and Color (/term.color toggle). A config termapy creates, from the
New Config dialog, /cfg.new, --new, a board starter or a
quick open, turns on Info, EOL, Echo
and Color, in a column on the right of the output, and leaves Baud off until you
enable it. Edit them, enable them, or add more entries.
Each button object has these fields:
| Field | Description |
|---|---|
enabled |
true to show the button, false to hide it |
name |
Label displayed on the button; see {value} |
command |
Command to execute when clicked |
tooltip |
Hover text for the button |
Example¶
"custom_buttons": [
{
"enabled": true,
"name": "Info",
"command": "/cfg.info",
"tooltip": "Project info"
},
{
"enabled": true,
"name": "Reset",
"command": "ATZ",
"tooltip": "Send ATZ reset"
},
{
"enabled": false,
"name": "Btn3",
"command": "",
"tooltip": "Custom button 3"
}
]
Command format¶
- Plain text is sent to the serial device (e.g.
"ATZ") - Commands starting with
/run as REPL commands (e.g."/run test.run") {prefix}at the start of a command stands for the config'scmd_prefix, so a button keeps working when the prefix is not/; the shipped Info button is"{prefix}cfg.info"- Use
\nto chain multiple commands (e.g."ATZ\nAT+INFO") - Mixed serial and REPL commands work:
"ATZ\n/delay 500ms\nAT+INFO" - A setting's
toggleorcyclemakes a one-click switch:"/term.hex toggle"flips hex display, and"/term.output cycle"steps through the output levels
Showing a setting¶
{value} in a button's name shows the setting its command toggles or cycles:
{
"enabled": true,
"name": "Timestamps {value}",
"command": "{prefix}term.timestamps toggle",
"tooltip": "Timestamps on received lines"
}
The button reads Timestamps off, and a click turns it into Timestamps on*. The value is what
the bare command answers (/term.timestamps answers off), read again after every
command, so a change typed or made by a script shows too. The * means the session
changed the setting and the config file still has its old value; opening the config
editor offers to save it (Configuration). {value} needs a command
that toggles or cycles a setting; on any other, the config load warns and the button
shows -, which is also what it shows when the setting has nothing to give.
Placement¶
custom_buttons_side sets where the buttons go:
| Value | Placement |
|---|---|
bottom (default) |
In the bottom bar, between the hardware buttons and Log |
left |
A column on the left edge of the output |
right |
A column on the right edge of the output |
The bottom bar fits only a few buttons; a column stacks them with a blank
row above each and scrolls when there are more than fit. It is as wide as the longest name,
up to 24 columns. /cfg custom_buttons_side right moves the buttons for the
session; the config editor saves the setting.
In the bottom bar, a small gap separates the custom buttons from the hardware buttons and the system buttons (Log, SS, Cap). The demo config's five buttons (Demo Help through TempPlot):