Skip to content

Commit

Permalink
Fix RESTORE_LEVELING_AFTER_G28 (#20471)
Browse files Browse the repository at this point in the history
  • Loading branch information
GadgetAngel authored Dec 15, 2020
1 parent 69999f9 commit 1be16e3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Marlin/src/gcode/calibrate/G28.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ void GcodeSuite::G28() {
do_blocking_move_to_z(delta_clip_start_height);
#endif

TERN_(RESTORE_LEVELING_AFTER_G28, set_bed_leveling_enabled(leveling_was_active));
TERN_(RESTORE_LEVELING_AFTER_G28, set_bed_leveling_enabled(leveling_restore_state));

restore_feedrate_and_scaling();

Expand Down

9 comments on commit 1be16e3

@tpruvot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arlin/src/gcode/calibrate/G28.cpp: In static member function 'static void GcodeSuite::G28()':
Marlin/src/gcode/calibrate/G28.cpp:244:16: warning: unused variable 'leveling_restore_state' [-Wunused-variable]
const bool leveling_restore_state = ENABLED(ENABLE_LEVELING_AFTER_G28) || TERN0(RESTORE_LEVELING_AFTER_G28, planner.leveling_active);

@qwewer0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tpruvot Would #20474 be a good fix for that?

@tpruvot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont think so, may be related to my RESTORE_LEVELING_AFTER_G28 false value, for UBL

@FanDjango
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you define

/**
 * Normally G28 leaves leveling disabled on completion. Enable one of
 * these options to restore the prior leveling state or to always enable
 * leveling immediately after G28.
 */
//#define RESTORE_LEVELING_AFTER_G28
#define ENABLE_LEVELING_AFTER_G28

then the line 438:
TERN_(RESTORE_LEVELING_AFTER_G28, set_bed_leveling_enabled(leveling_restore_state));
leaves leveling_restore_state unused. It needs EITHER RESTORE_LEVELING_AFTER_G28 ENABLE_LEVELING_AFTER_G28

@FanDjango
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And sanity check maybe? Although enabling both shouldn`t hurt, I suppose

@qwewer0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And sanity check maybe? Although enabling both shouldn`t hurt, I suppose

#if ALL(HAS_LEVELING, RESTORE_LEVELING_AFTER_G28, ENABLE_LEVELING_AFTER_G28)
#error "Only enable RESTORE_LEVELING_AFTER_G28 or ENABLE_LEVELING_AFTER_G28, but not both."
#endif

@FanDjango
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yo, just found it too

@tpruvot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was not the problem, but that : SanityCheck.h:1449:6: error: #error "AUTO_BED_LEVELING_UBL used to enable RESTORE_LEVELING_AFTER_G28. To keep this behavior enable RESTORE_LEVELING_AFTER_G28. Otherwise define it as 'false'."

@FanDjango
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and if you define NONE of these two, you also get the -wunused warning

Please sign in to comment.