Made Arduino IDE scroll during upload #482
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of change
When esptool is run from the Arduino IDE, the output window doesn't
scroll because of the \rs used to make the console update status on a
single line.
To avoid this, don't attempt to output everything on a single line when
scripted (i.e. not running on a TTY) by replacing \r with \n.
See esp8266/Arduino#6765 for some discussion.
I have tested this change with the following hardware & software combinations:
ESP8266 Arduino IDE under Linux with WeMos D1 Mini (clone?)
I have run the esptool.py automated integration tests with this change and the above hardware. The results were:
** The two failures at 921k baud are expected and a known problem with my board, a WeMos D1 Mini, so can be ignored. **
earle@server:~/src/esptool/test$ ./test_esptool.py /dev/ttyUSB0 esp8266 230400
Running esptool.py tests...
.......sss..........s..E
Stdout:
Running /usr/bin/python /home/earle/src/esptool/test/../esptool.py --chip esp8266 --port /dev/ttyUSB0 --baud 921600 write_flash 0x0 images/fifty_kb.bin...
esptool.py v2.9-dev
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 60:01:94:23:b4:a6
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
A fatal error occurred: Invalid head of packet (0xE0)
........................
ERROR: test_highspeed_flash (main.TestFlashing)
Traceback (most recent call last):
File "./test_esptool.py", line 226, in test_highspeed_flash
self.run_esptool("write_flash 0x0 images/fifty_kb.bin", baud=921600)
File "./test_esptool.py", line 85, in run_esptool
raise e
CalledProcessError: Command '['/usr/bin/python', '/home/earle/src/esptool/test/../esptool.py', '--chip', 'esp8266', '--port', '/dev/ttyUSB0', '--baud', '921600', 'write_flash', '0x0', 'images/fifty_kb.bin']' returned non-zero exit status 2
Stdout:
Running /usr/bin/python /home/earle/src/esptool/test/../esptool.py --chip esp8266 --port /dev/ttyUSB0 --baud 921600 write_flash 0x0 images/fifty_kb.bin...
esptool.py v2.9-dev
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 60:01:94:23:b4:a6
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
A fatal error occurred: Invalid head of packet (0xE0)
Ran 48 tests in 439.226s
FAILED (errors=1, skipped=4)