Vrettel wrote: ↑Fri Jan 12, 2018 1:32 pm
3) Do you have any suggestion on how to increase the available memory for my code?
I am pretty new to the Micropython table, so I am basically operating on educated guesses at the moment.
My education for thoses guesses is about 30 years of fiddling with microcontrollers, though.
I still have to look into implementation details of the Micropyton interpreter, but I think it is safe to say that strings and names of objects use RAM. Again: I am guessing and may be completely wrong.
Maybe you can measure the impact of this by tracing the gc.mem_free() output over the runtime of your program and running two versions: one regular, the other with names of variables, objects, keys (indexes into dictionaries) replaced by very short strings.
This could be done with a C preprocessor and a bunch of #define statements.
I am planning to do just that when my current projects hits the RAM ceiling - and I am sure it will. Sometime.
But it is on the back burner for now, a customer called today and I am off to a job next week.
Oh, btw: the 20k RAM you have at the start of the program is pretty much all the ESP8266 will ever have.
If you already know this not to be sufficient, you better switch to another hardware richt away.
The ESP32 might be an alternative, or running the ESP8266 with the factory firmware (AT command set) and running the logic on a secondary µC.
hth
hase