浏览代码

Added optional feature to stop printing when an endstop is hit. Made the Z display on the LCD in 3.2 format instead of 3.1. Added LCD message when and endstop is hit.

daid303 12 年前
父节点
当前提交
921273baa0
共有 6 个文件被更改,包括 54 次插入16 次删除
  1. 5
    3
      Marlin/Configuration_adv.h
  2. 10
    2
      Marlin/Marlin_main.cpp
  3. 20
    2
      Marlin/stepper.cpp
  4. 3
    0
      Marlin/stepper.h
  5. 14
    7
      Marlin/ultralcd.cpp
  6. 2
    2
      Marlin/ultralcd_implementation_hitachi_HD44780.h

+ 5
- 3
Marlin/Configuration_adv.h 查看文件

@@ -15,7 +15,7 @@
15 15
 // If the temperature has not increased at the end of that period, the target temperature is set to zero. 
16 16
 // It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
17 17
 //  differ by at least 2x WATCH_TEMP_INCREASE
18
-//#define WATCH_TEMP_PERIOD 20000 //20 seconds
18
+//#define WATCH_TEMP_PERIOD 40000 //40 seconds
19 19
 //#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
20 20
 
21 21
 // Wait for Cooldown
@@ -193,7 +193,6 @@
193 193
 //=============================Additional Features===========================
194 194
 //===========================================================================
195 195
 
196
-
197 196
 #define SD_FINISHED_STEPPERRELEASE true  //if sd support and the file is finished: disable steppers?
198 197
 #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.
199 198
 
@@ -206,6 +205,9 @@
206 205
 //  However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled.
207 206
 //#define WATCHDOG_RESET_MANUAL
208 207
 #endif
208
+
209
+// Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled.
210
+//#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
209 211
 
210 212
 // extruder advance constant (s2/mm3)
211 213
 //
@@ -252,7 +254,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
252 254
 #else
253 255
   #define BLOCK_BUFFER_SIZE 16 // maximize block buffer
254 256
 #endif
255
-
257
+
256 258
 
257 259
 //The ASCII buffer for recieving from the serial:
258 260
 #define MAX_CMD_SIZE 96

+ 10
- 2
Marlin/Marlin_main.cpp 查看文件

@@ -124,7 +124,8 @@
124 124
 // M500 - stores paramters in EEPROM
125 125
 // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
126 126
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
127
-// M503 - print the current settings (from memory not from eeprom)
127
+// M503 - print the current settings (from memory not from eeprom)
128
+// M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
128 129
 // M907 - Set digital trimpot motor current using axis codes.
129 130
 // M908 - Control digital trimpot directly.
130 131
 // M350 - Set microstepping mode.
@@ -1493,7 +1494,14 @@ void process_commands()
1493 1494
     {
1494 1495
         Config_PrintSettings();
1495 1496
     }
1496
-    break;
1497
+    break;
1498
+    #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
1499
+    case 540:
1500
+    {
1501
+        if(code_seen('S')) abort_on_endstop_hit = code_value() > 0;
1502
+    }
1503
+    break;
1504
+    #endif
1497 1505
     case 907: // M907 Set digital trimpot motor current using axis codes.
1498 1506
     {
1499 1507
       #if DIGIPOTSS_PIN > -1

+ 20
- 2
Marlin/stepper.cpp 查看文件

@@ -27,6 +27,7 @@
27 27
 #include "temperature.h"
28 28
 #include "ultralcd.h"
29 29
 #include "language.h"
30
+#include "cardreader.h"
30 31
 #include "speed_lookuptable.h"
31 32
 #if DIGIPOTSS_PIN > -1
32 33
 #include <SPI.h>
@@ -67,6 +68,9 @@ volatile long endstops_stepsTotal,endstops_stepsDone;
67 68
 static volatile bool endstop_x_hit=false;
68 69
 static volatile bool endstop_y_hit=false;
69 70
 static volatile bool endstop_z_hit=false;
71
+#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
72
+bool abort_on_endstop_hit = false;
73
+#endif
70 74
 
71 75
 static bool old_x_min_endstop=false;
72 76
 static bool old_x_max_endstop=false;
@@ -169,17 +173,31 @@ void checkHitEndstops()
169 173
    SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
170 174
    if(endstop_x_hit) {
171 175
      SERIAL_ECHOPAIR(" X:",(float)endstops_trigsteps[X_AXIS]/axis_steps_per_unit[X_AXIS]);
176
+     LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "X");
172 177
    }
173 178
    if(endstop_y_hit) {
174 179
      SERIAL_ECHOPAIR(" Y:",(float)endstops_trigsteps[Y_AXIS]/axis_steps_per_unit[Y_AXIS]);
180
+     LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Y");
175 181
    }
176 182
    if(endstop_z_hit) {
177 183
      SERIAL_ECHOPAIR(" Z:",(float)endstops_trigsteps[Z_AXIS]/axis_steps_per_unit[Z_AXIS]);
184
+     LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Z");
178 185
    }
179
-   SERIAL_ECHOLN("");
186
+   SERIAL_ECHOLN("");
180 187
    endstop_x_hit=false;
181 188
    endstop_y_hit=false;
182
-   endstop_z_hit=false;
189
+   endstop_z_hit=false;
190
+#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
191
+   if (abort_on_endstop_hit)
192
+   {
193
+     card.sdprinting = false;
194
+     card.closefile();
195
+     quickStop();
196
+     setTargetHotend0(0);
197
+     setTargetHotend1(0);
198
+     setTargetHotend2(0);
199
+   }
200
+#endif
183 201
  }
184 202
 }
185 203
 

+ 3
- 0
Marlin/stepper.h 查看文件

@@ -37,6 +37,9 @@
37 37
   #define REV_E_DIR() WRITE(E0_DIR_PIN, INVERT_E0_DIR)
38 38
 #endif
39 39
 
40
+#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
41
+extern bool abort_on_endstop_hit;
42
+#endif
40 43
 
41 44
 // Initialize and start the stepper motor subsystem
42 45
 void st_init();

+ 14
- 7
Marlin/ultralcd.cpp 查看文件

@@ -518,6 +518,9 @@ static void lcd_control_motion_menu()
518 518
     MENU_ITEM_EDIT(float52, MSG_YSTEPS, &axis_steps_per_unit[Y_AXIS], 5, 9999);
519 519
     MENU_ITEM_EDIT(float51, MSG_ZSTEPS, &axis_steps_per_unit[Z_AXIS], 5, 9999);
520 520
     MENU_ITEM_EDIT(float51, MSG_ESTEPS, &axis_steps_per_unit[E_AXIS], 5, 9999);    
521
+#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
522
+    MENU_ITEM_EDIT(bool, "Endstop abort", &abort_on_endstop_hit);
523
+#endif
521 524
     END_MENU();
522 525
 }
523 526
 
@@ -888,14 +891,18 @@ char *ftostr31(const float &x)
888 891
 
889 892
 char *ftostr32(const float &x)
890 893
 {
891
-  long xx=x*100;
892
-  conv[0]=(xx>=0)?'+':'-';
894
+  long xx=x*100;
895
+  if (xx >= 0)
896
+    conv[0]=(xx/10000)%10+'0';
897
+  else
898
+    conv[0]='-';
893 899
   xx=abs(xx);
894
-  conv[1]=(xx/100)%10+'0';
895
-  conv[2]='.';
896
-  conv[3]=(xx/10)%10+'0';
897
-  conv[4]=(xx)%10+'0';
898
-  conv[5]=0;
900
+  conv[1]=(xx/1000)%10+'0';
901
+  conv[2]=(xx/100)%10+'0';
902
+  conv[3]='.';
903
+  conv[4]=(xx/10)%10+'0';
904
+  conv[5]=(xx)%10+'0';
905
+  conv[6]=0;
899 906
   return conv;
900 907
 }
901 908
 

+ 2
- 2
Marlin/ultralcd_implementation_hitachi_HD44780.h 查看文件

@@ -256,9 +256,9 @@ static void lcd_implementation_status_screen()
256 256
     lcd.print(ftostr3(current_position[Y_AXIS]));
257 257
 #  endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
258 258
 # endif//LCD_WIDTH > 19
259
-    lcd.setCursor(LCD_WIDTH - 7, 1);
259
+    lcd.setCursor(LCD_WIDTH - 8, 1);
260 260
     lcd.print('Z');
261
-    lcd.print(ftostr31(current_position[Z_AXIS]));
261
+    lcd.print(ftostr32(current_position[Z_AXIS]));
262 262
 #endif//LCD_HEIGHT > 2
263 263
 
264 264
 #if LCD_HEIGHT > 3

正在加载...
取消
保存