Started reworking menu to include main param

This commit is contained in:
2023-08-06 22:02:42 +03:00
parent fc622a1663
commit aec68332e4
3 changed files with 108 additions and 78 deletions

View File

@ -12,25 +12,25 @@ void updateScreen() {
//Menu items
byte menuItemWidth = 32;
if (masterClockMode == 0 && bpmModulationRange == 0) {
lastMenuItem = 1;
} else if (masterClockMode == 0 && bpmModulationRange != 0) {
lastMenuItem = 2;
} else if (masterClockMode == 0 && bpmModulationRange != 0) {
lastMenuItem = 3;
} else if (masterClockMode == 1) {
lastMenuItem = 0;
}
if (menuItem == 0 && insideTab) {
if ((menuItem == 1 && insideTab) || (insideTab && masterClockMode == 1 && menuItem == 0)) {
u8g2.drawButtonUTF8(62, 6, U8G2_BTN_BW0|U8G2_BTN_INV, menuItemWidth, 2, 2, "MODE:" );
} else {
u8g2.drawButtonUTF8(62, 6, U8G2_BTN_BW0, menuItemWidth, 2, 2, "MODE:" );
}
if (masterClockMode == 0) {
if (menuItem == 1) {
if (menuItem == 2) {
u8g2.drawButtonUTF8(62, 16, U8G2_BTN_BW0|U8G2_BTN_INV, menuItemWidth, 2, 2, "MOD:" );
} else {
u8g2.drawButtonUTF8(62, 16, U8G2_BTN_BW0, menuItemWidth, 2, 2, "MOD:" );
}
if (bpmModulationRange != 0) {
if (menuItem == 2) {
if (menuItem == 3) {
u8g2.drawButtonUTF8(62, 26, U8G2_BTN_BW0|U8G2_BTN_INV, menuItemWidth, 2, 2, "RANGE:" );
} else {
u8g2.drawButtonUTF8(62, 26, U8G2_BTN_BW0, menuItemWidth, 2, 2, "RANGE:" );
@ -39,39 +39,39 @@ void updateScreen() {
}
//Values
byte valueWidth = 28;
if (menuItem == 0 && insideTab && masterClockMode == 0) {
if (menuItem == 1 && insideTab && masterClockMode == 0) {
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 6, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 2, 2, "INT" );
} else if ((menuItem != 0 || !insideTab) && masterClockMode == 0) {
} else if ((menuItem != 1 || !insideTab) && masterClockMode == 0) {
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 6, U8G2_BTN_BW0, valueWidth, 2, 2, "INT" );
}
if (menuItem == 0 && insideTab && masterClockMode == 1) {
if (menuItem == 1 && insideTab && masterClockMode == 1) {
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 6, U8G2_BTN_BW0|U8G2_BTN_INV, 30, 2, 2, "EXT" );
} else if ((menuItem != 0 || !insideTab) && masterClockMode == 1) {
} else if ((menuItem != 1 || !insideTab) && masterClockMode == 1) {
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 6, U8G2_BTN_BW0, valueWidth, 2, 2, "EXT" );
}
if (masterClockMode == 0) {
if (menuItem == 1 && bpmModulationRange != 0 && bpmModulationChannel == 0) {
if (menuItem == 2 && bpmModulationRange != 0 && bpmModulationChannel == 0) {
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 16, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 2, 2, "CV1" );
} else if (menuItem != 1 && bpmModulationRange != 0 && bpmModulationChannel == 0) {
} else if (menuItem != 2 && bpmModulationRange != 0 && bpmModulationChannel == 0) {
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 16, U8G2_BTN_BW0, valueWidth, 3, 2, "CV1" );
}
if (menuItem == 1 && bpmModulationRange != 0 && bpmModulationChannel == 1) {
if (menuItem == 2 && bpmModulationRange != 0 && bpmModulationChannel == 1) {
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 16, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 2, 2, "CV2" );
} else if (menuItem != 1 && bpmModulationRange != 0 && bpmModulationChannel == 1){
} else if (menuItem != 2 && bpmModulationRange != 0 && bpmModulationChannel == 1){
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 16, U8G2_BTN_BW0, valueWidth, 2, 2, "CV2" );
}
if (menuItem == 1 && bpmModulationRange == 0) {
if (menuItem == 2 && bpmModulationRange == 0) {
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 16, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 2, 2, "OFF" );
} else if (menuItem != 1 && bpmModulationRange == 0) {
} else if (menuItem != 2 && bpmModulationRange == 0) {
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 16, U8G2_BTN_BW0, valueWidth, 2, 2, "OFF" );
}
String bpmModStr = String(bpmModulationRange * 10);
char bpmModChar[3];
bpmModStr.toCharArray(bpmModChar, 3);
if (menuItem == 2 && bpmModulationRange != 0) {
if (menuItem == 3 && bpmModulationRange != 0) {
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 26, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 4, 2, bpmModChar );
} else if (menuItem != 2 && bpmModulationRange != 0) {
} else if (menuItem != 3 && bpmModulationRange != 0) {
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 26, U8G2_BTN_BW0, valueWidth, 4, 2, bpmModChar );
}
}
@ -85,11 +85,15 @@ void updateScreen() {
char bpmChar[5];
bpmStr.toCharArray(bpmChar, 5);
u8g2.setFont(u8g2_font_logisoso24_tn);
if (!insideTab && shiftBtnPushed && masterClockMode == 0) {
if (((!insideTab && shiftBtnPushed) || (insideTab && menuItem == 0)) && masterClockMode == 0) {
u8g2.drawButtonUTF8(28, 26, U8G2_BTN_BW1|U8G2_BTN_INV|U8G2_BTN_HCENTER, 56, 0, 0, bpmChar );
u8g2.setFont(velvetscreen);
if (masterClockMode == 0) {
u8g2.drawButtonUTF8(29, 40, U8G2_BTN_BW1|U8G2_BTN_HCENTER, 55, 0, 2, "BPM" );
if (insideTab && menuItem == 0 && !menuItemSelected && !shiftBtnPushed) {
u8g2.drawButtonUTF8(29, 40, U8G2_BTN_BW1|U8G2_BTN_INV|U8G2_BTN_HCENTER, 55, 0, 2, "BPM" );
} else {
u8g2.drawButtonUTF8(29, 40, U8G2_BTN_BW1|U8G2_BTN_HCENTER, 55, 0, 2, "BPM" );
}
} else {
u8g2.drawButtonUTF8(29, 40, U8G2_BTN_BW1|U8G2_BTN_HCENTER, 55, 0, 2, "PPQN" );
}
@ -107,34 +111,34 @@ void updateScreen() {
//Channel Tabs
else {
//Menu items
lastMenuItem = 3;
lastMenuItem = 4;
byte menuItemWidth = 32;
if (menuItem == 0 && insideTab) {
if (menuItem == 1 && insideTab) {
u8g2.drawButtonUTF8(2, 6, U8G2_BTN_BW0|U8G2_BTN_INV, menuItemWidth, 2, 2, "MODE:" );
} else {
u8g2.drawButtonUTF8(2, 6, U8G2_BTN_BW0, menuItemWidth, 2, 2, "MODE:" );
}
if (menuItem == 1 && insideTab && channels[displayTab - 1].mode == 0) {
if (menuItem == 2 && insideTab && channels[displayTab - 1].mode == 0) {
u8g2.drawButtonUTF8(2, 16, U8G2_BTN_BW0|U8G2_BTN_INV, menuItemWidth, 2, 2, "OFFSET:" );
} else if ((menuItem != 1 || insideTab) && channels[displayTab - 1].mode == 0) {
u8g2.drawButtonUTF8(2, 16, U8G2_BTN_BW0, menuItemWidth, 2, 2, "OFFSET:" );
}
if (menuItem == 1 && insideTab && channels[displayTab - 1].mode == 1) {
if (menuItem == 2 && insideTab && channels[displayTab - 1].mode == 1) {
u8g2.drawButtonUTF8(2, 16, U8G2_BTN_BW0|U8G2_BTN_INV, menuItemWidth, 2, 2, "SUBDIV:" );
} else if ((menuItem != 1 || insideTab) && channels[displayTab - 1].mode == 1) {
u8g2.drawButtonUTF8(2, 16, U8G2_BTN_BW0, menuItemWidth, 2, 2, "SUBDIV:" );
}
if (menuItem == 1 && insideTab && channels[displayTab - 1].mode == 2) {
if (menuItem == 2 && insideTab && channels[displayTab - 1].mode == 2) {
u8g2.drawButtonUTF8(2, 16, U8G2_BTN_BW0|U8G2_BTN_INV, menuItemWidth, 2, 2, "EDIT PATTERN" );
} else if ((menuItem != 1 || insideTab) && channels[displayTab - 1].mode == 2) {
u8g2.drawButtonUTF8(2, 16, U8G2_BTN_BW0, menuItemWidth, 2, 2, "EDIT PATTERN" );
}
if (menuItem == 2 && insideTab) {
if (menuItem == 3 && insideTab) {
u8g2.drawButtonUTF8(2, 26, U8G2_BTN_BW0|U8G2_BTN_INV, menuItemWidth, 2, 2, "CV1:" );
} else {
u8g2.drawButtonUTF8(2, 26, U8G2_BTN_BW0, menuItemWidth, 2, 2, "CV1:" );
}
if (menuItem == 3 && insideTab) {
if (menuItem == 4 && insideTab) {
u8g2.drawButtonUTF8(2, 36, U8G2_BTN_BW0|U8G2_BTN_INV, menuItemWidth, 2, 2, "CV2:" );
} else {
u8g2.drawButtonUTF8(2, 36, U8G2_BTN_BW0, menuItemWidth, 2, 2, "CV2:" );
@ -145,17 +149,17 @@ void updateScreen() {
//Values
byte valueWidth = 28;
if (menuItem == 0 && insideTab && channels[displayTab - 1].mode == 0) {
if (menuItem == 1 && insideTab && channels[displayTab - 1].mode == 0) {
u8g2.drawButtonUTF8(menuItemWidth+6, 6, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 2, 2, "CLOCK" );
} else if ((menuItem != 0 || !insideTab) && channels[displayTab - 1].mode == 0) {
} else if ((menuItem != 1 || !insideTab) && channels[displayTab - 1].mode == 0) {
u8g2.drawButtonUTF8(menuItemWidth+6, 6, U8G2_BTN_BW0, valueWidth, 3, 2, "CLOCK" );
} else if (menuItem == 0 && insideTab && channels[displayTab - 1].mode == 1) {
} else if (menuItem == 1 && insideTab && channels[displayTab - 1].mode == 1) {
u8g2.drawButtonUTF8(menuItemWidth+6, 6, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 2, 2, "RAND" );
} else if ((menuItem != 0 || !insideTab) && channels[displayTab - 1].mode == 1) {
} else if ((menuItem != 1 || !insideTab) && channels[displayTab - 1].mode == 1) {
u8g2.drawButtonUTF8(menuItemWidth+6, 6, U8G2_BTN_BW0, valueWidth, 3, 2, "RAND" );
} else if (menuItem == 0 && insideTab && channels[displayTab - 1].mode == 2) {
} else if (menuItem == 1 && insideTab && channels[displayTab - 1].mode == 2) {
u8g2.drawButtonUTF8(menuItemWidth+6, 6, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 2, 2, "SEQ" );
} else if ((menuItem != 0 || !insideTab) && channels[displayTab - 1].mode == 2) {
} else if ((menuItem != 1 || !insideTab) && channels[displayTab - 1].mode == 2) {
u8g2.drawButtonUTF8(menuItemWidth+6, 6, U8G2_BTN_BW0, valueWidth, 3, 2, "SEQ" );
}
@ -169,65 +173,90 @@ void updateScreen() {
valueStr = "x" + String(abs(subDivs[channels[displayTab - 1].subDiv]));
}
valueStr.toCharArray(valueChar, 8);
if (menuItem == 1 && insideTab && channels[displayTab - 1].mode != 2) {
if (menuItem == 2 && insideTab && channels[displayTab - 1].mode != 2) {
u8g2.drawButtonUTF8(menuItemWidth+6, 16, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 2, 2, valueChar );
} else if ((menuItem != 1 || !insideTab)) {
} else if ((menuItem != 2 || !insideTab)) {
u8g2.drawButtonUTF8(menuItemWidth+6, 16, U8G2_BTN_BW0, valueWidth, 3, 2, valueChar );
}
//CV1
if (menuItem == 2 && insideTab && channels[displayTab - 1].CV1Target == 1) {
if (menuItem == 3 && insideTab && channels[displayTab - 1].CV1Target == 1) {
u8g2.drawButtonUTF8(menuItemWidth+6, 26, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 2, 2, "SUBDIV" );
} else if ((menuItem != 2 || !insideTab) && channels[displayTab - 1].CV1Target == 1) {
} else if ((menuItem != 3 || !insideTab) && channels[displayTab - 1].CV1Target == 1) {
u8g2.drawButtonUTF8(menuItemWidth+6, 26, U8G2_BTN_BW0, valueWidth, 2, 2, "SUBDIV" );
} else if (menuItem == 2 && insideTab && channels[displayTab - 1].CV1Target == 2) {
} else if (menuItem == 3 && insideTab && channels[displayTab - 1].CV1Target == 2) {
u8g2.drawButtonUTF8(menuItemWidth+6, 26, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 2, 2, "RAND" );
} else if ((menuItem != 2 || !insideTab) && channels[displayTab - 1].CV1Target == 2) {
} else if ((menuItem != 3 || !insideTab) && channels[displayTab - 1].CV1Target == 2) {
u8g2.drawButtonUTF8(menuItemWidth+6, 26, U8G2_BTN_BW0, valueWidth, 2, 2, "RAND" );
} else if (menuItem == 2 && !insideTab && channels[displayTab - 1].CV1Target == 3) {
} else if (menuItem == 3 && !insideTab && channels[displayTab - 1].CV1Target == 3) {
u8g2.drawButtonUTF8(menuItemWidth+6, 26, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 2, 2, "PATT" );
} else if ((menuItem != 2 || !insideTab) && channels[displayTab - 1].CV1Target == 3) {
} else if ((menuItem != 3 || !insideTab) && channels[displayTab - 1].CV1Target == 3) {
u8g2.drawButtonUTF8(menuItemWidth+6, 26, U8G2_BTN_BW0, valueWidth, 2, 2, "PATT" );
} else if (menuItem == 2 && insideTab && channels[displayTab - 1].CV1Target == 0) {
} else if (menuItem == 3 && insideTab && channels[displayTab - 1].CV1Target == 0) {
u8g2.drawButtonUTF8(menuItemWidth+6, 26, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 2, 2, "OFF" );
} else if ((menuItem != 2 || !insideTab) && channels[displayTab - 1].CV1Target == 0) {
} else if ((menuItem != 3 || !insideTab) && channels[displayTab - 1].CV1Target == 0) {
u8g2.drawButtonUTF8(menuItemWidth+6, 26, U8G2_BTN_BW0, valueWidth, 2, 2, "OFF" );
}
//CV2
if (menuItem == 3 && insideTab && channels[displayTab - 1].CV2Target == 1) {
if (menuItem == 4 && insideTab && channels[displayTab - 1].CV2Target == 1) {
u8g2.drawButtonUTF8(menuItemWidth+6, 36, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 2, 2, "SUBDIV" );
} else if ((menuItem != 3 || !insideTab) && channels[displayTab - 1].CV2Target == 1) {
} else if ((menuItem != 4 || !insideTab) && channels[displayTab - 1].CV2Target == 1) {
u8g2.drawButtonUTF8(menuItemWidth+6, 36, U8G2_BTN_BW0, valueWidth, 2, 2, "SUBDIV" );
} else if (menuItem == 3 && insideTab && channels[displayTab - 1].CV2Target == 2) {
} else if (menuItem == 4 && insideTab && channels[displayTab - 1].CV2Target == 2) {
u8g2.drawButtonUTF8(menuItemWidth+6, 36, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 2, 2, "RANDOM" );
} else if ((menuItem != 3 || !insideTab) && channels[displayTab - 1].CV2Target == 2) {
} else if ((menuItem != 4 || !insideTab) && channels[displayTab - 1].CV2Target == 2) {
u8g2.drawButtonUTF8(menuItemWidth+6, 36, U8G2_BTN_BW0, valueWidth, 2, 2, "RANDOM" );
} else if (menuItem == 3 && !insideTab && channels[displayTab - 1].CV2Target == 3) {
} else if (menuItem == 4 && !insideTab && channels[displayTab - 1].CV2Target == 3) {
u8g2.drawButtonUTF8(menuItemWidth+6, 36, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 2, 2, "PATTERN" );
} else if ((menuItem != 3 || !insideTab) && channels[displayTab - 1].CV2Target == 3) {
} else if ((menuItem != 4 || !insideTab) && channels[displayTab - 1].CV2Target == 3) {
u8g2.drawButtonUTF8(menuItemWidth+6, 36, U8G2_BTN_BW0, valueWidth, 2, 2, "PATTERN" );
} else if (menuItem == 3 && insideTab && channels[displayTab - 1].CV2Target == 0) {
} else if (menuItem == 4 && insideTab && channels[displayTab - 1].CV2Target == 0) {
u8g2.drawButtonUTF8(menuItemWidth+6, 36, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 2, 2, "OFF" );
} else if ((menuItem != 3 || !insideTab) && channels[displayTab - 1].CV2Target == 0) {
} else if ((menuItem != 4 || !insideTab) && channels[displayTab - 1].CV2Target == 0) {
u8g2.drawButtonUTF8(menuItemWidth+6, 36, U8G2_BTN_BW0, valueWidth, 2, 2, "OFF" );
}
//Main Param
if (channels[displayTab - 1].mode == 0 && subDivs[channels[displayTab - 1].subDiv] > 0) {
valueStr = "/" + String(subDivs[channels[displayTab - 1].subDiv]);
} else if (channels[displayTab - 1].mode == 0 && subDivs[channels[displayTab - 1].subDiv] < 0) {
valueStr = "x" + String(abs(subDivs[channels[displayTab - 1].subDiv]));
if (channels[displayTab - 1].mode == 0) {
if (subDivs[channels[displayTab - 1].subDiv] > 0) {
valueStr = "/" + String(subDivs[channels[displayTab - 1].subDiv]);
} else {
valueStr = "x" + String(abs(subDivs[channels[displayTab - 1].subDiv]));
}
if (insideTab && menuItem == 0 && !menuItemSelected && !shiftBtnPushed) {
u8g2.drawButtonUTF8(96, 40, U8G2_BTN_BW1|U8G2_BTN_INV|U8G2_BTN_HCENTER, 56, 0, 2, "SUBDIVISION" );
} else if ((!insideTab && shiftBtnPushed) || (insideTab && menuItem == 0 && shiftBtnPushed) || (insideTab && menuItem == 0 && menuItemSelected)) {
u8g2.drawButtonUTF8(96, 40, U8G2_BTN_BW1|U8G2_BTN_HCENTER, 56, 0, 2, "SUBDIVISION" );
} else {
u8g2.drawButtonUTF8(96, 40, U8G2_BTN_BW0|U8G2_BTN_HCENTER, 56, 0, 2, "SUBDIVISION" );
}
} else if (channels[displayTab - 1].mode == 1) {
valueStr = String(channels[displayTab - 1].random) + "0%";
} else if (channels[displayTab - 1].mode == 2 && channels[displayTab - 1].seqPattern < 8) {
valueStr = "A" + String(channels[displayTab - 1].seqPattern + 1);
} else if (channels[displayTab - 1].mode == 2 && channels[displayTab - 1].seqPattern >= 8) {
valueStr = "B" + String(channels[displayTab - 1].seqPattern - 7);
if (insideTab && menuItem == 0 && !menuItemSelected && !shiftBtnPushed) {
u8g2.drawButtonUTF8(96, 40, U8G2_BTN_BW1|U8G2_BTN_INV|U8G2_BTN_HCENTER, 56, 0, 2, "SKIP CHANCE" );
} else if ((!insideTab && shiftBtnPushed) || (insideTab && menuItem == 0 && shiftBtnPushed) || (insideTab && menuItem == 0 && menuItemSelected)) {
u8g2.drawButtonUTF8(96, 40, U8G2_BTN_BW1|U8G2_BTN_HCENTER, 56, 0, 2, "SKIP CHANCE" );
} else {
u8g2.drawButtonUTF8(96, 40, U8G2_BTN_BW0|U8G2_BTN_HCENTER, 56, 0, 2, "SKIP CHANCE" );
}
} else if (channels[displayTab - 1].mode == 2) {
if (channels[displayTab - 1].seqPattern < 8) {
valueStr = "A" + String(channels[displayTab - 1].seqPattern + 1);
} else {
valueStr = "B" + String(channels[displayTab - 1].seqPattern - 7);
}
if (insideTab && menuItem == 0 && !menuItemSelected && !shiftBtnPushed) {
u8g2.drawButtonUTF8(96, 40, U8G2_BTN_BW1|U8G2_BTN_INV|U8G2_BTN_HCENTER, 56, 0, 2, "PATTERN" );
} else if ((!insideTab && shiftBtnPushed) || (insideTab && menuItem == 0 && shiftBtnPushed) || (insideTab && menuItem == 0 && menuItemSelected)) {
u8g2.drawButtonUTF8(96, 40, U8G2_BTN_BW1|U8G2_BTN_HCENTER, 56, 0, 2, "PATTERN" );
} else {
u8g2.drawButtonUTF8(96, 40, U8G2_BTN_BW0|U8G2_BTN_HCENTER, 56, 0, 2, "PATTERN" );
}
}
valueStr.toCharArray(valueChar, 8);
u8g2.setFont(u8g2_font_logisoso24_tr);
if (!insideTab && shiftBtnPushed) {
if ((!insideTab && shiftBtnPushed) || (insideTab && menuItem == 0)) {
u8g2.drawButtonUTF8(96, 26, U8G2_BTN_BW1|U8G2_BTN_INV|U8G2_BTN_HCENTER, 56, 0, 0, valueChar );
} else {
u8g2.drawButtonUTF8(96, 26, U8G2_BTN_BW0|U8G2_BTN_HCENTER, 56, 0, 0, valueChar );