-->
Page 3 of 4

Re: dofile gives not enough memory

PostPosted: Sat Apr 04, 2015 4:27 am
by timoline
snice wrote:then this firmware is a complete bullshit if we can't have 52 lines of custom program :shock:


or it is a challenge to get more with less :D

Re: dofile gives not enough memory

PostPosted: Sat Apr 04, 2015 5:27 am
by cal
Moin,

timoline wrote:
snice wrote:then this firmware is a complete bullshit if we can't have 52 lines of custom program :shock:


or it is a challenge to get more with less :D


Exactly. You don't program a multi-GB multi-core environment here.
We are programming a chip for embedded programming here.
It has to deal properly with the following program

Code: Select allwhile true do end


doing a reboot and thats fine.
A programmer error would otherwise have made the chip "hang up", something you want to avoid
at all costs if this is some battery operated node in the wild.

Using a high level languags like lua doesn't change reality.
I am still struggling too, how to get memory demands low and what lua tricks to apply.
(Use locals in modules, avoid long variable names, use compiled lua, ...)
The nodemcu does a good job making lua possible and giving us a tool.
We have to learn how to use it.

Carsten

Re: dofile gives not enough memory

PostPosted: Mon Apr 06, 2015 2:46 am
by kellopeli
snice wrote:error loading module 'ds18b20' from file 'ds18b20.lua': not enough memory

I had the same problem and got around it by compiling the lua script to bytecode. The intepretation of lua skripts eats lots of that precious memory. To compile the bytecode just hit the "Save&Compile" button in ESPlorer and everything is hunky dory.

Re: dofile gives not enough memory

PostPosted: Mon Apr 06, 2015 11:48 am
by Mikey
snice wrote:then this firmware is a complete bullshit if we can't have 52 lines of custom program :shock:

I got a LUA script currently sitting at 135 lines, I only get "not enough memory" when the old is running at the same time. All I do is to delete init.lua, restart the ESP8266, then send the new code to it.