|
@@ -390,26 +390,6 @@ uint16_t max_display_update_time = 0;
|
390
|
390
|
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_ITEM(setting_edit_callback_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__)
|
391
|
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
|
393
|
#define SCREEN_OR_MENU_LOOP() \
|
414
|
394
|
int8_t _menuLineNr = encoderTopLine, _thisItemNr; \
|
415
|
395
|
for (int8_t _lcdLineNr = 0; _lcdLineNr < menu_bottom; _lcdLineNr++, _menuLineNr++) { \
|
|
@@ -642,9 +622,18 @@ uint16_t max_display_update_time = 0;
|
642
|
622
|
|
643
|
623
|
/**
|
644
|
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
|
633
|
int8_t encoderLine, screen_items;
|
647
|
634
|
void scroll_screen(const uint8_t limit, const bool is_menu) {
|
|
635
|
+ ENCODER_DIRECTION_MENUS();
|
|
636
|
+ ENCODER_RATE_MULTIPLY(false);
|
648
|
637
|
if (encoderPosition > 0x8000) encoderPosition = 0;
|
649
|
638
|
if (first_page) {
|
650
|
639
|
encoderLine = encoderPosition / (ENCODER_STEPS_PER_MENU_ITEM);
|