Changes to accomodate new sensors
PB control -> 2d stick Extra -> cap lip sensor Bite -> force sensitive resistor Lever -> pot 2d Stick added
This commit is contained in:
parent
e8aeb26399
commit
b401b34bb4
8 changed files with 150 additions and 143 deletions
|
@ -395,11 +395,8 @@ void portamento_() {
|
|||
//***********************************************************
|
||||
|
||||
void sendCC() {
|
||||
int biteVal = instrument.biteSignal;
|
||||
if (ExtraControl::CC == state.currentPreset->biteControl) {
|
||||
if (instrument.biteSignal >= calibration.biteThrVal) { // we are over the threshold, calculate CC value
|
||||
biteVal = mapConstrain(instrument.biteSignal, calibration.biteThrVal, calibration.biteMaxVal, 0, 127);
|
||||
}
|
||||
int biteVal = mapConstrain(instrument.biteSignal, calibration.biteThrVal, calibration.biteMaxVal, 0, 127);
|
||||
|
||||
if (biteVal != instrument.biteVal) {
|
||||
midiSendControlChange(state.currentPreset->biteCC, biteVal);
|
||||
|
@ -407,11 +404,8 @@ void sendCC() {
|
|||
instrument.biteVal = biteVal;
|
||||
}
|
||||
|
||||
int extraVal = instrument.extraVal;
|
||||
if (ExtraControl::CC == state.currentPreset->extraControl) {
|
||||
if (instrument.extraSignal != INT16_MIN) { // we are over the threshold, calculate CC value
|
||||
extraVal = mapConstrain(instrument.extraSignal, calibration.extraMinVal, calibration.extraMaxVal, 0, 127);
|
||||
}
|
||||
int extraVal = mapConstrain(instrument.extraSignal, calibration.extraMinVal, calibration.extraMaxVal, 0, 127);
|
||||
|
||||
if (extraVal != instrument.extraVal) {
|
||||
midiSendControlChange(state.currentPreset->extraCC, extraVal);
|
||||
|
@ -419,11 +413,8 @@ void sendCC() {
|
|||
instrument.extraVal = extraVal;
|
||||
}
|
||||
|
||||
int leverVal = instrument.leverVal;
|
||||
if (ExtraControl::CC == state.currentPreset->leverControl) {
|
||||
if (instrument.leverSignal != INT16_MIN) { // we are over the threshold, calculate CC value
|
||||
leverVal = mapConstrain(instrument.leverSignal, calibration.leverMinVal, calibration.leverMaxVal, 0, 127);
|
||||
}
|
||||
int leverVal = mapConstrain(instrument.leverSignal, calibration.leverMinVal, calibration.leverMaxVal, 0, 127);
|
||||
|
||||
if (leverVal != instrument.leverVal) {
|
||||
midiSendControlChange(state.currentPreset->leverCC, leverVal);
|
||||
|
@ -431,11 +422,8 @@ void sendCC() {
|
|||
instrument.leverVal = leverVal;
|
||||
}
|
||||
|
||||
int pbVal = instrument.pbVal;
|
||||
if (ExtraControl::CC == state.currentPreset->pbControl) {
|
||||
if (instrument.pbSignal != INT16_MIN) { // we are over the threshold, calculate CC value
|
||||
pbVal = mapConstrain(instrument.pbSignal, calibration.pbMinVal, calibration.pbMaxVal, 0, 127);
|
||||
}
|
||||
int pbVal = mapConstrain(instrument.pbSignal, calibration.pbMinVal, calibration.pbMaxVal, 0, 127);
|
||||
|
||||
if (pbVal != instrument.pbVal) {
|
||||
midiSendControlChange(state.currentPreset->pbCC, pbVal);
|
||||
|
@ -443,6 +431,34 @@ void sendCC() {
|
|||
instrument.pbVal = pbVal;
|
||||
}
|
||||
|
||||
if (state.currentPreset->pbYCC) {
|
||||
int pbYVal = mapConstrain(instrument.pbYSignal, calibration.pbYMinVal, calibration.pbYMaxVal, 0, 127);
|
||||
|
||||
if (pbYVal != instrument.pbYVal) {
|
||||
midiSendControlChange(state.currentPreset->pbYCC, pbYVal);
|
||||
}
|
||||
instrument.pbYVal = pbYVal;
|
||||
}
|
||||
|
||||
if (state.currentPreset->stickXCC) {
|
||||
int stickXVal = mapConstrain(instrument.stickXSignal, calibration.stickXMinVal, calibration.stickXMaxVal, 0, 127);
|
||||
|
||||
if (stickXVal != instrument.stickXVal) {
|
||||
midiSendControlChange(state.currentPreset->stickXCC, stickXVal);
|
||||
}
|
||||
instrument.stickXVal = stickXVal;
|
||||
}
|
||||
|
||||
if (state.currentPreset->stickYCC) {
|
||||
int stickYVal = mapConstrain(instrument.stickYSignal, calibration.stickYMinVal, calibration.stickYMaxVal, 0, 127);
|
||||
|
||||
if (stickYVal != instrument.stickYVal) {
|
||||
midiSendControlChange(state.currentPreset->stickYCC, stickYVal);
|
||||
}
|
||||
instrument.stickYVal = stickYVal;
|
||||
}
|
||||
|
||||
|
||||
if (!inMenu()) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
byte val = constrain((int)state.instrument->knobVals[i] + readKnob(i), 0, 127);
|
||||
|
@ -490,9 +506,6 @@ void autoCal() {
|
|||
for (int i = 1; i <= CALIBRATE_SAMPLE_COUNT; ++i) {
|
||||
bZero += readPressure();
|
||||
bAltZero += readAltPressure();
|
||||
bLeverTouchZero += readRawSlider(Slider::SLIDER_LEVER);
|
||||
bExtraTouchZero += readRawSlider(Slider::SLIDER_EXTRA);
|
||||
bPBTouchZero += readRawSlider(Slider::SLIDER_PITCH_BEND);
|
||||
}
|
||||
|
||||
instrument.breathZero = bZero / CALIBRATE_SAMPLE_COUNT;
|
||||
|
@ -842,10 +855,13 @@ void initState() {
|
|||
* Read all utility sensors
|
||||
*/
|
||||
void readUtil() {
|
||||
instrument.biteSignal = readTouchRoller(bitePin);
|
||||
instrument.pbSignal = readSlider(Slider::SLIDER_PITCH_BEND, instrument.sliderPBThr);
|
||||
instrument.leverSignal = readSlider(Slider::SLIDER_LEVER, instrument.sliderLeverThr);
|
||||
instrument.extraSignal = readSlider(Slider::SLIDER_EXTRA, instrument.sliderExtraThr);
|
||||
instrument.biteSignal = readRawControl(CONTROL_BITE);
|
||||
instrument.pbSignal = readRawControl(CONTROL_PB);
|
||||
instrument.pbYSignal = readRawControl(CONTROL_PB_Y);
|
||||
instrument.extraSignal = readRawControl(CONTROL_EXTRA);
|
||||
instrument.leverSignal = readRawControl(CONTROL_LEVER);
|
||||
instrument.stickXSignal = readRawControl(CONTROL_STICK_X);
|
||||
instrument.stickYSignal = readRawControl(CONTROL_STICK_Y);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1029,6 +1045,10 @@ void setup() {
|
|||
initState(); // Set up midi/etc
|
||||
statusLedOn(); // Switch on the onboard LED to indicate power on/ready
|
||||
displayOff(state);
|
||||
|
||||
if (checkButtonState(STARTUP_TEST)) {
|
||||
instrument.mode = MODE_TEST;
|
||||
}
|
||||
}
|
||||
|
||||
//_______________________________________________________________________________________________ MAIN LOOP
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue