-
Notifications
You must be signed in to change notification settings - Fork 85
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
Line editing & history problem #11
Comments
Need to check that later on. If you don't mind, you could try using 'miniterm.py' (which comes with pyserial), and see if it behaves also odd for you. Because "miniterm.py" is used for the REPL. It should work (for pyserial >= 3) like so:
|
|
Ahhh, that's bad news. Looks like I need to write a own terminal emulation sooner or later :-/ Thanks for testing! |
This is really crazy. I get the errors as described with Python 3 + PySerial 3. It is not there with Python 2 + PySerial 3. |
For whatever reason, today (with latest micropython from repo) I am not able to reproduce this any more. Not with Python 3, not with Python 2. Thus, I will close this issue for now. |
Testing Typing
gives a single Or type something and hit This happens in |
I can confirm that the bug is still present with MicroPython v1.8.4-10-gbc28ac8 on 2016-09-09; ESP module with ESP8266 and Python 3.5.2 using PySerial 3.2.1. The problem is indeed related to miniterm as It was suggested [1] that the problem was caused by a missing "-f direct" parameter when calling miniterm. However this didn't fix the problem for me. So I tried taking a closed look at what is send/received by miniterm - the "-f debug" switch. --- Miniterm on /dev/ttyUSB0 115200,8,N,1 --- Perhaps I'm wrong but if I don't seen any answer here is it simply because MicroPython doesn't send one? |
On a naked, freshly flashed MicroPython typing MicroPython does not know who is listening on the serial so how should it behave differently depending on the terminal being connected? |
Yes, PySerial could be the culpit, too. So I took a look at the USB link with wireshark. After the outgoing traffic for the UP-ARROW key
You are correct - it somehow depends on the terminal program or precisely the way they connect. Could you please check the difference between screen and miniterm in the initial sequence when connecting to MicroPython? (Wireshark should do the job...) Update 1: Don't look any further: The problem is caused by miniterm. The cursor keys are handled incorrectly here (in getkey() to be precise). Update 2: Reported the bug in pyserial, see link below. |
Since no-one on the pyserial repository came up with an idea I tried tweaking the code a bit to see where the problem originates. Things start getting wrong in the getkey function in miniterm.py (line 161). Here key presses get delayed and sent out later as a block. After extensive testing I finally changed the time out parameter from 'None' to 0 and the REPL works fine now: If you are affected by this bug please check if this patch solves your problem. |
There is a fix for this problem in pyserial/miniterm. It's not yet part of an official release but you can get the patched version of miniterm.py here I consider this bug fixed. |
Final remark: On March 8th the patch has been released as part of the official version 3.3 of pyserial. There is no longer a need to download miniterm.py - just updated the package with pip (or your favorite package manager). |
Trying to scroll through history lines, the 1st line is not displayed until hitting the up key again or
CTRL-L
.While edititing a line, the cursor often is displaced by 1 position, again
CTRL-L
helps.This happens while being connected serially or over websocket running
mpfshell
in anxterm
withscreen
.It does not happen when connecting using webrepl.html or using
screen /dev/ttyUSB0 115200
inside the samexterm
like above.The text was updated successfully, but these errors were encountered: