Parcourir la source

Merge Fix M600 (PR#2301)

Richard Wackerbarth il y a 10 ans
Parent
révision
e09abb1b31
3 fichiers modifiés avec 56 ajouts et 26 suppressions
  1. 54
    26
      Marlin/Marlin_main.cpp
  2. 1
    0
      Marlin/configurator/config/language.h
  3. 1
    0
      Marlin/language.h

+ 54
- 26
Marlin/Marlin_main.cpp Voir le fichier

4887
 #ifdef FILAMENTCHANGEENABLE
4887
 #ifdef FILAMENTCHANGEENABLE
4888
 
4888
 
4889
   /**
4889
   /**
4890
-   * M600: Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
4890
+   * M600: Pause for filament change
4891
+   *
4892
+   *  E[distance] - Retract the filament this far (negative value)
4893
+   *  Z[distance] - Move the Z axis by this distance
4894
+   *  X[position] - Move to this X position, with Y
4895
+   *  Y[position] - Move to this Y position, with X
4896
+   *  L[distance] - Retract distance for removal (manual reload)
4897
+   *
4898
+   *  Default values are used for omitted arguments.
4899
+   *
4891
    */
4900
    */
4892
   inline void gcode_M600() {
4901
   inline void gcode_M600() {
4893
-    float target[NUM_AXIS], lastpos[NUM_AXIS], fr60 = feedrate / 60;
4902
+
4903
+    if (degHotend(active_extruder) < extrude_min_temp) {
4904
+      SERIAL_ERROR_START;
4905
+      SERIAL_ERRORLNPGM(MSG_TOO_COLD_FOR_M600);
4906
+      return;
4907
+    }
4908
+
4909
+    float lastpos[NUM_AXIS], fr60 = feedrate / 60;
4910
+
4894
     for (int i=0; i<NUM_AXIS; i++)
4911
     for (int i=0; i<NUM_AXIS; i++)
4895
-      target[i] = lastpos[i] = current_position[i];
4912
+      lastpos[i] = destination[i] = current_position[i];
4896
 
4913
 
4897
-    #define BASICPLAN plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], fr60, active_extruder);
4898
     #ifdef DELTA
4914
     #ifdef DELTA
4899
-      #define RUNPLAN calculate_delta(target); BASICPLAN
4915
+      #define RUNPLAN calculate_delta(destination); \
4916
+                      plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], fr60, active_extruder);
4900
     #else
4917
     #else
4901
-      #define RUNPLAN BASICPLAN
4918
+      #define RUNPLAN line_to_destination();
4902
     #endif
4919
     #endif
4903
 
4920
 
4904
     //retract by E
4921
     //retract by E
4905
-    if (code_seen('E')) target[E_AXIS] += code_value();
4922
+    if (code_seen('E')) destination[E_AXIS] += code_value();
4906
     #ifdef FILAMENTCHANGE_FIRSTRETRACT
4923
     #ifdef FILAMENTCHANGE_FIRSTRETRACT
4907
-      else target[E_AXIS] += FILAMENTCHANGE_FIRSTRETRACT;
4924
+      else destination[E_AXIS] += FILAMENTCHANGE_FIRSTRETRACT;
4908
     #endif
4925
     #endif
4909
 
4926
 
4910
     RUNPLAN;
4927
     RUNPLAN;
4911
 
4928
 
4912
     //lift Z
4929
     //lift Z
4913
-    if (code_seen('Z')) target[Z_AXIS] += code_value();
4930
+    if (code_seen('Z')) destination[Z_AXIS] += code_value();
4914
     #ifdef FILAMENTCHANGE_ZADD
4931
     #ifdef FILAMENTCHANGE_ZADD
4915
-      else target[Z_AXIS] += FILAMENTCHANGE_ZADD;
4932
+      else destination[Z_AXIS] += FILAMENTCHANGE_ZADD;
4916
     #endif
4933
     #endif
4917
 
4934
 
4918
     RUNPLAN;
4935
     RUNPLAN;
4919
 
4936
 
4920
     //move xy
4937
     //move xy
4921
-    if (code_seen('X')) target[X_AXIS] = code_value();
4938
+    if (code_seen('X')) destination[X_AXIS] = code_value();
4922
     #ifdef FILAMENTCHANGE_XPOS
4939
     #ifdef FILAMENTCHANGE_XPOS
4923
-      else target[X_AXIS] = FILAMENTCHANGE_XPOS;
4940
+      else destination[X_AXIS] = FILAMENTCHANGE_XPOS;
4924
     #endif
4941
     #endif
4925
 
4942
 
4926
-    if (code_seen('Y')) target[Y_AXIS] = code_value();
4943
+    if (code_seen('Y')) destination[Y_AXIS] = code_value();
4927
     #ifdef FILAMENTCHANGE_YPOS
4944
     #ifdef FILAMENTCHANGE_YPOS
4928
-      else target[Y_AXIS] = FILAMENTCHANGE_YPOS;
4945
+      else destination[Y_AXIS] = FILAMENTCHANGE_YPOS;
4929
     #endif
4946
     #endif
4930
 
4947
 
4931
     RUNPLAN;
4948
     RUNPLAN;
4932
 
4949
 
4933
-    if (code_seen('L')) target[E_AXIS] += code_value();
4950
+    if (code_seen('L')) destination[E_AXIS] += code_value();
4934
     #ifdef FILAMENTCHANGE_FINALRETRACT
4951
     #ifdef FILAMENTCHANGE_FINALRETRACT
4935
-      else target[E_AXIS] += FILAMENTCHANGE_FINALRETRACT;
4952
+      else destination[E_AXIS] += FILAMENTCHANGE_FINALRETRACT;
4936
     #endif
4953
     #endif
4937
 
4954
 
4938
     RUNPLAN;
4955
     RUNPLAN;
4946
     disable_e3();
4963
     disable_e3();
4947
     delay(100);
4964
     delay(100);
4948
     LCD_ALERTMESSAGEPGM(MSG_FILAMENTCHANGE);
4965
     LCD_ALERTMESSAGEPGM(MSG_FILAMENTCHANGE);
4949
-    uint8_t cnt = 0;
4966
+    millis_t next_tick = 0;
4950
     while (!lcd_clicked()) {
4967
     while (!lcd_clicked()) {
4951
       #ifndef AUTO_FILAMENT_CHANGE
4968
       #ifndef AUTO_FILAMENT_CHANGE
4952
-        if (++cnt == 0) lcd_quick_feedback(); // every 256th frame till the lcd is clicked
4969
+        millis_t ms = millis();
4970
+        if (ms >= next_tick) {
4971
+          lcd_quick_feedback();
4972
+          next_tick = ms + 2500; // feedback every 2.5s while waiting
4973
+        }
4953
         manage_heater();
4974
         manage_heater();
4954
         manage_inactivity(true);
4975
         manage_inactivity(true);
4955
         lcd_update();
4976
         lcd_update();
4959
         st_synchronize();
4980
         st_synchronize();
4960
       #endif
4981
       #endif
4961
     } // while(!lcd_clicked)
4982
     } // while(!lcd_clicked)
4983
+    lcd_quick_feedback(); // click sound feedback
4962
 
4984
 
4963
     #ifdef AUTO_FILAMENT_CHANGE
4985
     #ifdef AUTO_FILAMENT_CHANGE
4964
       current_position[E_AXIS]= 0;
4986
       current_position[E_AXIS]= 0;
4966
     #endif
4988
     #endif
4967
           
4989
           
4968
     //return to normal
4990
     //return to normal
4969
-    if (code_seen('L')) target[E_AXIS] -= code_value();
4991
+    if (code_seen('L')) destination[E_AXIS] -= code_value();
4970
     #ifdef FILAMENTCHANGE_FINALRETRACT
4992
     #ifdef FILAMENTCHANGE_FINALRETRACT
4971
-      else target[E_AXIS] -= FILAMENTCHANGE_FINALRETRACT;
4993
+      else destination[E_AXIS] -= FILAMENTCHANGE_FINALRETRACT;
4972
     #endif
4994
     #endif
4973
 
4995
 
4974
-    current_position[E_AXIS] = target[E_AXIS]; //the long retract of L is compensated by manual filament feeding
4996
+    current_position[E_AXIS] = destination[E_AXIS]; //the long retract of L is compensated by manual filament feeding
4975
     plan_set_e_position(current_position[E_AXIS]);
4997
     plan_set_e_position(current_position[E_AXIS]);
4976
 
4998
 
4977
     RUNPLAN; //should do nothing
4999
     RUNPLAN; //should do nothing
4979
     lcd_reset_alert_level();
5001
     lcd_reset_alert_level();
4980
 
5002
 
4981
     #ifdef DELTA
5003
     #ifdef DELTA
5004
+      // Move XYZ to starting position, then E
4982
       calculate_delta(lastpos);
5005
       calculate_delta(lastpos);
4983
-      plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], fr60, active_extruder); //move xyz back
4984
-      plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], lastpos[E_AXIS], fr60, active_extruder); //final untretract
5006
+      plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], fr60, active_extruder);
5007
+      plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], lastpos[E_AXIS], fr60, active_extruder);
4985
     #else
5008
     #else
4986
-      plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], target[Z_AXIS], target[E_AXIS], fr60, active_extruder); //move xy back
4987
-      plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], fr60, active_extruder); //move z back
4988
-      plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], lastpos[E_AXIS], fr60, active_extruder); //final untretract
5009
+      // Move XY to starting position, then Z, then E
5010
+      destination[X_AXIS] = lastpos[X_AXIS];
5011
+      destination[Y_AXIS] = lastpos[Y_AXIS];
5012
+      line_to_destination();
5013
+      destination[Z_AXIS] = lastpos[Z_AXIS];
5014
+      line_to_destination();
5015
+      destination[E_AXIS] = lastpos[E_AXIS];
5016
+      line_to_destination();
4989
     #endif        
5017
     #endif        
4990
 
5018
 
4991
     #ifdef FILAMENT_RUNOUT_SENSOR
5019
     #ifdef FILAMENT_RUNOUT_SENSOR

+ 1
- 0
Marlin/configurator/config/language.h Voir le fichier

170
 #define MSG_ENDSTOPS_HIT                    "endstops hit: "
170
 #define MSG_ENDSTOPS_HIT                    "endstops hit: "
171
 #define MSG_ERR_COLD_EXTRUDE_STOP           " cold extrusion prevented"
171
 #define MSG_ERR_COLD_EXTRUDE_STOP           " cold extrusion prevented"
172
 #define MSG_ERR_LONG_EXTRUDE_STOP           " too long extrusion prevented"
172
 #define MSG_ERR_LONG_EXTRUDE_STOP           " too long extrusion prevented"
173
+#define MSG_TOO_COLD_FOR_M600               "M600 Hotend too cold to change filament"
173
 #define MSG_BABYSTEPPING_X                  "Babystepping X"
174
 #define MSG_BABYSTEPPING_X                  "Babystepping X"
174
 #define MSG_BABYSTEPPING_Y                  "Babystepping Y"
175
 #define MSG_BABYSTEPPING_Y                  "Babystepping Y"
175
 #define MSG_BABYSTEPPING_Z                  "Babystepping Z"
176
 #define MSG_BABYSTEPPING_Z                  "Babystepping Z"

+ 1
- 0
Marlin/language.h Voir le fichier

171
 #define MSG_ENDSTOPS_HIT                    "endstops hit: "
171
 #define MSG_ENDSTOPS_HIT                    "endstops hit: "
172
 #define MSG_ERR_COLD_EXTRUDE_STOP           " cold extrusion prevented"
172
 #define MSG_ERR_COLD_EXTRUDE_STOP           " cold extrusion prevented"
173
 #define MSG_ERR_LONG_EXTRUDE_STOP           " too long extrusion prevented"
173
 #define MSG_ERR_LONG_EXTRUDE_STOP           " too long extrusion prevented"
174
+#define MSG_TOO_COLD_FOR_M600               "M600 Hotend too cold to change filament"
174
 #define MSG_BABYSTEPPING_X                  "Babystepping X"
175
 #define MSG_BABYSTEPPING_X                  "Babystepping X"
175
 #define MSG_BABYSTEPPING_Y                  "Babystepping Y"
176
 #define MSG_BABYSTEPPING_Y                  "Babystepping Y"
176
 #define MSG_BABYSTEPPING_Z                  "Babystepping Z"
177
 #define MSG_BABYSTEPPING_Z                  "Babystepping Z"

Chargement…
Annuler
Enregistrer