Browse Source

Merge pull request #7079 from thinkyhead/bf_m600_fixes

M600 fixes
Scott Lahteine 7 years ago
parent
commit
2e1b7d3a22
4 changed files with 78 additions and 43 deletions
  1. 56
    26
      Marlin/Marlin_main.cpp
  2. 2
    2
      Marlin/mesh_bed_leveling.h
  3. 8
    8
      Marlin/planner.cpp
  4. 12
    7
      Marlin/ultralcd.cpp

+ 56
- 26
Marlin/Marlin_main.cpp View File

@@ -5866,7 +5866,7 @@ inline void gcode_M17() {
5866 5866
       idle();
5867 5867
       heaters_heating = false;
5868 5868
       HOTEND_LOOP() {
5869
-        if (thermalManager.degTargetHotend(e) && abs(thermalManager.degHotend(e) - thermalManager.degTargetHotend(e)) > 3) {
5869
+        if (thermalManager.degTargetHotend(e) && abs(thermalManager.degHotend(e) - thermalManager.degTargetHotend(e)) > TEMP_HYSTERESIS) {
5870 5870
           heaters_heating = true;
5871 5871
           #if ENABLED(ULTIPANEL)
5872 5872
             lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT);
@@ -5882,7 +5882,7 @@ inline void gcode_M17() {
5882 5882
   ) {
5883 5883
     if (move_away_flag) return false; // already paused
5884 5884
 
5885
-    if (!DEBUGGING(DRYRUN) && unload_length != 0) {
5885
+    if (!DEBUGGING(DRYRUN) && (unload_length != 0 || retract != 0)) {
5886 5886
       #if ENABLED(PREVENT_COLD_EXTRUSION)
5887 5887
         if (!thermalManager.allow_cold_extrude &&
5888 5888
             thermalManager.degTargetHotend(active_extruder) < thermalManager.extrude_min_temp) {
@@ -5919,10 +5919,11 @@ inline void gcode_M17() {
5919 5919
     COPY(resume_position, current_position);
5920 5920
     set_destination_to_current();
5921 5921
 
5922
-    // Initial retract before move to filament change position
5923
-    destination[E_AXIS] += retract;
5924
-
5925
-    RUNPLAN(PAUSE_PARK_RETRACT_FEEDRATE);
5922
+    if (retract) {
5923
+      // Initial retract before move to filament change position
5924
+      destination[E_AXIS] += retract;
5925
+      RUNPLAN(PAUSE_PARK_RETRACT_FEEDRATE);
5926
+    }
5926 5927
 
5927 5928
     // Lift Z axis
5928 5929
     if (z_lift > 0) {
@@ -5951,23 +5952,25 @@ inline void gcode_M17() {
5951 5952
       destination[E_AXIS] += unload_length;
5952 5953
       RUNPLAN(FILAMENT_CHANGE_UNLOAD_FEEDRATE);
5953 5954
       stepper.synchronize();
5955
+    }
5954 5956
 
5955
-      if (show_lcd) {
5956
-        #if ENABLED(ULTIPANEL)
5957
-          lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT);
5958
-        #endif
5959
-      }
5960
-
5961
-      #if HAS_BUZZER
5962
-        filament_change_beep(max_beep_count, true);
5957
+    if (show_lcd) {
5958
+      #if ENABLED(ULTIPANEL)
5959
+        lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT);
5963 5960
       #endif
5964
-
5965
-      idle();
5966 5961
     }
5967 5962
 
5968
-    // Disable extruders steppers for manual filament changing
5969
-    disable_e_steppers();
5970
-    safe_delay(100);
5963
+    #if HAS_BUZZER
5964
+      filament_change_beep(max_beep_count, true);
5965
+    #endif
5966
+
5967
+    idle();
5968
+
5969
+    // Disable extruders steppers for manual filament changing (only on boards that have separate ENABLE_PINS)
5970
+    #if E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN
5971
+      disable_e_steppers();
5972
+      safe_delay(100);
5973
+    #endif
5971 5974
 
5972 5975
     // Start the heater idle timers
5973 5976
     const millis_t nozzle_timeout = (millis_t)(PAUSE_PARK_NOZZLE_TIMEOUT) * 1000UL;
@@ -5989,14 +5992,43 @@ inline void gcode_M17() {
5989 5992
         filament_change_beep(max_beep_count);
5990 5993
       #endif
5991 5994
 
5995
+      // If the nozzle has timed out, wait for the user to press the button to re-heat the nozzle, then
5996
+      // re-heat the nozzle, re-show the insert screen, restart the idle timers, and start over
5992 5997
       if (!nozzle_timed_out)
5993 5998
         HOTEND_LOOP()
5994 5999
           nozzle_timed_out |= thermalManager.is_heater_idle(e);
5995 6000
 
5996
-      #if ENABLED(ULTIPANEL)
5997
-        if (nozzle_timed_out)
6001
+      if (nozzle_timed_out) {
6002
+        #if ENABLED(ULTIPANEL)
5998 6003
           lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_CLICK_TO_HEAT_NOZZLE);
5999
-      #endif
6004
+        #endif
6005
+
6006
+        // Wait for LCD click or M108
6007
+        while (wait_for_user) idle(true);
6008
+
6009
+        // Re-enable the heaters if they timed out
6010
+        HOTEND_LOOP() thermalManager.reset_heater_idle_timer(e);
6011
+
6012
+        // Wait for the heaters to reach the target temperatures
6013
+        ensure_safe_temperature();
6014
+
6015
+        #if ENABLED(ULTIPANEL)
6016
+          lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT);
6017
+        #endif
6018
+
6019
+        // Start the heater idle timers
6020
+        const millis_t nozzle_timeout = (millis_t)(PAUSE_PARK_NOZZLE_TIMEOUT) * 1000UL;
6021
+
6022
+        HOTEND_LOOP()
6023
+          thermalManager.start_heater_idle_timer(e, nozzle_timeout);
6024
+
6025
+        wait_for_user = true; /* Wait for user to load filament */
6026
+        nozzle_timed_out = false;
6027
+
6028
+        #if HAS_BUZZER
6029
+          filament_change_beep(max_beep_count, true);
6030
+        #endif
6031
+      }
6000 6032
 
6001 6033
       idle(true);
6002 6034
     }
@@ -6049,7 +6081,7 @@ inline void gcode_M17() {
6049 6081
       stepper.synchronize();
6050 6082
     }
6051 6083
 
6052
-    #if ENABLED(ULTIPANEL) && defined(ADVANCED_PAUSE_EXTRUDE_LENGTH) && ADVANCED_PAUSE_EXTRUDE_LENGTH > 0
6084
+    #if ENABLED(ULTIPANEL) && ADVANCED_PAUSE_EXTRUDE_LENGTH > 0
6053 6085
 
6054 6086
       float extrude_length = initial_extrude_length;
6055 6087
 
@@ -6104,8 +6136,6 @@ inline void gcode_M17() {
6104 6136
       filament_ran_out = false;
6105 6137
     #endif
6106 6138
 
6107
-    set_current_to_destination();
6108
-
6109 6139
     #if ENABLED(ULTIPANEL)
6110 6140
       // Show status screen
6111 6141
       lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS);
@@ -7643,7 +7673,7 @@ inline void gcode_M18_M84() {
7643 7673
       if (parser.seen('X')) disable_X();
7644 7674
       if (parser.seen('Y')) disable_Y();
7645 7675
       if (parser.seen('Z')) disable_Z();
7646
-      #if ((E0_ENABLE_PIN != X_ENABLE_PIN) && (E1_ENABLE_PIN != Y_ENABLE_PIN)) // Only enable on boards that have seperate ENABLE_PINS
7676
+      #if E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN // Only enable on boards that have separate ENABLE_PINS
7647 7677
         if (parser.seen('E')) disable_e_steppers();
7648 7678
       #endif
7649 7679
     }

+ 2
- 2
Marlin/mesh_bed_leveling.h View File

@@ -94,8 +94,8 @@
94 94
     }
95 95
 
96 96
     static float calc_z0(const float &a0, const float &a1, const float &z1, const float &a2, const float &z2) {
97
-      const float delta_z = (z2 - z1) / (a2 - a1);
98
-      const float delta_a = a0 - a1;
97
+      const float delta_z = (z2 - z1) / (a2 - a1),
98
+                  delta_a = a0 - a1;
99 99
       return z1 + delta_a * delta_z;
100 100
     }
101 101
 

+ 8
- 8
Marlin/planner.cpp View File

@@ -534,10 +534,10 @@ void Planner::check_axes_activity() {
534 534
       if (!ubl.state.active) return;
535 535
       #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
536 536
         // if z_fade_height enabled (nonzero) and raw_z above it, no leveling required
537
-        if ((planner.z_fade_height) && (planner.z_fade_height <= RAW_Z_POSITION(lz))) return;
537
+        if (planner.z_fade_height && planner.z_fade_height <= RAW_Z_POSITION(lz)) return;
538 538
         lz += ubl.state.z_offset + ubl.get_z_correction(lx, ly) * ubl.fade_scaling_factor_for_z(lz);
539 539
       #else // no fade
540
-        lz += ubl.state.z_offset + ubl.get_z_correction(lx,ly);
540
+        lz += ubl.state.z_offset + ubl.get_z_correction(lx, ly);
541 541
       #endif // FADE
542 542
     #endif // UBL
543 543
 
@@ -598,10 +598,10 @@ void Planner::check_axes_activity() {
598 598
 
599 599
       if (ubl.state.active) {
600 600
 
601
-        const float z_physical = RAW_Z_POSITION(logical[Z_AXIS]);
602
-        const float z_ublmesh  = ubl.get_z_correction(logical[X_AXIS], logical[Y_AXIS]);
603
-        const float z_virtual  = z_physical - ubl.state.z_offset - z_ublmesh;
604
-              float z_logical  = LOGICAL_Z_POSITION(z_virtual);
601
+        const float z_physical = RAW_Z_POSITION(logical[Z_AXIS]),
602
+                    z_correct = ubl.get_z_correction(logical[X_AXIS], logical[Y_AXIS]),
603
+                    z_virtual = z_physical - ubl.state.z_offset - z_correct;
604
+              float z_logical = LOGICAL_Z_POSITION(z_virtual);
605 605
 
606 606
         #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
607 607
 
@@ -614,10 +614,10 @@ void Planner::check_axes_activity() {
614 614
           //    so L=(P-O-M)/(1-M/H) for L<H
615 615
 
616 616
           if (planner.z_fade_height) {
617
-            if (z_logical < planner.z_fade_height )
618
-              z_logical = z_logical / (1.0 - (z_ublmesh * planner.inverse_z_fade_height));
619 617
             if (z_logical >= planner.z_fade_height)
620 618
               z_logical = LOGICAL_Z_POSITION(z_physical - ubl.state.z_offset);
619
+            else
620
+              z_logical /= 1.0 - z_correct * planner.inverse_z_fade_height;
621 621
           }
622 622
 
623 623
         #endif // ENABLE_LEVELING_FADE_HEIGHT

+ 12
- 7
Marlin/ultralcd.cpp View File

@@ -1018,8 +1018,8 @@ void kill_screen(const char* lcd_msg) {
1018 1018
 
1019 1019
   #if ENABLED(AUTO_BED_LEVELING_UBL)
1020 1020
 
1021
-    float mesh_edit_value, mesh_edit_accumulator; // We round mesh_edit_value to 2.5 decimal places.  So we keep a
1022
-                                                  // seperate value that doesn't lose precision.
1021
+    float mesh_edit_value, mesh_edit_accumulator; // We round mesh_edit_value to 2.5 decimal places. So we keep a
1022
+                                                  // separate value that doesn't lose precision.
1023 1023
     static int ubl_encoderPosition = 0;
1024 1024
 
1025 1025
     static void _lcd_mesh_fine_tune(const char* msg) {
@@ -1107,11 +1107,16 @@ void kill_screen(const char* lcd_msg) {
1107 1107
   #if ENABLED(ADVANCED_PAUSE_FEATURE)
1108 1108
 
1109 1109
     void lcd_enqueue_filament_change() {
1110
-      if (!DEBUGGING(DRYRUN) && thermalManager.tooColdToExtrude(active_extruder)) {
1111
-        lcd_save_previous_screen();
1112
-        lcd_goto_screen(lcd_advanced_pause_toocold_menu);
1113
-        return;
1114
-      }
1110
+
1111
+      #if ENABLED(PREVENT_COLD_EXTRUSION)
1112
+        if (!DEBUGGING(DRYRUN) && !thermalManager.allow_cold_extrude &&
1113
+            thermalManager.degTargetHotend(active_extruder) < thermalManager.extrude_min_temp) {
1114
+          lcd_save_previous_screen();
1115
+          lcd_goto_screen(lcd_advanced_pause_toocold_menu);
1116
+          return;
1117
+        }
1118
+      #endif
1119
+
1115 1120
       lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT);
1116 1121
       enqueue_and_echo_commands_P(PSTR("M600 B0"));
1117 1122
     }

Loading…
Cancel
Save