Pico-W Access Point static file webserver
Posted: Wed Jul 06, 2022 10:20 am
I implemented a static file webserver for the Pico-W with Pico-W MicroPython firmware:
https://forums.raspberrypi.com/viewtopi ... 8#p2017461
https://github.com/Hermann-SW/pico-w
Main demo serves my planar_graph_playground (index.html, 7 .js files and new Pico-W favicon.ico):
There is a weird MicroPython bug most likely related to resource usage of webserver.
Any help in debugging/analyzing this problem is greatly appreciated.
All files needed are in the repo (including htmlsvg.js).
Biggest .js file served was htmlsvg.js of size 8096 bytes.
When requesting that file via webserver
https://github.com/Hermann-SW/pico-w/bl ... ain.py#L41
only 6536 bytes get returned. Workaround in place in the repo is to use minimized JS file htmlsvg.min.js instead.
Surprisingly "get_file()" works if run directly in MicroPython REPL:
https://forums.raspberrypi.com/viewtopi ... 8#p2017461
https://github.com/Hermann-SW/pico-w
Main demo serves my planar_graph_playground (index.html, 7 .js files and new Pico-W favicon.ico):
There is a weird MicroPython bug most likely related to resource usage of webserver.
Any help in debugging/analyzing this problem is greatly appreciated.
All files needed are in the repo (including htmlsvg.js).
Biggest .js file served was htmlsvg.js of size 8096 bytes.
When requesting that file via webserver
https://github.com/Hermann-SW/pico-w/bl ... ain.py#L41
Code: Select all
response = get_file(r)
only 6536 bytes get returned. Workaround in place in the repo is to use minimized JS file htmlsvg.min.js instead.
Surprisingly "get_file()" works if run directly in MicroPython REPL:
Code: Select all
...
KeyboardInterrupt:
MicroPython v1.19.1 on 2022-07-05; Raspberry Pi Pico W with RP2040
Type "help()" for more information.
>>> def get_file(file_name):
... with open(file_name, 'rb') as file:
... return file.read()
...
>>> print(len(get_file("htmlsvg.js")))
8096
>>>