0

I am working with the ESP8266 and Micropython currently and I encountered a strange behaviour.

example string:


Server: SimpleHTTP/0.6 Python/2.7.13\r\nDate: Wed, 02 Aug 2017 13:40:05 GMT\r\nContent-type: application/octet-stream\r\nContent-Length: 6609\r\nLast-Modified: Wed, 02 Aug 2017 13:02:40 GMT\r\n\r\n&lt;Storage {}&gt;86400<div>Uhrzeit in Sekunden: 65567</div><div>Timer: 20833</div>\r\n<!DOCTYPE html>\r\n<!--[if (gt IE 9)|!(IE)]><!--> <html class="no-js" lang="de"> <!--<![endif]-->\r\n  <head>\r\n    <meta charset="utf-8">\r\n    <!\xe2\x80\x94 www.phpied.com/conditional-comments-block-downloads/ \xe2\x80\x94>\r\n    <!\xe2\x80\x94 Always force latest IE rendering engine\r\n

when i paste it into the putty console it is fine. When i save it in a variable like that:

a = 'paste examplestring and add the second ' afterwards it is fine.

but when i type a = '' and paste the string in afterwards it turns into that:


a = 'Server: SimpleHTTP/0.6 Python/2.7.13\r\nDate: Wed, 02 Aug 2017 13:40:05 GMT\r\nContent-type: application/octet-stream\r\nContent-Length: 6609\r\nLast-Modified: Wed, 02 Aug 2017 13:02:40 GMT\r\n\r\n&lt;Storage {}&gt;86400<div>Uhrzeit in Sekunden: 65567</div><div>Timer: 20833</div>\r\n<!DOCTYPE html>\r\n<!--[if (gt IE 9)|!(IE)]><!--> <html class="no-js" lang="de"> <!--<![endif]-->\r\n  <head>\r\n    <meta charset="utf-8">\r\n    <!\xe2\x80w.phpditions-blos/ \x\r\n  80\x9rce lnderin\'

I really dont know why this happens. Is it something that has to do with Putty? Because when I use the python interpreter directly on my local machine it works as supposed without this weird behaviour.

1 Answers1

2

I would guess that you're simply overrunning the ESP8266's input buffer.

With that quote mark after the insertion point, every character being typed (or pasted) results in:

  1. the new character being echoed,
  2. the quote mark being reprinted, then
  3. a backspace being issued to move back to the insertion point.

For a total of 3 times the serial traffic compared to a paste at the end of the input line.

Many terminal programs have a configurable per-character delay during pastes to handle precisely this problem. Unfortunately, putty doesn't have such a feature yet, although there is a wishlist item for it.

jasonharper
  • 9,450
  • 2
  • 18
  • 42