reworked the menu
This commit is contained in:
@ -71,6 +71,7 @@ void checkInputs() {
|
||||
insideTab = 0;
|
||||
menuItem = 0;
|
||||
isRecording = 0;
|
||||
menuItemSelected = 0;
|
||||
}
|
||||
} else if (encReleasedTime - encPressedTime > 2000 && shiftBtnPushed) { //2s+ combo with shift to open the settings
|
||||
displayScreen = 2;
|
||||
@ -162,7 +163,7 @@ void checkInputs() {
|
||||
masterClockMode = 1;
|
||||
}
|
||||
saveState();
|
||||
} else if (insideTab && shiftBtnPushed && displayTab == 0 && menuItem == 2) { //Modulation channel
|
||||
} else if (insideTab && (menuItemSelected || shiftBtnPushed) && displayTab == 0 && menuItem == 2) { //Modulation channel
|
||||
bpmModulationChannel = bpmModulationChannel + change;
|
||||
if (bpmModulationChannel == 0 || bpmModulationChannel == 1) {
|
||||
bpmModulationRange = 1;
|
||||
@ -173,7 +174,7 @@ void checkInputs() {
|
||||
bpmModulationChannel = 1;
|
||||
}
|
||||
saveState();
|
||||
} else if (insideTab && shiftBtnPushed && displayTab == 0 && menuItem == 3) { //Modulation range
|
||||
} else if (insideTab && (menuItemSelected || shiftBtnPushed) && displayTab == 0 && menuItem == 3) { //Modulation range
|
||||
bpmModulationRange = bpmModulationRange + change;
|
||||
if (bpmModulationRange == 0) {
|
||||
bpmModulationRange = 1;
|
||||
@ -183,7 +184,7 @@ void checkInputs() {
|
||||
bpmModulationRange = 5;
|
||||
}
|
||||
saveState();
|
||||
} else if (insideTab && shiftBtnPushed && displayTab != 0 && menuItem == 1) { //Channel Mode
|
||||
} else if (insideTab && (menuItemSelected || shiftBtnPushed) && displayTab != 0 && menuItem == 1) { //Channel Mode
|
||||
channels[displayTab - 1].mode = channels[displayTab - 1].mode + change;
|
||||
if (channels[displayTab - 1].mode > 100) {
|
||||
channels[displayTab - 1].mode = 0;
|
||||
@ -193,7 +194,7 @@ void checkInputs() {
|
||||
channels[displayTab - 1].CV1Target = 0;
|
||||
channels[displayTab - 1].CV2Target = 0;
|
||||
saveState();
|
||||
} else if (insideTab && shiftBtnPushed && displayTab != 0 && menuItem == 2 && channels[displayTab - 1].mode == 0) { //Offset
|
||||
} else if (insideTab && (menuItemSelected || shiftBtnPushed) && displayTab != 0 && menuItem == 2 && channels[displayTab - 1].mode == 0) { //Offset
|
||||
channels[displayTab - 1].offset = channels[displayTab - 1].offset + change;
|
||||
if (channels[displayTab - 1].offset > 100) {
|
||||
channels[displayTab - 1].offset = 0;
|
||||
@ -201,7 +202,7 @@ void checkInputs() {
|
||||
channels[displayTab - 1].offset = channelPulsesPerCycle[displayTab-1];
|
||||
}
|
||||
saveState();
|
||||
} else if (insideTab && shiftBtnPushed && displayTab != 0 && menuItem == 2 && channels[displayTab - 1].mode == 1) { //SUBDIV for RANDOM
|
||||
} else if (insideTab && (menuItemSelected || shiftBtnPushed) && displayTab != 0 && menuItem == 2 && channels[displayTab - 1].mode == 1) { //SUBDIV for RANDOM
|
||||
channels[displayTab - 1].subDiv = channels[displayTab - 1].subDiv - change;
|
||||
if (channels[displayTab - 1].subDiv > 200) {
|
||||
channels[displayTab - 1].subDiv = 0;
|
||||
@ -212,7 +213,7 @@ void checkInputs() {
|
||||
calculateCycles();
|
||||
}
|
||||
saveState();
|
||||
} else if (insideTab && shiftBtnPushed && displayTab != 0 && menuItem == 3 && channels[displayTab - 1].mode == 0) { //CV1 for CLK
|
||||
} else if (insideTab && (menuItemSelected || shiftBtnPushed) && displayTab != 0 && menuItem == 3 && channels[displayTab - 1].mode == 0) { //CV1 for CLK
|
||||
channels[displayTab - 1].CV1Target = channels[displayTab - 1].CV1Target + change;
|
||||
if (channels[displayTab - 1].CV1Target > 100) {
|
||||
channels[displayTab - 1].CV1Target = 0;
|
||||
@ -221,7 +222,7 @@ void checkInputs() {
|
||||
}
|
||||
saveState();
|
||||
}
|
||||
else if (insideTab && shiftBtnPushed && displayTab != 0 && menuItem == 4 && channels[displayTab - 1].mode == 0) { //CV2 for CLK
|
||||
else if (insideTab && (menuItemSelected || shiftBtnPushed) && displayTab != 0 && menuItem == 4 && channels[displayTab - 1].mode == 0) { //CV2 for CLK
|
||||
channels[displayTab - 1].CV2Target = channels[displayTab - 1].CV2Target + change;
|
||||
if (channels[displayTab - 1].CV2Target > 100) {
|
||||
channels[displayTab - 1].CV2Target = 0;
|
||||
@ -229,7 +230,7 @@ void checkInputs() {
|
||||
channels[displayTab - 1].CV2Target = 1;
|
||||
}
|
||||
saveState();
|
||||
} else if (insideTab && shiftBtnPushed && displayTab != 0 && menuItem == 3 && channels[displayTab - 1].mode == 1) { //CV1 for RND
|
||||
} else if (insideTab && (menuItemSelected || shiftBtnPushed) && displayTab != 0 && menuItem == 3 && channels[displayTab - 1].mode == 1) { //CV1 for RND
|
||||
channels[displayTab - 1].CV1Target = channels[displayTab - 1].CV1Target + change;
|
||||
if (channels[displayTab - 1].CV1Target > 100) {
|
||||
channels[displayTab - 1].CV1Target = 0;
|
||||
@ -238,7 +239,7 @@ void checkInputs() {
|
||||
}
|
||||
saveState();
|
||||
}
|
||||
else if (insideTab && shiftBtnPushed && displayTab != 0 && menuItem == 4 && channels[displayTab - 1].mode == 1) { //CV2 for RND
|
||||
else if (insideTab && (menuItemSelected || shiftBtnPushed) && displayTab != 0 && menuItem == 4 && channels[displayTab - 1].mode == 1) { //CV2 for RND
|
||||
channels[displayTab - 1].CV2Target = channels[displayTab - 1].CV2Target + change;
|
||||
if (channels[displayTab - 1].CV2Target > 100) {
|
||||
channels[displayTab - 1].CV2Target = 0;
|
||||
|
||||
@ -2,6 +2,11 @@ void updateScreen() {
|
||||
|
||||
u8g2.firstPage();
|
||||
do {
|
||||
byte leftOffset;
|
||||
byte width;
|
||||
//String textToShow;
|
||||
String valueStr;
|
||||
char valueChar[16];
|
||||
|
||||
if (displayScreen == 0) {
|
||||
//BPM Tab
|
||||
@ -10,7 +15,8 @@ void updateScreen() {
|
||||
u8g2.setFont(velvetscreen);
|
||||
|
||||
//Menu items
|
||||
byte menuItemWidth = 32;
|
||||
width = 32;
|
||||
leftOffset = 62;
|
||||
if (masterClockMode == 0 && bpmModulationRange == 0) {
|
||||
lastMenuItem = 2;
|
||||
} else if (masterClockMode == 0 && bpmModulationRange != 0) {
|
||||
@ -19,60 +25,60 @@ void updateScreen() {
|
||||
lastMenuItem = 0;
|
||||
}
|
||||
if ((menuItem == 1 && insideTab) || (insideTab && masterClockMode == 1 && menuItem == 0)) {
|
||||
u8g2.drawButtonUTF8(62, 6, U8G2_BTN_BW0|U8G2_BTN_INV, menuItemWidth, 2, 2, "MODE:" );
|
||||
u8g2.drawButtonUTF8(leftOffset, 6, U8G2_BTN_BW0|U8G2_BTN_INV, width, 2, 2, "MODE:" );
|
||||
} else {
|
||||
u8g2.drawButtonUTF8(62, 6, U8G2_BTN_BW0, menuItemWidth, 2, 2, "MODE:" );
|
||||
u8g2.drawButtonUTF8(leftOffset, 6, U8G2_BTN_BW0, width, 2, 2, "MODE:" );
|
||||
}
|
||||
if (masterClockMode == 0) {
|
||||
if (menuItem == 2) {
|
||||
u8g2.drawButtonUTF8(62, 16, U8G2_BTN_BW0|U8G2_BTN_INV, menuItemWidth, 2, 2, "MOD:" );
|
||||
u8g2.drawButtonUTF8(leftOffset, 16, U8G2_BTN_BW0|U8G2_BTN_INV, width, 2, 2, "MOD:" );
|
||||
} else {
|
||||
u8g2.drawButtonUTF8(62, 16, U8G2_BTN_BW0, menuItemWidth, 2, 2, "MOD:" );
|
||||
u8g2.drawButtonUTF8(leftOffset, 16, U8G2_BTN_BW0, width, 2, 2, "MOD:" );
|
||||
}
|
||||
if (bpmModulationRange != 0) {
|
||||
if (menuItem == 3) {
|
||||
u8g2.drawButtonUTF8(62, 26, U8G2_BTN_BW0|U8G2_BTN_INV, menuItemWidth, 2, 2, "RANGE:" );
|
||||
u8g2.drawButtonUTF8(leftOffset, 26, U8G2_BTN_BW0|U8G2_BTN_INV, width, 2, 2, "RANGE:" );
|
||||
} else {
|
||||
u8g2.drawButtonUTF8(62, 26, U8G2_BTN_BW0, menuItemWidth, 2, 2, "RANGE:" );
|
||||
u8g2.drawButtonUTF8(leftOffset, 26, U8G2_BTN_BW0, width, 2, 2, "RANGE:" );
|
||||
}
|
||||
}
|
||||
}
|
||||
//Values
|
||||
byte valueWidth = 28;
|
||||
width = 28;
|
||||
if (menuItem == 1 && insideTab && masterClockMode == 0) {
|
||||
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 6, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 2, 2, "INT" );
|
||||
u8g2.drawButtonUTF8(leftOffset + width + 4, 6, U8G2_BTN_BW0|U8G2_BTN_INV, width, 2, 2, "INT" );
|
||||
} else if ((menuItem != 1 || !insideTab) && masterClockMode == 0) {
|
||||
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 6, U8G2_BTN_BW0, valueWidth, 2, 2, "INT" );
|
||||
u8g2.drawButtonUTF8(leftOffset + width + 4, 6, U8G2_BTN_BW0, width, 2, 2, "INT" );
|
||||
}
|
||||
if (menuItem == 1 && insideTab && masterClockMode == 1) {
|
||||
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 6, U8G2_BTN_BW0|U8G2_BTN_INV, 30, 2, 2, "EXT" );
|
||||
u8g2.drawButtonUTF8(leftOffset + width + 4, 6, U8G2_BTN_BW0|U8G2_BTN_INV, 30, 2, 2, "EXT" );
|
||||
} else if ((menuItem != 1 || !insideTab) && masterClockMode == 1) {
|
||||
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 6, U8G2_BTN_BW0, valueWidth, 2, 2, "EXT" );
|
||||
u8g2.drawButtonUTF8(leftOffset + width + 4, 6, U8G2_BTN_BW0, width, 2, 2, "EXT" );
|
||||
}
|
||||
|
||||
if (masterClockMode == 0) {
|
||||
if (menuItem == 2 && bpmModulationRange != 0 && bpmModulationChannel == 0) {
|
||||
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 16, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 2, 2, "CV1" );
|
||||
u8g2.drawButtonUTF8(leftOffset + width + 4, 16, U8G2_BTN_BW0|U8G2_BTN_INV, width, 2, 2, "CV1" );
|
||||
} else if (menuItem != 2 && bpmModulationRange != 0 && bpmModulationChannel == 0) {
|
||||
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 16, U8G2_BTN_BW0, valueWidth, 3, 2, "CV1" );
|
||||
u8g2.drawButtonUTF8(leftOffset + width + 4, 16, U8G2_BTN_BW0, width, 3, 2, "CV1" );
|
||||
}
|
||||
if (menuItem == 2 && bpmModulationRange != 0 && bpmModulationChannel == 1) {
|
||||
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 16, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 2, 2, "CV2" );
|
||||
u8g2.drawButtonUTF8(leftOffset + width + 4, 16, U8G2_BTN_BW0|U8G2_BTN_INV, width, 2, 2, "CV2" );
|
||||
} else if (menuItem != 2 && bpmModulationRange != 0 && bpmModulationChannel == 1){
|
||||
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 16, U8G2_BTN_BW0, valueWidth, 2, 2, "CV2" );
|
||||
u8g2.drawButtonUTF8(leftOffset + width + 4, 16, U8G2_BTN_BW0, width, 2, 2, "CV2" );
|
||||
}
|
||||
if (menuItem == 2 && bpmModulationRange == 0) {
|
||||
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 16, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 2, 2, "OFF" );
|
||||
u8g2.drawButtonUTF8(leftOffset + width + 4, 16, U8G2_BTN_BW0|U8G2_BTN_INV, width, 2, 2, "OFF" );
|
||||
} else if (menuItem != 2 && bpmModulationRange == 0) {
|
||||
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 16, U8G2_BTN_BW0, valueWidth, 2, 2, "OFF" );
|
||||
u8g2.drawButtonUTF8(leftOffset + width + 4, 16, U8G2_BTN_BW0, width, 2, 2, "OFF" );
|
||||
}
|
||||
String bpmModStr = String(bpmModulationRange * 10);
|
||||
char bpmModChar[3];
|
||||
bpmModStr.toCharArray(bpmModChar, 3);
|
||||
if (menuItem == 3 && bpmModulationRange != 0) {
|
||||
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 26, U8G2_BTN_BW0|U8G2_BTN_INV, valueWidth, 4, 2, bpmModChar );
|
||||
u8g2.drawButtonUTF8(leftOffset + width + 4, 26, U8G2_BTN_BW0|U8G2_BTN_INV, width, 4, 2, bpmModChar );
|
||||
} else if (menuItem != 3 && bpmModulationRange != 0) {
|
||||
u8g2.drawButtonUTF8(62 + menuItemWidth + 4, 26, U8G2_BTN_BW0, valueWidth, 4, 2, bpmModChar );
|
||||
u8g2.drawButtonUTF8(leftOffset + width + 4, 26, U8G2_BTN_BW0, width, 4, 2, bpmModChar );
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,27 +90,32 @@ void updateScreen() {
|
||||
}
|
||||
char bpmChar[5];
|
||||
bpmStr.toCharArray(bpmChar, 5);
|
||||
u8g2.setFont(fabryka);
|
||||
if (((!insideTab && shiftBtnPushed) || (insideTab && menuItem == 0)) && masterClockMode == 0) {
|
||||
u8g2.drawButtonUTF8(28, 26, U8G2_BTN_BW1|U8G2_BTN_INV|U8G2_BTN_HCENTER, 56, 0, 5, bpmChar );
|
||||
u8g2.setFont(velvetscreen);
|
||||
if (masterClockMode == 0) {
|
||||
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" );
|
||||
leftOffset = 29;
|
||||
width = 55;
|
||||
if (masterClockMode == 0) {
|
||||
if ((!insideTab && !shiftBtnPushed) || (insideTab && menuItem != 0)) { //default view, nothing is selected or editable
|
||||
u8g2.setFont(fabryka);
|
||||
u8g2.drawButtonUTF8(leftOffset-1, 28, U8G2_BTN_BW0|U8G2_BTN_HCENTER, width, 0, 3, bpmChar );
|
||||
u8g2.setFont(velvetscreen);
|
||||
u8g2.drawButtonUTF8(leftOffset, 40, U8G2_BTN_BW0|U8G2_BTN_HCENTER, width, 0, 2, "BPM" );
|
||||
} else if ((!insideTab && shiftBtnPushed) || (insideTab && menuItem == 0 && (menuItemSelected || shiftBtnPushed))) { //show value as editable
|
||||
u8g2.setFont(fabryka);
|
||||
u8g2.drawButtonUTF8(leftOffset-1, 28, U8G2_BTN_BW1|U8G2_BTN_HCENTER, width, 0, 3, bpmChar );
|
||||
u8g2.setFont(velvetscreen);
|
||||
u8g2.drawButtonUTF8(leftOffset, 40, U8G2_BTN_BW1|U8G2_BTN_INV|U8G2_BTN_HCENTER, width, 0, 2, "BPM" );
|
||||
} else if (insideTab && menuItem == 0 && !menuItemSelected) { //show as selected menu item
|
||||
u8g2.setFont(fabryka);
|
||||
u8g2.drawButtonUTF8(leftOffset-1, 28, U8G2_BTN_BW1|U8G2_BTN_INV|U8G2_BTN_HCENTER, width, 0, 3, bpmChar );
|
||||
u8g2.setFont(velvetscreen);
|
||||
u8g2.drawButtonUTF8(leftOffset, 40, U8G2_BTN_BW1|U8G2_BTN_INV|U8G2_BTN_HCENTER, width, 0, 2, "BPM" );
|
||||
}
|
||||
} else {
|
||||
u8g2.drawButtonUTF8(28, 26, U8G2_BTN_BW0|U8G2_BTN_HCENTER, 56, 0, 0, bpmChar );
|
||||
}
|
||||
|
||||
if (masterClockMode == 1) {
|
||||
u8g2.setFont(fabryka);
|
||||
u8g2.drawButtonUTF8(leftOffset, 28, U8G2_BTN_BW0|U8G2_BTN_HCENTER, width, 0, 0, bpmChar );
|
||||
u8g2.setFont(velvetscreen);
|
||||
if (masterClockMode == 0) {
|
||||
u8g2.drawButtonUTF8(29, 40, U8G2_BTN_BW0|U8G2_BTN_HCENTER, 55, 0, 2, "BPM" );
|
||||
} else {
|
||||
u8g2.drawButtonUTF8(29, 40, U8G2_BTN_BW0|U8G2_BTN_HCENTER, 55, 0, 2, "PPQN" );
|
||||
}
|
||||
u8g2.drawButtonUTF8(leftOffset, 40, U8G2_BTN_BW0|U8G2_BTN_HCENTER, width, 0, 2, "PPQN" );
|
||||
}
|
||||
|
||||
}
|
||||
@ -112,154 +123,120 @@ void updateScreen() {
|
||||
else {
|
||||
//Menu items
|
||||
lastMenuItem = 4;
|
||||
byte menuItemWidth = 32;
|
||||
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:" );
|
||||
width = 32;
|
||||
leftOffset = 62;
|
||||
for (byte i = 1; i <= lastMenuItem; i++) {
|
||||
if (i == 1) {
|
||||
valueStr = "MODE:";
|
||||
} else if (i == 2 && channels[displayTab - 1].mode == 0) {
|
||||
valueStr = "OFFSET:";
|
||||
} else if (i == 2 && channels[displayTab - 1].mode == 1) {
|
||||
valueStr = "SUBDIV:";
|
||||
} else if (i == 2 && channels[displayTab - 1].mode == 2) {
|
||||
valueStr = "EDIT PATTERN";
|
||||
} else if (i == 3) {
|
||||
valueStr = "CV1";
|
||||
} else if (i == 4) {
|
||||
valueStr = "CV2";
|
||||
}
|
||||
valueStr.toCharArray(valueChar, 16);
|
||||
if (menuItem == i && insideTab) {
|
||||
u8g2.drawButtonUTF8(leftOffset, 8 + (i-1) *11, U8G2_BTN_BW1|U8G2_BTN_INV, width, 1, 2, valueChar );
|
||||
} else {
|
||||
u8g2.drawButtonUTF8(leftOffset, 8 + (i-1) *11, U8G2_BTN_BW0, width, 1, 2, valueChar);
|
||||
}
|
||||
}
|
||||
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 == 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 == 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 == 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 == 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:" );
|
||||
}
|
||||
|
||||
String valueStr;
|
||||
char valueChar[8];
|
||||
|
||||
|
||||
//Values
|
||||
byte valueWidth = 28;
|
||||
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 != 1 || !insideTab) && channels[displayTab - 1].mode == 0) {
|
||||
u8g2.drawButtonUTF8(menuItemWidth+6, 6, U8G2_BTN_BW0, valueWidth, 3, 2, "CLOCK" );
|
||||
} 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 != 1 || !insideTab) && channels[displayTab - 1].mode == 1) {
|
||||
u8g2.drawButtonUTF8(menuItemWidth+6, 6, U8G2_BTN_BW0, valueWidth, 3, 2, "RAND" );
|
||||
} 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 != 1 || !insideTab) && channels[displayTab - 1].mode == 2) {
|
||||
u8g2.drawButtonUTF8(menuItemWidth+6, 6, U8G2_BTN_BW0, valueWidth, 3, 2, "SEQ" );
|
||||
}
|
||||
for (byte i = 1; i <= lastMenuItem; i++) {
|
||||
if (i == 1 && channels[displayTab - 1].mode == 0) { //Channel mode
|
||||
valueStr = "CLOCK";
|
||||
} else if (i == 1 && channels[displayTab - 1].mode == 1) {
|
||||
valueStr = "RAND";
|
||||
} else if (i == 1 && channels[displayTab - 1].mode == 2) {
|
||||
valueStr = "SEQ";
|
||||
} else if (i == 2 && channels[displayTab - 1].mode == 0) { //SubDiv and offset
|
||||
valueStr = String(channels[displayTab - 1].offset) + "/";
|
||||
valueStr = valueStr + String(channelPulsesPerCycle[displayTab-1]+1);
|
||||
} else if (i == 2 && channels[displayTab - 1].mode == 1 && subDivs[channels[displayTab - 1].subDiv] > 0) {
|
||||
valueStr = "/" + String(subDivs[channels[displayTab - 1].subDiv]);
|
||||
} else if (i == 2 && channels[displayTab - 1].mode == 1 && subDivs[channels[displayTab - 1].subDiv] < 0) {
|
||||
valueStr = "x" + String(abs(subDivs[channels[displayTab - 1].subDiv]));
|
||||
} else if (i == 3 && channels[displayTab - 1].CV1Target == 0) { //CV1
|
||||
valueStr = "OFF";
|
||||
} else if (i == 3 && channels[displayTab - 1].CV1Target == 1) {
|
||||
valueStr = "SUBDIV";
|
||||
} else if (i == 3 && channels[displayTab - 1].CV1Target == 2) {
|
||||
valueStr = "RAND";
|
||||
} else if (i == 3 && channels[displayTab - 1].CV1Target == 3) {
|
||||
valueStr = "PATT";
|
||||
} else if (i == 4 && channels[displayTab - 1].CV2Target == 0) { //CV2
|
||||
valueStr = "OFF";
|
||||
} else if (i == 4 && channels[displayTab - 1].CV2Target == 1) {
|
||||
valueStr = "SUBDIV";
|
||||
} else if (i == 4 && channels[displayTab - 1].CV2Target == 2) {
|
||||
valueStr = "RAND";
|
||||
} else if (i == 4 && channels[displayTab - 1].CV2Target == 3) {
|
||||
valueStr = "PATT";
|
||||
}
|
||||
|
||||
//SubDiv and offset
|
||||
if (channels[displayTab - 1].mode == 0) {
|
||||
valueStr = String(channels[displayTab - 1].offset) + "/";
|
||||
valueStr = valueStr + String(channelPulsesPerCycle[displayTab-1]+1);
|
||||
} else if (channels[displayTab - 1].mode == 1 && subDivs[channels[displayTab - 1].subDiv] > 0) {
|
||||
valueStr = "/" + String(subDivs[channels[displayTab - 1].subDiv]);
|
||||
} else if (channels[displayTab - 1].mode == 1 && subDivs[channels[displayTab - 1].subDiv] < 0) {
|
||||
valueStr = "x" + String(abs(subDivs[channels[displayTab - 1].subDiv]));
|
||||
}
|
||||
valueStr.toCharArray(valueChar, 8);
|
||||
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 != 2 || !insideTab)) {
|
||||
u8g2.drawButtonUTF8(menuItemWidth+6, 16, U8G2_BTN_BW0, valueWidth, 3, 2, valueChar );
|
||||
}
|
||||
|
||||
//CV1
|
||||
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 != 3 || !insideTab) && channels[displayTab - 1].CV1Target == 1) {
|
||||
u8g2.drawButtonUTF8(menuItemWidth+6, 26, U8G2_BTN_BW0, valueWidth, 2, 2, "SUBDIV" );
|
||||
} 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 != 3 || !insideTab) && channels[displayTab - 1].CV1Target == 2) {
|
||||
u8g2.drawButtonUTF8(menuItemWidth+6, 26, U8G2_BTN_BW0, valueWidth, 2, 2, "RAND" );
|
||||
} 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 != 3 || !insideTab) && channels[displayTab - 1].CV1Target == 3) {
|
||||
u8g2.drawButtonUTF8(menuItemWidth+6, 26, U8G2_BTN_BW0, valueWidth, 2, 2, "PATT" );
|
||||
} 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 != 3 || !insideTab) && channels[displayTab - 1].CV1Target == 0) {
|
||||
u8g2.drawButtonUTF8(menuItemWidth+6, 26, U8G2_BTN_BW0, valueWidth, 2, 2, "OFF" );
|
||||
}
|
||||
|
||||
//CV2
|
||||
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 != 4 || !insideTab) && channels[displayTab - 1].CV2Target == 1) {
|
||||
u8g2.drawButtonUTF8(menuItemWidth+6, 36, U8G2_BTN_BW0, valueWidth, 2, 2, "SUBDIV" );
|
||||
} 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 != 4 || !insideTab) && channels[displayTab - 1].CV2Target == 2) {
|
||||
u8g2.drawButtonUTF8(menuItemWidth+6, 36, U8G2_BTN_BW0, valueWidth, 2, 2, "RANDOM" );
|
||||
} 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 != 4 || !insideTab) && channels[displayTab - 1].CV2Target == 3) {
|
||||
u8g2.drawButtonUTF8(menuItemWidth+6, 36, U8G2_BTN_BW0, valueWidth, 2, 2, "PATTERN" );
|
||||
} 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 != 4 || !insideTab) && channels[displayTab - 1].CV2Target == 0) {
|
||||
u8g2.drawButtonUTF8(menuItemWidth+6, 36, U8G2_BTN_BW0, valueWidth, 2, 2, "OFF" );
|
||||
valueStr.toCharArray(valueChar, 16);
|
||||
if (i == 2 && channels[displayTab - 1].mode == 2) { //EDIT PATTERN thing
|
||||
if (menuItem == i && insideTab) {
|
||||
u8g2.drawBox(leftOffset + 55, ((i-1) * 11)-1, 10, 11);
|
||||
}
|
||||
} else {
|
||||
if (menuItem == i && insideTab && (menuItemSelected || shiftBtnPushed)) {
|
||||
u8g2.drawButtonUTF8(leftOffset + 37, 8 + (i-1) *11, U8G2_BTN_BW1, 26, 2, 2, valueChar );
|
||||
} else if (menuItem == i && insideTab && (!menuItemSelected || !shiftBtnPushed)) {
|
||||
u8g2.drawButtonUTF8(leftOffset + 37, 8 + (i-1) *11, U8G2_BTN_BW1|U8G2_BTN_INV, 26, 2, 2, valueChar );
|
||||
} else {
|
||||
u8g2.drawButtonUTF8(leftOffset + 37, 8 + (i-1) *11, U8G2_BTN_BW0, 26, 2, 2, valueChar );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Main Param
|
||||
leftOffset = 29;
|
||||
width = 55;
|
||||
if (channels[displayTab - 1].mode == 0) {
|
||||
valueStr = "SUBDIVISION";
|
||||
} else if (channels[displayTab - 1].mode == 1) {
|
||||
valueStr = "SKIP CHANCE";
|
||||
} else if (channels[displayTab - 1].mode == 2) {
|
||||
valueStr = "PATTERN";
|
||||
}
|
||||
valueStr.toCharArray(valueChar, 16);
|
||||
if ((!insideTab && shiftBtnPushed) || (insideTab && menuItem == 0)) {
|
||||
u8g2.drawButtonUTF8(leftOffset, 41, U8G2_BTN_BW1|U8G2_BTN_INV|U8G2_BTN_HCENTER, width, 0, 3, valueChar );
|
||||
} else {
|
||||
u8g2.drawButtonUTF8(leftOffset, 41, U8G2_BTN_BW0|U8G2_BTN_HCENTER, width, 1, 2, valueChar );
|
||||
}
|
||||
|
||||
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%";
|
||||
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" );
|
||||
}
|
||||
valueStr = String(channels[displayTab - 1].random) + "0%";
|
||||
} 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);
|
||||
valueStr.toCharArray(valueChar, 16);
|
||||
u8g2.setFont(fabryka);
|
||||
if ((!insideTab && shiftBtnPushed) || (insideTab && menuItem == 0)) {
|
||||
u8g2.drawButtonUTF8(96, 26, U8G2_BTN_BW1|U8G2_BTN_INV|U8G2_BTN_HCENTER, 56, 0, 5, valueChar );
|
||||
if ((!insideTab && shiftBtnPushed) || (insideTab && menuItem == 0 && (menuItemSelected || shiftBtnPushed))) {
|
||||
u8g2.drawButtonUTF8(leftOffset, 28, U8G2_BTN_BW1|U8G2_BTN_HCENTER, width, 0, 3, valueChar );
|
||||
} else if (insideTab && menuItem == 0 && !menuItemSelected) {
|
||||
u8g2.drawButtonUTF8(leftOffset, 28, U8G2_BTN_BW1|U8G2_BTN_INV|U8G2_BTN_HCENTER, width, 0, 3, valueChar );
|
||||
} else {
|
||||
u8g2.drawButtonUTF8(96, 26, U8G2_BTN_BW0|U8G2_BTN_HCENTER, 56, 0, 5, valueChar );
|
||||
u8g2.drawButtonUTF8(leftOffset, 28, U8G2_BTN_BW0|U8G2_BTN_HCENTER, width, 0, 3, valueChar );
|
||||
}
|
||||
}
|
||||
|
||||
@ -311,7 +288,6 @@ void updateScreen() {
|
||||
}
|
||||
char patChar[16];
|
||||
patStr.toCharArray(patChar, 16);
|
||||
//u8g2.drawUTF8(31, 5, patChar);
|
||||
u8g2.drawButtonUTF8(64, 5, U8G2_BTN_BW1|U8G2_BTN_HCENTER, 128, 0, 2, patChar );
|
||||
for (byte i = 0; i < 8; i++) {
|
||||
if (patternToEdit[i]) {
|
||||
@ -345,21 +321,21 @@ void updateScreen() {
|
||||
else if (displayScreen == 2) {
|
||||
u8g2.drawButtonUTF8(64, 5, U8G2_BTN_BW1|U8G2_BTN_HCENTER, 128, 0, 2, "SETTINGS" );
|
||||
lastMenuItem = 2;
|
||||
byte menuItemWidth = 112;
|
||||
byte width = 112;
|
||||
if (menuItem == 0) {
|
||||
u8g2.drawButtonUTF8(8, 18, U8G2_BTN_BW0|U8G2_BTN_INV, menuItemWidth, 2, 2, "CALIBRATE CV INS" );
|
||||
u8g2.drawButtonUTF8(8, 18, U8G2_BTN_BW0|U8G2_BTN_INV, width, 2, 2, "CALIBRATE CV INS" );
|
||||
} else {
|
||||
u8g2.drawButtonUTF8(8, 18, U8G2_BTN_BW0, menuItemWidth, 2, 2, "CALIBRATE CV INS" );
|
||||
u8g2.drawButtonUTF8(8, 18, U8G2_BTN_BW0, width, 2, 2, "CALIBRATE CV INS" );
|
||||
}
|
||||
if (menuItem == 1) {
|
||||
u8g2.drawButtonUTF8(8, 32, U8G2_BTN_BW0|U8G2_BTN_INV, menuItemWidth, 2, 2, "ROTATE SCREEN" );
|
||||
u8g2.drawButtonUTF8(8, 32, U8G2_BTN_BW0|U8G2_BTN_INV, width, 2, 2, "ROTATE SCREEN" );
|
||||
} else {
|
||||
u8g2.drawButtonUTF8(8, 32, U8G2_BTN_BW0, menuItemWidth, 2, 2, "ROTATE SCREEN" );
|
||||
u8g2.drawButtonUTF8(8, 32, U8G2_BTN_BW0, width, 2, 2, "ROTATE SCREEN" );
|
||||
}
|
||||
if (menuItem == 2) {
|
||||
u8g2.drawButtonUTF8(8, 46, U8G2_BTN_BW0|U8G2_BTN_INV, menuItemWidth, 2, 2, "FACTORY RESET" );
|
||||
u8g2.drawButtonUTF8(8, 46, U8G2_BTN_BW0|U8G2_BTN_INV, width, 2, 2, "FACTORY RESET" );
|
||||
} else {
|
||||
u8g2.drawButtonUTF8(8, 46, U8G2_BTN_BW0, menuItemWidth, 2, 2, "FACTORY RESET" );
|
||||
u8g2.drawButtonUTF8(8, 46, U8G2_BTN_BW0, width, 2, 2, "FACTORY RESET" );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user