Open krystlih opened 7 years ago
You need to install the asyncio (and other) dependencies.
Please see https://github.com/fadushin/esp8266/tree/master/micropython/uhttpd#frozen-bytecode-recommended
@krystlih Ok to close?
Hi! I also trying to compile firmware with uhttpd and I following this instructions: https://github.com/fadushin/esp8266/tree/master/micropython/uhttpd#frozen-bytecode-recommended But at the moment link https://github.com/micropython/micropython/tree/master/esp8266 is broken and it seems, that directory structure of micropython project is changed. I found directory esp8266 at https://github.com/micropython/micropython/tree/master/ports/esp8266 and I'll check ability of compiling, but documentations needs to be fixed.
UPD: I checked it - I can compile firmware, that contains uhttpd, asyncio, logger. Also I can start server:
import uhttpd
import uhttpd.file_handler
import uhttpd.api_handler
import api
api_handler = uhttpd.api_handler.Handler([
(['system'], api.SystemAPIHandler()),
(['memory'], api.MemoryAPIHandler()),
(['flash'], api.FlashAPIHandler()),
(['network'], api.NetworkAPIHandler())
])
file_handler = uhttpd.file_handler.Handler('/www')
# in documentaion Handler initialized without '/www' parameter,
# but I think it's mistake, anyway, I cat get content from /www only
# if I initialize Handler with path, cause by documentation I uploaded
# content into /www
server = uhttpd.Server([
('/api', api_handler),
('/', file_handler)],
{'max_headers': 50, 'backlog': 10})
server.run()
I append api.py (and then api.mpy - the same situation) into the root. It works if I run it from repl:
MicroPython v1.9.3-240-ga275cb0f on 2018-01-12; ESP module with ESP8266
Type "help()" for more information.
>>> import api
>>> m = api.MemoryAPIHandler()
>>> m.get_memory_stats()
{'mem_alloc': 19648, 'mem_free': 16320}
>>> n = api.NetworkAPIHandler()
>>> n.get_ap_stats()
{'ifconfig': {'ip': '192.168.4.1', 'gateway': '192.168.4.1', 'subnet': '255.255.255.0', 'dns': '208.67.222.222'}, 'status': 'Unknown wlan status: -1', 'config': {'authmode':
'AUTH_WPA_WPA2_PSK', 'hidden': False, 'mac': '0x1afe34d3fc05', 'channel': 1, 'essid': 'MicroPython-d3fc05'}}
But when I trying to get api through web, I got error and repl restarting:
>>> import serv
INFO:None:uhttpd-master running...
ets Jan 8 2013,rst cause:4, boot mode:(3,7)
wdt reset
load 0x40100000, len 31096, room 16
tail 8
chksum 0x40
load 0x3ffe8000, len 1076, room 0
tail 4
chksum 0xfd
load 0x3ffe8440, len 3252, room 4
tail 0
chksum 0x89
csum 0x89
lܞ|rn#
l
Bb䌜dl
"
b$`$
$ܟ|2srn#l$
bc"
$`lo"
#
#l
b#lNN|l
lld`$
p
l l
$l {l#ccc{
n$lllll nb
$
$b
$
cr$r$s
oܟcpBr$#$`lorll#4 ets_task(40100130, 3, 3fff838c, 4)
OSError: [Errno 2] ENOENT
MicroPython v1.9.3-240-ga275cb0f on 2018-01-12; ESP module with ESP8266
Type "help()" for more information.
>>>
Wow that's cool. It looks like your ESP (or whatever device you are running on) crashed. Does it crash immediately, or does it crash only when you make an HTTP request to the device?
I'm not sure how to help you here. For me, I usually experience issues like this when I have a faulty power supply.
Wow that's cool. It looks like your ESP (or whatever device you are running on) crashed. Does it crash immediately, or does it crash only when you make an HTTP request to the device?
Couple of hours ago I taked two other esp8266 boards, and flashed them with the same builded firmware. They doesn't crash at all. I can get any api response by curl or browser, so it seems, that my first ESP board is broken. But there are another problem with web-console: I can see console, but in "About" tab I can see only "A web console into your ESP8266" label, "Access Point" label in "Networking" tab and some empty space between labels and footers.
Hi,
I followed your instructions for building the frozen code, and I'm getting the following on import:
I have all the files linked as specified in the modules directory:
Thoughts?