Changed long-press time, added encoder reverse settings. memory is tight, needs testing. also removed everything related to hardware

This commit is contained in:
Oleksiy
2024-06-27 16:51:17 +03:00
parent 11965f7ac6
commit 79bc258cf1
129 changed files with 36 additions and 90097 deletions

View File

@ -6,7 +6,7 @@
#include <avr/wdt.h>
#include <NeoHWSerial.h>
const char version[5] = "V:1.1";
const char version[5] = "1.1.1";
#define SCREEN_ADDRESS 0x3C
@ -27,6 +27,7 @@ const char version[5] = "V:1.1";
const byte outsPins[6] = { 7, 8, 10, 6, 9, 11 };
const byte clockOutPin = 3;
bool rotateScreen = false;
bool reverseEnc = false;
//
/* Rev 1 Config
@ -588,6 +589,8 @@ void saveState() {
EEPROM.put(addr, rotateScreen);
addr = addr + sizeof(rotateScreen);
EEPROM.put(addr, extClockPPQN);
addr = addr + sizeof(extClockPPQN);
EEPROM.put(addr, reverseEnc);
}
void loadState() {
@ -643,6 +646,8 @@ void loadState() {
EEPROM.get(addr, rotateScreen);
addr = addr + sizeof(rotateScreen);
EEPROM.get(addr, extClockPPQN);
addr = addr + sizeof(extClockPPQN);
EEPROM.get(addr, reverseEnc);
} else {
//calibrateCVs();
saveState();

View File

@ -9,7 +9,7 @@ void checkInputs() {
encReleasedTime = millis();
if (showDone) {
showDone = false;
} else if (encReleasedTime - encPressedTime <= 500) { // press shorter than .5s is for entering the submenu
} else if (encReleasedTime - encPressedTime <= 300) { // press shorter than .3s is for entering the submenu
if (!insideTab && displayScreen == 0) {
insideTab = true;
} else if (insideTab && channels[displayTab - 1].mode == 2 && menuItem == 2 && displayScreen == 0) { //enter the pattern editor
@ -62,10 +62,13 @@ void checkInputs() {
saveState();
checkScreenRotation();
} else if (displayScreen == 2 && menuItem == 2) {
reverseEnc = !reverseEnc;
saveState();
} else if (displayScreen == 2 && menuItem == 3) {
EEPROM.put(1023, memCode - 1);
reboot();
}
} else if (encReleasedTime - encPressedTime > 500 && !shiftBtnPushed) { // longer press is for navigating back. longer than 2s presses are no longer ignored (used do be < 2000)
} else if (encReleasedTime - encPressedTime > 300 && !shiftBtnPushed) { // longer press is for navigating back. longer than 2s presses are no longer ignored (used do be < 2000)
if (menuItemSelected == 1) {
menuItemSelected = 0;
} else if (displayScreen != 0) {
@ -88,6 +91,9 @@ void checkInputs() {
int encDirection = (int)(encoder.getDirection());
if (encPositionOld != encPosition) {
int change = encPositionOld - encPosition;
if (reverseEnc) {
change = change * -1;
}
unsigned long ms = encoder.getMillisBetweenRotations();
/*if (encDirectionOld == encDirection && ms < 20) { //encoder acceleration
change = change * 5;

View File

@ -320,24 +320,30 @@ void updateScreen() {
u8g2.drawStr(8, 5,"SETTINGS" );
u8g2.drawStr(102, 5, version );
u8g2.drawHLine(0, 8, 128);
lastMenuItem = 2;
lastMenuItem = 3;
byte width = 112;
if (menuItem == 0) {
u8g2.drawButtonUTF8(8, 19, U8G2_BTN_BW0|U8G2_BTN_INV, width, 2, 3, "CALIBRATE CV INS" );
} else {
u8g2.drawButtonUTF8(8, 19, U8G2_BTN_BW0, width, 2, 3, "CALIBRATE CV INS" );
}
if (menuItem == 1) {
u8g2.drawButtonUTF8(8, 31, U8G2_BTN_BW0|U8G2_BTN_INV, width, 2, 3, "ROTATE SCREEN" );
} else {
u8g2.drawButtonUTF8(8, 31, U8G2_BTN_BW0, width, 2, 3, "ROTATE SCREEN" );
for (byte i = 0; i <= lastMenuItem; i++) {
switch(i) {
case 0:
valueStr = "CALIBRATE CV";
break;
case 1:
valueStr = "ROTATE SCREEN";
break;
case 2:
valueStr = "REVERSE ENC";
break;
case 3:
valueStr = "FACTORY RESET";
break;
};
valueStr.toCharArray(valueChar, 16);
if (menuItem == i) {
u8g2.drawButtonUTF8(8, 19 + (i*11), U8G2_BTN_BW0|U8G2_BTN_INV, width, 2, 3, valueChar );
} else {
u8g2.drawButtonUTF8(8, 19 + (i*11), U8G2_BTN_BW0, width, 2, 3, valueChar );
}
}
if (menuItem == 2) {
u8g2.drawButtonUTF8(8, 43, U8G2_BTN_BW0|U8G2_BTN_INV, width, 2, 3, "FACTORY RESET" );
} else {
u8g2.drawButtonUTF8(8, 43, U8G2_BTN_BW0, width, 2, 3, "FACTORY RESET" );
}
}
if (showDone) {