It is my understanding that I should be able to pepper throughout my code Serial.print() & Serial.println() commands for debug and later when done with debug process I could comment out the Serial.begin() command and the debug output will no longer be sent to the serial/usb port.
What I am seeing is the output continues to be sent whether or not I have executed a Serial.begin() command.
I am building with the develop branch.
Am I wrong in my understanding of how I believe this is supposed to work?
@HardWater, personally I wrap my debug serial prints in a set of macros so I can conditionally compile out ALL the Serial.print() code. Besides, I’m not sure it’s a good idea to call Serial.print() if you haven’t done a Serial.begin() first.
But for what it’s worth, on the Core the USB-USART functions did have an if (bDeviceStatus == CONFIGURED) { ... } to prevent problems with a missing begin() call.
I’m not sure if breaking this (if it’s actually done - haven’t checked ) with the Photon is one of the best decisions
Hi @kennethlimcp I figured there would probably be a make command that would turn this off, if not I guess I will probably go with @peekay123’s suggestion.
@HardWater, I’m just an optimizing kinda guy. I hate having code that is not necessary. However, one could turn serial logging on and off via a Spark.function() and log to an OpenLog if the Photon is not directly connected. Just thinking out loud