mirror of
https://github.com/vale981/KSP-30-Hack
synced 2025-03-04 17:01:39 -05:00
implement disabling serial
This commit is contained in:
parent
0664fdeafb
commit
21523c3b4d
3 changed files with 14 additions and 6 deletions
|
@ -1,2 +1,3 @@
|
||||||
FQBN = arduino:avr:micro
|
FQBN = arduino:avr:micro
|
||||||
PORT = /dev/ttyACM0
|
PORT = /dev/ttyACM0
|
||||||
|
DEBUG_SERIAL = false
|
||||||
|
|
4
makefile
4
makefile
|
@ -12,7 +12,7 @@ ELF = $(B_PATH)/$(PRG).ino.elf
|
||||||
ARDLIBS = USB-MIDI@1.1.2
|
ARDLIBS = USB-MIDI@1.1.2
|
||||||
|
|
||||||
$(HEX): $(SRCS)
|
$(HEX): $(SRCS)
|
||||||
$(ARDCLI) compile --fqbn $(FQBN) --build-path $(B_PATH) $(CURDIR)
|
$(ARDCLI) compile --build-property build.extra_flags="-DDEBUG_SERIAL=$(DEBUG_SERIAL)" --fqbn $(FQBN) --build-path $(B_PATH) $(CURDIR)
|
||||||
|
|
||||||
upload: $(HEX)
|
upload: $(HEX)
|
||||||
sudo $(ARDCLI) upload -v --fqbn $(FQBN) --input-dir $(B_PATH) -p $(PORT) $(CURDIR)
|
sudo $(ARDCLI) upload -v --fqbn $(FQBN) --input-dir $(B_PATH) -p $(PORT) $(CURDIR)
|
||||||
|
@ -22,7 +22,7 @@ deps:
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) $(HEX) $(ELF)
|
$(RM) $(HEX) $(ELF)
|
||||||
$(RM) $(B_PATH)
|
$(RM) -r $(B_PATH)
|
||||||
|
|
||||||
.PHONY: all upload deps clean
|
.PHONY: all upload deps clean
|
||||||
|
|
||||||
|
|
15
midikeys.ino
15
midikeys.ino
|
@ -1,6 +1,11 @@
|
||||||
#include <USB-MIDI.h>
|
#include <USB-MIDI.h>
|
||||||
|
#if DEBUG_SERIAL
|
||||||
#define Sprintln(...) (Serial.println(__VA_ARGS__))
|
#define Sprintln(...) (Serial.println(__VA_ARGS__))
|
||||||
#define Sprint(...) (Serial.print(__VA_ARGS__))
|
#define Sprint(...) (Serial.print(__VA_ARGS__))
|
||||||
|
#else
|
||||||
|
#define Sprintln(...)
|
||||||
|
#define Sprint(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Pins */
|
/* Pins */
|
||||||
|
@ -44,8 +49,8 @@ constexpr midi::Channel channel = 1;
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Velocity */
|
/* Velocity */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
constexpr double min_velocity = 0.00001;
|
constexpr double min_velocity = 0.000001;
|
||||||
constexpr double max_velocity = 0.00024;
|
constexpr double max_velocity = 0.00015;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Keyscanning */
|
/* Keyscanning */
|
||||||
|
@ -116,7 +121,9 @@ void setup() {
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* Serial */
|
/* Serial */
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
#if DEBUG_SERIAL
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
#endif
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* Pins */
|
/* Pins */
|
||||||
|
@ -166,10 +173,10 @@ void send_note_up(int key) {
|
||||||
void send_pedal(bool down) {
|
void send_pedal(bool down) {
|
||||||
if (down) {
|
if (down) {
|
||||||
Sprintln("SSTE DOWN");
|
Sprintln("SSTE DOWN");
|
||||||
MIDI.sendControlChange(64, 64, 1);
|
MIDI.sendControlChange(64, 127, 1);
|
||||||
} else {
|
} else {
|
||||||
Sprintln("SSTE UP");
|
Sprintln("SSTE UP");
|
||||||
MIDI.sendControlChange(64, 63, 1);
|
MIDI.sendControlChange(64, 0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue