I am currently doing a project using particle photon. However, I may need to customize the original particle firmware code to fit in my project.
For developing application code, I am able to use simple Serial.printf(); / Serial.println(); to monitor the program states.
Similarity, I am wondering whether there is any methods for Serial.printing message in libray/system code, which can bring huge convenience for us!!
For example, when I debugging spark_protocol.cpp file, is there any method for me to print the states of variables on console??
For now I found a existing library called service_debug.h, which provides 4 possible âprintingâ function, called DEBUG, WARN, ERROR, PANIC, INFO, which seems can be used to printing out message. However, I never did it success, it looks like I need to enable some macrosâŚbut just donât know how to do that.
However if it really dosenât work for my customized function, which is a little bit wierd.
For example, I implement a myfunction() {} in the spark_protocol.cpp file (in communication folder). And I want to print âhello worldâ when entering myfunction() {}, what I already do is:
put WARN(âHello Worldâ); in myfunction() {}; [firmware code]
as you said, put SerialLogHandler logHandler(LOG_LEVEL_ALL); in application.cpp [application code];
Thanks @bko@ScruffR
not really, I think we can use it in application code, e.g. main.cpp, Instead of firmware code, such as communication stubs, protocols etc.
I guess we need to use some macros, just like how original code does. But for somehow, the extra WARN(âŚ) a added do not really work. I think there must be some macro definition I need to modify, but couldnât really find it