Skip to content

Commit 3640d11

Browse files
committed
Define output for logging in ConfigMidi.h
1 parent 4ece285 commit 3640d11

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,18 @@ We also provide some higher level API "Server" classes which can be used for bo
7878
Here is the generated [Class Documentation](https://pschatzmann.github.io/arduino-midi/html/annotated.html).
7979
You can find [further information in my blogs](https://www.pschatzmann.ch/home/tag/midi/).
8080

81-
82-
### Namespace
83-
84-
All the midi classes are defined using the midi namespace. If you include Midi.h the using namespace is already defined. However, if you include the individual class specific header files you need to add a using namespace midi; in your sketch.
85-
8681
### Logging
8782

8883
The library provides some logging functionality. By default the log level is set to MidiDebug. You can change the level with
8984
```
9085
MidiLogLevel = MidiDebug; // or MidiInfo, MidiWarning, MidiError
9186
```
9287

88+
### Namespace
89+
90+
All the midi classes are defined using the midi namespace. If you include Midi.h the using namespace is already defined. However, if you include the individual class specific header files you need to add a using namespace midi; in your sketch.
91+
92+
9393

9494
### Installation in Arduino
9595

src/ConfigMidi.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#pragma once
22

33
#define MIDI_ACTIVE true
4+
45
#define NAMESPACE_ACTIVE true
6+
#define LOG_OUT Serial
57

68
#if defined(ESP32)
79
# define MIDI_BLE_ACTIVE true
@@ -15,11 +17,17 @@
1517
# define MDNS_ACTIVE false
1618
# define UDP_ACTIVE true
1719
# define TCP_ACTIVE true
18-
#else
20+
#elif defined(ARDUINO)
1921
# define APPLE_MIDI_ACTIVE true
2022
# define MIDI_BLE_ACTIVE false
2123
# define MDNS_ACTIVE false
2224
# define UDP_ACTIVE true
2325
# define TCP_ACTIVE true
26+
#else
27+
# define APPLE_MIDI_ACTIVE false
28+
# define MIDI_BLE_ACTIVE false
29+
# define MDNS_ACTIVE false
30+
# define UDP_ACTIVE false
31+
# define TCP_ACTIVE false
2432
#endif
2533

src/Midi.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "MidiStreamIn.h"
55
#include "MidiStreamOut.h"
66
#include "MidiCallbackAction.h"
7+
78
#include "MidiBleClient.h"
89
#include "MidiBleServer.h"
910
#include "MidiBleParser.h"
@@ -16,6 +17,6 @@
1617
#if APPLE_MIDI_ACTIVE
1718
#include "AppleMidiServer.h"
1819
#endif
19-
#if NAMESPACE_ACTIVE
20+
#if NAMESPACE_ACTIVE || MIDI_NAMESPACE_ACTIVE
2021
using namespace midi;
2122
#endif

src/MidiLogger.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <stdio.h>
33
#include <stdarg.h>
44
#include "MidiLogger.h"
5+
#include "MidiConfig.h"
56

67
// global actual loggin level for application
78
MidiLogLevel_t MidiLogLevel= MidiWarning;
@@ -19,7 +20,6 @@ void midi_log(MidiLogLevel_t level, const char* fmt ...) {
1920
va_start(arg, fmt);
2021
vsprintf(log_buffer+9, fmt, arg);
2122
va_end(arg);
22-
strcat(log_buffer, "\n");
23-
printf(log_buffer);
23+
LOG_OUT.println(log_buffer);
2424
}
2525
}

0 commit comments

Comments
 (0)