I think E.getConsole() can return USB also if it is not connected when it is the default in board file.
Yes, that's true, or if you force it with USB.setConsole(1).
So right now I don't think we have a way, except to alter the code as @fanoush has done. IMO a Serial.isConnected might be quite good. It would be handy for Bluetooth, but also for Serial1/etc it could still return true/false depending on whether they've been set up.
What board are you using @MarkBloom? Is it your own custom one?
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, that's true, or if you force it with
USB.setConsole(1)
.So right now I don't think we have a way, except to alter the code as @fanoush has done. IMO a Serial.isConnected might be quite good. It would be handy for Bluetooth, but also for Serial1/etc it could still return true/false depending on whether they've been set up.
What board are you using @MarkBloom? Is it your own custom one?