-
Notifications
You must be signed in to change notification settings - Fork 0
Setup
The CLI requires a client machine (your PC or any machine with python installed) and your MCU to be connected via the serial line. For most dev-boards, this is integrated into the normal USB connection used for power and flashing. If you have an off-the-shelf dev-board connected to your PC right now, there is a 90% chance that your hardware setup is ready for jescore.
Create a virtual python environment and install the CLI there.
python -m venv .venv
source .venv/bin/activate
pip install git+https://github.com/jesdev-io/jescorecli.gitYou can now call jescore -h for help on the client side or jescore help for help on the MCU side if it runs a program that contains jes_init().
The Python side of the CLI has these client-side arguments:
| -h | -p / --port | -v / --verbose | -b / --baudrate | -d / --discover | -l / --listen | --inline | --filter |
|---|---|---|---|---|---|---|---|
Standard argparse help output |
Followed by a port such as COM5 or /dev/ttyACM0
|
Enable debug output while scanning or communicating | Followed by the baudrate; this must match the MCU firmware | Discover jescore compatible devices and their ports |
Open a UART stream and print continuous MCU output | Extra flag for -l to print received output into the same line |
Only print messages containing one of the given job names; use brackets like [job1,job2] for multiple names |
I use jescore for many projects and therefore want it globally. This way I can just run jescore from any terminal on my machine. You can achieve the same with pipx or a forced pip installation (not recommended). Install pipx and run pipx install git+https://github.com/jesdev-io/jescorecli.git. The CLI can now be accessed from any terminal. The CLI only depends on one installable package, which is pyserial. For this reason, I deem it to be ok to install it globally.
In the end, all the jescore CLI uses is a UART TX and RX line. This means that you can omit the Python-based CLI if you know what you are doing. For example, you can use the terminal emulator PuTTY to open the serial stream directly. jescore will still respond if you configure your terminal emulator to send and receive messages in a manner that behaves like a local terminal (e.g., messages are sent on enter, not after every keystroke). You could even hook up another MCU to control the other. All it takes is the UART line and some string parsing. The Python wrapper is invoked by writing jescore <cmd>, which does not apply to the version with the direct UART connection. Here, you just send <cmd>, which is the name of a job you registered in the MCU code. To reiterate, these are two different pairs of shoes: a direct connection is a "stream", meaning that new prints from the MCU will show up in real time on the emulator. This is not the same as the Python wrapper calling for a response, which of course will only happen if a command is sent first. If you need a UART stream but would also like the Python CLI, refer to program interaction.