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.

This commit is contained in:
daid303 2013-01-08 11:53:18 +01:00
parent 5e3873c8db
commit 921273baa0
6 changed files with 54 additions and 16 deletions

View file

@ -15,7 +15,7 @@
// If the temperature has not increased at the end of that period, the target temperature is set to zero.
// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
// differ by at least 2x WATCH_TEMP_INCREASE
//#define WATCH_TEMP_PERIOD 20000 //20 seconds
//#define WATCH_TEMP_PERIOD 40000 //40 seconds
//#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds
// Wait for Cooldown
@ -193,7 +193,6 @@
//=============================Additional Features===========================
//===========================================================================
#define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers?
#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.
@ -207,6 +206,9 @@
//#define WATCHDOG_RESET_MANUAL
#endif
// Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled.
//#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
// extruder advance constant (s2/mm3)
//
// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2

View file

@ -125,6 +125,7 @@
// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
// M503 - print the current settings (from memory not from eeprom)
// M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
// M907 - Set digital trimpot motor current using axis codes.
// M908 - Control digital trimpot directly.
// M350 - Set microstepping mode.
@ -1494,6 +1495,13 @@ void process_commands()
Config_PrintSettings();
}
break;
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
case 540:
{
if(code_seen('S')) abort_on_endstop_hit = code_value() > 0;
}
break;
#endif
case 907: // M907 Set digital trimpot motor current using axis codes.
{
#if DIGIPOTSS_PIN > -1

View file

@ -27,6 +27,7 @@
#include "temperature.h"
#include "ultralcd.h"
#include "language.h"
#include "cardreader.h"
#include "speed_lookuptable.h"
#if DIGIPOTSS_PIN > -1
#include <SPI.h>
@ -67,6 +68,9 @@ volatile long endstops_stepsTotal,endstops_stepsDone;
static volatile bool endstop_x_hit=false;
static volatile bool endstop_y_hit=false;
static volatile bool endstop_z_hit=false;
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
bool abort_on_endstop_hit = false;
#endif
static bool old_x_min_endstop=false;
static bool old_x_max_endstop=false;
@ -169,17 +173,31 @@ void checkHitEndstops()
SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
if(endstop_x_hit) {
SERIAL_ECHOPAIR(" X:",(float)endstops_trigsteps[X_AXIS]/axis_steps_per_unit[X_AXIS]);
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "X");
}
if(endstop_y_hit) {
SERIAL_ECHOPAIR(" Y:",(float)endstops_trigsteps[Y_AXIS]/axis_steps_per_unit[Y_AXIS]);
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Y");
}
if(endstop_z_hit) {
SERIAL_ECHOPAIR(" Z:",(float)endstops_trigsteps[Z_AXIS]/axis_steps_per_unit[Z_AXIS]);
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Z");
}
SERIAL_ECHOLN("");
endstop_x_hit=false;
endstop_y_hit=false;
endstop_z_hit=false;
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
if (abort_on_endstop_hit)
{
card.sdprinting = false;
card.closefile();
quickStop();
setTargetHotend0(0);
setTargetHotend1(0);
setTargetHotend2(0);
}
#endif
}
}

View file

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

View file

@ -518,6 +518,9 @@ static void lcd_control_motion_menu()
MENU_ITEM_EDIT(float52, MSG_YSTEPS, &axis_steps_per_unit[Y_AXIS], 5, 9999);
MENU_ITEM_EDIT(float51, MSG_ZSTEPS, &axis_steps_per_unit[Z_AXIS], 5, 9999);
MENU_ITEM_EDIT(float51, MSG_ESTEPS, &axis_steps_per_unit[E_AXIS], 5, 9999);
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
MENU_ITEM_EDIT(bool, "Endstop abort", &abort_on_endstop_hit);
#endif
END_MENU();
}
@ -889,13 +892,17 @@ char *ftostr31(const float &x)
char *ftostr32(const float &x)
{
long xx=x*100;
conv[0]=(xx>=0)?'+':'-';
if (xx >= 0)
conv[0]=(xx/10000)%10+'0';
else
conv[0]='-';
xx=abs(xx);
conv[1]=(xx/100)%10+'0';
conv[2]='.';
conv[3]=(xx/10)%10+'0';
conv[4]=(xx)%10+'0';
conv[5]=0;
conv[1]=(xx/1000)%10+'0';
conv[2]=(xx/100)%10+'0';
conv[3]='.';
conv[4]=(xx/10)%10+'0';
conv[5]=(xx)%10+'0';
conv[6]=0;
return conv;
}

View file

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