Only play navigation animation when menus changed

This commit is contained in:
Patrick Horlebein
2020-04-06 17:39:05 +02:00
parent ec6140317c
commit bbb724e8f0

View File

@@ -823,6 +823,8 @@ void gui_Menu(const menuitem *menu) {
int16_t lastOffset = -1; int16_t lastOffset = -1;
bool lcdRefresh = true; bool lcdRefresh = true;
ButtonState lastButtonState = BUTTON_NONE; ButtonState lastButtonState = BUTTON_NONE;
static bool enterGUIMenu = true;
enterGUIMenu = true;
if (menu[currentScreen].draw.func != NULL) { if (menu[currentScreen].draw.func != NULL) {
uint8_t secondFrameBuffer[OLED_WIDTH * 2]; uint8_t secondFrameBuffer[OLED_WIDTH * 2];
@@ -882,14 +884,18 @@ void gui_Menu(const menuitem *menu) {
// increment // increment
if (descriptionStart == 0) { if (descriptionStart == 0) {
if (menu[currentScreen].incrementHandler.func != NULL) { if (menu[currentScreen].incrementHandler.func != NULL) {
enterGUIMenu = false;
menu[currentScreen].incrementHandler.func(); menu[currentScreen].incrementHandler.func();
// MARK: Might jump in submenu here
OLED::use_second_buffer(); if (enterGUIMenu) {
OLED::setFont(0); uint8_t secondFrameBuffer[OLED_WIDTH * 2];
OLED::setCursor(0, 0); OLED::set_framebuffer(secondFrameBuffer);
OLED::clearScreen(); OLED::setFont(0);
menu[currentScreen].draw.func(); OLED::setCursor(0, 0);
OLED::presentSecondScreenBufferAnimatedBack(); OLED::clearScreen();
menu[currentScreen].draw.func();
OLED::presentSecondScreenBufferAnimatedBack();
}
} else { } else {
earlyExit = true; earlyExit = true;
} }