Browse Source

🎨 Adjust some conditionals

Scott Lahteine 3 years ago
parent
commit
0e1e159187

+ 1
- 1
Marlin/src/feature/bedlevel/bedlevel.h View File

@@ -24,7 +24,7 @@
24 24
 #include "../../inc/MarlinConfigPre.h"
25 25
 
26 26
 #if EITHER(RESTORE_LEVELING_AFTER_G28, ENABLE_LEVELING_AFTER_G28)
27
-  #define G28_L0_ENSURES_LEVELING_OFF 1
27
+  #define CAN_SET_LEVELING_AFTER_G28 1
28 28
 #endif
29 29
 
30 30
 #if ENABLED(PROBE_MANUALLY)

+ 2
- 2
Marlin/src/feature/powerloss.h View File

@@ -88,7 +88,7 @@ typedef struct {
88 88
     uint8_t fan_speed[FAN_COUNT];
89 89
   #endif
90 90
 
91
-  #if ENABLED(HAS_LEVELING)
91
+  #if HAS_LEVELING
92 92
     float fade;
93 93
   #endif
94 94
 
@@ -120,7 +120,7 @@ typedef struct {
120 120
     bool raised:1;                // Raised before saved
121 121
     bool dryrun:1;                // M111 S8
122 122
     bool allow_cold_extrusion:1;  // M302 P1
123
-    #if ENABLED(HAS_LEVELING)
123
+    #if HAS_LEVELING
124 124
       bool leveling:1;            // M420 S
125 125
     #endif
126 126
     #if DISABLED(NO_VOLUMETRICS)

+ 1
- 1
Marlin/src/gcode/bedlevel/abl/G29.cpp View File

@@ -246,7 +246,7 @@ G29_TYPE GcodeSuite::G29() {
246 246
 
247 247
   // Send 'N' to force homing before G29 (internal only)
248 248
   if (parser.seen_test('N'))
249
-    process_subcommands_now_P(TERN(G28_L0_ENSURES_LEVELING_OFF, PSTR("G28L0"), G28_STR));
249
+    process_subcommands_now_P(TERN(CAN_SET_LEVELING_AFTER_G28, PSTR("G28L0"), G28_STR));
250 250
 
251 251
   // Don't allow auto-leveling without homing first
252 252
   if (homing_needed_error()) G29_RETURN(false);

+ 1
- 1
Marlin/src/gcode/bedlevel/mbl/G29.cpp View File

@@ -87,7 +87,7 @@ void GcodeSuite::G29() {
87 87
       mbl.reset();
88 88
       mbl_probe_index = 0;
89 89
       if (!ui.wait_for_move) {
90
-        queue.inject_P(parser.seen_test('N') ? PSTR("G28" TERN(G28_L0_ENSURES_LEVELING_OFF, "L0", "") "\nG29S2") : PSTR("G29S2"));
90
+        queue.inject_P(parser.seen_test('N') ? PSTR("G28" TERN(CAN_SET_LEVELING_AFTER_G28, "L0", "") "\nG29S2") : PSTR("G29S2"));
91 91
         return;
92 92
       }
93 93
       state = MeshNext;

+ 13
- 10
Marlin/src/gcode/calibrate/G28.cpp View File

@@ -242,12 +242,16 @@ void GcodeSuite::G28() {
242 242
   SET_SOFT_ENDSTOP_LOOSE(false);  // Reset a leftover 'loose' motion state
243 243
 
244 244
   // Disable the leveling matrix before homing
245
-  #if HAS_LEVELING
246
-    const bool leveling_restore_state = parser.boolval('L', TERN(RESTORE_LEVELING_AFTER_G28, planner.leveling_active, ENABLED(ENABLE_LEVELING_AFTER_G28)));
247
-    IF_ENABLED(PROBE_MANUALLY, g29_in_progress = false); // Cancel the active G29 session
248
-    set_bed_leveling_enabled(false);
245
+  #if CAN_SET_LEVELING_AFTER_G28
246
+    const bool leveling_restore_state = parser.boolval('L', TERN1(RESTORE_LEVELING_AFTER_G28, planner.leveling_active));
249 247
   #endif
250 248
 
249
+  // Cancel any prior G29 session
250
+  TERN_(PROBE_MANUALLY, g29_in_progress = false);
251
+
252
+  // Disable leveling before homing
253
+  TERN_(HAS_LEVELING, set_bed_leveling_enabled(false));
254
+
251 255
   // Reset to the XY plane
252 256
   TERN_(CNC_WORKSPACE_PLANES, workspace_plane = PLANE_XY);
253 257
 
@@ -353,13 +357,14 @@ void GcodeSuite::G28() {
353 357
 
354 358
     const float z_homing_height = parser.seenval('R') ? parser.value_linear_units() : Z_HOMING_HEIGHT;
355 359
 
356
-    if (z_homing_height && (0 LINEAR_AXIS_GANG(|| doX, || doY, || TERN0(Z_SAFE_HOMING, doZ), || doI, || doJ, || doK))) {
360
+    if (z_homing_height && (LINEAR_AXIS_GANG(doX, || doY, || TERN0(Z_SAFE_HOMING, doZ), || doI, || doJ, || doK))) {
357 361
       // Raise Z before homing any other axes and z is not already high enough (never lower z)
358 362
       if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Raise Z (before homing) by ", z_homing_height);
359 363
       do_z_clearance(z_homing_height);
360 364
       TERN_(BLTOUCH, bltouch.init());
361 365
     }
362 366
 
367
+    // Diagonal move first if both are homing
363 368
     TERN_(QUICK_HOME, if (doX && doY) quick_home_xy());
364 369
 
365 370
     // Home Y (before X)
@@ -464,12 +469,10 @@ void GcodeSuite::G28() {
464 469
   // Clear endstop state for polled stallGuard endstops
465 470
   TERN_(SPI_ENDSTOPS, endstops.clear_endstop_state());
466 471
 
467
-  #if BOTH(DELTA, DELTA_HOME_TO_SAFE_ZONE)
468
-    // move to a height where we can use the full xy-area
469
-    do_blocking_move_to_z(delta_clip_start_height);
470
-  #endif
472
+  // Move to a height where we can use the full xy-area
473
+  TERN_(DELTA_HOME_TO_SAFE_ZONE, do_blocking_move_to_z(delta_clip_start_height));
471 474
 
472
-  TERN_(HAS_LEVELING, set_bed_leveling_enabled(leveling_restore_state));
475
+  TERN_(CAN_SET_LEVELING_AFTER_G28, if (leveling_restore_state) set_bed_leveling_enabled());
473 476
 
474 477
   restore_feedrate_and_scaling();
475 478
 

+ 1
- 1
Marlin/src/gcode/gcode.h View File

@@ -392,7 +392,7 @@ public:
392 392
   static void process_subcommands_now(char * gcode);
393 393
 
394 394
   static inline void home_all_axes(const bool keep_leveling=false) {
395
-    process_subcommands_now_P(keep_leveling ? G28_STR : TERN(G28_L0_ENSURES_LEVELING_OFF, PSTR("G28L0"), G28_STR));
395
+    process_subcommands_now_P(keep_leveling ? G28_STR : TERN(CAN_SET_LEVELING_AFTER_G28, PSTR("G28L0"), G28_STR));
396 396
   }
397 397
 
398 398
   #if EITHER(HAS_AUTO_REPORTING, HOST_KEEPALIVE_FEATURE)

+ 4
- 0
Marlin/src/inc/Conditionals_LCD.h View File

@@ -1027,6 +1027,10 @@
1027 1027
   #endif
1028 1028
 #endif
1029 1029
 
1030
+#if DISABLED(DELTA)
1031
+  #undef DELTA_HOME_TO_SAFE_ZONE
1032
+#endif
1033
+
1030 1034
 // This flag indicates some kind of jerk storage is needed
1031 1035
 #if EITHER(CLASSIC_JERK, IS_KINEMATIC)
1032 1036
   #define HAS_CLASSIC_JERK 1

+ 1
- 1
Marlin/src/lcd/menu/menu_probe_offset.cpp View File

@@ -42,7 +42,7 @@
42 42
 // Global storage
43 43
 float z_offset_backup, calculated_z_offset, z_offset_ref;
44 44
 
45
-#if ENABLED(HAS_LEVELING)
45
+#if HAS_LEVELING
46 46
   bool leveling_was_active;
47 47
 #endif
48 48
 

+ 1
- 1
Marlin/src/lcd/menu/menu_tramming.cpp View File

@@ -92,7 +92,7 @@ void goto_tramming_wizard() {
92 92
 
93 93
   // Inject G28, wait for homing to complete,
94 94
   set_all_unhomed();
95
-  queue.inject_P(TERN(G28_L0_ENSURES_LEVELING_OFF, PSTR("G28L0"), G28_STR));
95
+  queue.inject_P(TERN(CAN_SET_LEVELING_AFTER_G28, PSTR("G28L0"), G28_STR));
96 96
 
97 97
   ui.goto_screen([]{
98 98
     _lcd_draw_homing();

Loading…
Cancel
Save