function test(i)
{
let imgname = `rc${i}.img`;
console.log(imgname);
let imgdata = require("Storage").read(imgname);
if ( !imgdata ) {
console.log("cant find image");
}
try{
g.drawImage(imgdata);
} catch(e) {
try{
g.drawImage(E.toString(imgdata));
}
catch(e) {
console.log(e);
console.log("too large to flatstring");
}
}
Bangle.setLCDPower(true);
}
function hashow() {
let delay = 1000;
let hihi = 27;
for(var lol=1;lol<=hihi;lol++){
setTimeout(test,delay*lol,lol);
}
}
And the memory is just getting more and more full, because of the for loop. Is there a way to free memory within a for loop to run a task like this? Its meant to be a slideshow of images..
EDIT: its related to using setTimeout within the loop I think, it doesnt activate the garbage collection cos of the setTimeout or something?
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.
Yes I am trying this :
And the memory is just getting more and more full, because of the for loop. Is there a way to free memory within a for loop to run a task like this? Its meant to be a slideshow of images..
EDIT: its related to using setTimeout within the loop I think, it doesnt activate the garbage collection cos of the setTimeout or something?