Merge pull request #20 from Trasselfrisyr/patchselectfix

Fixed regression bug for patch select
This commit is contained in:
John Stäck 2019-06-27 10:13:32 +02:00 committed by GitHub
commit 42fcc89da9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1070,6 +1070,8 @@ static bool patchPageUpdate(KeyState& input, uint32_t timeNow) {
int trills = readTrills(); int trills = readTrills();
switch (input.current){ switch (input.current){
case BTN_DOWN: case BTN_DOWN:
// fallthrough
case BTN_UP:
if (trills && (fastPatch[trills-1] > 0)){ if (trills && (fastPatch[trills-1] > 0)){
patch = fastPatch[trills-1]; patch = fastPatch[trills-1];
activePatch = 0; activePatch = 0;
@ -1077,9 +1079,7 @@ static bool patchPageUpdate(KeyState& input, uint32_t timeNow) {
FPD = 1; FPD = 1;
writeSetting(PATCH_ADDR,patch); writeSetting(PATCH_ADDR,patch);
} else if (!trills){ } else if (!trills){
if (patch > 1){ patch = (((patch-1u) + ((input.current == BTN_UP)?1u:-1u))&127u) + 1u;
patch--;
} else patch = 128;
activePatch = 0; activePatch = 0;
doPatchUpdate = 1; doPatchUpdate = 1;
FPD = 0; FPD = 0;
@ -1099,24 +1099,6 @@ static bool patchPageUpdate(KeyState& input, uint32_t timeNow) {
} }
break; break;
case BTN_UP:
if (trills && (fastPatch[trills-1] > 0)){
patch = fastPatch[trills-1];
activePatch = 0;
doPatchUpdate = 1;
FPD = 1;
writeSetting(PATCH_ADDR,patch);
} else if (!trills){
if (patch < 128){
patch++;
} else patch = 1;
activePatch = 0;
doPatchUpdate = 1;
FPD = 0;
}
drawPatchView();
redraw = true;
break;
case BTN_MENU: case BTN_MENU:
if (FPD < 2){ if (FPD < 2){
@ -1160,18 +1142,13 @@ static bool idlePageUpdate(KeyState& __unused input, uint32_t __unused timeNow)
if (input.changed) { if (input.changed) {
int trills = readTrills(); int trills = readTrills();
switch (input.current){ switch (input.current){
case BTN_UP: // fallthrough case BTN_UP:
// fallthrough
case BTN_DOWN: case BTN_DOWN:
if (trills && (fastPatch[trills-1] > 0)){ if (!trills) {
patch = fastPatch[trills-1]; patch = (((patch-1u) + ((input.current == BTN_UP)?1u:-1u))&127u) + 1u;
activePatch = 0; }
doPatchUpdate = 1; // fallthrough
FPD = 1;
} // else if (!trills) buttonPressedAndNotUsed = 1; // <- TODO: this is now broken, all input is consumed... solve in another way.
menuState= PATCH_VIEW;
stateFirstRun = 1;
break;
case BTN_ENTER: case BTN_ENTER:
if (trills && (fastPatch[trills-1] > 0)){ if (trills && (fastPatch[trills-1] > 0)){
patch = fastPatch[trills-1]; patch = fastPatch[trills-1];