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
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
// Statup buttons
|
// Statup buttons
|
||||||
#define STARTUP_FACTORY_RESET 0x3
|
#define STARTUP_FACTORY_RESET 0x3
|
||||||
|
#define STARTUP_TEST 0x2
|
||||||
#define STARTUP_CONFIG 0xC
|
#define STARTUP_CONFIG 0xC
|
||||||
#define TEST_CONFIG 0xA
|
#define TEST_CONFIG 0xA
|
||||||
#define DEBUG_CONFIG 0x1
|
#define DEBUG_CONFIG 0x1
|
||||||
|
@ -50,7 +51,7 @@
|
||||||
|
|
||||||
#define BREATH_LO_LIMIT 9000
|
#define BREATH_LO_LIMIT 9000
|
||||||
#define BREATH_HI_LIMIT 12000
|
#define BREATH_HI_LIMIT 12000
|
||||||
#define BITE_LO_LIMIT 500
|
#define BITE_LO_LIMIT 0
|
||||||
#define BITE_HI_LIMIT 1000
|
#define BITE_HI_LIMIT 1000
|
||||||
#define PITCHB_LO_LIMIT -2000
|
#define PITCHB_LO_LIMIT -2000
|
||||||
#define PITCHB_HI_LIMIT 2000
|
#define PITCHB_HI_LIMIT 2000
|
||||||
|
|
|
@ -101,8 +101,11 @@ struct instrument_state_t {
|
||||||
int16_t biteSignal = 0; // capacitance data from bite sensor, for midi cc and threshold checks
|
int16_t biteSignal = 0; // capacitance data from bite sensor, for midi cc and threshold checks
|
||||||
int16_t leverSignal = 0;
|
int16_t leverSignal = 0;
|
||||||
int16_t pbSignal = 0;
|
int16_t pbSignal = 0;
|
||||||
|
int16_t pbYSignal = 0;
|
||||||
int16_t extraSignal = 0;
|
int16_t extraSignal = 0;
|
||||||
int16_t vibSignal = 0;
|
int16_t vibSignal = 0;
|
||||||
|
int16_t stickXSignal = 0;
|
||||||
|
int16_t stickYSignal = 0;
|
||||||
int16_t avgCTouchSignal = 0;
|
int16_t avgCTouchSignal = 0;
|
||||||
|
|
||||||
// MIDI values
|
// MIDI values
|
||||||
|
@ -112,6 +115,9 @@ struct instrument_state_t {
|
||||||
byte extraVal = 0; // keep track and make sure we send CC with 0 value when off threshold
|
byte extraVal = 0; // keep track and make sure we send CC with 0 value when off threshold
|
||||||
byte leverVal = 0; // keep track and make sure we send CC with 0 value when off threshold
|
byte leverVal = 0; // keep track and make sure we send CC with 0 value when off threshold
|
||||||
byte pbVal = 0; // keep track and make sure we send CC with 0 value when off threshold
|
byte pbVal = 0; // keep track and make sure we send CC with 0 value when off threshold
|
||||||
|
byte pbYVal = 0; // keep track and make sure we send CC with 0 value when off threshold
|
||||||
|
byte stickXVal = 0; // keep track and make sure we send CC with 0 value when off threshold
|
||||||
|
byte stickYVal = 0; // keep track and make sure we send CC with 0 value when off threshold
|
||||||
int pitchBend = 8192;
|
int pitchBend = 8192;
|
||||||
int pbSend = 8192; // Pitch bend actually sent, modified by vibrato, etc
|
int pbSend = 8192; // Pitch bend actually sent, modified by vibrato, etc
|
||||||
bool pbActive = false; // extra CC selection
|
bool pbActive = false; // extra CC selection
|
||||||
|
|
|
@ -20,7 +20,6 @@ float sliderMALever = 0.0;
|
||||||
|
|
||||||
Adafruit_MPR121 touchSensorKeys = Adafruit_MPR121();
|
Adafruit_MPR121 touchSensorKeys = Adafruit_MPR121();
|
||||||
Adafruit_MPR121 touchSensorRoller = Adafruit_MPR121();
|
Adafruit_MPR121 touchSensorRoller = Adafruit_MPR121();
|
||||||
Adafruit_MPR121 touchSensorUtil = Adafruit_MPR121();
|
|
||||||
Adafruit_MPRLS pressureSensorMain = Adafruit_MPRLS();
|
Adafruit_MPRLS pressureSensorMain = Adafruit_MPRLS();
|
||||||
Adafruit_MPRLS pressureSensorAlt = Adafruit_MPRLS();
|
Adafruit_MPRLS pressureSensorAlt = Adafruit_MPRLS();
|
||||||
|
|
||||||
|
@ -56,9 +55,6 @@ void initHardware() {
|
||||||
tiltFilter.setFilter(LOWPASS, ICM_FILTER_FREQ, 0.0); // create a one pole (RC) lowpass filter
|
tiltFilter.setFilter(LOWPASS, ICM_FILTER_FREQ, 0.0); // create a one pole (RC) lowpass filter
|
||||||
rollFilter.setFilter(LOWPASS, ICM_FILTER_FREQ, 0.0); // create a one pole (RC) lowpass filter
|
rollFilter.setFilter(LOWPASS, ICM_FILTER_FREQ, 0.0); // create a one pole (RC) lowpass filter
|
||||||
icmSensor.begin_I2C(ICM20948_I2CADDR_DEFAULT, &MainI2CBus);
|
icmSensor.begin_I2C(ICM20948_I2CADDR_DEFAULT, &MainI2CBus);
|
||||||
sliderFilterExtra.setFilter(INTEGRATOR, 0.75, 0.0);
|
|
||||||
sliderFilterLever.setFilter(INTEGRATOR, 0.75, 0.0);
|
|
||||||
sliderFilterPB.setFilter(INTEGRATOR, 0.75, 0.0);
|
|
||||||
|
|
||||||
ledStrip.begin();
|
ledStrip.begin();
|
||||||
|
|
||||||
|
@ -72,13 +68,6 @@ void initHardware() {
|
||||||
errorWait();
|
errorWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!touchSensorUtil.begin(UtilI2CAddr, &MainI2CBus)) {
|
|
||||||
displayError("Util touch error");
|
|
||||||
errorWait();
|
|
||||||
}
|
|
||||||
//touchSensorUtil.writeRegister(MPR121_CONFIG1, 0x3f); // default, 16uA charge current
|
|
||||||
//touchSensorUtil.writeRegister(MPR121_CONFIG2, 0xE0); // 0.5uS encoding, 1ms period
|
|
||||||
|
|
||||||
if (!pressureSensorMain.begin(MPRLS_DEFAULT_ADDR, &AuxI2CBus)) {
|
if (!pressureSensorMain.begin(MPRLS_DEFAULT_ADDR, &AuxI2CBus)) {
|
||||||
displayError("Main pressure sensor error");
|
displayError("Main pressure sensor error");
|
||||||
errorWait();
|
errorWait();
|
||||||
|
@ -171,18 +160,10 @@ int readTouchRoller(uint8_t n) {
|
||||||
return CAP_SENS_ABSOLUTE_MAX - touchSensorRoller.filteredData(n);
|
return CAP_SENS_ABSOLUTE_MAX - touchSensorRoller.filteredData(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
int readTouchUtil(uint8_t n) {
|
|
||||||
return CAP_SENS_ABSOLUTE_MAX - touchSensorUtil.filteredData(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t keysTouched() {
|
uint16_t keysTouched() {
|
||||||
return touchSensorKeys.touched();
|
return touchSensorKeys.touched();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t utilTouched() {
|
|
||||||
return touchSensorUtil.touched();
|
|
||||||
}
|
|
||||||
|
|
||||||
int readSpikePressure() {
|
int readSpikePressure() {
|
||||||
return spikeFilter.output();
|
return spikeFilter.output();
|
||||||
}
|
}
|
||||||
|
@ -198,47 +179,12 @@ int readAltPressure() {
|
||||||
return breathAltFilter.input(pressureSensorAlt.readPressure()) * PRESSURE_SENS_MULTIPLIER;
|
return breathAltFilter.input(pressureSensorAlt.readPressure()) * PRESSURE_SENS_MULTIPLIER;
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t readSlider(Slider id, int thr) {
|
int16_t readAnalog(Control id, int thr) {
|
||||||
float filtered = 0.0;
|
|
||||||
float a = 0, b = 0;
|
|
||||||
FilterOnePole *filter;
|
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case SLIDER_PITCH_BEND:
|
|
||||||
a = touchSensorUtil.filteredData(pbSliderPin1);
|
|
||||||
b = touchSensorUtil.filteredData(pbSliderPin2);
|
|
||||||
filter = &sliderFilterPB;
|
|
||||||
break;
|
|
||||||
case SLIDER_EXTRA:
|
|
||||||
a = touchSensorRoller.filteredData(extraSliderPin1);
|
|
||||||
b = touchSensorRoller.filteredData(extraSliderPin2);
|
|
||||||
filter = &sliderFilterExtra;
|
|
||||||
/*
|
|
||||||
Serial.print(">a:");
|
|
||||||
Serial.println(a);
|
|
||||||
Serial.print(">b:");
|
|
||||||
Serial.println(b);
|
|
||||||
Serial.print(">thr:");
|
|
||||||
Serial.println(thr);
|
|
||||||
*/
|
|
||||||
break;
|
|
||||||
case SLIDER_LEVER:
|
|
||||||
a = touchSensorUtil.filteredData(leverSliderPin1);
|
|
||||||
b = touchSensorUtil.filteredData(leverSliderPin2);
|
|
||||||
filter = &sliderFilterLever;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return 0.0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((a + b) <= (thr + thr - SLIDER_TOUCH_OFFSET)) {
|
|
||||||
filtered = filter->input(a - b);
|
|
||||||
} else {
|
|
||||||
return INT16_MIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
return filtered * 100;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
icm_result_t readICM() {
|
icm_result_t readICM() {
|
||||||
|
@ -254,25 +200,34 @@ icm_result_t readICM() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
int readRawSlider(Slider id) {
|
int readRawControl(Control id) {
|
||||||
float a, b;
|
int a;
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case SLIDER_PITCH_BEND:
|
case CONTROL_PB:
|
||||||
a = touchSensorUtil.filteredData(pbSliderPin1);
|
a = analogRead(pbXPin);
|
||||||
b = touchSensorUtil.filteredData(pbSliderPin2);
|
|
||||||
break;
|
break;
|
||||||
case SLIDER_EXTRA:
|
case CONTROL_PB_Y:
|
||||||
a = touchSensorRoller.filteredData(extraSliderPin1);
|
a = analogRead(pbYPin);
|
||||||
b = touchSensorRoller.filteredData(extraSliderPin2);
|
|
||||||
break;
|
break;
|
||||||
case SLIDER_LEVER:
|
case CONTROL_EXTRA:
|
||||||
a = touchSensorUtil.filteredData(leverSliderPin1);
|
a = readTouchRoller(extraPin);
|
||||||
b = touchSensorUtil.filteredData(leverSliderPin2);
|
break;
|
||||||
|
case CONTROL_BITE:
|
||||||
|
a = analogRead(bitePin);
|
||||||
|
break;
|
||||||
|
case CONTROL_LEVER:
|
||||||
|
a = analogRead(leverPin);
|
||||||
|
break;
|
||||||
|
case CONTROL_STICK_X:
|
||||||
|
a = analogRead(stickXPin);
|
||||||
|
break;
|
||||||
|
case CONTROL_STICK_Y:
|
||||||
|
a = analogRead(stickYPin);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return 0.0;
|
return 0.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (a + b) / 2;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,14 @@ struct icm_result_t {
|
||||||
float roll;
|
float roll;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Slider : uint8_t {
|
enum Control : uint8_t {
|
||||||
SLIDER_PITCH_BEND = 0,
|
CONTROL_PB = 0,
|
||||||
SLIDER_EXTRA = 1,
|
CONTROL_PB_Y = 1,
|
||||||
SLIDER_LEVER = 2,
|
CONTROL_EXTRA = 2,
|
||||||
|
CONTROL_LEVER = 3,
|
||||||
|
CONTROL_STICK_X = 4,
|
||||||
|
CONTROL_STICK_Y = 5,
|
||||||
|
CONTROL_BITE = 6,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,11 +39,9 @@ uint8_t buttonState(); // return true if the given buttons are pressed
|
||||||
int readKnob(uint8_t n);
|
int readKnob(uint8_t n);
|
||||||
int readTouchKey(uint8_t n);
|
int readTouchKey(uint8_t n);
|
||||||
int readTouchRoller(uint8_t n);
|
int readTouchRoller(uint8_t n);
|
||||||
int readTouchUtil(uint8_t n);
|
int readRawControl(Control id);
|
||||||
int readRawSlider(Slider id);
|
int16_t readControl(Control id, int thr);
|
||||||
int16_t readSlider(Slider id, int thr);
|
|
||||||
uint16_t keysTouched();
|
uint16_t keysTouched();
|
||||||
uint16_t utilTouched();
|
|
||||||
int readPressure();
|
int readPressure();
|
||||||
int readAltPressure();
|
int readAltPressure();
|
||||||
int readSpikePressure();
|
int readSpikePressure();
|
||||||
|
@ -48,8 +50,8 @@ icm_result_t readICM();
|
||||||
// xEVI hardware setup
|
// xEVI hardware setup
|
||||||
|
|
||||||
// I2C
|
// I2C
|
||||||
#define MainI2CBus Wire1
|
#define MainI2CBus Wire
|
||||||
#define AuxI2CBus Wire
|
#define AuxI2CBus Wire1
|
||||||
#define KeysI2CAddr 0x5A
|
#define KeysI2CAddr 0x5A
|
||||||
#define RollerI2CAddr 0x5B
|
#define RollerI2CAddr 0x5B
|
||||||
#define UtilI2CAddr 0x5C
|
#define UtilI2CAddr 0x5C
|
||||||
|
@ -61,15 +63,15 @@ icm_result_t readICM();
|
||||||
#define b4Pin 0
|
#define b4Pin 0
|
||||||
|
|
||||||
// Digital pins for encoder quadrature
|
// Digital pins for encoder quadrature
|
||||||
#define e1aPin 6
|
#define e1aPin 8
|
||||||
#define e2aPin 8
|
#define e2aPin 7
|
||||||
#define e3aPin 7
|
#define e3aPin 6
|
||||||
#define e4aPin 5
|
#define e4aPin 5
|
||||||
|
|
||||||
#define e1bPin 22
|
#define e1bPin 12
|
||||||
#define e2bPin 21
|
#define e2bPin 11
|
||||||
#define e3bPin 20
|
#define e3bPin 10
|
||||||
#define e4bPin 23
|
#define e4bPin 9
|
||||||
|
|
||||||
// CV pins
|
// CV pins
|
||||||
#define cvGatePin 9
|
#define cvGatePin 9
|
||||||
|
@ -107,13 +109,14 @@ icm_result_t readICM();
|
||||||
#define R5Pin 10
|
#define R5Pin 10
|
||||||
#define R6Pin 11
|
#define R6Pin 11
|
||||||
|
|
||||||
// Additional pins
|
// Control pins
|
||||||
#define bitePin 0
|
#define extraPin 0
|
||||||
#define barPin 7
|
#define bitePin A6
|
||||||
#define pbSliderPin1 11
|
#define pbXPin A8
|
||||||
#define pbSliderPin2 10
|
#define pbYPin A9
|
||||||
#define leverSliderPin1 9
|
#define pbBPin 21
|
||||||
#define leverSliderPin2 8
|
#define stickXPin A10
|
||||||
#define extraSliderPin1 2
|
#define stickYPin A11
|
||||||
#define extraSliderPin2 3
|
#define leverPin A1
|
||||||
|
#define stickBPin 14
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -223,7 +223,7 @@ static const unsigned char PROGMEM nuevi_logo_bmp[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
#define OLED_RESET 4
|
#define OLED_RESET 4
|
||||||
Adafruit_SSD1306 display(128, 64, &Wire1, OLED_RESET, 1000000, 1000000);
|
Adafruit_SSD1306 display(128, 64, &MainI2CBus, OLED_RESET, 1000000, 1000000);
|
||||||
int16_t ctouchVal = 0;
|
int16_t ctouchVal = 0;
|
||||||
|
|
||||||
MenuScreen* currentMenu = NULL;
|
MenuScreen* currentMenu = NULL;
|
||||||
|
@ -936,18 +936,21 @@ private:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::array<AdjustValue, 7> adjustValues = { {
|
std::array<AdjustValue, 10> adjustValues = { {
|
||||||
{"BREATH", &instrument_state_t::breathSignal, &calibration_t::breathThrValOffset, &calibration_t::breathMaxValOffset,
|
{"BREATH", &instrument_state_t::breathSignal, &calibration_t::breathThrValOffset, &calibration_t::breathMaxValOffset,
|
||||||
BREATH_LO_LIMIT, BREATH_HI_LIMIT, &instrument_state_t::breathZero},
|
BREATH_LO_LIMIT, BREATH_HI_LIMIT, &instrument_state_t::breathZero},
|
||||||
{"BITE",&instrument_state_t::biteSignal, &calibration_t::biteThrVal, &calibration_t::biteMaxVal, BITE_LO_LIMIT, BITE_HI_LIMIT, NULL},
|
{"BITE",&instrument_state_t::biteSignal, &calibration_t::biteThrVal, &calibration_t::biteMaxVal, BITE_LO_LIMIT, BITE_HI_LIMIT, NULL},
|
||||||
{"PB",&instrument_state_t::pbSignal, &calibration_t::pbMinVal, &calibration_t::pbMaxVal, PITCHB_LO_LIMIT, PITCHB_HI_LIMIT, NULL},
|
{"PB",&instrument_state_t::pbSignal, &calibration_t::pbMinVal, &calibration_t::pbMaxVal, PITCHB_LO_LIMIT, PITCHB_HI_LIMIT, NULL},
|
||||||
{"PB Z/DZ",&instrument_state_t::pbSignal, &calibration_t::pbCenterVal, &calibration_t::pbDeadzone, PITCHB_LO_LIMIT, PITCHB_HI_LIMIT, NULL},
|
{"PB Z/DZ",&instrument_state_t::pbSignal, &calibration_t::pbCenterVal, &calibration_t::pbDeadzone, PITCHB_LO_LIMIT, PITCHB_HI_LIMIT, NULL},
|
||||||
|
{"PB Y",&instrument_state_t::pbYSignal, &calibration_t::pbYMinVal, &calibration_t::pbYMaxVal, PITCHB_LO_LIMIT, PITCHB_HI_LIMIT, NULL},
|
||||||
{"EXTRA", &instrument_state_t::extraSignal, &calibration_t::extraMinVal, &calibration_t::extraMaxVal, EXTRA_LO_LIMIT, EXTRA_HI_LIMIT, NULL},
|
{"EXTRA", &instrument_state_t::extraSignal, &calibration_t::extraMinVal, &calibration_t::extraMaxVal, EXTRA_LO_LIMIT, EXTRA_HI_LIMIT, NULL},
|
||||||
{"LEVER", &instrument_state_t::leverSignal, &calibration_t::leverMinVal, &calibration_t::leverMaxVal, LEVER_LO_LIMIT, LEVER_HI_LIMIT, NULL},
|
{"LEVER", &instrument_state_t::leverSignal, &calibration_t::leverMinVal, &calibration_t::leverMaxVal, LEVER_LO_LIMIT, LEVER_HI_LIMIT, NULL},
|
||||||
|
{"STICK X", &instrument_state_t::stickXSignal, &calibration_t::stickXMinVal, &calibration_t::stickXMaxVal, LEVER_LO_LIMIT, LEVER_HI_LIMIT, NULL},
|
||||||
|
{"STICK Y", &instrument_state_t::stickYSignal, &calibration_t::stickYMinVal, &calibration_t::stickYMaxVal, LEVER_LO_LIMIT, LEVER_HI_LIMIT, NULL},
|
||||||
{"TOUCH", &instrument_state_t::avgCTouchSignal, &calibration_t::ctouchThrVal, &calibration_t::ctouchThrVal, CTOUCH_LO_LIMIT, CTOUCH_HI_LIMIT, NULL},
|
{"TOUCH", &instrument_state_t::avgCTouchSignal, &calibration_t::ctouchThrVal, &calibration_t::ctouchThrVal, CTOUCH_LO_LIMIT, CTOUCH_HI_LIMIT, NULL},
|
||||||
}};
|
}};
|
||||||
|
|
||||||
AdjustMenuScreen<7> adjustMenu("ADJUST", adjustValues);
|
AdjustMenuScreen<10> adjustMenu("ADJUST", adjustValues);
|
||||||
|
|
||||||
|
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
@ -1005,6 +1008,9 @@ ChoiceMenu<4, ExtraControl> extraCtlMenu("EXT CTL", &preset_t::extraControl, { {
|
||||||
PresetValueMenu<128, uint8_t> extraCCMenu("EXT CC", &preset_t::extraCC, 0, 127, true, CC_NAMES);
|
PresetValueMenu<128, uint8_t> extraCCMenu("EXT CC", &preset_t::extraCC, 0, 127, true, CC_NAMES);
|
||||||
ChoiceMenu<6, ExtraControl> pbCtlMenu("PB CTL", &preset_t::pbControl, { {OFF, VIBRATO, GLIDE, CC, BEND, VIB_BEND} }, { "OFF", "VIBRATO", "GLIDE", "CC", "BEND", "VIB_BEND" });
|
ChoiceMenu<6, ExtraControl> pbCtlMenu("PB CTL", &preset_t::pbControl, { {OFF, VIBRATO, GLIDE, CC, BEND, VIB_BEND} }, { "OFF", "VIBRATO", "GLIDE", "CC", "BEND", "VIB_BEND" });
|
||||||
PresetValueMenu<128, uint8_t> pbCCMenu("PB CC", &preset_t::pbCC, 0, 127, true, CC_NAMES);
|
PresetValueMenu<128, uint8_t> pbCCMenu("PB CC", &preset_t::pbCC, 0, 127, true, CC_NAMES);
|
||||||
|
PresetValueMenu<128, uint8_t> pbYCCMenu("PB Y CC", &preset_t::pbYCC, 0, 127, true, CC_NAMES);
|
||||||
|
PresetValueMenu<128, uint8_t> stickXCCMenu("STICK X CC", &preset_t::stickXCC, 0, 127, true, CC_NAMES);
|
||||||
|
PresetValueMenu<128, uint8_t> stickYCCMenu("STICK Y CC", &preset_t::stickYCC, 0, 127, true, CC_NAMES);
|
||||||
ChoiceMenu<4, ExtraControl> tiltModeMenu("TILT MODE", &preset_t::icmTiltMode, { {OFF, VIBRATO, GLIDE, CC} }, { "OFF", "VIBRATO", "GLIDE", "CC" });
|
ChoiceMenu<4, ExtraControl> tiltModeMenu("TILT MODE", &preset_t::icmTiltMode, { {OFF, VIBRATO, GLIDE, CC} }, { "OFF", "VIBRATO", "GLIDE", "CC" });
|
||||||
PresetValueMenu<128, uint8_t> tiltCCMenu("TILT CC", &preset_t::icmTiltCC, 0, 127, true, CC_NAMES);
|
PresetValueMenu<128, uint8_t> tiltCCMenu("TILT CC", &preset_t::icmTiltCC, 0, 127, true, CC_NAMES);
|
||||||
ChoiceMenu<4, ExtraControl> rollModeMenu("ROLL MODE", &preset_t::icmRollMode, { {OFF, VIBRATO, GLIDE, CC} }, { "OFF", "VIBRATO", "GLIDE", "CC" });
|
ChoiceMenu<4, ExtraControl> rollModeMenu("ROLL MODE", &preset_t::icmRollMode, { {OFF, VIBRATO, GLIDE, CC} }, { "OFF", "VIBRATO", "GLIDE", "CC" });
|
||||||
|
@ -1082,7 +1088,7 @@ std::array<MenuScreen *const, 11> breathMenuEntries = {
|
||||||
};
|
};
|
||||||
SubMenu<11> breathMenu("BR SETUP", breathMenuEntries);
|
SubMenu<11> breathMenu("BR SETUP", breathMenuEntries);
|
||||||
|
|
||||||
const std::array<MenuScreen *const, 22> controlMenuEntries = {
|
const std::array<MenuScreen *const, 25> controlMenuEntries = {
|
||||||
&fingeringMenu,
|
&fingeringMenu,
|
||||||
&polyMenu,
|
&polyMenu,
|
||||||
&rollerMenu,
|
&rollerMenu,
|
||||||
|
@ -1090,6 +1096,9 @@ const std::array<MenuScreen *const, 22> controlMenuEntries = {
|
||||||
&biteCCMenu,
|
&biteCCMenu,
|
||||||
&pbCtlMenu,
|
&pbCtlMenu,
|
||||||
&pbCCMenu,
|
&pbCCMenu,
|
||||||
|
&pbYCCMenu,
|
||||||
|
&stickXCCMenu,
|
||||||
|
&stickYCCMenu,
|
||||||
&leverCtlMenu,
|
&leverCtlMenu,
|
||||||
&leverCCMenu,
|
&leverCCMenu,
|
||||||
&extraCtlMenu,
|
&extraCtlMenu,
|
||||||
|
@ -1106,7 +1115,7 @@ const std::array<MenuScreen *const, 22> controlMenuEntries = {
|
||||||
&accelModeMenu,
|
&accelModeMenu,
|
||||||
&accelCCMenu,
|
&accelCCMenu,
|
||||||
};
|
};
|
||||||
SubMenu<22> controlMenu("CTL SETUP", controlMenuEntries);
|
SubMenu<25> controlMenu("CTL SETUP", controlMenuEntries);
|
||||||
|
|
||||||
const std::array<MenuScreen *const, 5> vibratoMenuEntries = {
|
const std::array<MenuScreen *const, 5> vibratoMenuEntries = {
|
||||||
&vibDepthMenu,
|
&vibDepthMenu,
|
||||||
|
@ -1249,7 +1258,7 @@ void initDisplay() {
|
||||||
// internally, this will display the splashscreen.
|
// internally, this will display the splashscreen.
|
||||||
|
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
display.setRotation(2);
|
display.setRotation(0);
|
||||||
display.drawBitmap(0, 0, nuevi_logo_bmp, LOGO16_GLCD_WIDTH, LOGO16_GLCD_HEIGHT, 1);
|
display.drawBitmap(0, 0, nuevi_logo_bmp, LOGO16_GLCD_WIDTH, LOGO16_GLCD_HEIGHT, 1);
|
||||||
display.display();
|
display.display();
|
||||||
currentMenu = &statusMenu;
|
currentMenu = &statusMenu;
|
||||||
|
|
|
@ -35,7 +35,13 @@ struct calibration_t {
|
||||||
int16_t extraMinVal = -1000;
|
int16_t extraMinVal = -1000;
|
||||||
int16_t extraMaxVal = 1000;
|
int16_t extraMaxVal = 1000;
|
||||||
int16_t ctouchThrVal = 900;
|
int16_t ctouchThrVal = 900;
|
||||||
uint8_t _reserved[24];
|
int16_t pbYMinVal = 0;
|
||||||
|
int16_t pbYMaxVal = 1000;
|
||||||
|
int16_t stickXMinVal = 0;
|
||||||
|
int16_t stickXMaxVal = 1000;
|
||||||
|
int16_t stickYMinVal = 0;
|
||||||
|
int16_t stickYMaxVal = 1000;
|
||||||
|
uint8_t _reserved[12];
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(calibration_t) == CALIBRATION_MAX_SIZE, "calibration data wrong size");
|
static_assert(sizeof(calibration_t) == CALIBRATION_MAX_SIZE, "calibration data wrong size");
|
||||||
|
@ -97,8 +103,11 @@ struct preset_t {
|
||||||
PolySelect polyMode = PolySelect::EHarmonizerOff;
|
PolySelect polyMode = PolySelect::EHarmonizerOff;
|
||||||
ExtraControl pbControl = ExtraControl::VIB_BEND;
|
ExtraControl pbControl = ExtraControl::VIB_BEND;
|
||||||
uint8_t pbCC = 12; // extra CC selection
|
uint8_t pbCC = 12; // extra CC selection
|
||||||
|
uint8_t pbYCC = 13; // pbY CC selection
|
||||||
|
uint8_t stickXCC = 14; // stickX CC selection
|
||||||
|
uint8_t stickYCC = 15; // stickY CC selection
|
||||||
|
|
||||||
uint8_t _reserved[80];
|
uint8_t _reserved[77];
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(preset_t) == PRESET_MAX_SIZE, "preset_t must be 128 bytes");
|
static_assert(sizeof(preset_t) == PRESET_MAX_SIZE, "preset_t must be 128 bytes");
|
||||||
|
|
|
@ -12,7 +12,25 @@ void handleTestMode(state_t &state) {
|
||||||
Serial.print("Buttons:");
|
Serial.print("Buttons:");
|
||||||
Serial.println(buttons, HEX);
|
Serial.println(buttons, HEX);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
Serial.print(">KnobE1aPin:");
|
||||||
|
Serial.println(digitalRead(e1aPin));
|
||||||
|
Serial.print(">KnobE2aPin:");
|
||||||
|
Serial.println(digitalRead(e2aPin));
|
||||||
|
Serial.print(">KnobE3aPin:");
|
||||||
|
Serial.println(digitalRead(e3aPin));
|
||||||
|
Serial.print(">KnobE4aPin:");
|
||||||
|
Serial.println(digitalRead(e4aPin));
|
||||||
|
|
||||||
|
Serial.print(">KnobE1bPin:");
|
||||||
|
Serial.println(digitalRead(e1bPin));
|
||||||
|
Serial.print(">KnobE2bPin:");
|
||||||
|
Serial.println(digitalRead(e2bPin));
|
||||||
|
Serial.print(">KnobE3bPin:");
|
||||||
|
Serial.println(digitalRead(e3bPin));
|
||||||
|
Serial.print(">KnobE4bPin:");
|
||||||
|
Serial.println(digitalRead(e4bPin));
|
||||||
|
*/
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
int k = readKnob(i);
|
int k = readKnob(i);
|
||||||
if (k != 0) {
|
if (k != 0) {
|
||||||
|
@ -30,13 +48,6 @@ void handleTestMode(state_t &state) {
|
||||||
oldKeys = keys;
|
oldKeys = keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t util = utilTouched();
|
|
||||||
if (util != oldUtil) {
|
|
||||||
Serial.print("Util:");
|
|
||||||
Serial.println(util, HEX);
|
|
||||||
oldUtil = util;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buttons == 0x01) {
|
if (buttons == 0x01) {
|
||||||
plotCap = !plotCap;
|
plotCap = !plotCap;
|
||||||
}
|
}
|
||||||
|
@ -46,18 +57,11 @@ void handleTestMode(state_t &state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plotCap) {
|
if (plotCap) {
|
||||||
for (int i = 0; i < 12; i++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
Serial.print(">key");
|
Serial.print(">control");
|
||||||
Serial.print(i);
|
Serial.print(i);
|
||||||
Serial.print(":");
|
Serial.print(":");
|
||||||
Serial.println(readTouchKey(i));
|
Serial.println(readRawControl(i));
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < 12; i++) {
|
|
||||||
Serial.print(">util");
|
|
||||||
Serial.print(i);
|
|
||||||
Serial.print(":");
|
|
||||||
Serial.println(readTouchRoller(i));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -395,11 +395,8 @@ void portamento_() {
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
||||||
void sendCC() {
|
void sendCC() {
|
||||||
int biteVal = instrument.biteSignal;
|
|
||||||
if (ExtraControl::CC == state.currentPreset->biteControl) {
|
if (ExtraControl::CC == state.currentPreset->biteControl) {
|
||||||
if (instrument.biteSignal >= calibration.biteThrVal) { // we are over the threshold, calculate CC value
|
int biteVal = mapConstrain(instrument.biteSignal, calibration.biteThrVal, calibration.biteMaxVal, 0, 127);
|
||||||
biteVal = mapConstrain(instrument.biteSignal, calibration.biteThrVal, calibration.biteMaxVal, 0, 127);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (biteVal != instrument.biteVal) {
|
if (biteVal != instrument.biteVal) {
|
||||||
midiSendControlChange(state.currentPreset->biteCC, biteVal);
|
midiSendControlChange(state.currentPreset->biteCC, biteVal);
|
||||||
|
@ -407,11 +404,8 @@ void sendCC() {
|
||||||
instrument.biteVal = biteVal;
|
instrument.biteVal = biteVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
int extraVal = instrument.extraVal;
|
|
||||||
if (ExtraControl::CC == state.currentPreset->extraControl) {
|
if (ExtraControl::CC == state.currentPreset->extraControl) {
|
||||||
if (instrument.extraSignal != INT16_MIN) { // we are over the threshold, calculate CC value
|
int extraVal = mapConstrain(instrument.extraSignal, calibration.extraMinVal, calibration.extraMaxVal, 0, 127);
|
||||||
extraVal = mapConstrain(instrument.extraSignal, calibration.extraMinVal, calibration.extraMaxVal, 0, 127);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (extraVal != instrument.extraVal) {
|
if (extraVal != instrument.extraVal) {
|
||||||
midiSendControlChange(state.currentPreset->extraCC, extraVal);
|
midiSendControlChange(state.currentPreset->extraCC, extraVal);
|
||||||
|
@ -419,11 +413,8 @@ void sendCC() {
|
||||||
instrument.extraVal = extraVal;
|
instrument.extraVal = extraVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
int leverVal = instrument.leverVal;
|
|
||||||
if (ExtraControl::CC == state.currentPreset->leverControl) {
|
if (ExtraControl::CC == state.currentPreset->leverControl) {
|
||||||
if (instrument.leverSignal != INT16_MIN) { // we are over the threshold, calculate CC value
|
int leverVal = mapConstrain(instrument.leverSignal, calibration.leverMinVal, calibration.leverMaxVal, 0, 127);
|
||||||
leverVal = mapConstrain(instrument.leverSignal, calibration.leverMinVal, calibration.leverMaxVal, 0, 127);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (leverVal != instrument.leverVal) {
|
if (leverVal != instrument.leverVal) {
|
||||||
midiSendControlChange(state.currentPreset->leverCC, leverVal);
|
midiSendControlChange(state.currentPreset->leverCC, leverVal);
|
||||||
|
@ -431,11 +422,8 @@ void sendCC() {
|
||||||
instrument.leverVal = leverVal;
|
instrument.leverVal = leverVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pbVal = instrument.pbVal;
|
|
||||||
if (ExtraControl::CC == state.currentPreset->pbControl) {
|
if (ExtraControl::CC == state.currentPreset->pbControl) {
|
||||||
if (instrument.pbSignal != INT16_MIN) { // we are over the threshold, calculate CC value
|
int pbVal = mapConstrain(instrument.pbSignal, calibration.pbMinVal, calibration.pbMaxVal, 0, 127);
|
||||||
pbVal = mapConstrain(instrument.pbSignal, calibration.pbMinVal, calibration.pbMaxVal, 0, 127);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pbVal != instrument.pbVal) {
|
if (pbVal != instrument.pbVal) {
|
||||||
midiSendControlChange(state.currentPreset->pbCC, pbVal);
|
midiSendControlChange(state.currentPreset->pbCC, pbVal);
|
||||||
|
@ -443,6 +431,34 @@ void sendCC() {
|
||||||
instrument.pbVal = pbVal;
|
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()) {
|
if (!inMenu()) {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
byte val = constrain((int)state.instrument->knobVals[i] + readKnob(i), 0, 127);
|
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) {
|
for (int i = 1; i <= CALIBRATE_SAMPLE_COUNT; ++i) {
|
||||||
bZero += readPressure();
|
bZero += readPressure();
|
||||||
bAltZero += readAltPressure();
|
bAltZero += readAltPressure();
|
||||||
bLeverTouchZero += readRawSlider(Slider::SLIDER_LEVER);
|
|
||||||
bExtraTouchZero += readRawSlider(Slider::SLIDER_EXTRA);
|
|
||||||
bPBTouchZero += readRawSlider(Slider::SLIDER_PITCH_BEND);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
instrument.breathZero = bZero / CALIBRATE_SAMPLE_COUNT;
|
instrument.breathZero = bZero / CALIBRATE_SAMPLE_COUNT;
|
||||||
|
@ -842,10 +855,13 @@ void initState() {
|
||||||
* Read all utility sensors
|
* Read all utility sensors
|
||||||
*/
|
*/
|
||||||
void readUtil() {
|
void readUtil() {
|
||||||
instrument.biteSignal = readTouchRoller(bitePin);
|
instrument.biteSignal = readRawControl(CONTROL_BITE);
|
||||||
instrument.pbSignal = readSlider(Slider::SLIDER_PITCH_BEND, instrument.sliderPBThr);
|
instrument.pbSignal = readRawControl(CONTROL_PB);
|
||||||
instrument.leverSignal = readSlider(Slider::SLIDER_LEVER, instrument.sliderLeverThr);
|
instrument.pbYSignal = readRawControl(CONTROL_PB_Y);
|
||||||
instrument.extraSignal = readSlider(Slider::SLIDER_EXTRA, instrument.sliderExtraThr);
|
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
|
initState(); // Set up midi/etc
|
||||||
statusLedOn(); // Switch on the onboard LED to indicate power on/ready
|
statusLedOn(); // Switch on the onboard LED to indicate power on/ready
|
||||||
displayOff(state);
|
displayOff(state);
|
||||||
|
|
||||||
|
if (checkButtonState(STARTUP_TEST)) {
|
||||||
|
instrument.mode = MODE_TEST;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//_______________________________________________________________________________________________ MAIN LOOP
|
//_______________________________________________________________________________________________ MAIN LOOP
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue