EXTRAS menu page added, with items LEGACY PB, LEGACY BR, GATE HOLD and SPECIAL KEY to enable/disable these special functions.

This commit is contained in:
Johan Berglund 2019-07-15 07:51:44 +02:00
parent 9f7fbb60c3
commit 1d34681c40
5 changed files with 154 additions and 63 deletions

View file

@ -81,6 +81,9 @@ uint16_t rotations[4]; // semitones { -5, -10, -7, -14 };
uint16_t parallel; // = 7; // semitones
byte gateOpen = 0; // setting for gate always open, note on sent for every time fingering changes, no matter the breath status
uint16_t gateOpenEnable = 0;
uint16_t specialKeyEnable = 0;
int touch_Thr = 1300;
@ -109,8 +112,8 @@ byte activeMIDIchannel; // MIDI channel
byte activePatch=0;
byte doPatchUpdate=0;
byte legacy = 0;
byte legacyBrAct = 0;
uint16_t legacy = 0;
uint16_t legacyBrAct = 0;
byte halfTime = 0;
boolean programonce = false;
byte slowMidi = 0;
@ -350,6 +353,8 @@ void setup() {
legacy = dipSwBits & (1<<1);
legacyBrAct = dipSwBits & (1<<2);
slowMidi = dipSwBits & (1<<3);
gateOpenEnable = dipSwBits & (1<<4);
specialKeyEnable = dipSwBits & (1<<5);
activePatch = patch;
touch_Thr = map(ctouchThrVal,ctouchHiLimit,ctouchLoLimit,ttouchLoLimit,ttouchHiLimit);
@ -558,47 +563,54 @@ void loop() {
if (analogRead(breathSensorPin) > (breathCalZero - 800)) programonce = false;
specialKey = (touchRead(specialKeyPin) > touch_Thr); //S2 on pcb
if (lastSpecialKey != specialKey) {
if (specialKey) {
// special key just pressed, check other keys
if (K4) {
if (!slurSustain) {
slurSustain = 1;
parallelChord = 0;
rotatorOn = 0;
} else slurSustain = 0;
}
if (K5) {
if (!parallelChord) {
parallelChord = 1;
slurSustain = 0;
rotatorOn = 0;
} else parallelChord = 0;
}
if (K1) {
if (!subOctaveDouble) {
subOctaveDouble = 1;
rotatorOn = 0;
} else subOctaveDouble = 0;
}
if (!K1 && !K4 && !K5) {
slurSustain = 0;
parallelChord = 0;
subOctaveDouble = 0;
rotatorOn = 0;
}
if (pinkyKey) {
if (!rotatorOn) {
rotatorOn = 1;
if (specialKeyEnable) {
specialKey = (touchRead(specialKeyPin) > touch_Thr); //S2 on pcb
if (lastSpecialKey != specialKey) {
if (specialKey) {
// special key just pressed, check other keys
if (K4) {
if (!slurSustain) {
slurSustain = 1;
parallelChord = 0;
rotatorOn = 0;
} else slurSustain = 0;
}
if (K5) {
if (!parallelChord) {
parallelChord = 1;
slurSustain = 0;
rotatorOn = 0;
} else parallelChord = 0;
}
if (K1) {
if (!subOctaveDouble) {
subOctaveDouble = 1;
rotatorOn = 0;
} else subOctaveDouble = 0;
}
if (!K1 && !K4 && !K5) {
slurSustain = 0;
parallelChord = 0;
subOctaveDouble = 0;
} else rotatorOn = 0;
rotatorOn = 0;
}
if (pinkyKey) {
if (!rotatorOn) {
rotatorOn = 1;
slurSustain = 0;
parallelChord = 0;
subOctaveDouble = 0;
} else rotatorOn = 0;
}
}
}
lastSpecialKey = specialKey;
} else {
rotatorOn = 0;
slurSustain = 0;
parallelChord = 0;
subOctaveDouble = 0;
}
lastSpecialKey = specialKey;
} else if (mainState == RISE_WAIT) {
if ((pressureSensor > breathThrVal) || gateOpen) {
// Has enough time passed for us to collect our second
@ -1012,29 +1024,34 @@ void doorKnobCheck() {
for (byte i = 0; i < 12; i++) {
touchValue[i] = touchSensor.filteredData(i);
}
if ((touchValue[K4Pin] < ctouchThrVal) && (touchValue[R1Pin] < ctouchThrVal) && (touchValue[R2Pin] < ctouchThrVal) && (touchValue[R3Pin] < ctouchThrVal)) { // doorknob grip on canister
if (pbUp > ((pitchbMaxVal + pitchbThrVal) / 2)) {
gateOpen = 1;
digitalWrite(statusLedPin, LOW);
delay(50);
digitalWrite(statusLedPin, HIGH);
delay(50);
} else if (pbDn > ((pitchbMaxVal + pitchbThrVal) / 2)) {
gateOpen = 0;
midiPanic();
digitalWrite(statusLedPin, LOW);
delay(50);
digitalWrite(statusLedPin, HIGH);
delay(50);
digitalWrite(statusLedPin, LOW);
delay(50);
digitalWrite(statusLedPin, HIGH);
delay(50);
digitalWrite(statusLedPin, LOW);
delay(50);
digitalWrite(statusLedPin, HIGH);
delay(700);
if (gateOpenEnable){
if ((touchValue[K4Pin] < ctouchThrVal) && (touchValue[R1Pin] < ctouchThrVal) && (touchValue[R2Pin] < ctouchThrVal) && (touchValue[R3Pin] < ctouchThrVal)) { // doorknob grip on canister
if (!gateOpen && (pbUp > ((pitchbMaxVal + pitchbThrVal) / 2))) {
gateOpen = 1;
digitalWrite(statusLedPin, LOW);
delay(50);
digitalWrite(statusLedPin, HIGH);
delay(50);
} else if (gateOpen && (pbDn > ((pitchbMaxVal + pitchbThrVal) / 2))) {
gateOpen = 0;
midiPanic();
digitalWrite(statusLedPin, LOW);
delay(50);
digitalWrite(statusLedPin, HIGH);
delay(50);
digitalWrite(statusLedPin, LOW);
delay(50);
digitalWrite(statusLedPin, HIGH);
delay(50);
digitalWrite(statusLedPin, LOW);
delay(50);
digitalWrite(statusLedPin, HIGH);
delay(700);
}
}
} else if (gateOpen) {
gateOpen = 0;
midiPanic();
}
}

View file

@ -5,7 +5,7 @@
// Compile options, comment/uncomment to change
#define FIRMWARE_VERSION "1.3.6" // FIRMWARE VERSION NUMBER HERE <<<<<<<<<<<<<<<<<<<<<<<
#define FIRMWARE_VERSION "1.3.7" // FIRMWARE VERSION NUMBER HERE <<<<<<<<<<<<<<<<<<<<<<<
//#define CASSIDY

View file

@ -61,6 +61,8 @@ extern unsigned short vibRetn; // vibrato return speed
extern unsigned short vibSquelch; //vibrato signal squelch
extern unsigned short vibDirection; //direction of first vibrato wave UPWD or DNWD
extern unsigned short fastPatch[7];
extern uint16_t gateOpenEnable;
extern uint16_t specialKeyEnable;
extern byte rotatorOn;
extern byte currentRotation;
extern uint16_t rotations[4];
@ -73,8 +75,8 @@ extern unsigned long cursorBlinkTime; // the last time the cursor was t
extern byte activePatch;
extern byte doPatchUpdate;
extern byte legacy;
extern byte legacyBrAct;
extern uint16_t legacy;
extern uint16_t legacyBrAct;
extern byte slowMidi;

View file

@ -19,7 +19,7 @@ enum CursorIdx {
EControl,
ERotator,
EVibrato,
EExtras,
// NEVER ADD ANYTHING AFTER THIS, ONLY ABOVE
NUM_CURSORS
};
@ -449,6 +449,72 @@ static void midiCustomDrawFunc(SubMenuRef __unused, char* __unused, const char**
}
}
//***********************************************************
const MenuEntrySub legacyPBMenu = {
MenuType::ESub, "LEGACY PB", "LEGACY PB", &legacy, 0, 1, MenuEntryFlags::EMenuEntryWrap,
[](SubMenuRef __unused, char* out, const char ** __unused unit) {
strncpy(out, legacy?"ON":"OFF", 4);
}, [](const MenuEntrySub & __unused sub) {
dipSwBits = dipSwBits & ~(1<<1);
dipSwBits |= (legacy <<1);
writeSetting(DIPSW_BITS_ADDR,dipSwBits);
}
, nullptr
};
const MenuEntrySub legacyBRMenu = {
MenuType::ESub, "LEGACY BR", "LEGACY BR", &legacyBrAct, 0, 1, MenuEntryFlags::EMenuEntryWrap,
[](SubMenuRef __unused, char* out, const char ** __unused unit) {
strncpy(out, legacyBrAct?"ON":"OFF", 4);
}, [](const MenuEntrySub & __unused sub) {
dipSwBits = dipSwBits & ~(1<<2);
dipSwBits |= (legacyBrAct <<2);
writeSetting(DIPSW_BITS_ADDR,dipSwBits);
}
, nullptr
};
const MenuEntrySub gateOpenMenu = {
MenuType::ESub, "GATE HOLD", "GATE HOLD", &gateOpenEnable, 0, 1, MenuEntryFlags::EMenuEntryWrap,
[](SubMenuRef __unused, char* out, const char ** __unused unit) {
strncpy(out, gateOpenEnable?"ON":"OFF", 4);
}, [](const MenuEntrySub & __unused sub) {
dipSwBits = dipSwBits & ~(1<<4);
dipSwBits |= (gateOpenEnable <<4);
writeSetting(DIPSW_BITS_ADDR,dipSwBits);
}
, nullptr
};
const MenuEntrySub specialKeyMenu = {
MenuType::ESub, "SPEC KEY", "SPEC KEY", &specialKeyEnable, 0, 1, MenuEntryFlags::EMenuEntryWrap,
[](SubMenuRef __unused, char* out, const char ** __unused unit) {
strncpy(out, specialKeyEnable?"ON":"OFF", 4);
}, [](const MenuEntrySub & __unused sub) {
dipSwBits = dipSwBits & ~(1<<5);
dipSwBits |= (specialKeyEnable <<5);
writeSetting(DIPSW_BITS_ADDR,dipSwBits);
}
, nullptr
};
const MenuEntry* extrasMenuEntries[] = {
(MenuEntry*)&legacyPBMenu,
(MenuEntry*)&legacyBRMenu,
(MenuEntry*)&gateOpenMenu,
(MenuEntry*)&specialKeyMenu,
};
const MenuPage extrasMenuPage = {
"EXTRAS",
0,
CursorIdx::EExtras,
MAIN_MENU,
ARR_LEN(extrasMenuEntries), extrasMenuEntries
};
static bool midiEnterHandlerFunc() {
readSwitches();
if (pinkyKey){
@ -470,6 +536,7 @@ const MenuEntrySub midiMenu = {
const MenuEntryStateCh adjustMenu = { MenuType::EStateChange, "ADJUST", ADJUST_MENU };
const MenuEntryStateCh breathMenu = { MenuType::EStateChange, "SETUP BR", SETUP_BR_MENU };
const MenuEntryStateCh controlMenu = { MenuType::EStateChange, "SETUP CTL", SETUP_CT_MENU };
const MenuEntryStateCh extrasMenu = { MenuType::EStateChange, "EXTRAS", EXTRAS_MENU };
const MenuEntryStateCh aboutMenu = { MenuType::EStateChange, "ABOUT", ABOUT_MENU };
const MenuEntry* mainMenuEntries[] = {
@ -479,6 +546,7 @@ const MenuEntry* mainMenuEntries[] = {
(MenuEntry*)&adjustMenu,
(MenuEntry*)&breathMenu,
(MenuEntry*)&controlMenu,
(MenuEntry*)&extrasMenu,
(MenuEntry*)&aboutMenu,
};
@ -825,6 +893,7 @@ const MenuPage vibratoMenuPage = {
"VIBRATO", 0, CursorIdx::EVibrato, SETUP_CT_MENU, ARR_LEN(vibratorMenuEntries), vibratorMenuEntries
};
//***********************************************************
static bool patchPageUpdate(KeyState& __unused input, uint32_t __unused timeNow);
@ -1337,6 +1406,8 @@ void menu() {
redraw |= updatePage(&vibratoMenuPage, input, timeNow);
} else if (menuState == ABOUT_MENU) {
redraw |= updatePage((const MenuPage*)&aboutMenuPage, input, timeNow);
} else if (menuState == EXTRAS_MENU) {
redraw |= updatePage((const MenuPage*)&extrasMenuPage, input, timeNow);
}
if(redraw) {

View file

@ -18,6 +18,7 @@
#define ROTATOR_MENU 6
#define VIBRATO_MENU 7
#define ABOUT_MENU 8
#define EXTRAS_MENU 9
#define ARR_LEN(a) (sizeof (a) / sizeof (a[0]))