<<< etheli.com Home Page

clipytool


AcroNaze32 Board

clipytool is a command-line utility written in Python for interacting with a Cleanflight controller board.  Configuration settings may be backed up, restored and verified.  An interactive-terminal mode is also implemented.

Developed by etheli (ethomas997), building on the "cli.py" program by 'hrrr'

Download distribution:  clipytool_v1.1_dist.zip

clipytool can be run on any computer with Python version 2.7.x installed.  Download Python from:  https://www.python.org

If the error "ImportError: No module named serial" occurs then install the 'pyserial' package from:  http://sourceforge.net/projects/pyserial

The distribution contains 'clipytool.bat' batch (Windows) and 'clipytool' script (Linux/Unix/Mac) files that may be used to run the program.  (The script will need to be marked as executable with a command like "chmod 755 clipytool".)  If the batch/script file doesn't work, the program can also be launched with a command like:  python clipytool.py [arguments...]

Configuration settings may be read from the controller into a backup file using the 'backup' command:


clipytool -p PORT -b

where PORT is the name of the serial port to use.  A file will be generated (in the current directory) with a name in the form "cli_bkp_YYYYMMDD_hhmmss.txt", where "YYYYMMDD_hhmmss" is the current date and time.  After the file is created, a verify is performed to confirm that the settings where accurately retrieved.  (The verify process consists of reading in the current set of configuration settings and comparing them to those in the backup file.)

If a filename is specified after the "-b" parameter then that filename will be used.  If a directory is specified then the "cli_bkp_YYYYMMDD_hhmmss.txt" file will be be created in that directory.

Configuration settings from the backup file may be written to the controller using the 'restore' command:


clipytool -p PORT -r

where PORT is the name of the serial port to use.  The most recent file with a name matching "cli_bkp_*.txt" (in the current directory) will be read.  After the settings are written to the controller, a verify is performed to confirm that the settings where accurately transferred.

If a filename is specified after the "-r" parameter then that filename will be read.  If a directory is specified then the most recent file with a name matching "cli_bkp_*.txt" in that directory will be read.

Configuration settings may be verified against the settings in the controller using the "-y" parameter.  (A filename may be specified in the same manner as with the restore function.)  Also, file-comparison tools like WinMerge and 'diff' can be useful for showing the changes in backup files that have been generated.

The "-c" parameter may be used with the "-y" parameter to generate a file of settings in the controller that have changed.  If a file of default settings was created for the controller, it can be used to generate a file containing just the non-default settings, i.e.:

clipytool -p PORT -y cli_bkp_defaults.txt -c cli_bkp_settings_diff.txt

An interactive terminal mode may be entered using the command:


clipytool -p PORT -t

To exit the terminal mode, enter "exit" (to reboot the controller without saving any changes), or "save" (to save changes and reboot the controller), or "quit" (to exit the terminal mode without rebooting the controller [not usually used]).  Enter the "help" command to view the help-screen information for the controller.

A list of the serial ports available on the computer may be displayed using the command:


clipytool -l

One way to discover the correct serial port for the controller is as follows:  Unplug the controller's USB cable from the computer, run "clipytool -l" and note the listing, plug in the controller's USB cable, run "clipytool -l" again and note which serial port was added -- this will be the port to use.

The following help information is displayed by running "clipytool -h":
usage: clipytool.py [-h] [-b [BACKUP] | -r [RESTORE] | -y [VERIFY]]
[-c [CHANGES]] [-n] [-p PORT] [-a BAUDRATE]
[-s SLEEPSCALE] [-u] [-x] [-l] [-t] [-v]

optional arguments:
-h, --help show this help message and exit
-b [BACKUP], --backup [BACKUP]
Save CLI settings to file: BACKUP
-r [RESTORE], --restore [RESTORE]
Restore CLI settings from file: RESTORE
-y [VERIFY], --verify [VERIFY]
Verify CLI settings vs file: VERIFY
-c [CHANGES], --changes [CHANGES]
Save 'verify' changes to file: CHANGES
-n, --noverify Don't perform verify after backup/restore
-p PORT, --port PORT Serial port to use (default=COM7)
-a BAUDRATE, --baudrate BAUDRATE
Baud rate to use (default=115200)
-s SLEEPSCALE, --sleepscale SLEEPSCALE
Scale comm sleep delays (default=1.0)
-u, --pauseonerror Pause before exit if error
-x, --pauseonexit Pause before exit (always)
-l, --listports Display available serial ports
-t, --terminal Enter interactive terminal mode
-v, --version show program's version number and exit

clipytool version 1.1
If backup filename not specified then defaults to "cli_bkp_YYYYMMDD_hhmmss.txt"
If restore/verify filename not specified then defaults to newest file matching "cli_bkp_*.txt"
If communications too fast for controller, try increasing 'sleepscale' > 1.00

The "sample_bats" directory in the distribution contains sample batch files (for Windows) that can be handy for running the program.  Setting up shortcuts to the batch files can allow the program's functions to be accessed via simple mouse clicks in the Windows GUI, and drag-and-drop can be used with the restore/verify.  The batch files can be modified to match the correct serial port for the user environment.  The default serial port can also be changed by modifying the "clipytool.py" program file.

If you have comments, questions or suggestions, please let me know.



Click here to contact me

Back to etheli.com home page



ET Heli