Explorar el Código

Finish scroll_screen with menu direction/multiplier

Fixes #10041
Scott Lahteine hace 7 años
padre
commit
51ebdf3b7d
Se han modificado 1 ficheros con 9 adiciones y 20 borrados
  1. 9
    20
      Marlin/src/lcd/ultralcd.cpp

+ 9
- 20
Marlin/src/lcd/ultralcd.cpp Ver fichero

390
     #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_ITEM(setting_edit_callback_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__)
390
     #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_ITEM(setting_edit_callback_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__)
391
   #endif // !ENCODER_RATE_MULTIPLIER
391
   #endif // !ENCODER_RATE_MULTIPLIER
392
 
392
 
393
-  /**
394
-   * START_SCREEN_OR_MENU generates init code for a screen or menu
395
-   *
396
-   *   encoderLine is the position based on the encoder
397
-   *   encoderTopLine is the top menu line to display
398
-   *   _lcdLineNr is the index of the LCD line (e.g., 0-3)
399
-   *   _menuLineNr is the menu item to draw and process
400
-   *   _thisItemNr is the index of each MENU_ITEM or STATIC_ITEM
401
-   *   screen_items is the total number of items in the menu (after one call)
402
-   */
403
-  #define START_SCREEN_OR_MENU(LIMIT) \
404
-    ENCODER_DIRECTION_MENUS(); \
405
-    ENCODER_RATE_MULTIPLY(false); \
406
-    if (encoderPosition > 0x8000) encoderPosition = 0; \
407
-    if (first_page) encoderLine = encoderPosition / (ENCODER_STEPS_PER_MENU_ITEM); \
408
-    if (screen_items > 0 && encoderLine >= screen_items - (LIMIT)) { \
409
-      encoderLine = max(0, screen_items - (LIMIT)); \
410
-      encoderPosition = encoderLine * (ENCODER_STEPS_PER_MENU_ITEM); \
411
-    }
412
-
413
   #define SCREEN_OR_MENU_LOOP() \
393
   #define SCREEN_OR_MENU_LOOP() \
414
     int8_t _menuLineNr = encoderTopLine, _thisItemNr; \
394
     int8_t _menuLineNr = encoderTopLine, _thisItemNr; \
415
     for (int8_t _lcdLineNr = 0; _lcdLineNr < menu_bottom; _lcdLineNr++, _menuLineNr++) { \
395
     for (int8_t _lcdLineNr = 0; _lcdLineNr < menu_bottom; _lcdLineNr++, _menuLineNr++) { \
642
 
622
 
643
   /**
623
   /**
644
    * Scrolling for menus and other line-based screens
624
    * Scrolling for menus and other line-based screens
625
+   *
626
+   *   encoderLine is the position based on the encoder
627
+   *   encoderTopLine is the top menu line to display
628
+   *   _lcdLineNr is the index of the LCD line (e.g., 0-3)
629
+   *   _menuLineNr is the menu item to draw and process
630
+   *   _thisItemNr is the index of each MENU_ITEM or STATIC_ITEM
631
+   *   screen_items is the total number of items in the menu (after one call)
645
    */
632
    */
646
   int8_t encoderLine, screen_items;
633
   int8_t encoderLine, screen_items;
647
   void scroll_screen(const uint8_t limit, const bool is_menu) {
634
   void scroll_screen(const uint8_t limit, const bool is_menu) {
635
+    ENCODER_DIRECTION_MENUS();
636
+    ENCODER_RATE_MULTIPLY(false);
648
     if (encoderPosition > 0x8000) encoderPosition = 0;
637
     if (encoderPosition > 0x8000) encoderPosition = 0;
649
     if (first_page) {
638
     if (first_page) {
650
       encoderLine = encoderPosition / (ENCODER_STEPS_PER_MENU_ITEM);
639
       encoderLine = encoderPosition / (ENCODER_STEPS_PER_MENU_ITEM);

Loading…
Cancelar
Guardar