I've set up an http file server using code similar to the Internet (HTTP) examples.
I wanted to try serving large files direct from my Pico with a SD card module and an Olimex MOD-WIFI-ESP8266-DEV board attached. The idea was to try using the HTML+SVG code examples to make a nice 'shiny' user interface using only the Pico.
Note that I'm only using the 'normal' AT commands on the ESP8266, no IoT firmware functionality (at least not yet!).
It's all working, using the ESP8266WiFi_0v25 module. It's reading files from the SD card and then using pipe to serve the chunks of the files as an http server, but it's very, very slow. It's painful to watch each line of text appear in the browser (for example, a copy of the Espruino Reference HTML page takes something like 25 minutes or so to serve from the Pico!), but it eventually sends the whole page via the ESP8266 without reporting any errors.
I've had a look at the code and played around with the chunkSize until I noticed that the buffer in the socket code seems to be fixed at a maximum of 64 bytes. Anything more than 64 doesn't have any effect. Of course less than 64 means the sending of the file gets even slower, but at least I can see that changing the chunkSize on the pipe has an effect!
According to all the ESP8266 AT command documentation it should be able to transfer 2048 bytes of data in a single call which would be a much better chunkSize.
I don't think it's any kind of firmware problem, at least everything looks clean with the at.debug switched on. But it's worth a mention that I'm using the latest firmware for the Olimex MOD-WIFI-ESP8266-DEV (which has 2MB of flash memory on the board), I'm NOT using the 512KB firmware that is officially supported. AT+GMR returns "AT version:0.30.0.0(Jul 3 2015 19:35:49)"
Is there any quick way around the Espruino 64 byte 'limit' or, if I want to try getting better performance, do I have to bite the bullet and think about handling all the AT commands myself with my own larger data buffer?
Or, more likely, have I simply misunderstood how to correctly use pipe and the chunkSize option?!
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I've set up an http file server using code similar to the Internet (HTTP) examples.
I wanted to try serving large files direct from my Pico with a SD card module and an Olimex MOD-WIFI-ESP8266-DEV board attached. The idea was to try using the HTML+SVG code examples to make a nice 'shiny' user interface using only the Pico.
Note that I'm only using the 'normal' AT commands on the ESP8266, no IoT firmware functionality (at least not yet!).
It's all working, using the ESP8266WiFi_0v25 module. It's reading files from the SD card and then using pipe to serve the chunks of the files as an http server, but it's very, very slow. It's painful to watch each line of text appear in the browser (for example, a copy of the Espruino Reference HTML page takes something like 25 minutes or so to serve from the Pico!), but it eventually sends the whole page via the ESP8266 without reporting any errors.
I've had a look at the code and played around with the chunkSize until I noticed that the buffer in the socket code seems to be fixed at a maximum of 64 bytes. Anything more than 64 doesn't have any effect. Of course less than 64 means the sending of the file gets even slower, but at least I can see that changing the chunkSize on the pipe has an effect!
According to all the ESP8266 AT command documentation it should be able to transfer 2048 bytes of data in a single call which would be a much better chunkSize.
I don't think it's any kind of firmware problem, at least everything looks clean with the at.debug switched on. But it's worth a mention that I'm using the latest firmware for the Olimex MOD-WIFI-ESP8266-DEV (which has 2MB of flash memory on the board), I'm NOT using the 512KB firmware that is officially supported. AT+GMR returns "AT version:0.30.0.0(Jul 3 2015 19:35:49)"
Is there any quick way around the Espruino 64 byte 'limit' or, if I want to try getting better performance, do I have to bite the bullet and think about handling all the AT commands myself with my own larger data buffer?
Or, more likely, have I simply misunderstood how to correctly use pipe and the chunkSize option?!