From b9a8742fc11f222018bbc11c18f14522c7011c7c Mon Sep 17 00:00:00 2001 From: Johan Berglund Date: Wed, 22 Jul 2020 13:24:56 +0200 Subject: [PATCH] NuEVI and NuRAD: Timing and speed issue solved - SSD1306 display library needed editing to prevent it from lowering I2C bus speed. Added setting to enable/disable the on the fly key switching. NuRAD: Changed touch sensor reading equalisation from offset to multiplier to improve coherence of readings. --- NuEVI/NuEVI.ino | 50 +- NuEVI/adjustmenu.cpp | 9 +- NuEVI/config.h | 7 +- NuEVI/globals.h | 2 + NuEVI/hardware.h | 2 +- NuEVI/menu.cpp | 44 +- NuEVI/settings.cpp | 7 + NuEVI/settings.h | 10 +- .../NuEVI-pp-brcc-beta4.ino.hex | 5245 ++++++++++++++++ .../NuRAD-pp-brcc-toucheq-beta4.ino.hex | 5353 +++++++++++++++++ .../poly play user guide section otfkey.txt | 68 + 11 files changed, 10772 insertions(+), 25 deletions(-) mode change 100755 => 100644 NuEVI/adjustmenu.cpp create mode 100644 uploadable hex files/NuEVI-pp-brcc-beta4.ino.hex create mode 100644 uploadable hex files/NuRAD-pp-brcc-toucheq-beta4.ino.hex create mode 100644 user guides/poly play user guide section otfkey.txt diff --git a/NuEVI/NuEVI.ino b/NuEVI/NuEVI.ino index 246b229..bf68294 100644 --- a/NuEVI/NuEVI.ino +++ b/NuEVI/NuEVI.ino @@ -98,7 +98,9 @@ unsigned short fwcType; // 6, m6, 7, m7 unsigned short fwcLockH; // OFF:ON unsigned short fwcDrop2; // OFF:ON unsigned short hmzKey; // 0-11 (0 is C) -unsigned short hmzLimit; // 2-5: +unsigned short hmzLimit; // 2-5 +unsigned short otfKey; //OFF:ON +unsigned short breathInterval = 6; // 3-15 unsigned short vibSens = 2; // vibrato sensitivity unsigned short vibRetn = 2; // vibrato return speed @@ -169,6 +171,8 @@ byte activeMIDIchannel; // MIDI channel byte activePatch=0; byte doPatchUpdate=0; +byte cvPortaTuneCount = 0; + uint16_t legacy = 0; uint16_t legacyBrAct = 0; byte halfTime = 0; @@ -190,7 +194,7 @@ int breathCalZero; int leverPortZero; #if defined(NURAD) -int leverPortThr = 40; +int leverPortThr = 50; #else int leverPortThr = 50; #endif @@ -550,7 +554,7 @@ void setup() { analogReadResolution(12); // set resolution of ADCs to 12 bit analogWriteResolution(12); analogWriteFrequency(pwmDacPin,11718.75); - Wire.setClock(400000); + Wire.setClock(1000000); pinMode(dPin, INPUT_PULLUP); pinMode(ePin, INPUT_PULLUP); @@ -1293,7 +1297,8 @@ 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 > (CC_BREATH_INTERVAL+slowMidi*SLOW_MIDI_ADD)){ + if (currentTime - ccBreathSendTime > (breathInterval-1)){ breath(); ccBreathSendTime = currentTime; } @@ -1331,10 +1336,22 @@ void loop() { targetPitch = (fingeredNote-24)*42; if (portIsOn){ if (targetPitch > cvPitch){ - cvPitch += 1+(127-oldport)/4; + if (!cvPortaTuneCount) { + cvPitch += 1+(127-oldport)/4; + } + else { + cvPortaTuneCount++; + if (cvPortaTuneCount > CVPORTATUNE) cvPortaTuneCount=0; + } if (cvPitch > targetPitch) cvPitch = targetPitch; } else if (targetPitch < cvPitch){ - cvPitch -= 1+(127-oldport)/4; + if (!cvPortaTuneCount) { + cvPitch -= 1+(127-oldport)/4; + } + else { + cvPortaTuneCount++; + if (cvPortaTuneCount > CVPORTATUNE) cvPortaTuneCount=0; + } if (cvPitch < targetPitch) cvPitch = targetPitch; } else { cvPitch = targetPitch; @@ -1842,7 +1859,8 @@ void readSwitches() { // Octave rollers int touchValueRollers[12]; for (byte i=0; i<6; i++){ - touchValueRollers[i]=touchSensorRollers.filteredData(i) - calOffsetRollers[i]; + //touchValueRollers[i]=touchSensorRollers.filteredData(i) - calOffsetRollers[i]; + touchValueRollers[i]=touchSensorRollers.filteredData(i) * (300-calOffsetRollers[i])/300; } // 6-pin version octaveR = 0; @@ -1852,6 +1870,13 @@ void readSwitches() { else if (R3=(touchValueRollers[rPin3] < ctouchThrVal)) octaveR = 3; //R3 (store for combo check) else if (R2=(touchValueRollers[rPin2] < ctouchThrVal)) octaveR = 2; //R2 (store for combo check) else if (touchValueRollers[rPin1] < ctouchThrVal) octaveR = 1; //R1 + else if (lastOctaveR > 1) { + octaveR = lastOctaveR; + if (otfKey && polySelect && (polySelect 1) octaveR = lastOctaveR; + else if (lastOctaveR > 1) { + octaveR = lastOctaveR; + if (otfKey && polySelect && (polySelect