• I have serial devices connected to both serial1 and serial2 on my Pico. I need to keep the console output off of these when USB is disconnected and pico running on external power.

    The desired behavior is to have the console on USB when USB is connected, and if no USB, console output is discarded. Am I missing some way to achieve this?

  • I've had the same problem. :S this thread helped me out:

    http://forum.espruino.com/conversations/­1506/

  • I guess one way is to assign the console to Loopback:

    USB.onData(function (d) { LoopbackB.write(d); });
    LoopbackB.onData(function (d) { USB.write(d); });
    LoopbackA.setConsole();
    

    But things like Ctrl-C to break won't work then.

    Can anyone think of a reason why setConsole shouldn't just override the automatic changeover? (the changeover happens if USB connects and you're on Serial1, or if USB disconnects while you're on USB)

    Perhaps Device.setConsole(true) could force the console to stay in place, and Device.setConsole() would have the existing behaviour.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

How to control console moving around when USB connected?

Posted by Avatar for DrAzzy @DrAzzy

Actions