From 602b656b01881953c0ae1be2ebf2da505e49fa73 Mon Sep 17 00:00:00 2001 From: jflyper Date: Wed, 5 Apr 2017 17:32:00 +0900 Subject: [PATCH 1/5] Refactor CMS - Introduce 'page' - Handle more than 2 pages correctly --- src/main/cms/cms.c | 274 ++++++++++++++++------------- src/main/cms/cms.h | 6 + src/main/cms/cms_menu_builtin.c | 5 +- src/main/target/OMNIBUSF4/target.h | 3 + 4 files changed, 164 insertions(+), 124 deletions(-) diff --git a/src/main/cms/cms.c b/src/main/cms/cms.c index f7e106a3e1..c90482600e 100644 --- a/src/main/cms/cms.c +++ b/src/main/cms/cms.c @@ -130,19 +130,20 @@ static displayPort_t *cmsDisplayPortSelectNext(void) static bool cmsInMenu = false; -STATIC_UNIT_TESTED const CMS_Menu *currentMenu; // Points to top entry of the current page +typedef struct cmsCtx_s { + const CMS_Menu *menu; // menu for this context + uint8_t page; // page in the menu + int8_t cursorRow; // cursorRow in the page +} cmsCtx_t; -// XXX Does menu backing support backing into second page??? - -static const CMS_Menu *menuStack[10]; // Stack to save menu transition -static uint8_t menuStackHistory[10];// cursorRow in a stacked menu +static cmsCtx_t menuStack[10]; static uint8_t menuStackIdx = 0; -static OSD_Entry *pageTop; // Points to top entry of the current page -static OSD_Entry *pageTopAlt; // Only 2 pages are allowed (for now) -static uint8_t maxRow; // Max row in the current page +static int8_t pageCount; // Number of pages in the current menu +static OSD_Entry *pageTop; // First entry for the current page +static uint8_t pageMaxRow; // Max row in the current page -static int8_t cursorRow; +static cmsCtx_t currentCtx; #ifdef CMS_MENU_DEBUG // For external menu content creators @@ -165,19 +166,54 @@ static CMS_Menu menuErr = { }; #endif +#define CMS_PAGE_DEBUG + +#ifdef CMS_PAGE_DEBUG +#define cmsPageDebug() { \ + debug[0] = pageCount; \ + debug[1] = currentCtx.page; \ + debug[2] = pageMaxRow; \ + debug[3] = currentCtx.cursorRow; } struct _dummy +#else +#define cmsPageDebug() +#endif + static void cmsUpdateMaxRow(displayPort_t *instance) { - maxRow = 0; + pageMaxRow = 0; for (const OSD_Entry *ptr = pageTop; ptr->type != OME_END; ptr++) { - maxRow++; + pageMaxRow++; } - if (maxRow > MAX_MENU_ITEMS(instance)) { - maxRow = MAX_MENU_ITEMS(instance); + if (pageMaxRow > MAX_MENU_ITEMS(instance)) { + pageMaxRow = MAX_MENU_ITEMS(instance); } - maxRow--; + pageMaxRow--; +} + +static uint8_t cmsCursorAbsolute(displayPort_t *instance) +{ + return currentCtx.cursorRow + currentCtx.page * MAX_MENU_ITEMS(instance); +} + +static void cmsPageSelect(displayPort_t *instance, int8_t newpage) +{ + currentCtx.page = (newpage + pageCount) % pageCount; + pageTop = ¤tCtx.menu->entries[currentCtx.page * MAX_MENU_ITEMS(instance)]; + cmsUpdateMaxRow(instance); + displayClearScreen(instance); +} + +static void cmsPageNext(displayPort_t *instance) +{ + cmsPageSelect(instance, currentCtx.page + 1); +} + +static void cmsPagePrev(displayPort_t *instance) +{ + cmsPageSelect(instance, currentCtx.page - 1); } static void cmsFormatFloat(int32_t value, char *floatString) @@ -378,7 +414,7 @@ static void cmsDrawMenu(displayPort_t *pDisplay, uint32_t currentTimeUs) uint8_t i; OSD_Entry *p; - uint8_t top = (pDisplay->rows - maxRow) / 2 - 1; + uint8_t top = (pDisplay->rows - pageMaxRow) / 2 - 1; // Polled (dynamic) value display denominator. @@ -397,17 +433,9 @@ static void cmsDrawMenu(displayPort_t *pDisplay, uint32_t currentTimeUs) SET_PRINTLABEL(p); SET_PRINTVALUE(p); } - - if (i > MAX_MENU_ITEMS(pDisplay)) // max per page - { - pageTopAlt = pageTop + MAX_MENU_ITEMS(pDisplay); - if (pageTopAlt->type == OME_END) - pageTopAlt = NULL; - } - pDisplay->cleared = false; } else if (drawPolled) { - for (p = pageTop ; p <= pageTop + maxRow ; p++) { + for (p = pageTop ; p <= pageTop + pageMaxRow ; p++) { if (IS_DYNAMIC(p)) SET_PRINTVALUE(p); } @@ -415,19 +443,21 @@ static void cmsDrawMenu(displayPort_t *pDisplay, uint32_t currentTimeUs) // Cursor manipulation - while ((pageTop + cursorRow)->type == OME_Label) // skip label - cursorRow++; + while ((pageTop + currentCtx.cursorRow)->type == OME_Label) // skip label + currentCtx.cursorRow++; - if (pDisplay->cursorRow >= 0 && cursorRow != pDisplay->cursorRow) { + cmsPageDebug(); + + if (pDisplay->cursorRow >= 0 && currentCtx.cursorRow != pDisplay->cursorRow) { room -= displayWrite(pDisplay, LEFT_MENU_COLUMN, pDisplay->cursorRow + top, " "); } if (room < 30) return; - if (pDisplay->cursorRow != cursorRow) { - room -= displayWrite(pDisplay, LEFT_MENU_COLUMN, cursorRow + top, " >"); - pDisplay->cursorRow = cursorRow; + if (pDisplay->cursorRow != currentCtx.cursorRow) { + room -= displayWrite(pDisplay, LEFT_MENU_COLUMN, currentCtx.cursorRow + top, " >"); + pDisplay->cursorRow = currentCtx.cursorRow; } if (room < 30) @@ -459,46 +489,57 @@ static void cmsDrawMenu(displayPort_t *pDisplay, uint32_t currentTimeUs) } } +static void cmsMenuCountPage(displayPort_t *pDisplay) +{ + OSD_Entry *p; + for (p = currentCtx.menu->entries; p->type != OME_END; p++); + pageCount = (p - currentCtx.menu->entries) / MAX_MENU_ITEMS(pDisplay) + 1; +} + long cmsMenuChange(displayPort_t *pDisplay, const void *ptr) { CMS_Menu *pMenu = (CMS_Menu *)ptr; - if (pMenu) { + if (!pMenu) + return 0; + #ifdef CMS_MENU_DEBUG - if (pMenu->GUARD_type != OME_MENU) { - // ptr isn't pointing to a CMS_Menu. - if (pMenu->GUARD_type <= OME_MAX) { - strncpy(menuErrLabel, pMenu->GUARD_text, sizeof(menuErrLabel) - 1); - } else { - strncpy(menuErrLabel, "LABEL UNKNOWN", sizeof(menuErrLabel) - 1); - } - pMenu = &menuErr; + if (pMenu->GUARD_type != OME_MENU) { + // ptr isn't pointing to a CMS_Menu. + if (pMenu->GUARD_type <= OME_MAX) { + strncpy(menuErrLabel, pMenu->GUARD_text, sizeof(menuErrLabel) - 1); + } else { + strncpy(menuErrLabel, "LABEL UNKNOWN", sizeof(menuErrLabel) - 1); } + pMenu = &menuErr; + } #endif + if (pMenu != currentCtx.menu) { // Stack the current menu and move to a new menu. - // The (pMenu == curretMenu) case occurs when reopening for display sw - if (pMenu != currentMenu) { - menuStack[menuStackIdx] = currentMenu; - cursorRow += pageTop - currentMenu->entries; // Convert cursorRow to absolute value - menuStackHistory[menuStackIdx] = cursorRow; - menuStackIdx++; + menuStack[menuStackIdx++] = currentCtx; - currentMenu = pMenu; - cursorRow = 0; + currentCtx.menu = pMenu; + currentCtx.cursorRow = 0; - if (pMenu->onEnter) - pMenu->onEnter(); - } + if (pMenu->onEnter) + pMenu->onEnter(); - pageTop = currentMenu->entries; - pageTopAlt = NULL; + cmsMenuCountPage(pDisplay); + cmsPageSelect(pDisplay, 0); + } else { + // The (pMenu == curretMenu) case occurs when reopening for display cycling + // currentCtx.cursorRow has been saved as absolute; convert it back to page + relative - displayClearScreen(pDisplay); - cmsUpdateMaxRow(pDisplay); + int8_t cursorAbs = currentCtx.cursorRow; + currentCtx.cursorRow = cursorAbs % MAX_MENU_ITEMS(pDisplay); + cmsMenuCountPage(pDisplay); + cmsPageSelect(pDisplay, cursorAbs / MAX_MENU_ITEMS(pDisplay)); } + cmsPageDebug(); + return 0; } @@ -506,29 +547,19 @@ STATIC_UNIT_TESTED long cmsMenuBack(displayPort_t *pDisplay) { // Let onExit function decide whether to allow exit or not. - if (currentMenu->onExit && currentMenu->onExit(pageTop + cursorRow) < 0) + if (currentCtx.menu->onExit && currentCtx.menu->onExit(pageTop + currentCtx.cursorRow) < 0) return -1; - if (menuStackIdx) { - displayClearScreen(pDisplay); - menuStackIdx--; - currentMenu = menuStack[menuStackIdx]; - cursorRow = menuStackHistory[menuStackIdx]; + if (!menuStackIdx) + return 0; - // cursorRow is absolute offset of a focused entry when stacked. - // Convert it back to page and relative offset. + currentCtx = menuStack[--menuStackIdx]; - pageTop = currentMenu->entries; // Temporary for cmsUpdateMaxRow() - cmsUpdateMaxRow(pDisplay); + cmsMenuCountPage(pDisplay); - if (cursorRow > maxRow) { - // Cursor was in the second page. - pageTopAlt = currentMenu->entries; - pageTop = pageTopAlt + maxRow + 1; - cursorRow -= (maxRow + 1); - cmsUpdateMaxRow(pDisplay); // Update maxRow for the second page - } - } + cmsPageSelect(pDisplay, currentCtx.page); + + cmsPageDebug(); return 0; } @@ -541,12 +572,15 @@ STATIC_UNIT_TESTED void cmsMenuOpen(void) if (!pCurrentDisplay) return; cmsInMenu = true; - currentMenu = &menuMain; + currentCtx = (cmsCtx_t){ &menuMain, 0, 0 }; DISABLE_ARMING_FLAG(OK_TO_ARM); } else { // Switch display displayPort_t *pNextDisplay = cmsDisplayPortSelectNext(); if (pNextDisplay != pCurrentDisplay) { + // DisplayPort has been changed. + // Convert cursorRow to absolute value + currentCtx.cursorRow = cmsCursorAbsolute(pCurrentDisplay); displayRelease(pCurrentDisplay); pCurrentDisplay = pNextDisplay; } else { @@ -554,7 +588,7 @@ STATIC_UNIT_TESTED void cmsMenuOpen(void) } } displayGrab(pCurrentDisplay); // grab the display for use by the CMS - cmsMenuChange(pCurrentDisplay, currentMenu); + cmsMenuChange(pCurrentDisplay, currentCtx.menu); } static void cmsTraverseGlobalExit(const CMS_Menu *pMenu) @@ -571,39 +605,47 @@ static void cmsTraverseGlobalExit(const CMS_Menu *pMenu) } long cmsMenuExit(displayPort_t *pDisplay, const void *ptr) -{ - if (ptr) { +{ + int exitType = (int)ptr; + switch (exitType) { + case CMS_EXIT_SAVE: + case CMS_EXIT_SAVEREBOOT: + + cmsTraverseGlobalExit(&menuMain); + + if (currentCtx.menu->onExit) + currentCtx.menu->onExit((OSD_Entry *)NULL); // Forced exit + + saveConfigAndNotify(); + break; + + case CMS_EXIT: + break; + } + + cmsInMenu = false; + + displayRelease(pDisplay); + currentCtx.menu = NULL; + + if (exitType == CMS_EXIT_SAVEREBOOT) { displayClearScreen(pDisplay); - displayWrite(pDisplay, 5, 3, "REBOOTING..."); + displayResync(pDisplay); // Was max7456RefreshAll(); why at this timing? - + stopMotors(); stopPwmAllMotors(); delay(200); - - cmsTraverseGlobalExit(&menuMain); - - if (currentMenu->onExit) - currentMenu->onExit((OSD_Entry *)NULL); // Forced exit - - saveConfigAndNotify(); - } - - cmsInMenu = false; - - displayRelease(pDisplay); - currentMenu = NULL; - - if (ptr) + systemReset(); - + } + ENABLE_ARMING_FLAG(OK_TO_ARM); - + return 0; } - // Stick/key detection and key codes #define IS_HI(X) (rcData[X] > 1750) @@ -626,7 +668,7 @@ STATIC_UNIT_TESTED uint16_t cmsHandleKey(displayPort_t *pDisplay, uint8_t key) uint16_t res = BUTTON_TIME; OSD_Entry *p; - if (!currentMenu) + if (!currentCtx.menu) return res; if (key == KEY_MENU) { @@ -640,42 +682,32 @@ STATIC_UNIT_TESTED uint16_t cmsHandleKey(displayPort_t *pDisplay, uint8_t key) } if (key == KEY_DOWN) { - if (cursorRow < maxRow) { - cursorRow++; + if (currentCtx.cursorRow < pageMaxRow) { + currentCtx.cursorRow++; } else { - if (pageTopAlt) { // we have another page - displayClearScreen(pDisplay); - p = pageTopAlt; - pageTopAlt = pageTop; - pageTop = (OSD_Entry *)p; - cmsUpdateMaxRow(pDisplay); - } - cursorRow = 0; // Goto top in any case + cmsPageNext(pDisplay); + currentCtx.cursorRow = 0; // Goto top in any case } } if (key == KEY_UP) { - cursorRow--; + currentCtx.cursorRow--; - if ((pageTop + cursorRow)->type == OME_Label && cursorRow > 0) - cursorRow--; + // Skip non-title labels + if ((pageTop + currentCtx.cursorRow)->type == OME_Label && currentCtx.cursorRow > 0) + currentCtx.cursorRow--; - if (cursorRow == -1 || (pageTop + cursorRow)->type == OME_Label) { - if (pageTopAlt) { - displayClearScreen(pDisplay); - p = pageTopAlt; - pageTopAlt = pageTop; - pageTop = (OSD_Entry *)p; - cmsUpdateMaxRow(pDisplay); - } - cursorRow = maxRow; // Goto bottom in any case + if (currentCtx.cursorRow == -1 || (pageTop + currentCtx.cursorRow)->type == OME_Label) { + // Goto previous page + cmsPagePrev(pDisplay); + currentCtx.cursorRow = pageMaxRow; } } if (key == KEY_DOWN || key == KEY_UP) return res; - p = pageTop + cursorRow; + p = pageTop + currentCtx.cursorRow; switch (p->type) { case OME_Submenu: @@ -970,8 +1002,6 @@ void cmsHandler(timeUs_t currentTimeUs) } } -// Is initializing with menuMain better? -// Can it be done with the current main()? void cmsInit(void) { cmsDeviceCount = 0; diff --git a/src/main/cms/cms.h b/src/main/cms/cms.h index 8bd35c47b5..6667c3d3cb 100644 --- a/src/main/cms/cms.h +++ b/src/main/cms/cms.h @@ -18,3 +18,9 @@ void cmsUpdate(uint32_t currentTimeUs); #define CMS_STARTUP_HELP_TEXT1 "MENU: THR MID" #define CMS_STARTUP_HELP_TEXT2 "+ YAW LEFT" #define CMS_STARTUP_HELP_TEXT3 "+ PITCH UP" + +// cmsMenuExit special ptr values +#define CMS_EXIT (0) +#define CMS_EXIT_SAVE (1) +#define CMS_EXIT_SAVEREBOOT (2) + diff --git a/src/main/cms/cms_menu_builtin.c b/src/main/cms/cms_menu_builtin.c index 1827655268..72196e4a5c 100644 --- a/src/main/cms/cms_menu_builtin.c +++ b/src/main/cms/cms_menu_builtin.c @@ -135,8 +135,9 @@ static OSD_Entry menuMainEntries[] = #endif {"FC&FW INFO", OME_Submenu, cmsMenuChange, &menuInfo, 0}, {"MISC", OME_Submenu, cmsMenuChange, &cmsx_menuMisc, 0}, - {"SAVE&REBOOT", OME_OSD_Exit, cmsMenuExit, (void*)1, 0}, - {"EXIT", OME_OSD_Exit, cmsMenuExit, (void*)0, 0}, + {"EXIT", OME_OSD_Exit, cmsMenuExit, (void *)CMS_EXIT, 0}, + {"SAVE&EXIT", OME_OSD_Exit, cmsMenuExit, (void *)CMS_EXIT_SAVE, 0}, + {"SAVE&REBOOT", OME_OSD_Exit, cmsMenuExit, (void *)CMS_EXIT_SAVEREBOOT, 0}, #ifdef CMS_MENU_DEBUG {"ERR SAMPLE", OME_Submenu, cmsMenuChange, &menuInfoEntries[0], 0}, #endif diff --git a/src/main/target/OMNIBUSF4/target.h b/src/main/target/OMNIBUSF4/target.h index 735a66982f..ec5577bac2 100644 --- a/src/main/target/OMNIBUSF4/target.h +++ b/src/main/target/OMNIBUSF4/target.h @@ -161,6 +161,9 @@ #define USE_ESCSERIAL #define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1 +#define USE_I2C +#define I2C_DEVICE (I2CDEV_2) + #define USE_SPI #define USE_SPI_DEVICE_1 From f15d5dd12c522d6caed15e57c1423f85b5a8a8e7 Mon Sep 17 00:00:00 2001 From: jflyper Date: Fri, 7 Apr 2017 12:40:51 +0900 Subject: [PATCH 2/5] More strict stick commands --- src/main/cms/cms.c | 11 +++++------ src/main/target/OMNIBUSF4/target.h | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/cms/cms.c b/src/main/cms/cms.c index c90482600e..933fddd1fb 100644 --- a/src/main/cms/cms.c +++ b/src/main/cms/cms.c @@ -556,7 +556,6 @@ STATIC_UNIT_TESTED long cmsMenuBack(displayPort_t *pDisplay) currentCtx = menuStack[--menuStackIdx]; cmsMenuCountPage(pDisplay); - cmsPageSelect(pDisplay, currentCtx.page); cmsPageDebug(); @@ -911,19 +910,19 @@ void cmsUpdate(uint32_t currentTimeUs) if (IS_MID(THROTTLE) && IS_LO(YAW) && IS_HI(PITCH) && !ARMING_FLAG(ARMED)) { key = KEY_MENU; } - else if (IS_HI(PITCH)) { + else if (IS_MID(THROTTLE) && IS_MID(YAW) && IS_MID(ROLL) && IS_HI(PITCH)) { key = KEY_UP; } - else if (IS_LO(PITCH)) { + else if (IS_MID(THROTTLE) && IS_MID(YAW) && IS_MID(ROLL) && IS_LO(PITCH)) { key = KEY_DOWN; } - else if (IS_LO(ROLL)) { + else if (IS_MID(THROTTLE) && IS_MID(YAW) && IS_LO(ROLL) && IS_MID(PITCH)) { key = KEY_LEFT; } - else if (IS_HI(ROLL)) { + else if (IS_MID(THROTTLE) && IS_MID(YAW) && IS_HI(ROLL) && IS_MID(PITCH)) { key = KEY_RIGHT; } - else if (IS_HI(YAW) || IS_LO(YAW)) + else if ((IS_HI(YAW) || IS_LO(YAW)) && IS_MID(THROTTLE) && IS_MID(ROLL) && IS_MID(PITCH)) { key = KEY_ESC; } diff --git a/src/main/target/OMNIBUSF4/target.h b/src/main/target/OMNIBUSF4/target.h index ec5577bac2..6b6e631a69 100644 --- a/src/main/target/OMNIBUSF4/target.h +++ b/src/main/target/OMNIBUSF4/target.h @@ -161,8 +161,8 @@ #define USE_ESCSERIAL #define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1 -#define USE_I2C -#define I2C_DEVICE (I2CDEV_2) +//#define USE_I2C +//#define I2C_DEVICE (I2CDEV_2) #define USE_SPI #define USE_SPI_DEVICE_1 From b10412ac9b83468a6292bae7e49a2a23f146ff63 Mon Sep 17 00:00:00 2001 From: jflyper Date: Fri, 7 Apr 2017 18:04:56 +0900 Subject: [PATCH 3/5] Tidy --- src/main/cms/cms.c | 33 ++++++++++++++++-------------- src/main/target/OMNIBUSF4/target.h | 3 --- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/cms/cms.c b/src/main/cms/cms.c index 933fddd1fb..d2e1cd7c51 100644 --- a/src/main/cms/cms.c +++ b/src/main/cms/cms.c @@ -500,8 +500,9 @@ long cmsMenuChange(displayPort_t *pDisplay, const void *ptr) { CMS_Menu *pMenu = (CMS_Menu *)ptr; - if (!pMenu) + if (!pMenu) { return 0; + } #ifdef CMS_MENU_DEBUG if (pMenu->GUARD_type != OME_MENU) { @@ -547,11 +548,13 @@ STATIC_UNIT_TESTED long cmsMenuBack(displayPort_t *pDisplay) { // Let onExit function decide whether to allow exit or not. - if (currentCtx.menu->onExit && currentCtx.menu->onExit(pageTop + currentCtx.cursorRow) < 0) + if (currentCtx.menu->onExit && currentCtx.menu->onExit(pageTop + currentCtx.cursorRow) < 0) { return -1; + } - if (!menuStackIdx) + if (!menuStackIdx) { return 0; + } currentCtx = menuStack[--menuStackIdx]; @@ -609,39 +612,39 @@ long cmsMenuExit(displayPort_t *pDisplay, const void *ptr) switch (exitType) { case CMS_EXIT_SAVE: case CMS_EXIT_SAVEREBOOT: - + cmsTraverseGlobalExit(&menuMain); - + if (currentCtx.menu->onExit) currentCtx.menu->onExit((OSD_Entry *)NULL); // Forced exit - + saveConfigAndNotify(); break; - + case CMS_EXIT: break; } - + cmsInMenu = false; - + displayRelease(pDisplay); currentCtx.menu = NULL; - + if (exitType == CMS_EXIT_SAVEREBOOT) { displayClearScreen(pDisplay); displayWrite(pDisplay, 5, 3, "REBOOTING..."); - + displayResync(pDisplay); // Was max7456RefreshAll(); why at this timing? - + stopMotors(); stopPwmAllMotors(); delay(200); - + systemReset(); } - + ENABLE_ARMING_FLAG(OK_TO_ARM); - + return 0; } diff --git a/src/main/target/OMNIBUSF4/target.h b/src/main/target/OMNIBUSF4/target.h index 6b6e631a69..735a66982f 100644 --- a/src/main/target/OMNIBUSF4/target.h +++ b/src/main/target/OMNIBUSF4/target.h @@ -161,9 +161,6 @@ #define USE_ESCSERIAL #define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1 -//#define USE_I2C -//#define I2C_DEVICE (I2CDEV_2) - #define USE_SPI #define USE_SPI_DEVICE_1 From 4c114db666e4208f24110ed6eb4af2a4354caf0a Mon Sep 17 00:00:00 2001 From: jflyper Date: Mon, 1 May 2017 10:40:44 +0900 Subject: [PATCH 4/5] Fix pageCount calculation --- src/main/cms/cms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/cms/cms.c b/src/main/cms/cms.c index d2e1cd7c51..b5600db43e 100644 --- a/src/main/cms/cms.c +++ b/src/main/cms/cms.c @@ -493,7 +493,7 @@ static void cmsMenuCountPage(displayPort_t *pDisplay) { OSD_Entry *p; for (p = currentCtx.menu->entries; p->type != OME_END; p++); - pageCount = (p - currentCtx.menu->entries) / MAX_MENU_ITEMS(pDisplay) + 1; + pageCount = (p - currentCtx.menu->entries - 1) / MAX_MENU_ITEMS(pDisplay) + 1; } long cmsMenuChange(displayPort_t *pDisplay, const void *ptr) From f4c21d06a96dfa73660a3762126baec6574fe41e Mon Sep 17 00:00:00 2001 From: jflyper Date: Mon, 1 May 2017 11:56:25 +0900 Subject: [PATCH 5/5] Disabled page debugging --- src/main/cms/cms.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/cms/cms.c b/src/main/cms/cms.c index b5600db43e..a910aeb204 100644 --- a/src/main/cms/cms.c +++ b/src/main/cms/cms.c @@ -21,6 +21,7 @@ CMS-displayPort separation by jflyper and martinbudden */ +//#define CMS_PAGE_DEBUG // For multi-page/menu debugging //#define CMS_MENU_DEBUG // For external menu content creators #include @@ -166,8 +167,6 @@ static CMS_Menu menuErr = { }; #endif -#define CMS_PAGE_DEBUG - #ifdef CMS_PAGE_DEBUG #define cmsPageDebug() { \ debug[0] = pageCount; \