|
|
@ -390,26 +390,6 @@ uint16_t max_display_update_time = 0; |
|
|
|
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_ITEM(setting_edit_callback_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__) |
|
|
|
#endif // !ENCODER_RATE_MULTIPLIER
|
|
|
|
|
|
|
|
/**
|
|
|
|
* START_SCREEN_OR_MENU generates init code for a screen or menu |
|
|
|
* |
|
|
|
* encoderLine is the position based on the encoder |
|
|
|
* encoderTopLine is the top menu line to display |
|
|
|
* _lcdLineNr is the index of the LCD line (e.g., 0-3) |
|
|
|
* _menuLineNr is the menu item to draw and process |
|
|
|
* _thisItemNr is the index of each MENU_ITEM or STATIC_ITEM |
|
|
|
* screen_items is the total number of items in the menu (after one call) |
|
|
|
*/ |
|
|
|
#define START_SCREEN_OR_MENU(LIMIT) \ |
|
|
|
ENCODER_DIRECTION_MENUS(); \ |
|
|
|
ENCODER_RATE_MULTIPLY(false); \ |
|
|
|
if (encoderPosition > 0x8000) encoderPosition = 0; \ |
|
|
|
if (first_page) encoderLine = encoderPosition / (ENCODER_STEPS_PER_MENU_ITEM); \ |
|
|
|
if (screen_items > 0 && encoderLine >= screen_items - (LIMIT)) { \ |
|
|
|
encoderLine = max(0, screen_items - (LIMIT)); \ |
|
|
|
encoderPosition = encoderLine * (ENCODER_STEPS_PER_MENU_ITEM); \ |
|
|
|
} |
|
|
|
|
|
|
|
#define SCREEN_OR_MENU_LOOP() \ |
|
|
|
int8_t _menuLineNr = encoderTopLine, _thisItemNr; \ |
|
|
|
for (int8_t _lcdLineNr = 0; _lcdLineNr < menu_bottom; _lcdLineNr++, _menuLineNr++) { \ |
|
|
@ -642,9 +622,18 @@ uint16_t max_display_update_time = 0; |
|
|
|
|
|
|
|
/**
|
|
|
|
* Scrolling for menus and other line-based screens |
|
|
|
* |
|
|
|
* encoderLine is the position based on the encoder |
|
|
|
* encoderTopLine is the top menu line to display |
|
|
|
* _lcdLineNr is the index of the LCD line (e.g., 0-3) |
|
|
|
* _menuLineNr is the menu item to draw and process |
|
|
|
* _thisItemNr is the index of each MENU_ITEM or STATIC_ITEM |
|
|
|
* screen_items is the total number of items in the menu (after one call) |
|
|
|
*/ |
|
|
|
int8_t encoderLine, screen_items; |
|
|
|
void scroll_screen(const uint8_t limit, const bool is_menu) { |
|
|
|
ENCODER_DIRECTION_MENUS(); |
|
|
|
ENCODER_RATE_MULTIPLY(false); |
|
|
|
if (encoderPosition > 0x8000) encoderPosition = 0; |
|
|
|
if (first_page) { |
|
|
|
encoderLine = encoderPosition / (ENCODER_STEPS_PER_MENU_ITEM); |
|
|
|