Add a string parameter to kill()

Makes the output on the LCD adjustable.
This commit is contained in:
AnHardt 2015-05-20 20:53:48 +02:00
parent 7ff18f6657
commit f4a93ed997
4 changed files with 10 additions and 14 deletions

View file

@ -220,7 +220,7 @@ void ok_to_send();
#endif #endif
void reset_bed_level(); void reset_bed_level();
void prepare_move(); void prepare_move();
void kill(); void kill(const char *);
void Stop(); void Stop();
#ifdef FILAMENT_RUNOUT_SENSOR #ifdef FILAMENT_RUNOUT_SENSOR

View file

@ -838,7 +838,7 @@ void get_command() {
} }
// If command was e-stop process now // If command was e-stop process now
if (strcmp(command, "M112") == 0) kill(); if (strcmp(command, "M112") == 0) kill(PSTR(MSG_KILLED));
cmd_queue_index_w = (cmd_queue_index_w + 1) % BUFSIZE; cmd_queue_index_w = (cmd_queue_index_w + 1) % BUFSIZE;
commands_in_queue += 1; commands_in_queue += 1;
@ -3593,7 +3593,7 @@ inline void gcode_M111() {
/** /**
* M112: Emergency Stop * M112: Emergency Stop
*/ */
inline void gcode_M112() { kill(); } inline void gcode_M112() { kill(PSTR(MSG_KILLED)); }
#ifdef BARICUDA #ifdef BARICUDA
@ -6244,7 +6244,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
millis_t ms = millis(); millis_t ms = millis();
if (max_inactive_time && ms > previous_cmd_ms + max_inactive_time) kill(); if (max_inactive_time && ms > previous_cmd_ms + max_inactive_time) kill(PSTR(MSG_KILLED));
if (stepper_inactive_time && ms > previous_cmd_ms + stepper_inactive_time if (stepper_inactive_time && ms > previous_cmd_ms + stepper_inactive_time
&& !ignore_stepper_queue && !blocks_queued()) && !ignore_stepper_queue && !blocks_queued())
@ -6272,7 +6272,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
// Exceeded threshold and we can confirm that it was not accidental // Exceeded threshold and we can confirm that it was not accidental
// KILL the machine // KILL the machine
// ---------------------------------------------------------------- // ----------------------------------------------------------------
if (killCount >= KILL_DELAY) kill(); if (killCount >= KILL_DELAY) kill(PSTR(MSG_KILLED));
#endif #endif
#if HAS_HOME #if HAS_HOME
@ -6373,11 +6373,11 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
check_axes_activity(); check_axes_activity();
} }
void kill() void kill(const char *lcd_msg) {
{ lcd_setalertstatuspgm(lcd_msg);
cli(); // Stop interrupts cli(); // Stop interrupts
disable_all_heaters(); disable_all_heaters();
disable_all_steppers(); disable_all_steppers();
#if HAS_POWER_SWITCH #if HAS_POWER_SWITCH
@ -6386,7 +6386,6 @@ void kill()
SERIAL_ERROR_START; SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_ERR_KILLED); SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
LCD_ALERTMESSAGEPGM(MSG_KILLED);
// FMC small patch to update the LCD before ending // FMC small patch to update the LCD before ending
sei(); // enable interrupts sei(); // enable interrupts

View file

@ -219,7 +219,7 @@ void CardReader::openFile(char* name, bool read, bool replace_current/*=true*/)
SERIAL_ERROR_START; SERIAL_ERROR_START;
SERIAL_ERRORPGM("trying to call sub-gcode files with too many levels. MAX level is:"); SERIAL_ERRORPGM("trying to call sub-gcode files with too many levels. MAX level is:");
SERIAL_ERRORLN(SD_PROCEDURE_DEPTH); SERIAL_ERRORLN(SD_PROCEDURE_DEPTH);
kill(); kill(PSTR(MSG_KILLED));
return; return;
} }

View file

@ -43,12 +43,9 @@ void watchdog_reset()
#ifdef WATCHDOG_RESET_MANUAL #ifdef WATCHDOG_RESET_MANUAL
ISR(WDT_vect) ISR(WDT_vect)
{ {
//TODO: This message gets overwritten by the kill() call
LCD_ALERTMESSAGEPGM("ERR:Please Reset");//16 characters so it fits on a 16x2 display
lcd_update();
SERIAL_ERROR_START; SERIAL_ERROR_START;
SERIAL_ERRORLNPGM("Something is wrong, please turn off the printer."); SERIAL_ERRORLNPGM("Something is wrong, please turn off the printer.");
kill(); //kill blocks kill(PSTR("ERR:Please Reset")); //kill blocks //16 characters so it fits on a 16x2 display
while(1); //wait for user or serial reset while(1); //wait for user or serial reset
} }
#endif//RESET_MANUAL #endif//RESET_MANUAL