This article is an overview of the VEX Visual Studio Code Extension UI(User Interface). The extension supports the development of C++ and Python projects for VEX IQ 2nd Generation, EXP, and V5 platforms.
UI Components
There are 3 major components to the VEX VS Code Extension.
- Toolbar
- Activity Bar and Side Bar
- Terminal Panel
Toolbar
The toolbar gives users a quick way to interact with VEX VS Code extension projects VEX Brains, and VEX Controllers. The toolbar is only active when a valid VEX project is open in VS Code. A valid VEX project is a project that is created or imported by the extension. Opening a VEXcode or VEXcode Pro project is not valid and will need to be imported.
Device Picker
The device picker has two main functions. First, it displays a brain or controller icon representing the connected VEX Device type.
Second, when the device list icon is clicked, a quick pick list appears with all of the connected VEX Devices. The user can select which device the extension will connect to.
The current connected device will always appear at the top of the list followed by all other devices sorted by device type(Brain or Controller) and platform(IQ 2nd Generation, EXP, and V5).
Each device item contains the Brain Name, Platform, Device type and device path information.
Important
If a controller is connected to a computer, but does not have a radio link to a brain, no brain name will be displayed next to the list item or device list status bar icon.
Slot Selector
The slot selector icon allows the user to pick which slot the extension will download or play a user program on.
When the slot selector icon is clicked, a quick pick list appears with the available user program slots 1-8.
Build/Download
The Build/Download icon changes functions if a VEX Brain or a VEX Controller is connected.
If a VEX Device is not connected then the build icon is shown. When clicked, the project will only build.
If a VEX Device is connected, then the download icon is shown. When clicked, the project will build and if successful, will be downloaded to the VEX Device.
Play
The play icon, when clicked, runs the user program in the selected slot.
Stop
The stop icon, when clicked, stops a user program.
Selected Workspace
VS Code supports multi workspace projects. The project selector allows users to switch between VEX projects when multiple exist inside the workspace.
When the project selector icon is clicked, a quick pick list appears with all valid projects.
Important
If a project is not valid, it will not be shown in the project quick pick list. A project is not valid unless it has been created or imported by the VEX VS Code Extension.
Python File Selector(Python Only)
When a VEX python project is selected the python file selector will appear in the toolbar. Python for VEX only supports single file downloads currently.
When the icon is clicked, a quick pick list appears with all python files located in the workspace directory.
The python file selector allows the user to switch between python source files(.py)
VEX Activity Bar and Sidebar
Projects Actions
The vex activity bar contains the Project Actions view and the VEX Device Info view.
The Project actions view is used for creating a new project or importing an existing VEXcode or VEXcode Pro Project.
For more information about creating a new project, check out this article!
Version information is also displayed in the bottom left and right hand corners of the view.
Important
If a VEXcode or VEXcode Pro project is open in the editor then it will not be considered a valid VEX Project, the project needs to be imported using the Import button in the VEX sidebar.
VEX Device Info
The VEX Device Info view gives the user an overview of the connected VEX Brain or VEX Controller. VEXos Version, serial port path, user program, and device information can all be found in this view. Other functions such as VEXos firmware updates, screen shots, setting brain name and settings team number can also be performed through this view as well.
System Information
The system information provides a brief overview of a connected VEX Device. This includes a device’s VEXos version, Brain name, team number, Brain ID, and python runtime version information.
Serial Port Information
Serial Port information displays the device path for each port available for a VEX Device. Most VEX Devices enumerate as two serial ports. The Communication serial port is used to download programs and control the brain functions. The User serial port is used to transfer data between the user app running on the Brain and the host computer connected via USB. The V5 Controller is the only VEX device that has just a Communication serial port and no User serial port.
Programs Information
Program information displays a list of all downloaded user programs on a VEX Brain.
Each program list item can be expanded to show additional information about each user program, such as slot location, filename, language type, filesize, and time of download.
Devices Information
Devices information shows a list of all smart port devices connected to a VEX Brain. Each list item shows the smart port number and device type.
Each Device list item can be expanded to show firmware version information about each smart port device.
Controller linked status is displayed when connected to VEX Brain Device.
VEX Brain is linked to a VEX Controller
VEX Brain is not linked to a VEX Controller
VEX V5 Controller is tethered to a VEX V5 Brain
Screen Shots
By clicking on the Camera icon, a user can take and download a screenshot from a VEX Brain.
Screen shots are only available when connected directly to a VEX Brain via USB
Battery Medic (V5 Brain Only)
By clicking on the Heart icon, the extension will download and run the battery medic user program.
Set Brain Name
By clicking on the Pencil icon next to system->name , a user can set the name for a VEX Brain.
After the Pencil icon is clicked, an input box will appear at the top of the VS Code editor. Type the new brain name in the input box and press enter to set.
Set Team Number
By clicking on the Pencil icon next to system->team , a user can set the team number for a VEX Brain.
After the Pencil icon is clicked then an input box will appear at the top of the VS Code editor. Type the new team number in the input box and press enter to set.
Erase User Program
By clicking on the Trashcan icon next to programs->project name, a user can erase a program in a specific slot. IMPORTANT, once you erase a program it can not be recovered. Please use caution when using this feature.
Device Info Warnings
VEXos Update
When a VEX Brain’s VEXos version is out of date, a warning message icon appears next to the VEXos version and both Brain icons turn yellow.
To resolve this warning a user should update VEXos for their VEXos Brain.
VEXos can be updated by clicking the up arrow next to the VEX Brain Icon.
Also a notification box will appear in the bottom right corner of the VS Code editor when VEXos is out of date. A user can start a VEXos update by clicking the “Update” button or click the “Ignore” button to skip the VEXos update.
Brain not linked to connected Controller
The VEX Controller icon will turn yellow when a VEX Controller is connected to a computer, but is not linked to a VEX Brain.
To resolve this warning a user should link a VEX Controller to a VEX Brain
Terminal Panel
The VEX VS Code Extension provides two terminals on startup, the Log Terminal and the Interactive Terminal
Log Terminal
The Log Terminal displays build output, build error, and download results.
Interactive Terminal
The Interactive Terminal has two functions, displaying printf logs and sending raw keystrokes back to a user program. In order to take advantage of the Interactive terminal a Brain or Controller must be connected to a computer running the VEX VS Code Extension. Interactive terminal output gets cleared by default after building and downloading a user program.
User Settings
User settings are global settings settings that visual studio code offers for each extension. User settings are applied to every VEX VS Code extension project.
How to access VEX user settings
Click the gear in the left hand corner of VS Code and a context menu will appear
In the context menu, click the “Settings” item and a settings page will appear.
In the left hand list view, click on the “Extensions” item. Next, scroll down to the bottom and find the item labeled “VEX”.
Click on the “VEX” list item.
The VEX User settings will appear in the right hand panel.
Settings Overview
Controller Channel (V5 Controller only)
The Controller Channel setting controls the radio communication channel type between a V5 Brain and V5 Controller.
This setting only applies when VS Code is connected to a V5 Controller via USB and the controller is connected to a V5 Brain via VEXnet. The user can pick between Download and Pit channels. When set to Download, the radio will jump to a download VEXnet channel once a user program download is initiated. The download channel allows for higher data rates and more efficient downloads. When set to Pit, the radio will remain on a pit channel and the download will take much longer. By default this setting is set to Download.
Cpp Project SDK Home
DO NOT EDIT THIS SETTING.
Cpp Toolchain Path
Cpp Toolchain Path sets the Path for the toolchain that is used when building a C++ VEX VS Code project.
Enable User Terminal
The Enable User Terminal setting allows the extension to open the user serial port when a VEX Brain or VEX Controller is detected by the extension. The only exception applies to a V5 Controller which does not enumerate with a user serial port.
Enable allows the extension to connect to a userport on startup and will create the Interactive Terminal. If enable is selected while the extension is running, the extension will try to open the userport if a device is connected.
Disable prevents the extension from connecting to the user port on startup and won’t create an Interactive Terminal. If disable is selected while the extension is running, the extension will close the user port and remove the Interactive Terminal.
Project Build Type
Project Build Type sets how the extension will build a C++ project. The user can set the build type to Build or Rebuild.
Build only build the project when Make detects any changes in the project’s source code.
Rebuild cleans the project’s build directory, then builds the project. This option is normally much slower.
Project Home
Project Home sets the default home directory for a new project when completing the New Project wizard.
Run After Download
Run After Download when enabled, causes the user program to run after it is downloaded to a VEX Brain.
Python SDK Home
DO NOT EDIT THIS SETTING.
VEX Command Help
VEX Command Help allows access to documentation for specific functions included in the C++ and Python API (Application Programming Interface). Documentation is specific to each VEX Platform(IQ 2nd Generation, EXP, V5).
To access VEX Command Help, first highlight the text of the function to search for.
Right Click on the selected text, and a context menu will appear.
Next Click on the VEX Command Help to access documentation.
If VEX Command Help finds an exact match, a new webview will appear with relevant documentation.
If multiple documents match the selected text, then a drop down will appear with a filtered list of relevant documentation.