Skip to content

Commit 337ba7f

Browse files
committed
implemented inline method to set verbosity level in debugMessage()
1 parent e0689bd commit 337ba7f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/ConnectionManager.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#define CONNECTION_MANAGER_H_INCLUDED
44

55
#ifndef ARDUINO_CLOUD_DEBUG_LEVEL
6-
#define ARDUINO_CLOUD_DEBUG_LEVEL 3
6+
#define ARDUINO_CLOUD_DEBUG_LEVEL 0
77
#endif
88

99
#include <Client.h>
@@ -31,8 +31,10 @@ class ConnectionManager {
3131
protected:
3232
unsigned long lastValidTimestamp = 0;
3333
NetworkConnectionState netConnectionState = CONNECTION_STATE_IDLE;
34+
3435
};
3536

37+
3638
#ifdef ARDUINO_SAMD_MKR1000
3739
#include <WiFi101.h>
3840
#define BOARD_HAS_WIFI
@@ -57,13 +59,17 @@ class ConnectionManager {
5759
#define NETWORK_CONNECTED GSM3_NetworkStatus_t::GPRS_READY
5860
#endif
5961

62+
static int debugMessageLevel = ARDUINO_CLOUD_DEBUG_LEVEL;
6063
inline void debugMessage(char *_msg, uint8_t _debugLevel) {
61-
if (_debugLevel <= ARDUINO_CLOUD_DEBUG_LEVEL) {
64+
if (_debugLevel <= debugMessageLevel) {
6265
char prepend[20];
6366
sprintf(prepend, "\n[ %d ] ", millis());
6467
Serial.print(prepend);
6568
Serial.println(_msg);
6669
}
6770
}
6871

72+
inline void setDebugMessageLevel(uint8_t _debugLevel){
73+
debugMessageLevel = _debugLevel;
74+
}
6975
#endif

0 commit comments

Comments
 (0)