@@ -62,7 +62,7 @@ uint8_t BaseGraphicalRenderer::setActiveItem(MenuItem *item) {
6262 serdebugF4 (" toth, activeidx, adj " , totalHeight, activeIndex, adjustedHeight);
6363
6464 auto startY = 0 ;
65- if (titleMode == TITLE_ALWAYS && menuMgr. getRoot () == rootItem ) {
65+ if (titleMode == TITLE_ALWAYS) {
6666 startRow++;
6767 startY = heightOfRow (0 , true );
6868 adjustedHeight -= startY;
@@ -282,16 +282,19 @@ GridPosition::GridDrawingMode modeFromItem(MenuItem* item, bool useSlider) {
282282}
283283
284284void BaseGraphicalRenderer::rootHasChanged (MenuItem* rootItem) {
285- currentRootMenu = rootItem;
286- redrawMode = MENUDRAW_COMPLETE_REDRAW;
287- recalculateDisplayOrder (rootItem, false );
285+ currentRootMenu = rootItem;
286+ redrawMode = MENUDRAW_COMPLETE_REDRAW;
288287
289- // if there is an encoder, we must update it if the values don't match because of hidden items
290- auto expectedCount = itemOrderByRow.count () - 1 ; // encoder is zero based so always one less.
291- if (switches.getEncoder () && expectedCount != switches.getEncoder ()->getMaximumValue ()) {
292- serlogF3 (SER_TCMENU_INFO, " Force encoder size: " , switches.getEncoder ()->getMaximumValue (), expectedCount)
293- menuMgr.setItemsInCurrentMenu (expectedCount, switches.getEncoder ()->getCurrentReading ());
294- }
288+ // force a complete recalculation of the grid.
289+ recalculateDisplayOrder (rootItem, false );
290+ setActiveItem (activeItem);
291+
292+ // if there is an encoder, we must update it if the values don't match because of hidden items
293+ auto expectedCount = itemOrderByRow.count () - 1 ; // encoder is zero based so always one less.
294+ if (switches.getEncoder () && expectedCount != switches.getEncoder ()->getMaximumValue ()) {
295+ serlogF3 (SER_TCMENU_INFO, " Force encoder size: " , switches.getEncoder ()->getMaximumValue (), expectedCount)
296+ menuMgr.setItemsInCurrentMenu (expectedCount, switches.getEncoder ()->getCurrentReading ());
297+ }
295298}
296299
297300void BaseGraphicalRenderer::recalculateDisplayOrder (MenuItem *root, bool safeMode) {
@@ -479,7 +482,6 @@ void BaseGraphicalRenderer::initialise() {
479482}
480483
481484void BaseGraphicalRenderer::displayPropertiesHaveChanged () {
482- currentRootMenu = nullptr ;
483485 rootHasChanged (menuMgr.getCurrentMenu ());
484486 redrawMode = MENUDRAW_COMPLETE_REDRAW;
485487}
0 commit comments