Tiny adjust menu redraw bug fix

Had forgotten to redraw adjust menu after normal update, it was only redrawn when the sensor pixels were to be updated.
As a bonus I cleaned up some code.
This commit is contained in:
Mikael Degerfält 2019-06-23 11:35:14 +02:00
parent bddbffd51d
commit f2e2b7d33f

View file

@ -11,14 +11,10 @@
#include "settings.h" #include "settings.h"
#include "numenu.h" #include "numenu.h"
// TODO: Ask Johan the reason for using this..
// static const uint16_t minOffset = 50;
static uint8_t lastDeumButtons = 0; static uint8_t lastDeumButtons = 0;
static uint8_t deumButtonState = 0; static uint8_t deumButtonState = 0;
static byte buttonPressedAndNotUsed = 0; static byte buttonPressedAndNotUsed = 0;
// Allocate some space for cursors
enum CursorIdx { enum CursorIdx {
EMain, EMain,
@ -27,16 +23,16 @@ enum CursorIdx {
ERotator, ERotator,
EVibrato, EVibrato,
// NEVER ADD // NEVER ADD ANYTHING AFTER THIS, ONLY ABOVE
NUM_CURSORS NUM_CURSORS
}; };
// Allocate some space for cursors
static byte cursors[CursorIdx::NUM_CURSORS]; static byte cursors[CursorIdx::NUM_CURSORS];
static byte offsets[CursorIdx::NUM_CURSORS]; static byte offsets[CursorIdx::NUM_CURSORS];
static byte activeSub[CursorIdx::NUM_CURSORS]; static byte activeSub[CursorIdx::NUM_CURSORS];
byte cursorNow; byte cursorNow;
static byte FPD = 0; static byte FPD = 0;
@ -852,7 +848,7 @@ static bool updateSubMenu(const MenuPage &page, uint32_t timeNow) {
bool redraw = false; bool redraw = false;
bool redrawSubValue = false; bool redrawSubValue = false;
if (buttonPressedAndNotUsed){ if (buttonPressedAndNotUsed) {
buttonPressedAndNotUsed = 0; buttonPressedAndNotUsed = 0;
int current_sub = activeSub[page.cursor] -1; int current_sub = activeSub[page.cursor] -1;
@ -930,7 +926,6 @@ static bool updateMenuPage( const MenuPage &page, uint32_t timeNow ) {
break; break;
case BTN_ENTER: case BTN_ENTER:
// redraw |= selectMenuOption(cursorPos, page.entries);
redraw |= selectMenuOption(page); redraw |= selectMenuOption(page);
break; break;
@ -985,7 +980,7 @@ static void checkForPatchView(int buttons) {
break; break;
case BTN_MENU+BTN_ENTER: case BTN_MENU+BTN_ENTER:
if (trills){ if (trills) {
state = PATCH_VIEW; state = PATCH_VIEW;
stateFirstRun = 1; stateFirstRun = 1;
setFPS(trills, patch); setFPS(trills, patch);
@ -993,7 +988,7 @@ static void checkForPatchView(int buttons) {
break; break;
case BTN_MENU+BTN_UP: case BTN_MENU+BTN_UP:
if (trills){ if (trills) {
state = PATCH_VIEW; state = PATCH_VIEW;
stateFirstRun = 1; stateFirstRun = 1;
clearFPS(trills); clearFPS(trills);
@ -1270,10 +1265,12 @@ void menu() {
stateFirstRun = 0; stateFirstRun = 0;
buttonPressedAndNotUsed = 0; buttonPressedAndNotUsed = 0;
if( result < 0) { if(result < 0) {
// Go back to main menu // Go back to main menu
state = MAIN_MENU; state = MAIN_MENU;
stateFirstRun = true; stateFirstRun = true;
} else {
redraw = result;
} }
if( old_thr != ctouchThrVal) { if( old_thr != ctouchThrVal) {