LibreSolar/charge-controller-firmware

Implement global debug print function

martinjaeger opened this issue · 3 comments

It would make sense to have a possibility to switch on / off all serial output debug messages at once. I will research if there is such a method in mbed. Otherwise we can define our own macro DEBUG_PRINT (or is there something more suitable from C++ world, @hogthrob ?) in the main.h file.

First simple idea: Implement functions print_info, print_warning and print_error which just pass the data to a printf command or do nothing, depending on a global define set in platformio.ini file.

Sounds good. Would do the job. Probably a C++ crack would have some ideas how to do this without the preprocessor, but your proposal will do the job just fine.

This approach sounds good. I would suggest we implement a 4th function print_comms in order to set the comms debug messages separately.