postponed kill() message with softReset
This commit is contained in:
parent
82343184e7
commit
f388d8abb6
|
|
@ -234,7 +234,7 @@ void FlushSerialRequestResend();
|
||||||
void ClearToSend();
|
void ClearToSend();
|
||||||
void update_currents();
|
void update_currents();
|
||||||
|
|
||||||
void kill(const char *full_screen_message = NULL, unsigned char id = 0);
|
void kill(const char *full_screen_message = NULL);
|
||||||
void finishAndDisableSteppers();
|
void finishAndDisableSteppers();
|
||||||
|
|
||||||
void UnconditionalStop(); // Stop heaters, motion and clear current print status
|
void UnconditionalStop(); // Stop heaters, motion and clear current print status
|
||||||
|
|
|
||||||
|
|
@ -1037,6 +1037,17 @@ static void fw_crash_init()
|
||||||
eeprom_update_byte((uint8_t*)EEPROM_FW_CRASH_FLAG, 0xFF);
|
eeprom_update_byte((uint8_t*)EEPROM_FW_CRASH_FLAG, 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void fw_kill_init() {
|
||||||
|
PGM_P kill_msg = (PGM_P)eeprom_init_default_word((uint16_t*)EEPROM_KILL_MESSAGE, 0);
|
||||||
|
if (kill_msg) {
|
||||||
|
// clear pending message event
|
||||||
|
eeprom_write_word((uint16_t*)EEPROM_KILL_MESSAGE, 0);
|
||||||
|
|
||||||
|
// display the kill message
|
||||||
|
lcd_show_fullscreen_message_and_wait_P(kill_msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void xflash_err_msg()
|
static void xflash_err_msg()
|
||||||
{
|
{
|
||||||
|
|
@ -1577,6 +1588,9 @@ void setup()
|
||||||
// report crash failures
|
// report crash failures
|
||||||
fw_crash_init();
|
fw_crash_init();
|
||||||
|
|
||||||
|
// report kill() events
|
||||||
|
fw_kill_init();
|
||||||
|
|
||||||
#ifdef UVLO_SUPPORT
|
#ifdef UVLO_SUPPORT
|
||||||
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO) != 0) { //previous print was terminated by UVLO
|
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO) != 0) { //previous print was terminated by UVLO
|
||||||
/*
|
/*
|
||||||
|
|
@ -5970,7 +5984,7 @@ Sigma_Exit:
|
||||||
It is processed much earlier as to bypass the cmdqueue.
|
It is processed much earlier as to bypass the cmdqueue.
|
||||||
*/
|
*/
|
||||||
case 112:
|
case 112:
|
||||||
kill(MSG_M112_KILL, 3);
|
kill(MSG_M112_KILL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -9378,7 +9392,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
|
||||||
|
|
||||||
if(previous_millis_cmd.expired(max_inactive_time))
|
if(previous_millis_cmd.expired(max_inactive_time))
|
||||||
if(max_inactive_time)
|
if(max_inactive_time)
|
||||||
kill(_n("Inactivity Shutdown"), 4);
|
kill(PSTR("Inactivity Shutdown"));
|
||||||
if(stepper_inactive_time) {
|
if(stepper_inactive_time) {
|
||||||
if(previous_millis_cmd.expired(stepper_inactive_time))
|
if(previous_millis_cmd.expired(stepper_inactive_time))
|
||||||
{
|
{
|
||||||
|
|
@ -9419,7 +9433,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
if ( killCount >= KILL_DELAY)
|
if ( killCount >= KILL_DELAY)
|
||||||
{
|
{
|
||||||
kill(NULL, 5);
|
kill();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -9465,49 +9479,30 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
|
||||||
host_keepalive();
|
host_keepalive();
|
||||||
}
|
}
|
||||||
|
|
||||||
void kill(const char *full_screen_message, unsigned char id)
|
void kill(const char *full_screen_message) {
|
||||||
{
|
cli(); // Stop interrupts
|
||||||
printf_P(_N("KILL: %d\n"), id);
|
disable_heater();
|
||||||
//return;
|
|
||||||
cli(); // Stop interrupts
|
|
||||||
disable_heater();
|
|
||||||
|
|
||||||
disable_x();
|
disable_x();
|
||||||
// SERIAL_ECHOLNPGM("kill - disable Y");
|
disable_y();
|
||||||
disable_y();
|
poweroff_z();
|
||||||
poweroff_z();
|
disable_e0();
|
||||||
disable_e0();
|
disable_e1();
|
||||||
disable_e1();
|
disable_e2();
|
||||||
disable_e2();
|
|
||||||
|
|
||||||
#if defined(PS_ON_PIN) && PS_ON_PIN > -1
|
SERIAL_ERROR_START;
|
||||||
pinMode(PS_ON_PIN,INPUT);
|
SERIAL_ERRORLNRPGM(PSTR("Printer halted. kill() called!"));
|
||||||
#endif
|
|
||||||
SERIAL_ERROR_START;
|
|
||||||
SERIAL_ERRORLNRPGM(_n("Printer halted. kill() called!"));////MSG_ERR_KILLED
|
|
||||||
if (full_screen_message != NULL) {
|
|
||||||
SERIAL_ERRORLNRPGM(full_screen_message);
|
|
||||||
lcd_display_message_fullscreen_P(full_screen_message);
|
|
||||||
} else {
|
|
||||||
LCD_ALERTMESSAGERPGM(_n("KILLED. "));////MSG_KILLED
|
|
||||||
}
|
|
||||||
|
|
||||||
// FMC small patch to update the LCD before ending
|
if (full_screen_message != NULL) {
|
||||||
sei(); // enable interrupts
|
SERIAL_ERRORLNRPGM(full_screen_message);
|
||||||
for ( int i=5; i--; lcd_update(0))
|
} else {
|
||||||
{
|
full_screen_message = PSTR("KILLED.");
|
||||||
_delay(200);
|
}
|
||||||
}
|
|
||||||
cli(); // disable interrupts
|
|
||||||
suicide();
|
|
||||||
while(1)
|
|
||||||
{
|
|
||||||
#ifdef WATCHDOG
|
|
||||||
wdt_reset();
|
|
||||||
#endif //WATCHDOG
|
|
||||||
/* Intentionally left empty */
|
|
||||||
|
|
||||||
} // Wait for reset
|
// update eeprom with the correct kill message to be shown on startup
|
||||||
|
eeprom_write_word((uint16_t*)EEPROM_KILL_MESSAGE, (uint16_t)full_screen_message);
|
||||||
|
|
||||||
|
softReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnconditionalStop()
|
void UnconditionalStop()
|
||||||
|
|
|
||||||
|
|
@ -402,7 +402,7 @@ void CardReader::openFileReadFilteredGcode(const char* name, bool replace_curren
|
||||||
// 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(ofKill, 1);
|
kill(ofKill);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -469,7 +469,7 @@ void CardReader::openFileWrite(const char* name)
|
||||||
// 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(ofKill, 1);
|
kill(ofKill);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -455,7 +455,7 @@ void get_command()
|
||||||
|
|
||||||
// Handle KILL early, even when Stopped
|
// Handle KILL early, even when Stopped
|
||||||
if(strcmp_P(cmd_start, PSTR("M112")) == 0)
|
if(strcmp_P(cmd_start, PSTR("M112")) == 0)
|
||||||
kill(MSG_M112_KILL, 2);
|
kill(MSG_M112_KILL);
|
||||||
|
|
||||||
// Bypass Stopped for some commands
|
// Bypass Stopped for some commands
|
||||||
bool allow_when_stopped = false;
|
bool allow_when_stopped = false;
|
||||||
|
|
|
||||||
|
|
@ -596,6 +596,8 @@ static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_SHEETS_BASE);
|
||||||
#define EEPROM_TEMP_MODEL_L (EEPROM_TEMP_MODEL_D-2) //uint16_t
|
#define EEPROM_TEMP_MODEL_L (EEPROM_TEMP_MODEL_D-2) //uint16_t
|
||||||
#define EEPROM_TEMP_MODEL_VER (EEPROM_TEMP_MODEL_L-1) //uint8_t
|
#define EEPROM_TEMP_MODEL_VER (EEPROM_TEMP_MODEL_L-1) //uint8_t
|
||||||
|
|
||||||
|
#define EEPROM_KILL_MESSAGE (EEPROM_TEMP_MODEL_VER-2) //PGM_P
|
||||||
|
|
||||||
//This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items.
|
//This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items.
|
||||||
#define EEPROM_LAST_ITEM EEPROM_TEMP_MODEL_VER
|
#define EEPROM_LAST_ITEM EEPROM_TEMP_MODEL_VER
|
||||||
// !!!!!
|
// !!!!!
|
||||||
|
|
|
||||||
|
|
@ -598,7 +598,7 @@ static float analog2temp(int raw, uint8_t e) {
|
||||||
SERIAL_ERROR_START;
|
SERIAL_ERROR_START;
|
||||||
SERIAL_ERROR((int)e);
|
SERIAL_ERROR((int)e);
|
||||||
SERIAL_ERRORLNPGM(" - Invalid extruder number !");
|
SERIAL_ERRORLNPGM(" - Invalid extruder number !");
|
||||||
kill(NULL, 6);
|
kill();
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
#ifdef HEATER_0_USES_MAX6675
|
#ifdef HEATER_0_USES_MAX6675
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue