Possible to temporarily disable USB Serial?

ltf

New member
Hello,
I'm using a Teensy 4.1 with a TFT display and using the ILI9488_t3.h library included in Teensy core.
Unfortunately and quite annoyingly, this library outputs initialization messages to USB Serial when its begin() function is called, and I'd like to get rid of them because I need full control of what is printed to Serial.
I cannot find a way to do this. I tried redefining "Serial" but the library includes Arduino.h which will reset it "correctly", enabling the print-out again.
Of course I can hack into the library code and comment the lines out, but I would like a solution that is independent of the third party code otherwise whenever there is an update it will be rewritten and it also means my code is not portable.
Thanks for your help,
 
Two step process:
a) comment out the two lines of code that have Serial.print still in there that have not been commented out.
b) Ask the owner of the library (in this case me), to update the library... https://github.com/KurtE/ILI9488_t3

And in most cases Paul will then simply sync back up to it when he starts the next Teensyduino release cycle:
Or get it from my github project...
 
Changes pushed up...
Can you call the ILI9488_t3.h begin sometime before the Serial.begin(9600);
It may or may not help. That is Serial.begin is optional... But you might be able to do it soon enough for the USB handshaking completes.
 
And in most cases Paul will then simply sync back up to it when he starts the next Teensyduino release cycle:

I already sync'd my local copy.

Planning to do 1.60-beta1 in a couple weeks. I finally have a Windows 11 laptop coming for software testing.
 
Hello,
Thanks for your replies!
Serial.begin is optional, yes, that is what I also gathered. And calling it after initializing the display still actually prints the last message from the display initialization which, I guess, is buffered even before Serial.begin is called. Adding a delay before .begin does not help.
I had hoped that something simple existed, like a theoretical Serial.begin and Serial.end to turn it on or off.
So yes, commenting out the lines seem to be the only option! I did it in my local version, but thank you for your changes upstream, that is a lot better of course.
You did miss some lines, by the way: 1817 gets printed in my case, and there are also other lines just before when checking the pins, but maybe you want to keep them printed in case of errors (I don't know what the policy for printing message to serial is), the library will return anyway.
Thank again for your reply and changes, and of course thank you for all the work, Kurt and Paul!
 
You did miss some lines, by the way: 1817 gets printed in my case, and there are also other lines just before when checking the pins, but maybe you want to keep them printed in case of errors (I don't know what the policy for printing message to serial is), the library will return anyway.
Thank again for your reply and changes, and of course thank you for all the work, Kurt and Paul!
Line 1817 is now commented out. Yes been hit when others have issues with something not working, so I usually leave those other
outputs in there... But you should never see them... Unless you try building for a different teensy board and then the pin is not valid
for that board.
 
I'm using a Teensy 4.1 with a TFT display and using the ILI9488_t3.h library included in Teensy core.
Unfortunately and quite annoyingly, this library outputs initialization messages to USB Serial when its begin() function is called, and I'd like to get rid of them because I need full control of what is printed to Serial.

Try picking up the current version of the library as was mentioned up earlier in this thread:

Most of the rest of this was picked up I believe for the current beta Teensy beta release... If not, it should be by picked up
for the next release.
 
Back
Top