Early access releases #3 & #4

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
User avatar
jwissing
Posts: 29
Joined: Thu Jun 19, 2014 12:23 pm
Location: Germany

Re: Early access releases #3 & #4

Post by jwissing » Sun Apr 24, 2016 10:30 am

Hi, i have just uploaded firmware-v04.bin to my ESP12E.
After recreating file boot.py and some of my test files i started to test webREPL via Wifi standalone by starting webrepl from main.py
without a serial connection.
Here are the files i use:
boot.py

Code: Select all

import esp
esp.osdebug(None)
import os
import time
import util
import network

ls = os.listdir()
main.py

Code: Select all

import webrepl
webrepl.start()
This is working and i can access the REPL via wifi after a hard reset.
After a soft reset with CTRL-D i can not reconnect.

So when i do the same with a serial REPL i see the following exception from webrepl after hitting ctrl-d in webREPL:

Code: Select all

Terminal ready

>>>
WebREPL connection from: ('192.168.178.26', 54495)
WebREPL connected
>>> ls
['boot.py', 'main.py', 'util.py', 'mqtt.py', 'test.py', 'wlanconnect.py']
>>>
PYB: soft reboot
Traceback (most recent call last):
  File "main.py", line 2, in <module>
  File "webrepl", line 55, in start
  File "webrepl", line 21, in setup_conn
OSError: 12
MicroPython v1.7-205-gb69d1fc on 2016-04-22; ESP module with ESP8266
Type "help()" for more information.
>>>
I would like to have this running without the need to do a hard reset.
The board will be deployed at a remote location.

Update:
When retrying this after disconnecting from serial i get the following message in the browser and the webREPL is unresponsive:

Code: Select all

WebREPL connection from: ('192.168.178.26', 54957)
Last edited by jwissing on Sun Apr 24, 2016 10:55 am, edited 1 time in total.

User avatar
jwissing
Posts: 29
Joined: Thu Jun 19, 2014 12:23 pm
Location: Germany

Re: Early access releases #3 & #4

Post by jwissing » Sun Apr 24, 2016 10:33 am

One more observation while testing the webREPL.
It takes about 20 seconds after a disconnect is acknowledged in the browser.
Could this be faster?

User avatar
jwissing
Posts: 29
Joined: Thu Jun 19, 2014 12:23 pm
Location: Germany

Re: Early access releases #3 & #4

Post by jwissing » Sun Apr 24, 2016 10:36 am

Hi, for those interested here is a small snippet to download files to a micropython board:

Code: Select all

def listfile(fn):
    f=open(fn,'rt')
    print(f.read())
    f.close()
lf = listfile
def getfile(name):
    import socket
    s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    addr=socket.getaddrinfo('giant.fritz.box',80)[0][-1]
    s.connect(addr)
    what = "GET /%s HTTP/1.0\n\n" % (name)
    s.send(what)
    resp = s.read()
    data = resp.decode()
    payl = data.split('\r\n\r\n')[1]
    of = '%s' % (name)
    f=open(of,'wt')
    f.write(payl)
    f.close()
    s.close()
gf = getfile
A have my development machine setup with a webserver pointing to my snippets directory.
I have saved the file as util.py and after import util i use the shortcut util.lf('xxx.py') and util.gf('xxx.py')

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Early access releases #3 & #4

Post by pfalcon » Wed Apr 27, 2016 4:01 pm

jwissing wrote:One more observation while testing the webREPL.
It takes about 20 seconds after a disconnect is acknowledged in the browser.
Could this be faster?
This was fixed in master.

Sorry for not many comments lately - we're all-hands preparing for the release. And yep, unfortunately, it will be with a number of known issues, which will take extra time later to resolve. Hopefully, many of them have easy workarounds. For example, WebREPL may indeed not work after "soft reset", but hard reset button (or cable replug) is a motion away. (Worst case, we'll need to disable "soft reset" feature for esp8266, but we hope to dig into it first instead of disabling right away.)
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

User avatar
jwissing
Posts: 29
Joined: Thu Jun 19, 2014 12:23 pm
Location: Germany

Re: Early access releases #3 & #4

Post by jwissing » Wed Apr 27, 2016 4:53 pm

pfalcon wrote:
jwissing wrote:One more observation while testing the webREPL.
It takes about 20 seconds after a disconnect is acknowledged in the browser.
Could this be faster?
This was fixed in master.

Sorry for not many comments lately - we're all-hands preparing for the release. And yep, unfortunately, it will be with a number of known issues, which will take extra time later to resolve. Hopefully, many of them have easy workarounds. For example, WebREPL may indeed not work after "soft reset", but hard reset button (or cable replug) is a motion away. (Worst case, we'll need to disable "soft reset" feature for esp8266, but we hope to dig into it first instead of disabling right away.)
The delay is confirmed as fixed after sync/make/deploy from origin master.
The unresponsive webREPL without active serial connection is not yet fixed.
Update: after make axtls/make clean/make this issue seems to be solved as well.

Hard reset or cable replug will not be available when the module will be deployed 1500 km apart.

User avatar
platforma
Posts: 258
Joined: Thu May 28, 2015 5:08 pm
Location: Japan

Re: Early access releases #3 & #4

Post by platforma » Wed Apr 27, 2016 7:48 pm

Everything went fine with using the v04 aplha for me, was able to connect to webrepl, transfer files back and forth. A couple of notes that were already mentioned:

1. Got the previously mentioned LmacRxBlk:1 after transferring the file a few times (but with power downs in between).
2. After I transfer test.py with the webrepl_cli.py and have webrepl open at the same time in the browser, it disconnects and doesn't come back again until a hard reset.

User avatar
platforma
Posts: 258
Joined: Thu May 28, 2015 5:08 pm
Location: Japan

Re: Early access releases #3 & #4

Post by platforma » Thu Apr 28, 2016 10:30 pm

I have also noticed that if I connect the esp to my AP as usual using the network.WLAN, and then try to start webrepl so I can talk to it through my router, instead of connecting directly, upon webrepl.start() i get:

Code: Select all

WebREPL daemon started on 192.168.4.1:8266
WebREPL daemon started on 10.10.0.11:8266
Which is great for the second IP address, and I can use webrepl.html to connect to it. But perhaps starting it twice on the 192.168.4.1:8266 as well is not necessary.

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: Early access releases #3 & #4

Post by deshipu » Fri Apr 29, 2016 3:59 am

This is easy to work around. Just disable the AP interface with network.WLAN(network.AP_IF).active(False).

User avatar
platforma
Posts: 258
Joined: Thu May 28, 2015 5:08 pm
Location: Japan

Re: Early access releases #3 & #4

Post by platforma » Fri Apr 29, 2016 10:10 am

It didn't occur to me that the AP was still on. This makes sense now, thanks!

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Early access releases #3 & #4

Post by pfalcon » Sat Apr 30, 2016 5:53 pm

Yes, WebREPL is started on all network interfaces available at the time of webrepl.start(), for user convenience. Note that we officially support WebREPL over AP only (i.e. you should connect your terminal machine directly to esp8266's AP and then connect to the corresponding address, 192.168.4.1 by default). However, connection over STA (i.e. without need to reconnect your work machine from your normal AP to esp8266 AP, thus losing Internet connection) will for many people and in many cases. Unfortunately, not always, that's the reason why only AP connection is "officially supported". We actually should start a separate thread to collect users' experiences to that and compile set of tips and tricks to make it work for more.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

Locked