Browse Source

Merge pull request #4309 from thinkyhead/rc_static_item_fix_77

Fix skipping of static items
Scott Lahteine 8 years ago
parent
commit
6446d3939a
1 changed files with 6 additions and 4 deletions
  1. 6
    4
      Marlin/ultralcd.cpp

+ 6
- 4
Marlin/ultralcd.cpp View File

@@ -214,25 +214,26 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
214 214
    *   _menuLineNr is the menu item to draw and process
215 215
    *   _thisItemNr is the index of each MENU_ITEM or STATIC_ITEM
216 216
    */
217
-  #define _START_SCREEN(CODE) \
217
+  #define _START_SCREEN(CODE, SKIP) \
218 218
     ENCODER_DIRECTION_MENUS(); \
219 219
     encoderRateMultiplierEnabled = false; \
220 220
     if (encoderPosition > 0x8000) encoderPosition = 0; \
221 221
     int8_t encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; \
222 222
     NOMORE(encoderTopLine, encoderLine); \
223 223
     int8_t _menuLineNr = encoderTopLine, _thisItemNr; \
224
+    bool _skipStatic = SKIP; \
224 225
     CODE; \
225 226
     for (int8_t _lcdLineNr = 0; _lcdLineNr < LCD_HEIGHT; _lcdLineNr++, _menuLineNr++) { \
226 227
       _thisItemNr = 0;
227 228
 
228
-  #define START_SCREEN() _START_SCREEN(NOOP)
229
+  #define START_SCREEN() _START_SCREEN(NOOP, false)
229 230
 
230 231
   /**
231 232
    * START_MENU generates the init code for a menu function
232 233
    *
233 234
    *   wasClicked indicates the controller was clicked
234 235
    */
235
-  #define START_MENU() _START_SCREEN(bool wasClicked = LCD_CLICKED)
236
+  #define START_MENU() _START_SCREEN(bool wasClicked = LCD_CLICKED, true)
236 237
 
237 238
   /**
238 239
    * MENU_ITEM generates draw & handler code for a menu item, potentially calling:
@@ -270,6 +271,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
270 271
     _thisItemNr++
271 272
 
272 273
   #define MENU_ITEM(TYPE, LABEL, ARGS...) do { \
274
+      _skipStatic = false; \
273 275
       _MENU_ITEM_PART_1(TYPE, LABEL, ## ARGS); \
274 276
       _MENU_ITEM_PART_2(TYPE, ## ARGS); \
275 277
     } while(0)
@@ -277,7 +279,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
277 279
   // Used to print static text with no visible cursor.
278 280
   #define STATIC_ITEM(LABEL, ARGS...) \
279 281
     if (_menuLineNr == _thisItemNr) { \
280
-      if (encoderLine == _thisItemNr && _thisItemNr < LCD_HEIGHT - 1) { \
282
+      if (_skipStatic && encoderLine <= _thisItemNr) { \
281 283
         encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
282 284
         lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \
283 285
       } \

Loading…
Cancel
Save