mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-02 11:59:17 +08:00
Tools: improve uploader output in scripts
When the px_uploader.py is used scripted, so without an interactive shell, the progress bar doesn't update. Therefore, I suggest to print a new line instead of a carriage return for the non-interactive shell case.
This commit is contained in:
@@ -428,7 +428,8 @@ class uploader:
|
|||||||
|
|
||||||
percent = (float(progress) / float(maxVal)) * 100.0
|
percent = (float(progress) / float(maxVal)) * 100.0
|
||||||
|
|
||||||
sys.stdout.write("\r%s: [%-20s] %.1f%%" % (label, '='*int(percent/5.0), percent))
|
redraw = "\r" if sys.stdout.isatty() else "\n"
|
||||||
|
sys.stdout.write("%s%s: [%-20s] %.1f%%" % (redraw, label, '='*int(percent/5.0), percent))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
# send the CHIP_ERASE command and wait for the bootloader to become ready
|
# send the CHIP_ERASE command and wait for the bootloader to become ready
|
||||||
|
|||||||
Reference in New Issue
Block a user