Shell Commands

Dear All,

I’m writing a shell command that loops until a button press terminates it through an interrupt callback. The loop delay is set by xtimer.

My printf outputs inside the loop seem to be buffered in the background and only ends up on screen when the command returns.

How can I get it to print on every loop iteration while the shell command is still executing?

Using RTT / Linux / pyterm / NRF52.

Cheers, Rik

Welcome Rik!

without seeing you actual code it's hard to debug, could you share the code snippet for you shell-command and loop? From what you write: remember to close everything you want to printf with '\n', bc the shell is looking for this before it prints anything.

It should look like this:

    while (run) {          printf("in the loop\n");          xtimer_sleep(1);     }

If you forget the '\n' the shell will buffer the string.

Best,   Sebastian

Hi,

If I remember correctly stdio in RIOT is not buffering at all, but pyterm is buffering until \n. You might solve the issue by passing an additional flag to pyterm or using a different terminal.

Kind regards, Marian