Browse Source

Merge pull request #6736 from thinkyhead/bf_axis_unhomed

More constraint on axis_unhomed_error
Scott Lahteine 8 years ago
parent
commit
b17bcd56da
4 changed files with 19 additions and 21 deletions
  1. 1
    1
      Marlin/G26_Mesh_Validation_Tool.cpp
  2. 1
    1
      Marlin/Marlin.h
  3. 16
    18
      Marlin/Marlin_main.cpp
  4. 1
    1
      Marlin/ubl_G29.cpp

+ 1
- 1
Marlin/G26_Mesh_Validation_Tool.cpp View File

201
 
201
 
202
     // Don't allow Mesh Validation without homing first,
202
     // Don't allow Mesh Validation without homing first,
203
     // or if the parameter parsing did not go OK, abort
203
     // or if the parameter parsing did not go OK, abort
204
-    if (axis_unhomed_error(true, true, true) || parse_G26_parameters()) return;
204
+    if (axis_unhomed_error() || parse_G26_parameters()) return;
205
 
205
 
206
     if (current_position[Z_AXIS] < Z_CLEARANCE_BETWEEN_PROBES) {
206
     if (current_position[Z_AXIS] < Z_CLEARANCE_BETWEEN_PROBES) {
207
       do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
207
       do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);

+ 1
- 1
Marlin/Marlin.h View File

426
 void do_blocking_move_to_xy(const float &x, const float &y, const float &fr_mm_s=0.0);
426
 void do_blocking_move_to_xy(const float &x, const float &y, const float &fr_mm_s=0.0);
427
 
427
 
428
 #if ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || HAS_PROBING_PROCEDURE || HOTENDS > 1 || ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE)
428
 #if ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || HAS_PROBING_PROCEDURE || HOTENDS > 1 || ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE)
429
-  bool axis_unhomed_error(const bool x, const bool y, const bool z);
429
+  bool axis_unhomed_error(const bool x=true, const bool y=true, const bool z=true);
430
 #endif
430
 #endif
431
 
431
 
432
 /**
432
 /**

+ 16
- 18
Marlin/Marlin_main.cpp View File

1851
 
1851
 
1852
 #if HAS_PROBING_PROCEDURE || HOTENDS > 1 || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE) || ENABLED(DELTA_AUTO_CALIBRATION)
1852
 #if HAS_PROBING_PROCEDURE || HOTENDS > 1 || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE) || ENABLED(DELTA_AUTO_CALIBRATION)
1853
 
1853
 
1854
-  bool axis_unhomed_error(const bool x, const bool y, const bool z) {
1855
-    const bool xx = x && !axis_homed[X_AXIS],
1856
-               yy = y && !axis_homed[Y_AXIS],
1857
-               zz = z && !axis_homed[Z_AXIS];
1854
+  bool axis_unhomed_error(const bool x/*=true*/, const bool y/*=true*/, const bool z/*=true*/) {
1855
+    const bool xx = x && !axis_known_position[X_AXIS],
1856
+               yy = y && !axis_known_position[Y_AXIS],
1857
+               zz = z && !axis_known_position[Z_AXIS];
1858
     if (xx || yy || zz) {
1858
     if (xx || yy || zz) {
1859
       SERIAL_ECHO_START;
1859
       SERIAL_ECHO_START;
1860
       SERIAL_ECHOPGM(MSG_HOME " ");
1860
       SERIAL_ECHOPGM(MSG_HOME " ");
2169
           return true;
2169
           return true;
2170
         }
2170
         }
2171
       }
2171
       }
2172
-    #elif ENABLED(Z_PROBE_SLED)
2173
-      if (axis_unhomed_error(true, false, false)) {
2174
-        SERIAL_ERROR_START;
2175
-        SERIAL_ERRORLNPGM(MSG_STOP_UNHOMED);
2176
-        stop();
2177
-        return true;
2178
-      }
2179
-    #elif ENABLED(Z_PROBE_ALLEN_KEY)
2180
-      if (axis_unhomed_error(true, true,  true )) {
2172
+    #elif ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
2173
+      #if ENABLED(Z_PROBE_SLED)
2174
+        #define _AUE_ARGS true, false, false
2175
+      #else
2176
+        #define _AUE_ARGS
2177
+      #endif
2178
+      if (axis_unhomed_error(_AUE_ARGS)) {
2181
         SERIAL_ERROR_START;
2179
         SERIAL_ERROR_START;
2182
         SERIAL_ERRORLNPGM(MSG_STOP_UNHOMED);
2180
         SERIAL_ERRORLNPGM(MSG_STOP_UNHOMED);
2183
         stop();
2181
         stop();
3414
    */
3412
    */
3415
   inline void gcode_G12() {
3413
   inline void gcode_G12() {
3416
     // Don't allow nozzle cleaning without homing first
3414
     // Don't allow nozzle cleaning without homing first
3417
-    if (axis_unhomed_error(true, true, true)) return;
3415
+    if (axis_unhomed_error()) return;
3418
 
3416
 
3419
     const uint8_t pattern = code_seen('P') ? code_value_ushort() : 0,
3417
     const uint8_t pattern = code_seen('P') ? code_value_ushort() : 0,
3420
                   strokes = code_seen('S') ? code_value_ushort() : NOZZLE_CLEAN_STROKES,
3418
                   strokes = code_seen('S') ? code_value_ushort() : NOZZLE_CLEAN_STROKES,
3443
    */
3441
    */
3444
   inline void gcode_G27() {
3442
   inline void gcode_G27() {
3445
     // Don't allow nozzle parking without homing first
3443
     // Don't allow nozzle parking without homing first
3446
-    if (axis_unhomed_error(true, true, true)) return;
3444
+    if (axis_unhomed_error()) return;
3447
     Nozzle::park(code_seen('P') ? code_value_ushort() : 0);
3445
     Nozzle::park(code_seen('P') ? code_value_ushort() : 0);
3448
   }
3446
   }
3449
 #endif // NOZZLE_PARK_FEATURE
3447
 #endif // NOZZLE_PARK_FEATURE
4222
     #endif
4220
     #endif
4223
 
4221
 
4224
     // Don't allow auto-leveling without homing first
4222
     // Don't allow auto-leveling without homing first
4225
-    if (axis_unhomed_error(true, true, true)) return;
4223
+    if (axis_unhomed_error()) return;
4226
 
4224
 
4227
     // Define local vars 'static' for manual probing, 'auto' otherwise
4225
     // Define local vars 'static' for manual probing, 'auto' otherwise
4228
     #if ENABLED(PROBE_MANUALLY)
4226
     #if ENABLED(PROBE_MANUALLY)
6174
    */
6172
    */
6175
   inline void gcode_M48() {
6173
   inline void gcode_M48() {
6176
 
6174
 
6177
-    if (axis_unhomed_error(true, true, true)) return;
6175
+    if (axis_unhomed_error()) return;
6178
 
6176
 
6179
     const int8_t verbose_level = code_seen('V') ? code_value_byte() : 1;
6177
     const int8_t verbose_level = code_seen('V') ? code_value_byte() : 1;
6180
     if (!WITHIN(verbose_level, 0, 4)) {
6178
     if (!WITHIN(verbose_level, 0, 4)) {
9427
       feedrate_mm_s = fr_mm_s > 0.0 ? fr_mm_s : XY_PROBE_FEEDRATE_MM_S;
9425
       feedrate_mm_s = fr_mm_s > 0.0 ? fr_mm_s : XY_PROBE_FEEDRATE_MM_S;
9428
 
9426
 
9429
       if (tmp_extruder != active_extruder) {
9427
       if (tmp_extruder != active_extruder) {
9430
-        if (!no_move && axis_unhomed_error(true, true, true)) {
9428
+        if (!no_move && axis_unhomed_error()) {
9431
           SERIAL_ECHOLNPGM("No move on toolchange");
9429
           SERIAL_ECHOLNPGM("No move on toolchange");
9432
           no_move = true;
9430
           no_move = true;
9433
         }
9431
         }

+ 1
- 1
Marlin/ubl_G29.cpp View File

329
     }
329
     }
330
 
330
 
331
     // Don't allow auto-leveling without homing first
331
     // Don't allow auto-leveling without homing first
332
-    if (!code_seen('N') && axis_unhomed_error(true, true, true)) // Warning! Use of 'N' flouts established standards.
332
+    if (!(code_seen('N') && code_value_bool()) && axis_unhomed_error()) // Warning! Use of 'N' flouts established standards.
333
       home_all_axes();
333
       home_all_axes();
334
 
334
 
335
     if (g29_parameter_parsing()) return; // abort if parsing the simple parameters causes a problem,
335
     if (g29_parameter_parsing()) return; // abort if parsing the simple parameters causes a problem,

Loading…
Cancel
Save