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
    *   _menuLineNr is the menu item to draw and process
214
    *   _menuLineNr is the menu item to draw and process
215
    *   _thisItemNr is the index of each MENU_ITEM or STATIC_ITEM
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
     ENCODER_DIRECTION_MENUS(); \
218
     ENCODER_DIRECTION_MENUS(); \
219
     encoderRateMultiplierEnabled = false; \
219
     encoderRateMultiplierEnabled = false; \
220
     if (encoderPosition > 0x8000) encoderPosition = 0; \
220
     if (encoderPosition > 0x8000) encoderPosition = 0; \
221
     int8_t encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; \
221
     int8_t encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; \
222
     NOMORE(encoderTopLine, encoderLine); \
222
     NOMORE(encoderTopLine, encoderLine); \
223
     int8_t _menuLineNr = encoderTopLine, _thisItemNr; \
223
     int8_t _menuLineNr = encoderTopLine, _thisItemNr; \
224
+    bool _skipStatic = SKIP; \
224
     CODE; \
225
     CODE; \
225
     for (int8_t _lcdLineNr = 0; _lcdLineNr < LCD_HEIGHT; _lcdLineNr++, _menuLineNr++) { \
226
     for (int8_t _lcdLineNr = 0; _lcdLineNr < LCD_HEIGHT; _lcdLineNr++, _menuLineNr++) { \
226
       _thisItemNr = 0;
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
    * START_MENU generates the init code for a menu function
232
    * START_MENU generates the init code for a menu function
232
    *
233
    *
233
    *   wasClicked indicates the controller was clicked
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
    * MENU_ITEM generates draw & handler code for a menu item, potentially calling:
239
    * MENU_ITEM generates draw & handler code for a menu item, potentially calling:
270
     _thisItemNr++
271
     _thisItemNr++
271
 
272
 
272
   #define MENU_ITEM(TYPE, LABEL, ARGS...) do { \
273
   #define MENU_ITEM(TYPE, LABEL, ARGS...) do { \
274
+      _skipStatic = false; \
273
       _MENU_ITEM_PART_1(TYPE, LABEL, ## ARGS); \
275
       _MENU_ITEM_PART_1(TYPE, LABEL, ## ARGS); \
274
       _MENU_ITEM_PART_2(TYPE, ## ARGS); \
276
       _MENU_ITEM_PART_2(TYPE, ## ARGS); \
275
     } while(0)
277
     } while(0)
277
   // Used to print static text with no visible cursor.
279
   // Used to print static text with no visible cursor.
278
   #define STATIC_ITEM(LABEL, ARGS...) \
280
   #define STATIC_ITEM(LABEL, ARGS...) \
279
     if (_menuLineNr == _thisItemNr) { \
281
     if (_menuLineNr == _thisItemNr) { \
280
-      if (encoderLine == _thisItemNr && _thisItemNr < LCD_HEIGHT - 1) { \
282
+      if (_skipStatic && encoderLine <= _thisItemNr) { \
281
         encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
283
         encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
282
         lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \
284
         lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \
283
       } \
285
       } \

Loading…
Cancel
Save