Skip to content
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

Fix compile error in menu_motion when enabled FT_MOTION_MENU #27401

Conversation

marbocub
Copy link
Contributor

@marbocub marbocub commented Sep 3, 2024

Description

There is a compile error in menu_motion.cpp when enabled FT_MOTION_MENU. The error message is:

Marlin\src\lcd\menu\menu_motion.cpp: In lambda function:
Marlin\src\lcd\menu\menu_motion.cpp:437:7: error: 'c' is not captured
       c.active ^= true;
       ^

The error occurs at capturing the c in the lambda function due to it not using capture syntax [&].
However, when using [&], the new error occurs because it cannot be converted from <lambda()> to screenFunc_t.

This PR fixes the error by declaring the new reference c within lambda. That is the same reference as the upper c.

This code may not be optimal, for example it can change ftMotion.cfg.active directly without using the c as before #26670. But I think it's readable to use the c for consistency with other codes.

Requirements

Benefits

Configurations

Related Issues

@thinkyhead thinkyhead merged commit 76a7ab6 into MarlinFirmware:bugfix-2.1.x Sep 3, 2024
63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants