changed most declarations typedefs. the ones that are not changed yet need to be reviewed in detail
This commit is contained in:
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#define VERSION "V:1.2A2"
|
#define VERSION "V:1.2A2"
|
||||||
|
|
||||||
byte memCode = '0'; //Change to different letter if you changed the data structure
|
uint8_t memCode = '0'; //Change to different letter if you changed the data structure
|
||||||
|
|
||||||
uint16_t CV1Calibration = 512;
|
uint16_t CV1Calibration = 512;
|
||||||
uint16_t CV2Calibration = 512;
|
uint16_t CV2Calibration = 512;
|
||||||
@ -19,17 +19,17 @@ bool showDone = false;
|
|||||||
|
|
||||||
const int subDivs[] = { -24, -12, -8, -6, -4, -3, -2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 16, 24, 32, 64, 128 }; //positive - divide, negative - multiply, 0 - off
|
const int subDivs[] = { -24, -12, -8, -6, -4, -3, -2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 16, 24, 32, 64, 128 }; //positive - divide, negative - multiply, 0 - off
|
||||||
|
|
||||||
byte bpm = 130;
|
uint8_t bpm = 130;
|
||||||
byte bpmModulationChannel = 200; //0 - CV1, 1 - CV2, 255 - OFF
|
uint8_t bpmModulationChannel = 200; //0 - CV1, 1 - CV2, 255 - OFF
|
||||||
byte bpmModulationRange = 0;
|
uint8_t bpmModulationRange = 0;
|
||||||
|
|
||||||
struct channel {
|
struct channel {
|
||||||
byte mode : 3; //mv: 7. 0 - CLK, 1 - RND, 2 - SEQ, 3 - SWING, 4 - Gate
|
uint8_t mode : 3; //mv: 7. 0 - CLK, 1 - RND, 2 - SEQ, 3 - SWING, 4 - Gate
|
||||||
byte subDiv : 5; //mv: 31
|
uint8_t subDiv : 5; //mv: 31
|
||||||
byte random : 4; //mv: 15
|
uint8_t random : 4; //mv: 15
|
||||||
byte seqPattern : 5;
|
uint8_t seqPattern : 5;
|
||||||
byte CV1Target : 3; //0 - Off, 1 - Subdiv, 2 - RND, 3 - SeqPattern
|
uint8_t CV1Target : 3; //0 - Off, 1 - Subdiv, 2 - RND, 3 - SeqPattern
|
||||||
byte CV2Target : 3;
|
uint8_t CV2Target : 3;
|
||||||
uint8_t swing : 3;
|
uint8_t swing : 3;
|
||||||
uint8_t offset : 7; //mv: 127
|
uint8_t offset : 7; //mv: 127
|
||||||
uint8_t gate : 7;
|
uint8_t gate : 7;
|
||||||
@ -48,7 +48,7 @@ channel channels[7] = { //array of channel settings
|
|||||||
|
|
||||||
struct sequence {
|
struct sequence {
|
||||||
uint32_t sequence;
|
uint32_t sequence;
|
||||||
uint8_t length : 5 ; //don't forget to add 1, values 0 - 31
|
uint8_t length : 5 ; //don't forget to add 1 where needed, values 0 - 31
|
||||||
};
|
};
|
||||||
|
|
||||||
sequence sequences[] {
|
sequence sequences[] {
|
||||||
@ -86,63 +86,63 @@ sequence sequences[] {
|
|||||||
{0b000000000000000000000000000000000, 15}
|
{0b000000000000000000000000000000000, 15}
|
||||||
};
|
};
|
||||||
|
|
||||||
byte currentStep[7] = {0};
|
uint8_t currentStep[7] = {0};
|
||||||
int8_t stepNumSelected = 0;
|
int8_t stepNumSelected = 0;
|
||||||
byte patternToEdit;
|
uint8_t patternToEdit;
|
||||||
|
|
||||||
unsigned int channelPulseCount[7];
|
unsigned int channelPulseCount[7];
|
||||||
unsigned int channelPulsesPerCycle[7];
|
unsigned int channelPulsesPerCycle[7];
|
||||||
byte sixteenthPulseCount = 0;
|
uint8_t sixteenthPulseCount = 0;
|
||||||
int playingModes[7]; // should be renamed to currentSubdivs or something. Updated from channels object on beat and with applied CV modulation
|
int playingModes[7]; // should be renamed to currentSubdivs or something. Updated from channels object on beat and with applied CV modulation
|
||||||
int playingModesOld[7];
|
int playingModesOld[7];
|
||||||
|
|
||||||
unsigned int pulsePeriod;
|
uint16_t pulsePeriod;
|
||||||
bool isPlaying;// = false; // replace to something like byte status where 1xxxxxx isPlaying, x1xxxxx isRecording etc
|
bool isPlaying;// = false; // replace to something like uint8_t status where 1xxxxxx isPlaying, x1xxxxx isRecording etc
|
||||||
bool isRecording = false;
|
bool isRecording = false;
|
||||||
bool recordToNextStep = false;
|
bool recordToNextStep = false;
|
||||||
bool MIDIClockReceived = false;
|
bool MIDIClockReceived = false;
|
||||||
|
|
||||||
unsigned int tickCount = 0;
|
uint16_t tickCount = 0;
|
||||||
unsigned int pulseCount = 0;
|
uint16_t pulseCount = 0;
|
||||||
|
|
||||||
byte masterClockMode = 0; // 0 - internal, 1 - external 24ppqn, 2 - MIDI
|
uint8_t masterClockMode = 0; // 0 - internal, 1 - external 24ppqn, 2 - MIDI
|
||||||
byte extClockPPQN = 0; // 0 - 24, 1 - 4 (1/16)
|
uint8_t extClockPPQN = 0; // 0 - 24, 1 - 4 (1/16)
|
||||||
byte extraChannel = 0; // 0 - off, 1 - pulse out = 7th channel
|
uint8_t extraChannel = 0; // 0 - off, 1 - pulse out = 7th channel
|
||||||
unsigned long lastExtPulseTime = 0;
|
uint32_t lastExtPulseTime = 0;
|
||||||
unsigned long newExtPulseTime = 0;
|
uint32_t newExtPulseTime = 0;
|
||||||
|
|
||||||
bool needPulseReset[] = { true, true, true, true, true, true, true };
|
bool needPulseReset[] = { true, true, true, true, true, true, true }; //to optimise, can be switched to uint8_t
|
||||||
uint16_t gateLengthTime[] = {0, 0, 0, 0, 0, 0, 0};
|
uint16_t gateLengthTime[] = {0, 0, 0, 0, 0, 0, 0};
|
||||||
uint16_t gateCountDown[7];
|
uint16_t gateCountDown[7];
|
||||||
bool stepIsOdd = 1;
|
bool stepIsOdd = 1;
|
||||||
|
|
||||||
byte displayTab = 0;
|
uint8_t displayTab = 0;
|
||||||
bool insideTab = false;
|
bool insideTab = false;
|
||||||
byte menuItem = 0;
|
uint8_t menuItem = 0;
|
||||||
bool menuItemSelected = false;
|
bool menuItemSelected = false;
|
||||||
byte lastMenuItem = 3;
|
uint8_t lastMenuItem = 3;
|
||||||
byte displayScreen = 0; //0 - main, 1 - sequencer, 2 - settings
|
uint8_t displayScreen = 0; //0 - main, 1 - sequencer, 2 - settings
|
||||||
|
|
||||||
bool playBtnPushed = false;
|
bool playBtnPushed = false;
|
||||||
bool shiftBtnPushed = false;
|
bool shiftBtnPushed = false;
|
||||||
|
|
||||||
int CV1Input = 0;
|
int16_t CV1Input = 0;
|
||||||
int CV2Input = 0;
|
int16_t CV2Input = 0;
|
||||||
|
|
||||||
int encPositionOld = 0;
|
int encPositionOld = 0;
|
||||||
int encDirectionOld = 0;
|
uint8_t encDirectionOld = 0;
|
||||||
unsigned long encPressedTime;
|
uint32_t encPressedTime;
|
||||||
unsigned long encReleasedTime;
|
uint32_t encReleasedTime;
|
||||||
unsigned long playPressedTime;
|
uint32_t playPressedTime;
|
||||||
unsigned long playReleasedTime;
|
uint32_t playReleasedTime;
|
||||||
unsigned long shiftPressedTime;
|
uint32_t shiftPressedTime;
|
||||||
unsigned long shiftReleasedTime;
|
uint32_t shiftReleasedTime;
|
||||||
bool encBtnPushed;
|
bool encBtnPushed;
|
||||||
|
|
||||||
int extResetCountdown;
|
int extResetCountdown;
|
||||||
int extTriggerCount;
|
int extTriggerCount;
|
||||||
|
|
||||||
//unsigned long lastInteractionTime; // used for display timeout
|
//uint32_t lastInteractionTime; // used for display timeout
|
||||||
|
|
||||||
U8G2_SSD1306_128X64_NONAME_2_HW_I2C u8g2(U8G2_R2, SCL, SDA, U8X8_PIN_NONE);
|
U8G2_SSD1306_128X64_NONAME_2_HW_I2C u8g2(U8G2_R2, SCL, SDA, U8X8_PIN_NONE);
|
||||||
RotaryEncoder encoder(ENC_D1_PIN, ENC_D2_PIN, RotaryEncoder::LatchMode::TWO03);
|
RotaryEncoder encoder(ENC_D1_PIN, ENC_D2_PIN, RotaryEncoder::LatchMode::TWO03);
|
||||||
@ -161,7 +161,7 @@ void setup() {
|
|||||||
pinMode(EXT_INPUT_PIN, INPUT_PULLUP);
|
pinMode(EXT_INPUT_PIN, INPUT_PULLUP);
|
||||||
attachInterrupt(digitalPinToInterrupt(EXT_INPUT_PIN), externalClock, FALLING);
|
attachInterrupt(digitalPinToInterrupt(EXT_INPUT_PIN), externalClock, FALLING);
|
||||||
|
|
||||||
for (byte i = 0; i < 6; i++) {
|
for (uint8_t i = 0; i < 6; i++) {
|
||||||
pinMode(outsPins[i], OUTPUT);
|
pinMode(outsPins[i], OUTPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ void clock() {
|
|||||||
}
|
}
|
||||||
if (bpmModulationRange != 0) {
|
if (bpmModulationRange != 0) {
|
||||||
calculateBPMTiming();
|
calculateBPMTiming();
|
||||||
for (byte i; i < 7; i++) {
|
for (uint8_t i; i < 7; i++) {
|
||||||
if (channels[i].mode == 4) {
|
if (channels[i].mode == 4) {
|
||||||
calculateGate(i);
|
calculateGate(i);
|
||||||
}
|
}
|
||||||
@ -263,7 +263,7 @@ void clock() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// pull low all outputs after set pulse length
|
// pull low all outputs after set pulse length
|
||||||
for (byte i = 0; i < 7; i++) {
|
for (uint8_t i = 0; i < 7; i++) {
|
||||||
if (channels[i].mode != 4 && tickCount >= PULSE_LENGTH) { //everything but gate mode
|
if (channels[i].mode != 4 && tickCount >= PULSE_LENGTH) { //everything but gate mode
|
||||||
digitalWrite(outsPins[i], LOW);
|
digitalWrite(outsPins[i], LOW);
|
||||||
} else if (channels[i].mode == 4 && tickCount >= gateCountDown[i]) { //gate mode gateLengthTime[i] < pulsePeriod
|
} else if (channels[i].mode == 4 && tickCount >= gateCountDown[i]) { //gate mode gateLengthTime[i] < pulsePeriod
|
||||||
@ -328,7 +328,7 @@ void externalClock() {
|
|||||||
|
|
||||||
void sendTriggers() { //rename to onPulse or something
|
void sendTriggers() { //rename to onPulse or something
|
||||||
|
|
||||||
for (byte i = 0; i < (extraChannel ? 7 : 6); i++) {
|
for (uint8_t i = 0; i < (extraChannel ? 7 : 6); i++) {
|
||||||
if (playingModes[i] != subDivs[channels[i].subDiv] && playingModesOld[i] != playingModes[i]) {
|
if (playingModes[i] != subDivs[channels[i].subDiv] && playingModesOld[i] != playingModes[i]) {
|
||||||
needPulseReset[i] = true;
|
needPulseReset[i] = true;
|
||||||
playingModesOld[i] = playingModes[i];
|
playingModesOld[i] = playingModes[i];
|
||||||
@ -337,11 +337,11 @@ void sendTriggers() { //rename to onPulse or something
|
|||||||
//16th notes for sequencer and swing
|
//16th notes for sequencer and swing
|
||||||
if (sixteenthPulseCount == 0) {
|
if (sixteenthPulseCount == 0) {
|
||||||
stepIsOdd = !stepIsOdd;
|
stepIsOdd = !stepIsOdd;
|
||||||
for (byte i = 0; i < (extraChannel ? 7 : 6); i++) {
|
for (uint8_t i = 0; i < (extraChannel ? 7 : 6); i++) {
|
||||||
|
|
||||||
//pattern modulation
|
//pattern modulation
|
||||||
int seqMod = 0;
|
int seqMod = 0;
|
||||||
byte seqPattern;
|
uint8_t seqPattern;
|
||||||
if (channels[i].CV2Target == 3) {
|
if (channels[i].CV2Target == 3) {
|
||||||
seqMod = map(CV2Input, -1, 1024, -8, 8); //-1 and 1024 are to try to make the last step not at max value (should make the range from -7 to +7)
|
seqMod = map(CV2Input, -1, 1024, -8, 8); //-1 and 1024 are to try to make the last step not at max value (should make the range from -7 to +7)
|
||||||
} else if (channels[i].CV1Target == 3) {
|
} else if (channels[i].CV1Target == 3) {
|
||||||
@ -372,7 +372,7 @@ void sendTriggers() { //rename to onPulse or something
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sixteenthPulseCount = 0;
|
sixteenthPulseCount = 0;
|
||||||
for (byte i; i < 7; i++) {
|
for (uint8_t i; i < 7; i++) {
|
||||||
if (channels[i].mode == 2 && currentStep[i] < sequences[channels[i].seqPattern].length) {
|
if (channels[i].mode == 2 && currentStep[i] < sequences[channels[i].seqPattern].length) {
|
||||||
currentStep[i] ++;
|
currentStep[i] ++;
|
||||||
} else {
|
} else {
|
||||||
@ -385,7 +385,7 @@ void sendTriggers() { //rename to onPulse or something
|
|||||||
//switching modes on the beat and resetting channel clock
|
//switching modes on the beat and resetting channel clock
|
||||||
if (pulseCount == 0) {
|
if (pulseCount == 0) {
|
||||||
calculateCycles();
|
calculateCycles();
|
||||||
for (byte i = 0; i < (extraChannel ? 7 : 6); i++) {
|
for (uint8_t i = 0; i < (extraChannel ? 7 : 6); i++) {
|
||||||
if (needPulseReset[i] == true) {
|
if (needPulseReset[i] == true) {
|
||||||
channelPulseCount[i] = 0;
|
channelPulseCount[i] = 0;
|
||||||
needPulseReset[i] = false;
|
needPulseReset[i] = false;
|
||||||
@ -397,10 +397,10 @@ void sendTriggers() { //rename to onPulse or something
|
|||||||
}
|
}
|
||||||
|
|
||||||
//multiplier
|
//multiplier
|
||||||
for (byte i = 0; i < (extraChannel ? 7 : 6); i++) {
|
for (uint8_t i = 0; i < (extraChannel ? 7 : 6); i++) {
|
||||||
|
|
||||||
//RND modulation
|
//RND modulation
|
||||||
byte randMod = 0;
|
uint8_t randMod = 0;
|
||||||
if (channels[i].CV1Target == 2) {
|
if (channels[i].CV1Target == 2) {
|
||||||
randMod = randMod + CV1Input;
|
randMod = randMod + CV1Input;
|
||||||
}
|
}
|
||||||
@ -410,7 +410,7 @@ void sendTriggers() { //rename to onPulse or something
|
|||||||
if (channels[i].CV1Target == 2 || channels[i].CV2Target == 2) {
|
if (channels[i].CV1Target == 2 || channels[i].CV2Target == 2) {
|
||||||
randMod = map(randMod, 0, 1023, -5, +5);
|
randMod = map(randMod, 0, 1023, -5, +5);
|
||||||
}
|
}
|
||||||
byte randAmount = channels[i].random + randMod;
|
uint8_t randAmount = channels[i].random + randMod;
|
||||||
if (randAmount > 100) {
|
if (randAmount > 100) {
|
||||||
randAmount = 0;
|
randAmount = 0;
|
||||||
} else if (randAmount > 10) {
|
} else if (randAmount > 10) {
|
||||||
@ -441,7 +441,7 @@ void sendTriggers() { //rename to onPulse or something
|
|||||||
|
|
||||||
void calculateCycles() {
|
void calculateCycles() {
|
||||||
|
|
||||||
for (byte i = 0; i < (extraChannel ? 7 : 6); i++) {
|
for (uint8_t i = 0; i < (extraChannel ? 7 : 6); i++) {
|
||||||
int mod = 0; //subdiv modulation happens here
|
int mod = 0; //subdiv modulation happens here
|
||||||
if (channels[i].CV1Target == 1) {
|
if (channels[i].CV1Target == 1) {
|
||||||
mod = map(CV1Input, -1, 1024, -5, 5);
|
mod = map(CV1Input, -1, 1024, -5, 5);
|
||||||
@ -476,9 +476,9 @@ void calculateBPMTiming() {
|
|||||||
} else if (bpmModulationRange != 0 && bpmModulationChannel == 1) {
|
} else if (bpmModulationRange != 0 && bpmModulationChannel == 1) {
|
||||||
mod = map(CV2Input, 0, 1023, bpmModulationRange * -10, bpmModulationRange * 10);
|
mod = map(CV2Input, 0, 1023, bpmModulationRange * -10, bpmModulationRange * 10);
|
||||||
}
|
}
|
||||||
byte calcbpm = bpm + mod;
|
uint8_t calcbpm = bpm + mod;
|
||||||
if (calcbpm > MAXBPM) { calcbpm = MAXBPM; };
|
if (calcbpm > MAXBPM) { calcbpm = MAXBPM; };
|
||||||
pulsePeriod = 600000 / (calcbpm * PPQN);
|
pulsePeriod = 600000 / (calcbpm * PPQN); //optimisation: try using floats, maybe it'll make it more precise, like 60000.0 / ((float)(calcbpm * PPQN));
|
||||||
|
|
||||||
} else if (masterClockMode == 1 && extClockPPQN == 1) { //for ext 1/16 clock
|
} else if (masterClockMode == 1 && extClockPPQN == 1) { //for ext 1/16 clock
|
||||||
pulsePeriod = (newExtPulseTime - lastExtPulseTime) * 10 / 6;
|
pulsePeriod = (newExtPulseTime - lastExtPulseTime) * 10 / 6;
|
||||||
@ -486,21 +486,21 @@ void calculateBPMTiming() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void resetClocks() {
|
void resetClocks() {
|
||||||
for (byte i = 0; i < (extraChannel ? 7 : 6); i++) {
|
for (uint8_t i = 0; i < (extraChannel ? 7 : 6); i++) {
|
||||||
channelPulseCount[i] = 0;
|
channelPulseCount[i] = 0;
|
||||||
digitalWrite(outsPins[i], LOW); //to avoid stuck leds
|
digitalWrite(outsPins[i], LOW); //to avoid stuck leds
|
||||||
}
|
}
|
||||||
pulseCount = 0;
|
pulseCount = 0;
|
||||||
tickCount = 0;
|
tickCount = 0;
|
||||||
sixteenthPulseCount = 0;
|
sixteenthPulseCount = 0;
|
||||||
for (byte i; i < 7; i++) {
|
for (uint8_t i; i < 7; i++) {
|
||||||
currentStep[i] = 0;
|
currentStep[i] = 0;
|
||||||
}
|
}
|
||||||
stepIsOdd = 1;
|
stepIsOdd = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveState() {
|
void saveState() {
|
||||||
int addr = 0;
|
uint16_t addr = 0;
|
||||||
EEPROM.put(addr, bpm);
|
EEPROM.put(addr, bpm);
|
||||||
addr = addr + sizeof(bpm);
|
addr = addr + sizeof(bpm);
|
||||||
EEPROM.put(addr, bpmModulationChannel);
|
EEPROM.put(addr, bpmModulationChannel);
|
||||||
@ -529,7 +529,7 @@ void saveState() {
|
|||||||
void loadState() {
|
void loadState() {
|
||||||
//check last bit in eeprom to know if the correct settings were stored
|
//check last bit in eeprom to know if the correct settings were stored
|
||||||
if (EEPROM.read(1023) == memCode) {
|
if (EEPROM.read(1023) == memCode) {
|
||||||
int addr = 0;
|
uint16_t addr = 0;
|
||||||
EEPROM.get(addr, bpm);
|
EEPROM.get(addr, bpm);
|
||||||
addr = addr + sizeof(bpm);
|
addr = addr + sizeof(bpm);
|
||||||
EEPROM.get(addr, bpmModulationChannel);
|
EEPROM.get(addr, bpmModulationChannel);
|
||||||
|
|||||||
@ -61,13 +61,13 @@ void checkInputs() {
|
|||||||
//encoder
|
//encoder
|
||||||
encoder.tick();
|
encoder.tick();
|
||||||
int encPosition = encoder.getPosition();
|
int encPosition = encoder.getPosition();
|
||||||
int encDirection = (int)(encoder.getDirection());
|
uint8_t encDirection = (int)(encoder.getDirection());
|
||||||
if (encPositionOld != encPosition) {
|
if (encPositionOld != encPosition) {
|
||||||
int change = encPositionOld - encPosition;
|
uint8_t change = encPositionOld - encPosition;
|
||||||
if (reverseEnc) {
|
if (reverseEnc) {
|
||||||
change = change * -1;
|
change = change * -1;
|
||||||
}
|
}
|
||||||
unsigned long ms = encoder.getMillisBetweenRotations();
|
uint32_t ms = encoder.getMillisBetweenRotations();
|
||||||
/*if (encDirectionOld == encDirection && ms < 20) { //encoder acceleration
|
/*if (encDirectionOld == encDirection && ms < 20) { //encoder acceleration
|
||||||
change = change * 5;
|
change = change * 5;
|
||||||
} else if (encDirectionOld == encDirection && ms < 80) {
|
} else if (encDirectionOld == encDirection && ms < 80) {
|
||||||
@ -77,7 +77,7 @@ void checkInputs() {
|
|||||||
}
|
}
|
||||||
encDirectionOld = encDirection;
|
encDirectionOld = encDirection;
|
||||||
if (displayScreen == 0) {
|
if (displayScreen == 0) {
|
||||||
byte channelCV;
|
uint8_t channelCV;
|
||||||
if (!insideTab && !shiftBtnPushed) { //Change tab
|
if (!insideTab && !shiftBtnPushed) { //Change tab
|
||||||
displayTab = displayTab + change;
|
displayTab = displayTab + change;
|
||||||
if (displayTab > 100) { //to address "negative" numbers
|
if (displayTab > 100) { //to address "negative" numbers
|
||||||
|
|||||||
@ -2,8 +2,8 @@ void updateScreen() {
|
|||||||
|
|
||||||
u8g2.firstPage();
|
u8g2.firstPage();
|
||||||
do {
|
do {
|
||||||
byte leftOffset;
|
uint8_t leftOffset;
|
||||||
byte width;
|
uint8_t width;
|
||||||
String valueStr;
|
String valueStr;
|
||||||
u8g2.setDrawColor(1);
|
u8g2.setDrawColor(1);
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ void updateScreen() {
|
|||||||
lastMenuItem = 1;
|
lastMenuItem = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (byte i = 1; i <= lastMenuItem; i++) {
|
for (uint8_t i = 1; i <= lastMenuItem; i++) {
|
||||||
if (i == 1) {
|
if (i == 1) {
|
||||||
valueStr = F("MODE:");
|
valueStr = F("MODE:");
|
||||||
} else if (i == 2 && masterClockMode == 0) {
|
} else if (i == 2 && masterClockMode == 0) {
|
||||||
@ -48,7 +48,7 @@ void updateScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Values
|
//Values
|
||||||
for (byte i = 1; i <= lastMenuItem; i++) {
|
for (uint8_t i = 1; i <= lastMenuItem; i++) {
|
||||||
if (i == 1 && masterClockMode == 0) { //Channel mode
|
if (i == 1 && masterClockMode == 0) { //Channel mode
|
||||||
valueStr = F("INT");
|
valueStr = F("INT");
|
||||||
} else if (i == 1 && masterClockMode == 1) {
|
} else if (i == 1 && masterClockMode == 1) {
|
||||||
@ -127,7 +127,7 @@ void updateScreen() {
|
|||||||
}
|
}
|
||||||
width = 32;
|
width = 32;
|
||||||
leftOffset = 62;
|
leftOffset = 62;
|
||||||
for (byte i = 1; i <= lastMenuItem; i++) {
|
for (uint8_t i = 1; i <= lastMenuItem; i++) {
|
||||||
if (i == 1) {
|
if (i == 1) {
|
||||||
valueStr = F("MODE:");
|
valueStr = F("MODE:");
|
||||||
} else if (i == 2 && channels[displayTab - 1].mode == 0) {
|
} else if (i == 2 && channels[displayTab - 1].mode == 0) {
|
||||||
@ -149,7 +149,7 @@ void updateScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Values
|
//Values
|
||||||
for (byte i = 1; i <= lastMenuItem; i++) {
|
for (uint8_t i = 1; i <= lastMenuItem; i++) {
|
||||||
if (i == 1 && channels[displayTab - 1].mode == 0) { //Channel mode
|
if (i == 1 && channels[displayTab - 1].mode == 0) { //Channel mode
|
||||||
valueStr = F("CLOCK");
|
valueStr = F("CLOCK");
|
||||||
} else if (i == 1 && channels[displayTab - 1].mode == 1) {
|
} else if (i == 1 && channels[displayTab - 1].mode == 1) {
|
||||||
@ -243,7 +243,7 @@ void updateScreen() {
|
|||||||
valueStr = valueStr + String(channels[displayTab - 1].seqPattern - 23);
|
valueStr = valueStr + String(channels[displayTab - 1].seqPattern - 23);
|
||||||
}
|
}
|
||||||
} else if (channels[displayTab - 1].mode == 3) {
|
} else if (channels[displayTab - 1].mode == 3) {
|
||||||
byte swingVals[6] = {50, 58, 66, 75, 83, 92};
|
uint8_t swingVals[6] = {50, 58, 66, 75, 83, 92};
|
||||||
valueStr = String(swingVals[channels[displayTab - 1].swing]) + "%";
|
valueStr = String(swingVals[channels[displayTab - 1].swing]) + "%";
|
||||||
} else if (channels[displayTab - 1].mode == 4) {
|
} else if (channels[displayTab - 1].mode == 4) {
|
||||||
valueStr = String(channels[displayTab - 1].gate) + "%";
|
valueStr = String(channels[displayTab - 1].gate) + "%";
|
||||||
@ -261,8 +261,8 @@ void updateScreen() {
|
|||||||
//Tabs
|
//Tabs
|
||||||
u8g2.drawHLine(0, 53, 128);
|
u8g2.drawHLine(0, 53, 128);
|
||||||
u8g2.setFont(stkS);
|
u8g2.setFont(stkS);
|
||||||
byte yPos = 61;
|
uint8_t yPos = 61;
|
||||||
byte xWidth = 12;
|
uint8_t xWidth = 12;
|
||||||
valueStr = F("w");
|
valueStr = F("w");
|
||||||
if (displayTab == 0) {
|
if (displayTab == 0) {
|
||||||
if (insideTab == true || shiftBtnPushed == true) {
|
if (insideTab == true || shiftBtnPushed == true) {
|
||||||
@ -274,7 +274,7 @@ void updateScreen() {
|
|||||||
u8g2.drawButtonUTF8(xWidth/2, yPos, U8G2_BTN_BW0|U8G2_BTN_HCENTER, xWidth, 0, 2, valueStr.c_str() );
|
u8g2.drawButtonUTF8(xWidth/2, yPos, U8G2_BTN_BW0|U8G2_BTN_HCENTER, xWidth, 0, 2, valueStr.c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 1; i <= (extraChannel ? 7 : 6); i++) {
|
for (uint8_t i = 1; i <= (extraChannel ? 7 : 6); i++) {
|
||||||
valueStr = String(i);
|
valueStr = String(i);
|
||||||
if (displayTab == i) {
|
if (displayTab == i) {
|
||||||
if (insideTab == true || shiftBtnPushed == true) {
|
if (insideTab == true || shiftBtnPushed == true) {
|
||||||
@ -299,7 +299,7 @@ void updateScreen() {
|
|||||||
//Edit Pattern Screen (Sequencer)
|
//Edit Pattern Screen (Sequencer)
|
||||||
else if (displayScreen == 1) {
|
else if (displayScreen == 1) {
|
||||||
u8g2.setFont(stkS);
|
u8g2.setFont(stkS);
|
||||||
byte pattern = channels[displayTab - 1].seqPattern;
|
uint8_t pattern = channels[displayTab - 1].seqPattern;
|
||||||
if (pattern < 8) {
|
if (pattern < 8) {
|
||||||
valueStr = F("PATTERN A");
|
valueStr = F("PATTERN A");
|
||||||
valueStr = valueStr + String(pattern + 1);
|
valueStr = valueStr + String(pattern + 1);
|
||||||
@ -327,7 +327,7 @@ void updateScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u8g2.drawHLine(0, 8, 128);
|
u8g2.drawHLine(0, 8, 128);
|
||||||
for (byte i = 0; i <= sequences[patternToEdit].length; i++) {
|
for (uint8_t i = 0; i <= sequences[patternToEdit].length; i++) {
|
||||||
u8g2.drawUTF8(19 + (i % 8)*12, 33 - ((sequences[patternToEdit].length / 8) * 5) + ((i / 8) * 11), (bitRead(sequences[patternToEdit].sequence, i) ? "q" : "p"));
|
u8g2.drawUTF8(19 + (i % 8)*12, 33 - ((sequences[patternToEdit].length / 8) * 5) + ((i / 8) * 11), (bitRead(sequences[patternToEdit].sequence, i) ? "q" : "p"));
|
||||||
}
|
}
|
||||||
if (!isRecording && stepNumSelected >= 0) {
|
if (!isRecording && stepNumSelected >= 0) {
|
||||||
@ -347,8 +347,8 @@ void updateScreen() {
|
|||||||
u8g2.drawStr(122 - (u8g2.getStrWidth(version.c_str())), 5, version.c_str() );
|
u8g2.drawStr(122 - (u8g2.getStrWidth(version.c_str())), 5, version.c_str() );
|
||||||
u8g2.drawHLine(0, 8, 128);
|
u8g2.drawHLine(0, 8, 128);
|
||||||
lastMenuItem = 4;
|
lastMenuItem = 4;
|
||||||
byte width = 112;
|
uint8_t width = 112;
|
||||||
for (byte i = 0; i <= lastMenuItem; i++) {
|
for (uint8_t i = 0; i <= lastMenuItem; i++) {
|
||||||
switch(i) {
|
switch(i) {
|
||||||
case 0:
|
case 0:
|
||||||
valueStr = F("CALIBRATE CV INS");
|
valueStr = F("CALIBRATE CV INS");
|
||||||
|
|||||||
@ -16,8 +16,8 @@
|
|||||||
#define EXT_INPUT_PIN 2 //needs to be an interrupt pin
|
#define EXT_INPUT_PIN 2 //needs to be an interrupt pin
|
||||||
#define ANALOGUE_INPUT_1_PIN A7
|
#define ANALOGUE_INPUT_1_PIN A7
|
||||||
#define ANALOGUE_INPUT_2_PIN A6
|
#define ANALOGUE_INPUT_2_PIN A6
|
||||||
const byte clockOutPin = 3;
|
const uint8_t clockOutPin = 3;
|
||||||
const byte outsPins[] = { 7, 8, 10, 6, 9, 11, clockOutPin };
|
const uint8_t outsPins[] = { 7, 8, 10, 6, 9, 11, clockOutPin };
|
||||||
bool rotateScreen = false;
|
bool rotateScreen = false;
|
||||||
bool reverseEnc = false;
|
bool reverseEnc = false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user