Skip to content

Commit

Permalink
tweaks for clocks/storage
Browse files Browse the repository at this point in the history
* grids mode was sending multple start/stop messages

* tweaks to storage/sysex for editor - add active pot bank to sysex
  • Loading branch information
okyeron committed Sep 1, 2024
1 parent 103709e commit e647eed
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 13 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
.DS_Store
OMX-27-firmware/build
.DS_Store
.DS_Store
Firmware-Hexes/beta/OMX-27-1.13.4b4-T4.hex
14 changes: 13 additions & 1 deletion OMX-27-firmware/OMX-27-firmware.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down
5 changes: 3 additions & 2 deletions OMX-27-firmware/src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 //
Expand Down Expand Up @@ -171,6 +171,7 @@ struct MidiConfig
bool midiInToCV = true;
bool midiSoftThru = false;
bool midiAUX = false;
bool isBankSelect = false;
};

extern MidiConfig midiSettings;
Expand Down
20 changes: 19 additions & 1 deletion OMX-27-firmware/src/modes/omx_mode_grids.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "../hardware/omx_leds.h"
// #include "../modes/sequencer.h"
#include "../midi/noteoffs.h"
#include "../consts/consts.h"

using namespace grids;

Expand Down Expand Up @@ -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])
{
Expand All @@ -102,6 +119,7 @@ void OmxModeGrids::onPotChanged(int potIndex, int prevValue, int newValue, int a
potPostLoadThresh[potIndex] = false;
}
}
#endif

if (potIndex < 4)
{
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions OMX-27-firmware/src/modes/omx_mode_midi_keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
4 changes: 2 additions & 2 deletions OMX-27-firmware/src/modes/retro_grids.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ namespace grids
{
tickCount_ = 0;
running_ = true;
MM::startClock();
// MM::startClock();

nextStepTimeP_ = micros();
lastStepTimeP_ = micros();
Expand All @@ -460,7 +460,7 @@ namespace grids
void GridsWrapper::stop()
{
running_ = false;
MM::stopClock();
// MM::stopClock();
}

void GridsWrapper::proceed()
Expand Down
11 changes: 7 additions & 4 deletions OMX-27-firmware/src/modes/sequencer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
}

Expand All @@ -814,6 +816,7 @@ void seqStop()
void seqContinue()
{
sequencer.playing = true;
omxUtil.resumeClocks();
}

int getPatternPage(int position)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e647eed

Please sign in to comment.