Skip to content

Commit

Permalink
moved debug macro to separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
soundanalogous committed Apr 12, 2015
1 parent 08758cb commit 979d46f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 23 deletions.
12 changes: 3 additions & 9 deletions examples/StandardFirmataEthernet/EthernetClientStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,10 @@
#include "EthernetClientStream.h"
#include <Arduino.h>

#define MILLIS_RECONNECT 5000

//#define DEBUG
#ifdef DEBUG
#define DEBUG_PRINTLN(x) Serial.println (x)
#define DEBUG_PRINT(x) Serial.print (x)
#else
#define DEBUG_PRINTLN(x)
#define DEBUG_PRINT(x)
#endif
#include "debug.h"

#define MILLIS_RECONNECT 5000

EthernetClientStream::EthernetClientStream(Client &client, IPAddress localip, IPAddress ip, const char* host, uint16_t port)
: ip(ip),
Expand Down
17 changes: 3 additions & 14 deletions examples/StandardFirmataEthernet/StandardFirmataEthernet.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
See file LICENSE.txt for further informations on licensing terms.
Last updated by Jeff Hoefs: April 10, 2015
Last updated by Jeff Hoefs: April 11, 2015
*/

/*
Expand All @@ -42,13 +42,7 @@
#include <Firmata.h>

//#define DEBUG
#ifdef DEBUG
#define DEBUG_PRINTLN(x) Serial.println (x)
#define DEBUG_PRINT(x) Serial.print (x)
#else
#define DEBUG_PRINTLN(x)
#define DEBUG_PRINT(x)
#endif
#include "debug.h"

#define I2C_WRITE B00000000
#define I2C_READ B00001000
Expand Down Expand Up @@ -778,12 +772,7 @@ void systemResetCallback()

void setup()
{
#ifdef DEBUG
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Need only for ATmega32u4-based boards (Leonardo)
}
#endif
DEBUG_BEGIN(9600);

#ifdef _YUN_CLIENT_H_
Bridge.begin();
Expand Down
14 changes: 14 additions & 0 deletions examples/StandardFirmataEthernet/debug.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef DEBUG_H
#define DEBUG_H

#ifdef DEBUG
#define DEBUG_BEGIN(baud) Serial.begin(baud); while(!Serial) {;}
#define DEBUG_PRINTLN(x) Serial.println (x)
#define DEBUG_PRINT(x) Serial.print (x)
#else
#define DEBUG_BEGIN(baud)
#define DEBUG_PRINTLN(x)
#define DEBUG_PRINT(x)
#endif

#endif /* DEBUG_H */

0 comments on commit 979d46f

Please sign in to comment.