mandulaj / PZEM-004T-v30

Arduino library for the Updated PZEM-004T v3.0 Power and Energy meter
MIT License
256 stars 108 forks source link

Add debugging capability to the library #48

Open mandulaj opened 3 years ago

mandulaj commented 3 years ago

Wee need a way to easily set the debug level of the library in order to print out useful statistics for debugging purposes.

For start I imagine a simple debug macro setting a verbosity level which allows to print information to the debug console when receiving or sending commands to the PZEM module:

// For setting debug level verbosity
#define PZEM004TV30_DEBUG 0

// For configuring custom serial debug interface
#define PZEM004TV30_DEBUG_SERIAL Serial

The debug code should be conditioned by the DEBUG verbosity level and only compiled if required.