I wanted to paste 194 lines of code with the WebREPL but it just freezes my ESP8266. Smaller code blocks with fewer lines work fine. (I haven't tested how much is too much.)
Is that expected behavior?
WebREPL freezes when pasting large code block
Re: WebREPL freezes when pasting large code block
The heap of the ESP8266 is rather small. A single source module of 194 lines could be too much. You may have to split that in into smaller pieces. Better upload pre-compiled code using the file transfer method.
Re: WebREPL freezes when pasting large code block
Thanks for the reply. :) However, splitting it up seems tedious. And using the file transfer method is going to write it to file and use up flash cycles, right? Because I'm still changing a lot and would be uploading different version after different version. Hmm...
-
- Posts: 969
- Joined: Sat Feb 03, 2018 7:02 pm
Re: WebREPL freezes when pasting large code block
I wouldn't worry about flash cycles on an esp8266 (and not just because they are dirt cheap). During my development I often end up uploading the whole firmware 20 times a day. For every change I make, I compile and flash a new firmware (which is ~700kB). And none of my devices have had any problems yet.
So I really wouldn't worry about uploading a new file for every change you make (at least not when using littleFS. Don't use fat)
So I really wouldn't worry about uploading a new file for every change you make (at least not when using littleFS. Don't use fat)
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode
Re: WebREPL freezes when pasting large code block
Hmm okay. However, I think it would still be more comfortable to be able to paste via WebREPL. 🙈kevinkk525 wrote: ↑Sat Jul 03, 2021 5:10 amSo I really wouldn't worry about uploading a new file for every change you make
Just tried it via the REPL on the serial console and it works fine there. Does that make a difference regarding the heap?
Re: WebREPL freezes when pasting large code block
I expect that webrepl uses memory from the heap. You can check with:
import gc
gc.collect()
gc.mem_free()
from both REPL and WebREPL.
Sometimes it helps doing a import gc;gc.collect() before loading.
import gc
gc.collect()
gc.mem_free()
from both REPL and WebREPL.
Sometimes it helps doing a import gc;gc.collect() before loading.
-
- Posts: 969
- Joined: Sat Feb 03, 2018 7:02 pm
Re: WebREPL freezes when pasting large code block
Might also be due to socket operations in webrepl making it slower, more complex and more resource hungry?
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode