|
@ -463,11 +463,21 @@ void enquecommand_P(const char *cmd) |
|
|
void setup_killpin() |
|
|
void setup_killpin() |
|
|
{ |
|
|
{ |
|
|
#if defined(KILL_PIN) && KILL_PIN > -1 |
|
|
#if defined(KILL_PIN) && KILL_PIN > -1 |
|
|
pinMode(KILL_PIN,INPUT); |
|
|
SET_INPUT(KILL_PIN); |
|
|
WRITE(KILL_PIN,HIGH); |
|
|
WRITE(KILL_PIN,HIGH); |
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Set home pin
|
|
|
|
|
|
void setup_homepin(void) |
|
|
|
|
|
{ |
|
|
|
|
|
#if defined(HOME_PIN) && HOME_PIN > -1 |
|
|
|
|
|
SET_INPUT(HOME_PIN); |
|
|
|
|
|
WRITE(HOME_PIN,HIGH); |
|
|
|
|
|
#endif |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setup_photpin() |
|
|
void setup_photpin() |
|
|
{ |
|
|
{ |
|
|
#if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1 |
|
|
#if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1 |
|
@ -600,6 +610,7 @@ void setup() |
|
|
pinMode(SERVO0_PIN, OUTPUT); |
|
|
pinMode(SERVO0_PIN, OUTPUT); |
|
|
digitalWrite(SERVO0_PIN, LOW); // turn it off
|
|
|
digitalWrite(SERVO0_PIN, LOW); // turn it off
|
|
|
#endif // Z_PROBE_SLED
|
|
|
#endif // Z_PROBE_SLED
|
|
|
|
|
|
setup_homepin(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -4303,6 +4314,18 @@ void handle_status_leds(void) { |
|
|
|
|
|
|
|
|
void manage_inactivity() |
|
|
void manage_inactivity() |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
#if defined(KILL_PIN) && KILL_PIN > -1 |
|
|
|
|
|
static int killCount = 0; // make the inactivity button a bit less responsive
|
|
|
|
|
|
const int KILL_DELAY = 10000; |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#if defined(HOME_PIN) && HOME_PIN > -1 |
|
|
|
|
|
static int homeDebounceCount = 0; // poor man's debouncing count
|
|
|
|
|
|
const int HOME_DEBOUNCE_DELAY = 10000; |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(buflen < (BUFSIZE-1)) |
|
|
if(buflen < (BUFSIZE-1)) |
|
|
get_command(); |
|
|
get_command(); |
|
|
|
|
|
|
|
@ -4332,9 +4355,49 @@ void manage_inactivity() |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if defined(KILL_PIN) && KILL_PIN > -1 |
|
|
#if defined(KILL_PIN) && KILL_PIN > -1 |
|
|
|
|
|
|
|
|
|
|
|
// Check if the kill button was pressed and wait just in case it was an accidental
|
|
|
|
|
|
// key kill key press
|
|
|
|
|
|
// -------------------------------------------------------------------------------
|
|
|
if( 0 == READ(KILL_PIN) ) |
|
|
if( 0 == READ(KILL_PIN) ) |
|
|
kill(); |
|
|
{ |
|
|
|
|
|
killCount++; |
|
|
|
|
|
} |
|
|
|
|
|
else if (killCount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
killCount--; |
|
|
|
|
|
} |
|
|
|
|
|
// Exceeded threshold and we can confirm that it was not accidental
|
|
|
|
|
|
// KILL the machine
|
|
|
|
|
|
// ----------------------------------------------------------------
|
|
|
|
|
|
if ( killCount >= KILL_DELAY) |
|
|
|
|
|
{ |
|
|
|
|
|
kill(); |
|
|
|
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#if defined(HOME_PIN) && HOME_PIN > -1 |
|
|
|
|
|
// Check to see if we have to home, use poor man's debouncer
|
|
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
|
|
if ( 0 == READ(HOME_PIN) ) |
|
|
|
|
|
{ |
|
|
|
|
|
if (homeDebounceCount == 0) |
|
|
|
|
|
{ |
|
|
|
|
|
enquecommand_P((PSTR("G28"))); |
|
|
|
|
|
homeDebounceCount++; |
|
|
|
|
|
LCD_ALERTMESSAGEPGM(MSG_AUTO_HOME); |
|
|
|
|
|
} |
|
|
|
|
|
else if (homeDebounceCount < HOME_DEBOUNCE_DELAY) |
|
|
|
|
|
{ |
|
|
|
|
|
homeDebounceCount++; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
homeDebounceCount = 0; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
#if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1 |
|
|
#if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1 |
|
|
controllerFan(); //Check if fan should be turned on to cool stepper drivers down
|
|
|
controllerFan(); //Check if fan should be turned on to cool stepper drivers down
|
|
|
#endif |
|
|
#endif |
|
@ -4391,6 +4454,14 @@ void kill() |
|
|
SERIAL_ERROR_START; |
|
|
SERIAL_ERROR_START; |
|
|
SERIAL_ERRORLNPGM(MSG_ERR_KILLED); |
|
|
SERIAL_ERRORLNPGM(MSG_ERR_KILLED); |
|
|
LCD_ALERTMESSAGEPGM(MSG_KILLED); |
|
|
LCD_ALERTMESSAGEPGM(MSG_KILLED); |
|
|
|
|
|
|
|
|
|
|
|
// FMC small patch to update the LCD before ending
|
|
|
|
|
|
sei(); // enable interrupts
|
|
|
|
|
|
for ( int i=5; i--; lcd_update()) |
|
|
|
|
|
{ |
|
|
|
|
|
delay(200); |
|
|
|
|
|
} |
|
|
|
|
|
cli(); // disable interrupts
|
|
|
suicide(); |
|
|
suicide(); |
|
|
while(1) { /* Intentionally left empty */ } // Wait for reset
|
|
|
while(1) { /* Intentionally left empty */ } // Wait for reset
|
|
|
} |
|
|
} |
|
|