-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Streamline menu item logic #17664
Streamline menu item logic #17664
Conversation
1118b1b
to
fc1bd9e
Compare
b81a3d2
to
53ac911
Compare
7b92348
to
37176ed
Compare
03dfbd8
to
0908f2d
Compare
1ef6bf5
to
e05000c
Compare
58573a8
to
630b4ec
Compare
e05000c
to
f3ce9a6
Compare
SKR1.4T
|
Thanks! That error got patched along the way. |
@thinkyhead: Several items are missing from the menus after this (Home All/ PLA preheat, Cooldown, just to make a few). I haven’t compared every menu, but something broke with this PR. |
Yes, I expected some things to fail. Please diagnose if you find the time. I have only time to patch issues and no time to test them. |
here is a full list of menu options that i found to be missing in the current version after reverting to 4f003fc now my printer does not have some other things so these are just the options available to me Auto Home |
I've got a better refactor coming pretty soon, so the |
Background: Menu items are processed in a loop from the top of the screen to the bottom, so any visible menu items will be processed up to 5 times per menu screen. This wastes processing and may cause unwanted side-effects since any un-protected function calls inside of menus will also be repeated.
Solutions:
MENU_ITEM_IF()
macro to replaceif
clauses inside of menu screens. The clause essentially gets moved "inside" the menu item, so it will only be run when the current menu item is being evaluated instead of 4 or 5 times per screen handler call.The compiler will optimize out the inner check for "is this the current menu item?" (implicit in
MENU_ITEM(...)
when the outer check is used, so there is no extra cost to usingMENU_ITEM_IF
.