Sfoglia il codice sorgente

Prevent damage if DELTA_HEIGHT is incorrect

Thomas Moore 7 anni fa
parent
commit
f54e0fc90f
4 ha cambiato i file con 166 aggiunte e 91 eliminazioni
  1. 132
    80
      Marlin/Marlin_main.cpp
  2. 5
    5
      Marlin/endstops.cpp
  3. 16
    1
      Marlin/language_en.h
  4. 13
    5
      Marlin/ultralcd.cpp

+ 132
- 80
Marlin/Marlin_main.cpp Vedi File

@@ -1409,6 +1409,9 @@ bool get_target_extruder_from_command(const uint16_t code) {
1409 1409
           soft_endstop_max[axis] = base_max_pos(axis) + offs;
1410 1410
         }
1411 1411
       }
1412
+    #elif ENABLED(DELTA)
1413
+      soft_endstop_min[axis] = base_min_pos(axis) + (axis == Z_AXIS ? 0 : offs);
1414
+      soft_endstop_max[axis] = base_max_pos(axis) + offs;
1412 1415
     #else
1413 1416
       soft_endstop_min[axis] = base_min_pos(axis) + offs;
1414 1417
       soft_endstop_max[axis] = base_max_pos(axis) + offs;
@@ -1806,13 +1809,9 @@ static void clean_up_after_endstop_or_probe_move() {
1806 1809
       }
1807 1810
     #endif
1808 1811
 
1809
-    float z_dest = LOGICAL_Z_POSITION(z_raise);
1812
+    float z_dest = z_raise;
1810 1813
     if (zprobe_zoffset < 0) z_dest -= zprobe_zoffset;
1811 1814
 
1812
-    #if ENABLED(DELTA)
1813
-      z_dest -= home_offset[Z_AXIS]; // Account for delta height adjustment
1814
-    #endif
1815
-
1816 1815
     if (z_dest > current_position[Z_AXIS])
1817 1816
       do_blocking_move_to_z(z_dest);
1818 1817
   }
@@ -2106,7 +2105,7 @@ static void clean_up_after_endstop_or_probe_move() {
2106 2105
       safe_delay(BLTOUCH_DELAY);
2107 2106
     }
2108 2107
 
2109
-    void set_bltouch_deployed(const bool deploy) {
2108
+    bool set_bltouch_deployed(const bool deploy) {
2110 2109
       if (deploy && TEST_BLTOUCH()) {      // If BL-Touch says it's triggered
2111 2110
         bltouch_command(BLTOUCH_RESET);    //  try to reset it.
2112 2111
         bltouch_command(BLTOUCH_DEPLOY);   // Also needs to deploy and stow to
@@ -2118,6 +2117,7 @@ static void clean_up_after_endstop_or_probe_move() {
2118 2117
           SERIAL_ERROR_START();
2119 2118
           SERIAL_ERRORLNPGM(MSG_STOP_BLTOUCH);
2120 2119
           stop();                          // punt!
2120
+          return true;
2121 2121
         }
2122 2122
       }
2123 2123
 
@@ -2130,6 +2130,8 @@ static void clean_up_after_endstop_or_probe_move() {
2130 2130
           SERIAL_EOL();
2131 2131
         }
2132 2132
       #endif
2133
+
2134
+      return false;
2133 2135
     }
2134 2136
 
2135 2137
   #endif // BLTOUCH
@@ -2149,23 +2151,7 @@ static void clean_up_after_endstop_or_probe_move() {
2149 2151
     // Make room for probe
2150 2152
     do_probe_raise(_Z_CLEARANCE_DEPLOY_PROBE);
2151 2153
 
2152
-    // When deploying make sure BLTOUCH is not already triggered
2153
-    #if ENABLED(BLTOUCH)
2154
-      if (deploy && TEST_BLTOUCH()) {      // If BL-Touch says it's triggered
2155
-        bltouch_command(BLTOUCH_RESET);    // try to reset it.
2156
-        bltouch_command(BLTOUCH_DEPLOY);   // Also needs to deploy and stow to
2157
-        bltouch_command(BLTOUCH_STOW);     // clear the triggered condition.
2158
-        safe_delay(1500);                  // wait for internal self test to complete
2159
-                                           //   measured completion time was 0.65 seconds
2160
-                                           //   after reset, deploy & stow sequence
2161
-        if (TEST_BLTOUCH()) {              // If it still claims to be triggered...
2162
-          SERIAL_ERROR_START();
2163
-          SERIAL_ERRORLNPGM(MSG_STOP_BLTOUCH);
2164
-          stop();                          // punt!
2165
-          return true;
2166
-        }
2167
-      }
2168
-    #elif ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
2154
+    #if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
2169 2155
       #if ENABLED(Z_PROBE_SLED)
2170 2156
         #define _AUE_ARGS true, false, false
2171 2157
       #else
@@ -2236,14 +2222,14 @@ static void clean_up_after_endstop_or_probe_move() {
2236 2222
     return false;
2237 2223
   }
2238 2224
 
2239
-  static void do_probe_move(float z, float fr_mm_m) {
2225
+  static bool do_probe_move(float z, float fr_mm_m) {
2240 2226
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2241 2227
       if (DEBUGGING(LEVELING)) DEBUG_POS(">>> do_probe_move", current_position);
2242 2228
     #endif
2243 2229
 
2244 2230
     // Deploy BLTouch at the start of any probe
2245 2231
     #if ENABLED(BLTOUCH)
2246
-      set_bltouch_deployed(true);
2232
+      if (set_bltouch_deployed(true)) return true;
2247 2233
     #endif
2248 2234
 
2249 2235
     #if QUIET_PROBING
@@ -2251,15 +2237,24 @@ static void clean_up_after_endstop_or_probe_move() {
2251 2237
     #endif
2252 2238
 
2253 2239
     // Move down until probe triggered
2254
-    do_blocking_move_to_z(LOGICAL_Z_POSITION(z), MMM_TO_MMS(fr_mm_m));
2240
+    do_blocking_move_to_z(z, MMM_TO_MMS(fr_mm_m));
2241
+
2242
+    // Check to see if the probe was triggered
2243
+    const bool probe_triggered = TEST(Endstops::endstop_hit_bits,
2244
+      #ifdef Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
2245
+        Z_MIN
2246
+      #else
2247
+        Z_MIN_PROBE
2248
+      #endif
2249
+    );
2255 2250
 
2256 2251
     #if QUIET_PROBING
2257 2252
       probing_pause(false);
2258 2253
     #endif
2259 2254
 
2260
-    // Retract BLTouch immediately after a probe
2255
+    // Retract BLTouch immediately after a probe if it was triggered
2261 2256
     #if ENABLED(BLTOUCH)
2262
-      set_bltouch_deployed(false);
2257
+      if (probe_triggered && set_bltouch_deployed(false)) return true;
2263 2258
     #endif
2264 2259
 
2265 2260
     // Clear endstop flags
@@ -2274,11 +2269,13 @@ static void clean_up_after_endstop_or_probe_move() {
2274 2269
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2275 2270
       if (DEBUGGING(LEVELING)) DEBUG_POS("<<< do_probe_move", current_position);
2276 2271
     #endif
2272
+
2273
+    return !probe_triggered;
2277 2274
   }
2278 2275
 
2279 2276
   // Do a single Z probe and return with current_position[Z_AXIS]
2280 2277
   // at the height where the probe triggered.
2281
-  static float run_z_probe() {
2278
+  static float run_z_probe(bool printable=true) {
2282 2279
 
2283 2280
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2284 2281
       if (DEBUGGING(LEVELING)) DEBUG_POS(">>> run_z_probe", current_position);
@@ -2290,34 +2287,33 @@ static void clean_up_after_endstop_or_probe_move() {
2290 2287
     #if ENABLED(PROBE_DOUBLE_TOUCH)
2291 2288
 
2292 2289
       // Do a first probe at the fast speed
2293
-      do_probe_move(-(Z_MAX_LENGTH) - 10, Z_PROBE_SPEED_FAST);
2290
+      if (do_probe_move(-10, Z_PROBE_SPEED_FAST)) return NAN;
2294 2291
 
2295 2292
       #if ENABLED(DEBUG_LEVELING_FEATURE)
2296 2293
         float first_probe_z = current_position[Z_AXIS];
2297 2294
         if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPAIR("1st Probe Z:", first_probe_z);
2298 2295
       #endif
2299 2296
 
2300
-      // move up by the bump distance
2301
-      do_blocking_move_to_z(current_position[Z_AXIS] + home_bump_mm(Z_AXIS), MMM_TO_MMS(Z_PROBE_SPEED_FAST));
2297
+      // move up to make clearance for the probe
2298
+      do_blocking_move_to_z(current_position[Z_AXIS] + Z_CLEARANCE_BETWEEN_PROBES, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
2302 2299
 
2303 2300
     #else
2304 2301
 
2305 2302
       // If the nozzle is above the travel height then
2306 2303
       // move down quickly before doing the slow probe
2307
-      float z = LOGICAL_Z_POSITION(Z_CLEARANCE_BETWEEN_PROBES);
2304
+      float z = Z_CLEARANCE_DEPLOY_PROBE;
2308 2305
       if (zprobe_zoffset < 0) z -= zprobe_zoffset;
2309 2306
 
2310
-      #if ENABLED(DELTA)
2311
-        z -= home_offset[Z_AXIS]; // Account for delta height adjustment
2312
-      #endif
2313
-
2314
-      if (z < current_position[Z_AXIS])
2315
-        do_blocking_move_to_z(z, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
2307
+      if (z < current_position[Z_AXIS]) {
2316 2308
 
2309
+        // If we don't make it to the z position (i.e. the probe triggered), move up to make clearance for the probe
2310
+        if (!do_probe_move(z, Z_PROBE_SPEED_FAST))
2311
+          do_blocking_move_to_z(current_position[Z_AXIS] + Z_CLEARANCE_BETWEEN_PROBES, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
2312
+      }
2317 2313
     #endif
2318 2314
 
2319 2315
     // move down slowly to find bed
2320
-    do_probe_move(-(Z_MAX_LENGTH) - 10, Z_PROBE_SPEED_SLOW);
2316
+    if (do_probe_move(-10 + (printable ? 0 : -(Z_MAX_LENGTH)), Z_PROBE_SPEED_SLOW)) return NAN;
2321 2317
 
2322 2318
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2323 2319
       if (DEBUGGING(LEVELING)) DEBUG_POS("<<< run_z_probe", current_position);
@@ -2330,6 +2326,7 @@ static void clean_up_after_endstop_or_probe_move() {
2330 2326
         SERIAL_ECHOLNPAIR(" Discrepancy:", first_probe_z - current_position[Z_AXIS]);
2331 2327
       }
2332 2328
     #endif
2329
+
2333 2330
     return RAW_CURRENT_POSITION(Z) + zprobe_zoffset
2334 2331
       #if ENABLED(DELTA)
2335 2332
         + home_offset[Z_AXIS] // Account for delta height adjustment
@@ -2371,22 +2368,31 @@ static void clean_up_after_endstop_or_probe_move() {
2371 2368
         do_blocking_move_to_z(delta_clip_start_height);
2372 2369
     #endif
2373 2370
 
2374
-    // Ensure a minimum height before moving the probe
2375
-    do_probe_raise(Z_CLEARANCE_BETWEEN_PROBES);
2371
+    #if HAS_SOFTWARE_ENDSTOPS
2372
+      // Store the status of the soft endstops and disable if we're probing a non-printable location
2373
+      static bool enable_soft_endstops = soft_endstops_enabled;
2374
+      if (!printable) soft_endstops_enabled = false;
2375
+    #endif
2376 2376
 
2377 2377
     feedrate_mm_s = XY_PROBE_FEEDRATE_MM_S;
2378 2378
 
2379 2379
     // Move the probe to the given XY
2380 2380
     do_blocking_move_to_xy(nx, ny);
2381 2381
 
2382
-    if (DEPLOY_PROBE()) return NAN;
2382
+    float measured_z = NAN;
2383
+    if (!DEPLOY_PROBE()) {
2384
+      measured_z = run_z_probe(printable);
2383 2385
 
2384
-    const float measured_z = run_z_probe();
2386
+      if (!stow)
2387
+        do_blocking_move_to_z(current_position[Z_AXIS] + Z_CLEARANCE_BETWEEN_PROBES, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
2388
+      else
2389
+        if (STOW_PROBE()) measured_z = NAN;
2390
+    }
2385 2391
 
2386
-    if (!stow)
2387
-      do_probe_raise(Z_CLEARANCE_BETWEEN_PROBES);
2388
-    else
2389
-      if (STOW_PROBE()) return NAN;
2392
+    #if HAS_SOFTWARE_ENDSTOPS
2393
+      // Restore the soft endstop status
2394
+      soft_endstops_enabled = enable_soft_endstops;
2395
+    #endif
2390 2396
 
2391 2397
     if (verbose_level > 2) {
2392 2398
       SERIAL_PROTOCOLPGM("Bed X: ");
@@ -3752,7 +3758,7 @@ inline void gcode_G4() {
3752 3758
    * A delta can only safely home all axes at the same time
3753 3759
    * This is like quick_home_xy() but for 3 towers.
3754 3760
    */
3755
-  inline void home_delta() {
3761
+  inline bool home_delta() {
3756 3762
     #if ENABLED(DEBUG_LEVELING_FEATURE)
3757 3763
       if (DEBUGGING(LEVELING)) DEBUG_POS(">>> home_delta", current_position);
3758 3764
     #endif
@@ -3761,10 +3767,23 @@ inline void gcode_G4() {
3761 3767
     sync_plan_position();
3762 3768
 
3763 3769
     // Move all carriages together linearly until an endstop is hit.
3764
-    current_position[X_AXIS] = current_position[Y_AXIS] = current_position[Z_AXIS] = (Z_MAX_LENGTH + 10);
3770
+    current_position[X_AXIS] = current_position[Y_AXIS] = current_position[Z_AXIS] = (DELTA_HEIGHT + home_offset[Z_AXIS] + 10);
3765 3771
     feedrate_mm_s = homing_feedrate(X_AXIS);
3766 3772
     line_to_current_position();
3767 3773
     stepper.synchronize();
3774
+
3775
+    // If an endstop was not hit, then damage can occur if homing is continued.
3776
+    // This can occur if the delta height (DELTA_HEIGHT + home_offset[Z_AXIS]) is
3777
+    // not set correctly.
3778
+    if (!(TEST(Endstops::endstop_hit_bits, X_MAX) ||
3779
+          TEST(Endstops::endstop_hit_bits, Y_MAX) ||
3780
+          TEST(Endstops::endstop_hit_bits, Z_MAX))) {
3781
+      LCD_MESSAGEPGM(MSG_ERR_HOMING_FAILED);
3782
+      SERIAL_ERROR_START();
3783
+      SERIAL_ERRORLNPGM(MSG_ERR_HOMING_FAILED);
3784
+      return false;
3785
+    }
3786
+
3768 3787
     endstops.hit_on_purpose(); // clear endstop hit flags
3769 3788
 
3770 3789
     // At least one carriage has reached the top.
@@ -3784,6 +3803,8 @@ inline void gcode_G4() {
3784 3803
     #if ENABLED(DEBUG_LEVELING_FEATURE)
3785 3804
       if (DEBUGGING(LEVELING)) DEBUG_POS("<<< home_delta", current_position);
3786 3805
     #endif
3806
+
3807
+    return true;
3787 3808
   }
3788 3809
 
3789 3810
 #endif // DELTA
@@ -4105,6 +4126,20 @@ void home_all_axes() { gcode_G28(true); }
4105 4126
 
4106 4127
 #endif
4107 4128
 
4129
+#if HAS_BED_PROBE
4130
+
4131
+  static bool nan_error(const float v) {
4132
+    const bool is_nan = isnan(v);
4133
+    if (is_nan) {
4134
+      LCD_MESSAGEPGM(MSG_ERR_PROBING_FAILED);
4135
+      SERIAL_ERROR_START();
4136
+      SERIAL_ERRORLNPGM(MSG_ERR_PROBING_FAILED);
4137
+    }
4138
+    return is_nan;
4139
+  }
4140
+
4141
+#endif // HAS_BED_PROBE
4142
+
4108 4143
 #if ENABLED(MESH_BED_LEVELING)
4109 4144
 
4110 4145
   // Save 130 bytes with non-duplication of PSTR
@@ -4648,7 +4683,7 @@ void home_all_axes() { gcode_G28(true); }
4648 4683
         // Deploy the probe. Probe will raise if needed.
4649 4684
         if (DEPLOY_PROBE()) {
4650 4685
           planner.abl_enabled = abl_should_enable;
4651
-          return;
4686
+          goto FAIL;
4652 4687
         }
4653 4688
       #endif
4654 4689
 
@@ -4864,7 +4899,7 @@ void home_all_axes() { gcode_G28(true); }
4864 4899
       #endif // AUTO_BED_LEVELING_3POINT
4865 4900
 
4866 4901
     #else // !PROBE_MANUALLY
4867
-
4902
+    {
4868 4903
       const bool stow_probe_after_each = parser.boolval('E');
4869 4904
 
4870 4905
       #if ABL_GRID
@@ -4909,9 +4944,9 @@ void home_all_axes() { gcode_G28(true); }
4909 4944
 
4910 4945
             measured_z = faux ? 0.001 * random(-100, 101) : probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
4911 4946
 
4912
-            if (isnan(measured_z)) {
4947
+            if (nan_error(measured_z)) {
4913 4948
               planner.abl_enabled = abl_should_enable;
4914
-              return;
4949
+              goto FAIL;
4915 4950
             }
4916 4951
 
4917 4952
             #if ENABLED(AUTO_BED_LEVELING_LINEAR)
@@ -4945,9 +4980,9 @@ void home_all_axes() { gcode_G28(true); }
4945 4980
           xProbe = LOGICAL_X_POSITION(points[i].x);
4946 4981
           yProbe = LOGICAL_Y_POSITION(points[i].y);
4947 4982
           measured_z = faux ? 0.001 * random(-100, 101) : probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
4948
-          if (isnan(measured_z)) {
4983
+          if (nan_error(measured_z)) {
4949 4984
             planner.abl_enabled = abl_should_enable;
4950
-            return;
4985
+            goto FAIL;
4951 4986
           }
4952 4987
           points[i].z = measured_z;
4953 4988
         }
@@ -4970,9 +5005,9 @@ void home_all_axes() { gcode_G28(true); }
4970 5005
       // Raise to _Z_CLEARANCE_DEPLOY_PROBE. Stow the probe.
4971 5006
       if (STOW_PROBE()) {
4972 5007
         planner.abl_enabled = abl_should_enable;
4973
-        return;
5008
+        goto FAIL;
4974 5009
       }
4975
-
5010
+    }
4976 5011
     #endif // !PROBE_MANUALLY
4977 5012
 
4978 5013
     //
@@ -4985,9 +5020,6 @@ void home_all_axes() { gcode_G28(true); }
4985 5020
     // return or loop before this point.
4986 5021
     //
4987 5022
 
4988
-    // Restore state after probing
4989
-    if (!faux) clean_up_after_endstop_or_probe_move();
4990
-
4991 5023
     #if ENABLED(DEBUG_LEVELING_FEATURE)
4992 5024
       if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position);
4993 5025
     #endif
@@ -5192,6 +5224,14 @@ void home_all_axes() { gcode_G28(true); }
5192 5224
       stepper.synchronize();
5193 5225
     #endif
5194 5226
 
5227
+    // Auto Bed Leveling is complete! Enable if possible.
5228
+    planner.abl_enabled = dryrun ? abl_should_enable : true;
5229
+
5230
+    FAIL:
5231
+
5232
+    // Restore state after probing
5233
+    if (!faux) clean_up_after_endstop_or_probe_move();
5234
+
5195 5235
     #if ENABLED(DEBUG_LEVELING_FEATURE)
5196 5236
       if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< gcode_G29");
5197 5237
     #endif
@@ -5200,9 +5240,6 @@ void home_all_axes() { gcode_G28(true); }
5200 5240
 
5201 5241
     KEEPALIVE_STATE(IN_HANDLER);
5202 5242
 
5203
-    // Auto Bed Leveling is complete! Enable if possible.
5204
-    planner.abl_enabled = dryrun ? abl_should_enable : true;
5205
-
5206 5243
     if (planner.abl_enabled)
5207 5244
       SYNC_PLAN_POSITION_KINEMATIC();
5208 5245
   }
@@ -5235,7 +5272,7 @@ void home_all_axes() { gcode_G28(true); }
5235 5272
 
5236 5273
     const float measured_z = probe_pt(xpos, ypos, parser.boolval('S', true), 1);
5237 5274
 
5238
-    if (!isnan(measured_z)) {
5275
+    if (!nan_error(measured_z)) {
5239 5276
       SERIAL_PROTOCOLPAIR("Bed X: ", FIXFLOAT(xpos));
5240 5277
       SERIAL_PROTOCOLPAIR(" Y: ", FIXFLOAT(ypos));
5241 5278
       SERIAL_PROTOCOLLNPAIR(" Z: ", FIXFLOAT(measured_z));
@@ -5399,9 +5436,9 @@ void home_all_axes() { gcode_G28(true); }
5399 5436
         tool_change(0, 0, true);
5400 5437
       #endif
5401 5438
       setup_for_endstop_or_probe_move();
5402
-      DEPLOY_PROBE();
5403 5439
       endstops.enable(true);
5404
-      home_delta();
5440
+      if (!home_delta())
5441
+        return;
5405 5442
       endstops.not_homing();
5406 5443
 
5407 5444
       // print settings
@@ -5415,7 +5452,11 @@ void home_all_axes() { gcode_G28(true); }
5415 5452
       print_G33_settings(!_1p_calibration, _7p_calibration && towers_set);
5416 5453
 
5417 5454
       #if DISABLED(PROBE_MANUALLY)
5418
-        home_offset[Z_AXIS] -= probe_pt(dx, dy, stow_after_each, 1, false); // 1st probe to set height
5455
+        const float measured_z = probe_pt(dx, dy, stow_after_each, 1, false); // 1st probe to set height
5456
+        if (nan_error(measured_z))
5457
+          goto FAIL;
5458
+        else
5459
+          home_offset[Z_AXIS] -= measured_z;
5419 5460
       #endif
5420 5461
 
5421 5462
       do {
@@ -5433,6 +5474,7 @@ void home_all_axes() { gcode_G28(true); }
5433 5474
             z_at_pt[0] += lcd_probe_pt(0, 0);
5434 5475
           #else
5435 5476
             z_at_pt[0] += probe_pt(dx, dy, stow_after_each, 1, false);
5477
+            if (nan_error(z_at_pt[0])) goto FAIL;
5436 5478
           #endif
5437 5479
         }
5438 5480
         if (_7p_calibration) { // probe extra center points
@@ -5441,7 +5483,8 @@ void home_all_axes() { gcode_G28(true); }
5441 5483
             #if ENABLED(PROBE_MANUALLY)
5442 5484
               z_at_pt[0] += lcd_probe_pt(cos(a) * r, sin(a) * r);
5443 5485
             #else
5444
-              z_at_pt[0] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1, false);
5486
+              z_at_pt[0] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1);
5487
+              if (nan_error(z_at_pt[0])) goto FAIL;
5445 5488
             #endif
5446 5489
           }
5447 5490
           z_at_pt[0] /= float(_7p_double_circle ? 7 : probe_points);
@@ -5461,7 +5504,8 @@ void home_all_axes() { gcode_G28(true); }
5461 5504
               #if ENABLED(PROBE_MANUALLY)
5462 5505
                 z_at_pt[axis] += lcd_probe_pt(cos(a) * r, sin(a) * r);
5463 5506
               #else
5464
-                z_at_pt[axis] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1, false);
5507
+                z_at_pt[axis] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1);
5508
+                if (nan_error(z_at_pt[axis])) goto FAIL;
5465 5509
               #endif
5466 5510
             }
5467 5511
             zig_zag = !zig_zag;
@@ -5661,6 +5705,8 @@ void home_all_axes() { gcode_G28(true); }
5661 5705
       }
5662 5706
       while ((zero_std_dev < test_precision && zero_std_dev > calibration_precision && iterations < 31) || iterations <= force_iterations);
5663 5707
 
5708
+      FAIL:
5709
+
5664 5710
       #if ENABLED(DELTA_HOME_TO_SAFE_ZONE)
5665 5711
         do_blocking_move_to_z(delta_clip_start_height);
5666 5712
       #endif
@@ -6979,14 +7025,14 @@ inline void gcode_M42() {
6979 7025
 
6980 7026
     setup_for_endstop_or_probe_move();
6981 7027
 
7028
+    double mean = 0.0, sigma = 0.0, min = 99999.9, max = -99999.9, sample_set[n_samples];
7029
+
6982 7030
     // Move to the first point, deploy, and probe
6983 7031
     const float t = probe_pt(X_probe_location, Y_probe_location, stow_probe_after_each, verbose_level);
6984
-    if (isnan(t)) return;
7032
+    if (nan_error(t)) goto FAIL;
6985 7033
 
6986 7034
     randomSeed(millis());
6987 7035
 
6988
-    double mean = 0.0, sigma = 0.0, min = 99999.9, max = -99999.9, sample_set[n_samples];
6989
-
6990 7036
     for (uint8_t n = 0; n < n_samples; n++) {
6991 7037
       if (n_legs) {
6992 7038
         const int dir = (random(0, 10) > 5.0) ? -1 : 1;  // clockwise or counter clockwise
@@ -7058,6 +7104,7 @@ inline void gcode_M42() {
7058 7104
 
7059 7105
       // Probe a single point
7060 7106
       sample_set[n] = probe_pt(X_probe_location, Y_probe_location, stow_probe_after_each, 0);
7107
+      if (nan_error(sample_set[n])) goto FAIL;
7061 7108
 
7062 7109
       /**
7063 7110
        * Get the current mean for the data points we have so far
@@ -7103,7 +7150,7 @@ inline void gcode_M42() {
7103 7150
 
7104 7151
     } // End of probe loop
7105 7152
 
7106
-    if (STOW_PROBE()) return;
7153
+    if (STOW_PROBE()) goto FAIL;
7107 7154
 
7108 7155
     SERIAL_PROTOCOLPGM("Finished!");
7109 7156
     SERIAL_EOL();
@@ -7125,6 +7172,8 @@ inline void gcode_M42() {
7125 7172
     SERIAL_EOL();
7126 7173
     SERIAL_EOL();
7127 7174
 
7175
+    FAIL:
7176
+
7128 7177
     clean_up_after_endstop_or_probe_move();
7129 7178
 
7130 7179
     // Re-enable bed level correction if it had been on
@@ -11452,19 +11501,22 @@ void ok_to_send() {
11452 11501
   //       DELTA_PRINTABLE_RADIUS from center of bed, but delta
11453 11502
   //       now enforces is_position_reachable for X/Y regardless
11454 11503
   //       of HAS_SOFTWARE_ENDSTOPS, so that enforcement would be
11455
-  //       redundant here.  Probably should #ifdef out the X/Y
11456
-  //       axis clamps here for delta and just leave the Z clamp.
11504
+  //       redundant here.
11457 11505
 
11458 11506
   void clamp_to_software_endstops(float target[XYZ]) {
11459 11507
     if (!soft_endstops_enabled) return;
11460 11508
     #if ENABLED(MIN_SOFTWARE_ENDSTOPS)
11461
-      NOLESS(target[X_AXIS], soft_endstop_min[X_AXIS]);
11462
-      NOLESS(target[Y_AXIS], soft_endstop_min[Y_AXIS]);
11509
+      #if DISABLED(DELTA)
11510
+        NOLESS(target[X_AXIS], soft_endstop_min[X_AXIS]);
11511
+        NOLESS(target[Y_AXIS], soft_endstop_min[Y_AXIS]);
11512
+      #endif
11463 11513
       NOLESS(target[Z_AXIS], soft_endstop_min[Z_AXIS]);
11464 11514
     #endif
11465 11515
     #if ENABLED(MAX_SOFTWARE_ENDSTOPS)
11466
-      NOMORE(target[X_AXIS], soft_endstop_max[X_AXIS]);
11467
-      NOMORE(target[Y_AXIS], soft_endstop_max[Y_AXIS]);
11516
+      #if DISABLED(DELTA)
11517
+        NOMORE(target[X_AXIS], soft_endstop_max[X_AXIS]);
11518
+        NOMORE(target[Y_AXIS], soft_endstop_max[Y_AXIS]);
11519
+      #endif
11468 11520
       NOMORE(target[Z_AXIS], soft_endstop_max[Z_AXIS]);
11469 11521
     #endif
11470 11522
   }

+ 5
- 5
Marlin/endstops.cpp Vedi File

@@ -247,7 +247,7 @@ void Endstops::update() {
247 247
   #define _ENDSTOP(AXIS, MINMAX) AXIS ##_## MINMAX
248 248
   #define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN
249 249
   #define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING
250
-  #define _ENDSTOP_HIT(AXIS) SBI(endstop_hit_bits, _ENDSTOP(AXIS, MIN))
250
+  #define _ENDSTOP_HIT(AXIS, MINMAX) SBI(endstop_hit_bits, _ENDSTOP(AXIS, MINMAX))
251 251
 
252 252
   // UPDATE_ENDSTOP_BIT: set the current endstop bits for an endstop to its status
253 253
   #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT(current_endstop_bits, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
@@ -257,7 +257,7 @@ void Endstops::update() {
257 257
   #define UPDATE_ENDSTOP(AXIS,MINMAX) do { \
258 258
       UPDATE_ENDSTOP_BIT(AXIS, MINMAX); \
259 259
       if (TEST_ENDSTOP(_ENDSTOP(AXIS, MINMAX)) && stepper.current_block->steps[_AXIS(AXIS)] > 0) { \
260
-        _ENDSTOP_HIT(AXIS); \
260
+        _ENDSTOP_HIT(AXIS, MINMAX); \
261 261
         stepper.endstop_triggered(_AXIS(AXIS)); \
262 262
       } \
263 263
     } while(0)
@@ -267,9 +267,9 @@ void Endstops::update() {
267 267
     if (G38_move) {
268 268
       UPDATE_ENDSTOP_BIT(Z, MIN_PROBE);
269 269
       if (TEST_ENDSTOP(_ENDSTOP(Z, MIN_PROBE))) {
270
-        if      (stepper.current_block->steps[_AXIS(X)] > 0) { _ENDSTOP_HIT(X); stepper.endstop_triggered(_AXIS(X)); }
271
-        else if (stepper.current_block->steps[_AXIS(Y)] > 0) { _ENDSTOP_HIT(Y); stepper.endstop_triggered(_AXIS(Y)); }
272
-        else if (stepper.current_block->steps[_AXIS(Z)] > 0) { _ENDSTOP_HIT(Z); stepper.endstop_triggered(_AXIS(Z)); }
270
+        if      (stepper.current_block->steps[_AXIS(X)] > 0) { _ENDSTOP_HIT(X, MIN); stepper.endstop_triggered(_AXIS(X)); }
271
+        else if (stepper.current_block->steps[_AXIS(Y)] > 0) { _ENDSTOP_HIT(Y, MIN); stepper.endstop_triggered(_AXIS(Y)); }
272
+        else if (stepper.current_block->steps[_AXIS(Z)] > 0) { _ENDSTOP_HIT(Z, MIN); stepper.endstop_triggered(_AXIS(Z)); }
273 273
         G38_endstop_hit = true;
274 274
       }
275 275
     }

+ 16
- 1
Marlin/language_en.h Vedi File

@@ -717,7 +717,7 @@
717 717
   #define MSG_DELTA_CALIBRATE_CENTER          _UxGT("Calibrate Center")
718 718
 #endif
719 719
 #ifndef MSG_DELTA_SETTINGS
720
-  #define MSG_DELTA_SETTINGS                  _UxGT("Show Delta Settings")
720
+  #define MSG_DELTA_SETTINGS                  _UxGT("Delta Settings")
721 721
 #endif
722 722
 #ifndef MSG_DELTA_AUTO_CALIBRATE
723 723
   #define MSG_DELTA_AUTO_CALIBRATE            _UxGT("Auto Calibration")
@@ -725,6 +725,15 @@
725 725
 #ifndef MSG_DELTA_HEIGHT_CALIBRATE
726 726
   #define MSG_DELTA_HEIGHT_CALIBRATE          _UxGT("Set Delta Height")
727 727
 #endif
728
+#ifndef MSG_DELTA_DIAG_ROG
729
+  #define MSG_DELTA_DIAG_ROG                  _UxGT("Diag Rod")
730
+#endif
731
+#ifndef MSG_DELTA_HEIGHT
732
+  #define MSG_DELTA_HEIGHT                    _UxGT("Height")
733
+#endif
734
+#ifndef MSG_DELTA_RADIUS
735
+  #define MSG_DELTA_RADIUS                    _UxGT("Radius")
736
+#endif
728 737
 #ifndef MSG_INFO_MENU
729 738
   #define MSG_INFO_MENU                       _UxGT("About Printer")
730 739
 #endif
@@ -840,6 +849,12 @@
840 849
 #ifndef MSG_FILAMENT_CHANGE_NOZZLE
841 850
   #define MSG_FILAMENT_CHANGE_NOZZLE          _UxGT("  Nozzle: ")
842 851
 #endif
852
+#ifndef MSG_ERR_HOMING_FAILED
853
+  #define MSG_ERR_HOMING_FAILED               _UxGT("Homing failed")
854
+#endif
855
+#ifndef MSG_ERR_PROBING_FAILED
856
+  #define MSG_ERR_PROBING_FAILED              _UxGT("Probing failed")
857
+#endif
843 858
 
844 859
 //
845 860
 // Filament Change screens show up to 3 lines on a 4-line display

+ 13
- 5
Marlin/ultralcd.cpp Vedi File

@@ -2537,15 +2537,23 @@ void kill_screen(const char* lcd_msg) {
2537 2537
     void _goto_tower_z() { _man_probe_pt(cos(RADIANS( 90)) * delta_calibration_radius, sin(RADIANS( 90)) * delta_calibration_radius); }
2538 2538
     void _goto_center()  { _man_probe_pt(0,0); }
2539 2539
 
2540
-    void lcd_delta_G33_settings() {
2540
+    static float _delta_height = DELTA_HEIGHT;
2541
+    void _lcd_set_delta_height() {
2542
+      home_offset[Z_AXIS] = _delta_height - DELTA_HEIGHT;
2543
+      update_software_endstops(Z_AXIS);
2544
+    }
2545
+
2546
+    void lcd_delta_settings() {
2541 2547
       START_MENU();
2542 2548
       MENU_BACK(MSG_DELTA_CALIBRATE);
2543
-      float delta_height = DELTA_HEIGHT + home_offset[Z_AXIS], Tz = 0.00;
2544
-      MENU_ITEM_EDIT(float52, "Height", &delta_height, delta_height, delta_height);
2549
+      float Tz = 0.00;
2550
+      MENU_ITEM_EDIT(float52, MSG_DELTA_DIAG_ROG, &delta_diagonal_rod, DELTA_DIAGONAL_ROD - 5.0, DELTA_DIAGONAL_ROD + 5.0);
2551
+      _delta_height = DELTA_HEIGHT + home_offset[Z_AXIS];
2552
+      MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_DELTA_HEIGHT, &_delta_height, _delta_height - 10.0, _delta_height + 10.0, _lcd_set_delta_height);
2545 2553
       MENU_ITEM_EDIT(float43, "Ex", &endstop_adj[A_AXIS], -5.0, 5.0);
2546 2554
       MENU_ITEM_EDIT(float43, "Ey", &endstop_adj[B_AXIS], -5.0, 5.0);
2547 2555
       MENU_ITEM_EDIT(float43, "Ez", &endstop_adj[C_AXIS], -5.0, 5.0);
2548
-      MENU_ITEM_EDIT(float52, "Radius", &delta_radius, DELTA_RADIUS - 5.0, DELTA_RADIUS + 5.0);
2556
+      MENU_ITEM_EDIT(float52, MSG_DELTA_RADIUS, &delta_radius, DELTA_RADIUS - 5.0, DELTA_RADIUS + 5.0);
2549 2557
       MENU_ITEM_EDIT(float43, "Tx", &delta_tower_angle_trim[A_AXIS], -5.0, 5.0);
2550 2558
       MENU_ITEM_EDIT(float43, "Ty", &delta_tower_angle_trim[B_AXIS], -5.0, 5.0);
2551 2559
       MENU_ITEM_EDIT(float43, "Tz", &Tz, -5.0, 5.0);
@@ -2556,7 +2564,7 @@ void kill_screen(const char* lcd_msg) {
2556 2564
       START_MENU();
2557 2565
       MENU_BACK(MSG_MAIN);
2558 2566
       #if ENABLED(DELTA_AUTO_CALIBRATION)
2559
-        MENU_ITEM(submenu, MSG_DELTA_SETTINGS, lcd_delta_G33_settings);
2567
+        MENU_ITEM(submenu, MSG_DELTA_SETTINGS, lcd_delta_settings);
2560 2568
         MENU_ITEM(gcode, MSG_DELTA_AUTO_CALIBRATE, PSTR("G33"));
2561 2569
         MENU_ITEM(gcode, MSG_DELTA_HEIGHT_CALIBRATE, PSTR("G33 P1"));
2562 2570
         #if ENABLED(EEPROM_SETTINGS)

Loading…
Annulla
Salva