Merge pull request #4119 from leptun/kill_reset
Postponed kill() message with softReset
This commit is contained in:
commit
c15ea67379
|
|
@ -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,19 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define KILL_PENDING_FLAG 0x42
|
||||||
|
|
||||||
|
static void fw_kill_init() {
|
||||||
|
if (eeprom_read_byte((uint8_t*)EEPROM_KILL_PENDING_FLAG) == KILL_PENDING_FLAG) {
|
||||||
|
// clear pending message event
|
||||||
|
eeprom_write_byte((uint8_t*)EEPROM_KILL_PENDING_FLAG, EEPROM_EMPTY_VALUE);
|
||||||
|
|
||||||
|
// display the kill message
|
||||||
|
PGM_P kill_msg = (PGM_P)eeprom_read_word((uint16_t*)EEPROM_KILL_MESSAGE);
|
||||||
|
lcd_show_fullscreen_message_and_wait_P(kill_msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void xflash_err_msg()
|
static void xflash_err_msg()
|
||||||
{
|
{
|
||||||
|
|
@ -1344,6 +1357,9 @@ void setup()
|
||||||
if (!xflash_success)
|
if (!xflash_success)
|
||||||
xflash_err_msg();
|
xflash_err_msg();
|
||||||
|
|
||||||
|
// report kill() events
|
||||||
|
fw_kill_init();
|
||||||
|
|
||||||
#ifdef FILAMENT_SENSOR
|
#ifdef FILAMENT_SENSOR
|
||||||
fsensor.init();
|
fsensor.init();
|
||||||
#endif //FILAMENT_SENSOR
|
#endif //FILAMENT_SENSOR
|
||||||
|
|
@ -5970,7 +5986,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 +9394,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 +9435,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 +9481,31 @@ 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);
|
||||||
|
eeprom_write_byte((uint8_t*)EEPROM_KILL_PENDING_FLAG, KILL_PENDING_FLAG);
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
|
||||||
|
|
@ -357,10 +357,13 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
|
||||||
| ^ | ^ | ^ | 20h 32 | ^ | Free bit | ^ | ^
|
| ^ | ^ | ^ | 20h 32 | ^ | Free bit | ^ | ^
|
||||||
| ^ | ^ | ^ | 40h 64 | ^ | Free bit | ^ | ^
|
| ^ | ^ | ^ | 40h 64 | ^ | Free bit | ^ | ^
|
||||||
| ^ | ^ | ^ | 80h 128 | ^ | Unknown | ^ | ^
|
| ^ | ^ | ^ | 80h 128 | ^ | Unknown | ^ | ^
|
||||||
| 0x0CA5 3237 | float | EEPROM_TEMP_MODEL_U | ??? | ff ff ff ffh | Temp model linear temperature coefficient (W/K/W) | Temp model | D3 Ax0ca5 C4
|
| 0x0CA2 3234 | float | EEPROM_TEMP_MODEL_U | ??? | ff ff ff ffh | Temp model linear temperature coefficient (W/K/W) | Temp model | D3 Ax0ca2 C4
|
||||||
| 0x0CA1 3233 | float | EEPROM_TEMP_MODEL_V | ??? | ff ff ff ffh | Temp model linear temperature intercept (W/W) | Temp model | D3 Ax0ca1 C4
|
| 0x0C9E 3230 | float | EEPROM_TEMP_MODEL_V | ??? | ff ff ff ffh | Temp model linear temperature intercept (W/W) | Temp model | D3 Ax0c9e C4
|
||||||
| 0x0C9D 3229 | float | EEPROM_TEMP_MODEL_D | ??? | ff ff ff ffh | Temp model sim. 1st order IIR filter factor | Temp model | D3 Ax0c9d C4
|
| 0x0C9A 3226 | float | EEPROM_TEMP_MODEL_D | ??? | ff ff ff ffh | Temp model sim. 1st order IIR filter factor | Temp model | D3 Ax0c9a C4
|
||||||
| 0x0C99 3225 | uint16 | EEPROM_TEMP_MODEL_L | 0-2160 | ff ffh | Temp model sim. response lag (ms) | Temp model | D3 Ax0c99 C2
|
| 0x0C98 3224 | uint16 | EEPROM_TEMP_MODEL_L | 0-2160 | ff ffh | Temp model sim. response lag (ms) | Temp model | D3 Ax0c98 C2
|
||||||
|
| 0x0C97 3223 | uint8 | EEPROM_TEMP_MODEL_VER | 0-255 | ffh | Temp model Version | Temp model | D3 Ax0c97 C1
|
||||||
|
| 0x0C95 3221 | PGM_P | EEPROM_KILL_MESSAGE | 0-65535 | ff ffh | Kill message PGM pointer | kill() | D3 Ax0c95 C2
|
||||||
|
| 0x0C94 3220 | uint8 | EEPROM_KILL_PENDING_FLAG | 42h, ffh | ffh | Kill pending flag (0x42 magic value) | kill() | D3 Ax0c94 C1
|
||||||
|
|
||||||
|Address begin|Bit/Type | Name | Valid values | Default/FactoryReset | Description |Gcode/Function| Debug code
|
|Address begin|Bit/Type | Name | Valid values | Default/FactoryReset | Description |Gcode/Function| Debug code
|
||||||
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--:
|
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--:
|
||||||
|
|
@ -596,8 +599,11 @@ 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
|
||||||
|
#define EEPROM_KILL_PENDING_FLAG (EEPROM_KILL_MESSAGE-1) //uint8
|
||||||
|
|
||||||
//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_KILL_PENDING_FLAG
|
||||||
// !!!!!
|
// !!!!!
|
||||||
// !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!!
|
// !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!!
|
||||||
// !!!!!
|
// !!!!!
|
||||||
|
|
|
||||||
|
|
@ -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