Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made Arduino IDE scroll during upload #482

Closed
wants to merge 2 commits into from

Conversation

earlephilhower
Copy link

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)

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.
@projectgus
Copy link
Contributor

Hi @earlephilhower

Sorry I didn't first reply when you submitted this PR.

I've re-implemented these changes at a slightly higher level (adding a print_overwrite function), plan to merge it for the v2.9 release. This PR will be updated once it merges

Thanks,

Angus

antmak pushed a commit that referenced this pull request Jan 15, 2020
Alternative implementation of the Arduino IDE fix contributed by
@earlephilhower in #482
@projectgus
Copy link
Contributor

Implemented as 028b672 . Should be equivalent logic, let me know if there is any remaining problem with the output in the Arduino IDE @earlephilhower :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants