Adjusted default breath cal offset value. Added inverted octave rollers option for NuEVI (EVR in fingering menu). Support for CME WIDI chip connected to Teensy underside pads. Alternate Serial2 TX pad 31 for separate MIDI output, jumper sensing between pads 27 and 28 and power control for WIDI using pad 33. The old "slow midi" function (touching pinky key when pressing enter to toggle on/off) now repurpused for WIDI power control (only available when pads 27 and 28 are bridged).
This commit is contained in:
parent
bc545cccc1
commit
822e15e33d
9 changed files with 86 additions and 31 deletions
|
@ -187,7 +187,7 @@ uint16_t legacy = 0;
|
|||
uint16_t legacyBrAct = 0;
|
||||
byte halfTime = 0;
|
||||
boolean programonce = false;
|
||||
byte slowMidi = 0;
|
||||
byte widiOn = 0;
|
||||
|
||||
int breathLevel=0; // breath level (smoothed) not mapped to CC value
|
||||
int oldbreath=0;
|
||||
|
@ -218,6 +218,7 @@ byte leverIsOn=0; // keep track and make sure we send CC with 0 value when o
|
|||
int oldport=0;
|
||||
int lastBite=0;
|
||||
byte biteJumper=0;
|
||||
byte widiJumper=0;
|
||||
int oldbitecc=0;
|
||||
int oldlevercc=0;
|
||||
|
||||
|
@ -601,6 +602,16 @@ void setup() {
|
|||
digitalWrite(biteJumperGndPin, LOW); //PBITE
|
||||
#endif
|
||||
|
||||
pinMode(widiPowerPin, OUTPUT); //WIDI
|
||||
pinMode(widiJumperPin, INPUT_PULLUP); //WIDI
|
||||
pinMode(widiJumperGndPin, OUTPUT); //WIDI
|
||||
digitalWrite(widiJumperGndPin, LOW); //WIDI
|
||||
|
||||
widiJumper = !digitalRead(widiJumperPin); //WIDI
|
||||
|
||||
Serial2.setRX (26); //WIDI
|
||||
Serial2.setTX (31); //WIDI
|
||||
|
||||
bool factoryReset = !digitalRead(ePin) && !digitalRead(mPin);
|
||||
configManagementMode = !factoryReset && !digitalRead(uPin) && !digitalRead(dPin);
|
||||
i2cScan = !factoryReset && !digitalRead(mPin);
|
||||
|
@ -633,19 +644,25 @@ void setup() {
|
|||
delay(100);
|
||||
analogWrite(bLedPin, BREATH_LED_BRIGHTNESS);
|
||||
if (!touchSensorRollers.begin(0x5D)) { //should be D
|
||||
while (1); // Touch sensor initialization failed - stop doing stuff
|
||||
while (1){ // Touch sensor initialization failed - stop doing stuff
|
||||
if (!digitalRead(dPin) && !digitalRead(ePin) && !digitalRead(uPin) && !digitalRead(mPin)) _reboot_Teensyduino_(); // reboot to program mode if all buttons pressed
|
||||
}
|
||||
}
|
||||
delay(100);
|
||||
analogWrite(bLedPin, 0);
|
||||
analogWrite(pLedPin, PORTAM_LED_BRIGHTNESS);
|
||||
if (!touchSensorLH.begin(0x5C)) {
|
||||
while (1); // Touch sensor initialization failed - stop doing stuff
|
||||
while (1){ // Touch sensor initialization failed - stop doing stuff
|
||||
if (!digitalRead(dPin) && !digitalRead(ePin) && !digitalRead(uPin) && !digitalRead(mPin)) _reboot_Teensyduino_(); // reboot to program mode if all buttons pressed
|
||||
}
|
||||
}
|
||||
delay(100);
|
||||
analogWrite(pLedPin, 0);
|
||||
analogWrite(eLedPin, PORTAM_LED_BRIGHTNESS);
|
||||
if (!touchSensorRH.begin(0x5B)) {
|
||||
while (1); // Touch sensor initialization failed - stop doing stuff
|
||||
while (1){ // Touch sensor initialization failed - stop doing stuff
|
||||
if (!digitalRead(dPin) && !digitalRead(ePin) && !digitalRead(uPin) && !digitalRead(mPin)) _reboot_Teensyduino_(); // reboot to program mode if all buttons pressed
|
||||
}
|
||||
}
|
||||
delay(100);
|
||||
analogWrite(eLedPin, 0);
|
||||
|
@ -656,7 +673,9 @@ void setup() {
|
|||
digitalWrite(statusLedPin,LOW);
|
||||
#else
|
||||
if (!touchSensor.begin(0x5A)) {
|
||||
while (1); // Touch sensor initialization failed - stop doing stuff
|
||||
while (1){ // Touch sensor initialization failed - stop doing stuff
|
||||
if (!digitalRead(dPin) && !digitalRead(ePin) && !digitalRead(uPin) && !digitalRead(mPin)) _reboot_Teensyduino_(); // reboot to program mode if all buttons pressed
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -717,6 +736,9 @@ void setup() {
|
|||
battMeasured[i] = analogRead(vMeterPin);
|
||||
delay(1);
|
||||
}
|
||||
|
||||
if (widiJumper && widiOn) digitalWrite(widiPowerPin, HIGH); else digitalWrite(widiPowerPin, LOW);
|
||||
|
||||
activeMIDIchannel = MIDIchannel;
|
||||
midiInitialize(MIDIchannel);
|
||||
|
||||
|
@ -966,7 +988,7 @@ void loop() {
|
|||
}
|
||||
lastPinkyKey = pinkyKey;
|
||||
} else if (pinkySetting == GLD){
|
||||
if (pinkyKey && K7){
|
||||
/*if (pinkyKey && K7){
|
||||
ledMeter(portLimit);
|
||||
if (K6 && (portLimit < 127)){
|
||||
if (currentTime - lvlTime > (LVL_TIMER_INTERVAL)){
|
||||
|
@ -983,7 +1005,7 @@ void loop() {
|
|||
}
|
||||
} else if (!pinkyKey && lastPinkyKey){
|
||||
writeSetting(PORTLIMIT_ADDR,portLimit);
|
||||
}
|
||||
}*/
|
||||
lastPinkyKey = pinkyKey;
|
||||
}
|
||||
} else if (mainState == RISE_WAIT) {
|
||||
|
@ -1347,7 +1369,6 @@ void loop() {
|
|||
}
|
||||
// Is it time to send more CC data?
|
||||
currentTime = millis();
|
||||
//if (currentTime - ccBreathSendTime > (CC_BREATH_INTERVAL+slowMidi*SLOW_MIDI_ADD)){
|
||||
if (currentTime - ccBreathSendTime > (breathInterval-1)){
|
||||
breath();
|
||||
ccBreathSendTime = currentTime;
|
||||
|
@ -2046,7 +2067,7 @@ void autoCal() {
|
|||
// Breath sensor
|
||||
calRead = analogRead(breathSensorPin);
|
||||
breathThrVal = constrain(calRead+200, breathLoLimit, breathHiLimit);
|
||||
breathMaxVal = constrain(breathThrVal+2000, breathLoLimit, breathHiLimit);
|
||||
breathMaxVal = constrain(breathThrVal+1500, breathLoLimit, breathHiLimit);
|
||||
writeSetting(BREATH_THR_ADDR, breathThrVal);
|
||||
writeSetting(BREATH_MAX_ADDR, breathMaxVal);
|
||||
// Pitch Bend
|
||||
|
@ -2316,13 +2337,20 @@ void readSwitches() {
|
|||
- 5*K4 //Fifth key
|
||||
+ 2*K5 + K6 + trill3_interval*K7 //Trill keys. 3rd trill key interval controlled by setting
|
||||
+ octaveR*12; //Octave rollers
|
||||
} else if (1 == fingering){ //TPT fingering
|
||||
} else if (1 == fingering){ //EVR fingering
|
||||
byte revOct = 6 - octaveR;
|
||||
fingeredNoteUntransposed = startNote
|
||||
- 2*K1 - K2 - 3*K3 //"Trumpet valves"
|
||||
- 5*K4 //Fifth key
|
||||
+ 2*K5 + K6 + trill3_interval*K7 //Trill keys. 3rd trill key interval controlled by setting
|
||||
+ revOct*12; //Octave rollers
|
||||
} else if (2 == fingering){ //TPT fingering
|
||||
fingeredNoteUntransposed = startNote
|
||||
- 2*K1 - K2 - 3*K3 //"Trumpet valves"
|
||||
- 2 //Trumpet in B flat
|
||||
+ 2*K5 + K6 + trill3_interval*K7 //Trill keys. 3rd trill key interval controlled by setting
|
||||
+ 24 + trumpetHarmonic[K4][octaveR]; // roller harmonics
|
||||
} else if (2 == fingering){ //HRN fingering
|
||||
} else if (3 == fingering){ //HRN fingering
|
||||
fingeredNoteUntransposed = startNote
|
||||
- 2*K1 - K2 - 3*K3 //"Trumpet valves"
|
||||
+ 5*K4 //Switch to Bb horn
|
||||
|
|
|
@ -160,7 +160,7 @@ void autoCalSelected() {
|
|||
if(adjustOption == 0) {
|
||||
calRead = analogRead(breathSensorPin);
|
||||
breathThrVal = constrain(calRead+200, breathLoLimit, breathHiLimit);
|
||||
breathMaxVal = constrain(breathThrVal+2000, breathLoLimit, breathHiLimit);
|
||||
breathMaxVal = constrain(breathThrVal+1500, breathLoLimit, breathHiLimit);
|
||||
writeSetting(BREATH_THR_ADDR, breathThrVal);
|
||||
writeSetting(BREATH_MAX_ADDR, breathMaxVal);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
// Compile options, comment/uncomment to change
|
||||
|
||||
#define FIRMWARE_VERSION "1.5b5" // FIRMWARE VERSION NUMBER HERE <<<<<<<<<<<<<<<<<<<<<<<
|
||||
#define FIRMWARE_VERSION "1.5b6" // FIRMWARE VERSION NUMBER HERE <<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
#define ON_Delay 20 // Set Delay after ON threshold before velocity is checked (wait for tounging peak)
|
||||
#define CCN_Port 5 // Controller number for portamento level
|
||||
|
|
|
@ -146,7 +146,7 @@ extern byte doPatchUpdate;
|
|||
extern uint16_t legacy;
|
||||
extern uint16_t legacyBrAct;
|
||||
|
||||
extern byte slowMidi;
|
||||
extern byte widiOn;
|
||||
|
||||
extern int pressureSensor; // pressure data from breath sensor, for midi breath cc and breath threshold checks
|
||||
extern int lastPressure;
|
||||
|
@ -154,7 +154,7 @@ extern int lastPressure;
|
|||
extern int biteSensor; // capacitance data from bite sensor, for midi cc and threshold checks
|
||||
extern int lastBite;
|
||||
extern byte biteJumper;
|
||||
|
||||
extern byte widiJumper;
|
||||
extern int exSensor;
|
||||
extern int exSensorIndicator;
|
||||
|
||||
|
|
|
@ -36,6 +36,11 @@
|
|||
#define sLedPin 23
|
||||
#define statusLedPin 13
|
||||
|
||||
//Pins for WIDI board management
|
||||
#define widiJumperPin 28
|
||||
#define widiJumperGndPin 27
|
||||
#define widiPowerPin 33
|
||||
|
||||
//Analog input for measuring voltage
|
||||
#define vMeterPin A11
|
||||
|
||||
|
@ -45,6 +50,7 @@
|
|||
|
||||
//Which serial port to use for MIDI
|
||||
#define MIDI_SERIAL Serial3
|
||||
#define WIDI_SERIAL Serial2
|
||||
|
||||
// MPR121 Rollers 0x5D
|
||||
|
||||
|
@ -99,6 +105,11 @@
|
|||
#define biteJumperPin 11
|
||||
#define biteJumperGndPin 12
|
||||
|
||||
//Pins for WIDI board management
|
||||
#define widiJumperPin 28
|
||||
#define widiJumperGndPin 27
|
||||
#define widiPowerPin 33
|
||||
|
||||
//Analog pressure sensors. Breath and optional bite
|
||||
#define breathSensorPin A0
|
||||
#define bitePressurePin A7
|
||||
|
@ -123,6 +134,7 @@
|
|||
|
||||
//Which serial port to use for MIDI
|
||||
#define MIDI_SERIAL Serial3
|
||||
#define WIDI_SERIAL Serial2
|
||||
|
||||
#if defined(REVB)
|
||||
|
||||
|
|
|
@ -941,11 +941,11 @@ static void midiCustomDrawFunc(SubMenuRef __unused, char* __unused, const char**
|
|||
char buff[7];
|
||||
numToString(MIDIchannel, buff);
|
||||
plotSubOption(buff);
|
||||
if (slowMidi) {
|
||||
//replaced with breathInterval setting and not used anymore.. do cleanup later removing all slowMidi related stuff
|
||||
//display.setTextSize(1);
|
||||
//display.setCursor(116,51);
|
||||
//display.print("S");
|
||||
if (widiJumper && widiOn) {
|
||||
//indicate that widi board is enabled
|
||||
display.setTextSize(1);
|
||||
display.setCursor(100,51);
|
||||
display.print("WIDI");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1110,21 +1110,22 @@ const MenuPage extrasMenuPage = {
|
|||
};
|
||||
|
||||
static bool midiEnterHandlerFunc() {
|
||||
/*
|
||||
|
||||
//this switching is removed due to new breathInterval setting
|
||||
readSwitches();
|
||||
if (pinkyKey){
|
||||
slowMidi = !slowMidi;
|
||||
if (pinkyKey && widiJumper){
|
||||
widiOn = !widiOn;
|
||||
dipSwBits = dipSwBits ^ (1<<3);
|
||||
writeSetting(DIPSW_BITS_ADDR,dipSwBits);
|
||||
if (widiJumper && widiOn) digitalWrite(widiPowerPin, HIGH); else digitalWrite(widiPowerPin, LOW);
|
||||
return false;
|
||||
} else {
|
||||
writeSetting(MIDI_ADDR, MIDIchannel);
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
writeSetting(MIDI_ADDR, MIDIchannel);
|
||||
return true;
|
||||
|
||||
//writeSetting(MIDI_ADDR, MIDIchannel);
|
||||
//return true;
|
||||
}
|
||||
|
||||
const MenuEntrySub midiMenu = {
|
||||
|
@ -1512,9 +1513,9 @@ const MenuEntrySub fingeringMenu = {
|
|||
};
|
||||
#else
|
||||
const MenuEntrySub fingeringMenu = {
|
||||
MenuType::ESub, "FINGERING", "FINGERING", &fingering, 0, 2, MenuEntryFlags::EMenuEntryWrap,
|
||||
MenuType::ESub, "FINGERING", "FINGERING", &fingering, 0, 3, MenuEntryFlags::EMenuEntryWrap,
|
||||
[](SubMenuRef __unused,char* out, const char ** __unused unit) {
|
||||
const char* labs[] = { "EVI", "TPT", "HRN" };
|
||||
const char* labs[] = { "EVI", "EVR", "TPT", "HRN" };
|
||||
strncpy(out, labs[fingering], 4);
|
||||
},
|
||||
[](SubMenuRef __unused sub) { writeSetting(FINGER_ADDR,fingering); }
|
||||
|
|
14
NuEVI/midi.cpp
Executable file → Normal file
14
NuEVI/midi.cpp
Executable file → Normal file
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "midi.h"
|
||||
#include "hardware.h"
|
||||
#include "globals.h"
|
||||
|
||||
int midiChannel;
|
||||
|
||||
|
@ -75,6 +76,10 @@ void midiPanic() { // all notes off
|
|||
void midiInitialize(uint8_t channel) {
|
||||
MIDI_SERIAL.begin(31250); // start serial with midi baudrate 31250
|
||||
MIDI_SERIAL.flush();
|
||||
if(widiJumper){
|
||||
WIDI_SERIAL.begin(31250); // start serial with midi baudrate 31250
|
||||
WIDI_SERIAL.flush();
|
||||
}
|
||||
midiSetChannel(channel);
|
||||
}
|
||||
|
||||
|
@ -87,6 +92,11 @@ void midiSend3B(uint8_t midistatus, uint8_t data1, uint8_t data2) {
|
|||
MIDI_SERIAL.write(midistatus);
|
||||
MIDI_SERIAL.write(data1);
|
||||
MIDI_SERIAL.write(data2);
|
||||
if (widiJumper && widiOn){
|
||||
WIDI_SERIAL.write(midistatus);
|
||||
WIDI_SERIAL.write(data1);
|
||||
WIDI_SERIAL.write(data2);
|
||||
}
|
||||
}
|
||||
|
||||
//**************************************************************
|
||||
|
@ -95,6 +105,10 @@ void midiSend3B(uint8_t midistatus, uint8_t data1, uint8_t data2) {
|
|||
void midiSend2B(uint8_t midistatus, uint8_t data) {
|
||||
MIDI_SERIAL.write(midistatus);
|
||||
MIDI_SERIAL.write(data);
|
||||
if (widiJumper && widiOn){
|
||||
WIDI_SERIAL.write(midistatus);
|
||||
WIDI_SERIAL.write(data);
|
||||
}
|
||||
}
|
||||
|
||||
//**************************************************************
|
||||
|
|
|
@ -231,7 +231,7 @@ void readEEPROM(const bool factoryReset) {
|
|||
#if defined(NURAD)
|
||||
fingering = readSettingBounded(FINGER_ADDR, 0, 4, FINGER_FACTORY);
|
||||
#else
|
||||
fingering = readSettingBounded(FINGER_ADDR, 0, 2, FINGER_FACTORY);
|
||||
fingering = readSettingBounded(FINGER_ADDR, 0, 3, FINGER_FACTORY);
|
||||
#endif
|
||||
lpinky3 = readSettingBounded(LPINKY3_ADDR, 0, 25, LPINKY3_FACTORY);
|
||||
batteryType = readSettingBounded(BATTYPE_ADDR, 0, 2, BATTYPE_FACTORY);
|
||||
|
@ -269,7 +269,7 @@ void readEEPROM(const bool factoryReset) {
|
|||
fastBoot = (dipSwBits & (1<<DIPSW_FASTBOOT))?1:0;
|
||||
legacy = (dipSwBits & (1<<DIPSW_LEGACY))?1:0;
|
||||
legacyBrAct = (dipSwBits & (1<<DIPSW_LEGACYBRACT))?1:0;
|
||||
slowMidi = (dipSwBits & (1<<DIPSW_SLOWMIDI))?1:0;
|
||||
widiOn = (dipSwBits & (1<<DIPSW_WIDION))?1:0;
|
||||
gateOpenEnable = (dipSwBits & (1<<DIPSW_GATEOPEN))?1:0;
|
||||
specialKeyEnable = (dipSwBits & (1<<DIPSW_SPKEYENABLE))?1:0;
|
||||
bcasMode = (dipSwBits & (1<<DIPSW_BCASMODE))?1:0;
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
#define DIPSW_FASTBOOT 0
|
||||
#define DIPSW_LEGACY 1
|
||||
#define DIPSW_LEGACYBRACT 2
|
||||
#define DIPSW_SLOWMIDI 3
|
||||
#define DIPSW_WIDION 3
|
||||
#define DIPSW_GATEOPEN 4
|
||||
#define DIPSW_SPKEYENABLE 5
|
||||
#define DIPSW_BCASMODE 6
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue