From e647eed821aa620e9a231c652db6a457241e4a84 Mon Sep 17 00:00:00 2001 From: Steven Noreyko <1909661+okyeron@users.noreply.github.com> Date: Sun, 1 Sep 2024 12:12:36 -0500 Subject: [PATCH] tweaks for clocks/storage * grids mode was sending multple start/stop messages * tweaks to storage/sysex for editor - add active pot bank to sysex --- .DS_Store | Bin 10244 -> 10244 bytes .gitignore | 2 ++ OMX-27-firmware/OMX-27-firmware.ino | 14 +++++++++++- OMX-27-firmware/src/config.h | 5 +++-- OMX-27-firmware/src/modes/omx_mode_grids.cpp | 20 +++++++++++++++++- .../src/modes/omx_mode_midi_keyboard.cpp | 5 +++-- OMX-27-firmware/src/modes/retro_grids.cpp | 4 ++-- OMX-27-firmware/src/modes/sequencer.cpp | 11 ++++++---- README.md | 2 +- 9 files changed, 50 insertions(+), 13 deletions(-) diff --git a/.DS_Store b/.DS_Store index be4cd0e38b807f22511b758887cc01dba06e4af2..af8d02aad5272e9ae5ebe3fdb991f7939e741fa7 100644 GIT binary patch delta 77 zcmZn(XbG5*urYBN`(`!{DGo-4&58nR=>Po5-VKe<;(b@Ea{ Z#m$$6b}+IdB+`It&xt5)mKJ>}1OS6z7YP6W delta 92 zcmZn(XbG5*z{t2UaX&vJ<7P#HOh!hA$=!mxMJx?0bQFw?&1!WNs!a`ybQH|YEho?dCoQ3vWiC!(}jTJ)t50JbX{F8}}l diff --git a/.gitignore b/.gitignore index 55d07e88..f81bae4a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ .DS_Store OMX-27-firmware/build .DS_Store +.DS_Store +Firmware-Hexes/beta/OMX-27-1.13.4b4-T4.hex diff --git a/OMX-27-firmware/OMX-27-firmware.ino b/OMX-27-firmware/OMX-27-firmware.ino index 03d86a5f..20fa2ce3 100644 --- a/OMX-27-firmware/OMX-27-firmware.ino +++ b/OMX-27-firmware/OMX-27-firmware.ino @@ -297,6 +297,16 @@ void handleControlChange(byte channel, byte control, byte value) { MM::sendControlChangeHW(control, value, channel); } + // change potbank on bank select + if (control == 0){ + midiSettings.isBankSelect = true; + potSettings.potbank = constrain(value, 0, NUM_CC_BANKS - 1); + omxDisp.setDirty(); + // }else if (midiSettings.isBankSelect && control == 32){ + // midiSettings.isBankSelect = true; + }else{ + midiSettings.isBankSelect = false; + } activeOmxMode->inMidiControlChange(channel, control, value); } @@ -368,7 +378,7 @@ void saveHeader() storage->write(EEPROM_HEADER_ADDRESS + 37, cvNoteUtil.triggerMode); - // 38 bytes + storage->write(EEPROM_HEADER_ADDRESS + 38, potSettings.potbank); } // returns true if the header contained initialized data @@ -440,6 +450,8 @@ bool loadHeader(void) cvNoteUtil.triggerMode = constrain(storage->read(EEPROM_HEADER_ADDRESS + 37), 0, 1); + potSettings.potbank = constrain(storage->read(EEPROM_HEADER_ADDRESS + 38), 0, NUM_CC_BANKS-1); + return true; } diff --git a/OMX-27-firmware/src/config.h b/OMX-27-firmware/src/config.h index ed56637b..66d2909e 100644 --- a/OMX-27-firmware/src/config.h +++ b/OMX-27-firmware/src/config.h @@ -18,7 +18,7 @@ // OMX_VERSION = 1.13.4 const int MAJOR_VERSION = 1; const int MINOR_VERSION = 13; -const int POINT_VERSION = 4; +const int POINT_VERSION = 6; // 1.13.2 - Adds CV Trigger modes for legato and regtrig // 1.13.3 - Bugfix for CV Trigger modes @@ -73,7 +73,7 @@ enum FUNCKEYMODE extern const uint8_t EEPROM_VERSION; #define EEPROM_HEADER_ADDRESS 0 -#define EEPROM_HEADER_SIZE 36 +#define EEPROM_HEADER_SIZE 40 #define EEPROM_PATTERN_ADDRESS 64 #define TRACKED_CV_SIZE 16 // @@ -171,6 +171,7 @@ struct MidiConfig bool midiInToCV = true; bool midiSoftThru = false; bool midiAUX = false; + bool isBankSelect = false; }; extern MidiConfig midiSettings; diff --git a/OMX-27-firmware/src/modes/omx_mode_grids.cpp b/OMX-27-firmware/src/modes/omx_mode_grids.cpp index a155a465..cf929390 100644 --- a/OMX-27-firmware/src/modes/omx_mode_grids.cpp +++ b/OMX-27-firmware/src/modes/omx_mode_grids.cpp @@ -5,6 +5,7 @@ #include "../hardware/omx_leds.h" // #include "../modes/sequencer.h" #include "../midi/noteoffs.h" +#include "../consts/consts.h" using namespace grids; @@ -90,6 +91,22 @@ void OmxModeGrids::onPotChanged(int potIndex, int prevValue, int newValue, int a // if (analogDelta < 3) // return; +#if T4 +// prevents values from being modified until pot is modified + if (potPostLoadThresh[potIndex]) + { + int delta = newValue - prevValue; + + if (delta >= 1) + { + potPostLoadThresh[potIndex] = false; + } + else + { + return; + } + } +#else // prevents values from being modified until pot is modified if (potPostLoadThresh[potIndex]) { @@ -102,6 +119,7 @@ void OmxModeGrids::onPotChanged(int potIndex, int prevValue, int newValue, int a potPostLoadThresh[potIndex] = false; } } +#endif if (potIndex < 4) { @@ -525,8 +543,8 @@ void OmxModeGrids::loadActivePattern(uint8_t pattIndex) void OmxModeGrids::startPlayback() { gridsAUX = true; - grids_.start(); omxUtil.resetClocks(); + grids_.start(); omxUtil.startClocks(); // sequencer.playing = true; isPlaying_ = true; diff --git a/OMX-27-firmware/src/modes/omx_mode_midi_keyboard.cpp b/OMX-27-firmware/src/modes/omx_mode_midi_keyboard.cpp index 4827d4c1..33677c0e 100644 --- a/OMX-27-firmware/src/modes/omx_mode_midi_keyboard.cpp +++ b/OMX-27-firmware/src/modes/omx_mode_midi_keyboard.cpp @@ -381,8 +381,9 @@ void OmxModeMidiKeyboard::onEncoderChanged(Encoder::Update enc) { midiSettings.currbank = constrain(midiSettings.currbank + amt, 0, 127); // Bank Select is 2 mesages - MM::sendControlChange(0, 0, sysSettings.midiChannel); - MM::sendControlChange(32, midiSettings.currbank, sysSettings.midiChannel); + // need to figure out bit shift to get values over 127 + MM::sendControlChange(0, midiSettings.currbank, sysSettings.midiChannel); + MM::sendControlChange(32, 0, sysSettings.midiChannel); MM::sendProgramChange(midiSettings.currpgm, sysSettings.midiChannel); } } diff --git a/OMX-27-firmware/src/modes/retro_grids.cpp b/OMX-27-firmware/src/modes/retro_grids.cpp index ce556138..d2db09f5 100644 --- a/OMX-27-firmware/src/modes/retro_grids.cpp +++ b/OMX-27-firmware/src/modes/retro_grids.cpp @@ -451,7 +451,7 @@ namespace grids { tickCount_ = 0; running_ = true; - MM::startClock(); +// MM::startClock(); nextStepTimeP_ = micros(); lastStepTimeP_ = micros(); @@ -460,7 +460,7 @@ namespace grids void GridsWrapper::stop() { running_ = false; - MM::stopClock(); +// MM::stopClock(); } void GridsWrapper::proceed() diff --git a/OMX-27-firmware/src/modes/sequencer.cpp b/OMX-27-firmware/src/modes/sequencer.cpp index 1025af05..a2442386 100644 --- a/OMX-27-firmware/src/modes/sequencer.cpp +++ b/OMX-27-firmware/src/modes/sequencer.cpp @@ -775,8 +775,8 @@ void seqReset() sequencer.lastSeqPos[k] = sequencer.seqPos[k]; } } - omxUtil.stopClocks(); - omxUtil.startClocks(); +// omxUtil.stopClocks(); +// omxUtil.startClocks(); // MM::stopClock(); // MM::startClock(); sequencer.seqResetFlag = false; @@ -797,8 +797,10 @@ void seqStart() { omxUtil.resumeClocks(); // MM::continueClock(); - // } else if (seqPos[sequencer.playingPattern]==0) { - // MM::startClock(); +// } else if (sequencer.seqPos[sequencer.playingPattern]==0) { + } else { + omxUtil.startClocks(); +// MM::startClock(); } } @@ -814,6 +816,7 @@ void seqStop() void seqContinue() { sequencer.playing = true; + omxUtil.resumeClocks(); } int getPatternPage(int position) diff --git a/README.md b/README.md index e331c0e5..a44c0d54 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Mechanical key switch midi keyboard and sequencer. Based on Teensy 3.2 and Cherry MX RGB key switches. -Full kits and partial kits are [available for sale here](https://denki-oto.weebly.com/#/). +Full kits and partial kits are [available for sale here](https://www.denki-oto.com/). Dimensions: 313mm x 65mm