Fixed sequence player

This commit is contained in:
2023-08-01 16:26:47 +03:00
parent dbf6cfe85a
commit fd77b88b6f
3 changed files with 67 additions and 73 deletions

View File

@ -124,28 +124,6 @@ bool encPressRegistered;
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);
const unsigned char splash_logo[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x07, 0xf8, 0x03, 0xff, 0xc0, 0x03, 0xf8, 0x1f, 0x00, 0x7c, 0x7c, 0x3f, 0xff, 0xc7, 0xc0, 0x3e,
0x0f, 0xfe, 0x03, 0xff, 0xe0, 0x07, 0xf8, 0x0f, 0x00, 0x78, 0x7c, 0x3f, 0xff, 0xc3, 0xe0, 0x7c,
0x1f, 0xff, 0x03, 0xff, 0xf0, 0x07, 0xf8, 0x0f, 0x80, 0xf8, 0x7c, 0x3f, 0xff, 0xc3, 0xe0, 0x78,
0x3f, 0xff, 0x03, 0xff, 0xf8, 0x07, 0xfc, 0x0f, 0x80, 0xf8, 0x7c, 0x3f, 0xff, 0xc1, 0xf0, 0xf8,
0x7e, 0x0f, 0x83, 0xe0, 0xf8, 0x0f, 0x3c, 0x07, 0x80, 0xf0, 0x7c, 0x00, 0xf8, 0x00, 0xf8, 0xf0,
0x7c, 0x07, 0x83, 0xe0, 0x78, 0x0f, 0x3c, 0x07, 0xc0, 0xf0, 0x7c, 0x00, 0xf0, 0x00, 0xf9, 0xf0,
0x7c, 0x00, 0x03, 0xe0, 0xf8, 0x0f, 0x3e, 0x07, 0xc1, 0xf0, 0x7c, 0x00, 0xf0, 0x00, 0x7d, 0xe0,
0x78, 0x00, 0x03, 0xe0, 0xf8, 0x1e, 0x1e, 0x03, 0xc1, 0xe0, 0x7c, 0x00, 0xf0, 0x00, 0x7f, 0xc0,
0x78, 0x3f, 0xc3, 0xff, 0xf0, 0x1e, 0x1e, 0x03, 0xe1, 0xe0, 0x7c, 0x00, 0xf0, 0x00, 0x3f, 0xc0,
0x78, 0x3f, 0xc3, 0xff, 0xe0, 0x1e, 0x1f, 0x01, 0xe3, 0xe0, 0x7c, 0x00, 0xf0, 0x00, 0x1f, 0x80,
0x78, 0x3f, 0xc3, 0xff, 0xc0, 0x3e, 0x1f, 0x01, 0xe3, 0xc0, 0x7c, 0x00, 0xf0, 0x00, 0x1f, 0x80,
0x7c, 0x3f, 0xc3, 0xe7, 0xc0, 0x3f, 0xff, 0x01, 0xf3, 0xc0, 0x7c, 0x00, 0xf0, 0x00, 0x0f, 0x00,
0x7e, 0x07, 0xc3, 0xe3, 0xe0, 0x3f, 0xff, 0x80, 0xf7, 0xc0, 0x7c, 0x00, 0xf0, 0x00, 0x0f, 0x00,
0x3f, 0x1f, 0xc3, 0xe1, 0xe0, 0x7f, 0xff, 0x80, 0xff, 0x80, 0x7c, 0x00, 0xf0, 0x00, 0x0f, 0x00,
0x1f, 0xff, 0xc3, 0xe1, 0xf0, 0x78, 0x07, 0x80, 0xff, 0x80, 0x7c, 0x00, 0xf0, 0x00, 0x0f, 0x00,
0x0f, 0xff, 0xc3, 0xe0, 0xf8, 0xf8, 0x07, 0xc0, 0x7f, 0x00, 0x7c, 0x00, 0xf0, 0x00, 0x0f, 0x00,
0x07, 0xf3, 0xc3, 0xe0, 0xf8, 0xf8, 0x07, 0xc0, 0x7f, 0x00, 0x7c, 0x00, 0xf0, 0x00, 0x0f, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
const uint8_t velvetscreen[597] U8G2_FONT_SECTION("velvetscreen") =
"I\0\2\2\3\3\3\3\4\5\5\0\0\5\0\5\0\0\363\0\0\2\70!\6)\251\254\0\42\6\23"
"\317$\25#\12-\351UC\345\241*\0$\11,\331\215\24e\32\11%\12-\351\250\244r\245\222\0"
@ -169,7 +147,7 @@ const uint8_t velvetscreen[597] U8G2_FONT_SECTION("velvetscreen") =
void setup() {
Serial.begin(9600);
//Serial.begin(9600);
//check last bit in eeprom to know if the correct settings were stored
if (EEPROM.read(1023) == memCode) {
@ -198,21 +176,6 @@ void setup() {
pinMode(outsPins[i], OUTPUT);
}
/*display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS);
display.setRotation(2);
display.clearDisplay();
//Splash screen
display.drawBitmap(0, 16, splash_logo, 128, 19, 1);
display.setCursor(0, 56);
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.print(F("V:"));
display.print(F(VERSION));
display.display();
delay(800);*/
//u8g2.setI2CAddress(SCREEN_ADDRESS);
u8g2.begin();
updateScreen();
@ -303,6 +266,39 @@ void sendTriggers() {
//16th notes for sequencer
if (sixteenthPulseCount == 0) {
for (byte i = 0; i < 6; i++) {
if (channels[i].seqPattern == 0) {
currentSeq = seqA1;
} else if (channels[i].seqPattern == 1) {
currentSeq = seqA2;
} else if (channels[i].seqPattern == 2) {
currentSeq = seqA3;
} else if (channels[i].seqPattern == 3) {
currentSeq = seqA4;
} else if (channels[i].seqPattern == 4) {
currentSeq = seqA5;
} else if (channels[i].seqPattern == 5) {
currentSeq = seqA6;
} else if (channels[i].seqPattern == 6) {
currentSeq = seqA7;
} else if (channels[i].seqPattern == 7) {
currentSeq = seqA8;
} else if (channels[i].seqPattern == 8) {
currentSeq = seqB1;
} else if (channels[i].seqPattern == 9) {
currentSeq = seqB2;
} else if (channels[i].seqPattern == 10) {
currentSeq = seqB3;
} else if (channels[i].seqPattern == 11) {
currentSeq = seqB4;
} else if (channels[i].seqPattern == 12) {
currentSeq = seqB5;
} else if (channels[i].seqPattern == 13) {
currentSeq = seqB6;
} else if (channels[i].seqPattern == 14) {
currentSeq = seqB7;
} else if (channels[i].seqPattern == 15) {
currentSeq = seqB8;
}
if (channels[i].mode == 2 && channelPulseCount[i] == 0 && currentSeq[currentStep]) {
digitalWrite(outsPins[i], HIGH);
}
@ -354,7 +350,6 @@ void sendTriggers() {
if ((channels[i].mode == 0 && channelPulseCount[i] == channels[i].offset) //CLK with offset
|| (channels[i].mode == 1 && channelPulseCount[i] == 0 && (random(10) + 1) > randAmount) //RND
//|| (channels[i].mode == 2 && channelPulseCount[i] == 0 && currentSeq[currentStep])
) {
digitalWrite(outsPins[i], HIGH);
}