How stop too many server.logs?

I’m logging too much in a loop. It goes offline, then boots again.
How do I stop it? How do I upload the corrected program?
It’s ignoring me…

Why is THIS LINE needed to keep it from crashing?
Without it, it will never respond to Run.
It’s from an Example in your Documentation.
I simplified my code to illustrate the problem.

function samplesReady(buffer, length){ buf <- blob(4000); if(length==8000) { for(local a=0;a<4000;a++) { //local w = buffer[a*2]+(buffer[a*2+1]<<8); local w=buffer[a*2+1]+128; buf.writen(w,'b'); } for(local a=0;a<16;a++) server.log(buf[a]); //agent.send("fbuffer",buf); //server.log(length); } else { server.log("Overrun"); }} function stopSampler() { server.log("stop"); hardware.sampler.stop(); imp.onidle(function() { server.sleepfor(5); } ); //THIS LINE } buffer1 <- blob(8000); buffer2 <- blob(8000); buffer3 <- blob(8000); hardware.sampler.configure(hardware.pin1, 8000, [buffer1, buffer2, buffer3],samplesReady, NORMALISE); // | A_LAW_COMPRESS); hardware.sampler.start(); imp.wakeup(2,stopSampler);

It closes the imp.onidle function. It doesn’t have to be on a different line but without it you have a syntax error. Without it your essentially calling someFunction(someArgument without the closing parenthesis

Not sure what you intended here, but a server.sleepfor(5) will cause the imp to sleep, and wake about 5 seconds later.

Release23 will throttle when you log too much, which allows you to get a word in edgeways when talking to the imp (eg, reboot it, load new code, etc).

Generally, you want to avoid logging in a sample ready callback because you need to spend as little time as possible in them to prevent overrunning your buffers.

Try running the code without THIS LINE. Run does not work after it is finished executing. It is ignored. Feel free to remove server.logs for this experiment.