Selaa lähdekoodia

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 vuotta sitten
vanhempi
commit
921273baa0

+ 5
- 3
Marlin/Configuration_adv.h Näytä tiedosto

15
 // If the temperature has not increased at the end of that period, the target temperature is set to zero. 
15
 // If the temperature has not increased at the end of that period, the target temperature is set to zero. 
16
 // It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
16
 // It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
17
 //  differ by at least 2x WATCH_TEMP_INCREASE
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
 //#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
19
 //#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
20
 
20
 
21
 // Wait for Cooldown
21
 // Wait for Cooldown
193
 //=============================Additional Features===========================
193
 //=============================Additional Features===========================
194
 //===========================================================================
194
 //===========================================================================
195
 
195
 
196
-
197
 #define SD_FINISHED_STEPPERRELEASE true  //if sd support and the file is finished: disable steppers?
196
 #define SD_FINISHED_STEPPERRELEASE true  //if sd support and the file is finished: disable steppers?
198
 #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.
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
 //  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.
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
 //#define WATCHDOG_RESET_MANUAL
206
 //#define WATCHDOG_RESET_MANUAL
208
 #endif
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
 // extruder advance constant (s2/mm3)
212
 // extruder advance constant (s2/mm3)
211
 //
213
 //
252
 #else
254
 #else
253
   #define BLOCK_BUFFER_SIZE 16 // maximize block buffer
255
   #define BLOCK_BUFFER_SIZE 16 // maximize block buffer
254
 #endif
256
 #endif
255
-
257
+
256
 
258
 
257
 //The ASCII buffer for recieving from the serial:
259
 //The ASCII buffer for recieving from the serial:
258
 #define MAX_CMD_SIZE 96
260
 #define MAX_CMD_SIZE 96

+ 10
- 2
Marlin/Marlin_main.cpp Näytä tiedosto

124
 // M500 - stores paramters in EEPROM
124
 // M500 - stores paramters in EEPROM
125
 // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
125
 // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
126
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
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
 // M907 - Set digital trimpot motor current using axis codes.
129
 // M907 - Set digital trimpot motor current using axis codes.
129
 // M908 - Control digital trimpot directly.
130
 // M908 - Control digital trimpot directly.
130
 // M350 - Set microstepping mode.
131
 // M350 - Set microstepping mode.
1493
     {
1494
     {
1494
         Config_PrintSettings();
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
     case 907: // M907 Set digital trimpot motor current using axis codes.
1505
     case 907: // M907 Set digital trimpot motor current using axis codes.
1498
     {
1506
     {
1499
       #if DIGIPOTSS_PIN > -1
1507
       #if DIGIPOTSS_PIN > -1

+ 20
- 2
Marlin/stepper.cpp Näytä tiedosto

27
 #include "temperature.h"
27
 #include "temperature.h"
28
 #include "ultralcd.h"
28
 #include "ultralcd.h"
29
 #include "language.h"
29
 #include "language.h"
30
+#include "cardreader.h"
30
 #include "speed_lookuptable.h"
31
 #include "speed_lookuptable.h"
31
 #if DIGIPOTSS_PIN > -1
32
 #if DIGIPOTSS_PIN > -1
32
 #include <SPI.h>
33
 #include <SPI.h>
67
 static volatile bool endstop_x_hit=false;
68
 static volatile bool endstop_x_hit=false;
68
 static volatile bool endstop_y_hit=false;
69
 static volatile bool endstop_y_hit=false;
69
 static volatile bool endstop_z_hit=false;
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
 static bool old_x_min_endstop=false;
75
 static bool old_x_min_endstop=false;
72
 static bool old_x_max_endstop=false;
76
 static bool old_x_max_endstop=false;
169
    SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
173
    SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
170
    if(endstop_x_hit) {
174
    if(endstop_x_hit) {
171
      SERIAL_ECHOPAIR(" X:",(float)endstops_trigsteps[X_AXIS]/axis_steps_per_unit[X_AXIS]);
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
    if(endstop_y_hit) {
178
    if(endstop_y_hit) {
174
      SERIAL_ECHOPAIR(" Y:",(float)endstops_trigsteps[Y_AXIS]/axis_steps_per_unit[Y_AXIS]);
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
    if(endstop_z_hit) {
182
    if(endstop_z_hit) {
177
      SERIAL_ECHOPAIR(" Z:",(float)endstops_trigsteps[Z_AXIS]/axis_steps_per_unit[Z_AXIS]);
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
    endstop_x_hit=false;
187
    endstop_x_hit=false;
181
    endstop_y_hit=false;
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 Näytä tiedosto

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

+ 14
- 7
Marlin/ultralcd.cpp Näytä tiedosto

518
     MENU_ITEM_EDIT(float52, MSG_YSTEPS, &axis_steps_per_unit[Y_AXIS], 5, 9999);
518
     MENU_ITEM_EDIT(float52, MSG_YSTEPS, &axis_steps_per_unit[Y_AXIS], 5, 9999);
519
     MENU_ITEM_EDIT(float51, MSG_ZSTEPS, &axis_steps_per_unit[Z_AXIS], 5, 9999);
519
     MENU_ITEM_EDIT(float51, MSG_ZSTEPS, &axis_steps_per_unit[Z_AXIS], 5, 9999);
520
     MENU_ITEM_EDIT(float51, MSG_ESTEPS, &axis_steps_per_unit[E_AXIS], 5, 9999);    
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
     END_MENU();
524
     END_MENU();
522
 }
525
 }
523
 
526
 
888
 
891
 
889
 char *ftostr32(const float &x)
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
   xx=abs(xx);
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
   return conv;
906
   return conv;
900
 }
907
 }
901
 
908
 

+ 2
- 2
Marlin/ultralcd_implementation_hitachi_HD44780.h Näytä tiedosto

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

Loading…
Peruuta
Tallenna