Disable or move console to fake terminal when USB is disconnected #5139
Replies: 1 comment
-
Posted at 2014-06-09 by @gfwilliams You should be able to do That way you could get USB comms when you plug in, and after power cycling/saving it would go back to being on Loopback... Posted at 2014-06-10 by aerialist_user6911 Thank you very much for you advice, Gordon! Doing LoopbackA.setConsole() on onInit works great! Serial1 is quiet now ;-)
I couldn't fully understand your suggestion.
?
Anyway, above onInit function seem to behave as I wanted. Posted at 2014-06-11 by @gfwilliams Glad it's sorted! You could maybe do something like:
So that only the first character received will call the callback... But if you're not using the button for anything, it's a nice easy way of working. I guess you could make it toggle back and forth? You can check what the current console device is using Posted at 2014-06-12 by aerialist_user6911 Thanks again, Gordon!
Taking your advice, I made it to toggle. Posted at 2015-11-12 by Sacha Hi Gordon
Is working as expected, but a warning is signaled: WARNING: Second argument to EventEmitter.on(..) must be a function or a String (containing code) Posted at 2015-11-13 by @allObjects ...what about passing an 'empty' function instead of undefined?
...with setting the on-handler first and then the redirect... Posted at 2015-11-13 by @gfwilliams
If you want to remove an event listener, just use Posted at 2015-11-13 by @gfwilliams Also... When the console is on USB (or any device for that matter), existing listeners for the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2014-06-09 by aerialist_user6911
Hi!
How could I stop Espruino to move console or force it to move to Serial6 (which does not exist on Espruino board?) when USB cable is disconnected?
I saw the case to do it after boot by defining onInit function and call setConsole() there.
http://forum.espruino.com/conversations/863/#comment11883
Is there event to watch for USB cable disconnected so that I can call Serial6.setConsole()?
I embed Espruino into a keyboard together with Adafruit EZ-Key module. Espruino scan the keyboard and send data which key is pressed to EZ-Key via Serial1(B6, B7). EZ-Key act as a BT Keyboard for iPhone. All USART1-5 enabled ports are used for keyscan excpet B6 and B7. I do want to have console on USB for debug but I also like to use it without USB connected for real use.
Beta Was this translation helpful? Give feedback.
All reactions